Package com._1c.g5.v8.dt.md
Class PredefinedItemUtil
java.lang.Object
com._1c.g5.v8.dt.md.PredefinedItemUtil
PredefinedItem
util.-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic enum
General enumerator for presentation fields (for example,CatalogMainPresentation
and others) -
Method Summary
Modifier and TypeMethodDescriptionstatic boolean
canCodeEdit
(org.eclipse.emf.ecore.EObject eObject) Checks code edit ability.static boolean
canDescriptionEdit
(org.eclipse.emf.ecore.EObject eObject) Checks description edit ability.static boolean
canTypeDescriptionEdit
(org.eclipse.emf.ecore.EObject eObject) Checks type description edit ability.static PredefinedItem
findPredefinedItemByName
(org.eclipse.emf.ecore.EObject parent, String name) Find predefined item in specified parent object by given namestatic String
Generates unique code for new predefined item in the given parent object.static String
generatePredefinedItemUniqueName
(BasicDbObject parent, boolean isFolder) Generates unique name for new predefined item in the given parent object.static AllowedLength
Gets code allowed length.static org.eclipse.emf.ecore.EAttribute
getCodeAllowedLengthFeature
(org.eclipse.emf.ecore.EObject eObject) Returns e-object code allowed length feature if present.static int
Gets code length.static org.eclipse.emf.ecore.EAttribute
getCodeLengthFeature
(org.eclipse.emf.ecore.EObject eObject) Returns e-object code length feature if present.static org.eclipse.emf.common.util.Enumerator
getCodeType
(BasicDbObject obj) Gets code type if supports.static org.eclipse.emf.ecore.EAttribute
getCodeTypeFeature
(org.eclipse.emf.ecore.EObject eObject) Returns e-object code type feature if present.static List<? extends PredefinedItem>
getContent
(org.eclipse.emf.ecore.EObject item) Get predefined item content.static int
Gets description length.static org.eclipse.emf.ecore.EAttribute
getDescriptionLengthFeature
(org.eclipse.emf.ecore.EObject eObject) Returns e-object description length feature if present.static List<? extends PredefinedItem>
getItems
(org.eclipse.emf.ecore.EObject obj) Gets model orPredefined
predefined items.static org.eclipse.emf.ecore.EObject
getItemsContainer
(org.eclipse.emf.ecore.EObject predefinedContainer) Returns predefined item container.static org.eclipse.emf.ecore.EReference
getItemsFeature
(org.eclipse.emf.ecore.EObject eObject) Returns predefined data items feature if object supports one.static int
getLevelCount
(org.eclipse.emf.ecore.EObject obj) Gets level count if supports.static Predefined
getPredefined
(org.eclipse.emf.ecore.EObject obj) Gets model predefined if supports.static List<? extends PredefinedItem>
getPredefinedChildItems
(org.eclipse.emf.ecore.EObject parent) Gets model predefined child items if supports.static org.eclipse.emf.ecore.EReference
getPredefinedFeature
(org.eclipse.emf.ecore.EObject eObject) Returns predefined data feature if object supports one.static Object
Gets predefined item code.static org.eclipse.emf.ecore.EStructuralFeature
Gets predefined item code.getPresentationField
(BasicDbObject object) Gets presentation field byBasicDbObject
ornull
static boolean
hasOwners
(BasicDbObject obj) Returnstrue
if the object has owners.static boolean
isAddEnabledForSelectedPredefinedItem
(BasicDbObject basicDbObject, Object selectedObject, boolean isFolder) Checks is element adding enabled for selected object for predefined container hierarchy type.static boolean
Returntrue
if autonumbering used.static boolean
Returntrue
if check unique used.static boolean
Checks if object code type is fixed.static boolean
isHierarchical
(org.eclipse.emf.ecore.EObject obj) Returnstrue
if hierarchical model.static boolean
Returnstrue
if folders and items hierarchy.static boolean
Returnstrue
if items hierarchy.static boolean
Cheks if object has number type code.static boolean
isNumberCodeType
(org.eclipse.emf.common.util.Enumerator codeType) Cheks if code type is number.static boolean
Checks if object has zero length code.static boolean
isPredefinedItemFolder
(Object item) Returnstrue
if predefined item is folder.static boolean
Checks if object supports predefined data.static boolean
Cheks if object has string type code.static boolean
isStringCodeType
(org.eclipse.emf.common.util.Enumerator codeType) Cheks if code type is string.static boolean
Returnstrue
if model has whole object code series selected.static Object
mapStringToValue
(String stringCodeVaule, BasicDbObject basicDbObject) Maps string code value to metadata model type value by hisBasicDbObject
code type.static String
normalizeCode
(boolean fixedStringCodeType, boolean numberCodeType, int codeLength, String code) Normalizes code for fixed string code or empty number code or null code.
-
Method Details
-
getPresentationField
Gets presentation field byBasicDbObject
ornull
- Parameters:
object
-BasicDbObject
, can benull
- Returns:
PredefinedItemUtil.PresentationField
, cannot benull
-
getCodeAllowedLength
Gets code allowed length.- Parameters:
obj
- the object, cannot benull
- Returns:
- the allowed length
-
getCodeLength
Gets code length.- Parameters:
obj
- the object, cannot benull
- Returns:
- the code length
-
getCodeType
Gets code type if supports.- Parameters:
obj
- the object, cannot benull
- Returns:
- the code type, if not supported returns
null
-
getContent
Get predefined item content.- Parameters:
item
- the predefined item, cannot benull
- Returns:
- the content
-
getItems
Gets model orPredefined
predefined items.- Parameters:
obj
- the object or predefined, cannot benull
- Returns:
- the items
-
getLevelCount
public static int getLevelCount(org.eclipse.emf.ecore.EObject obj) Gets level count if supports.- Parameters:
obj
- the object, cannot benull
- Returns:
- the level count or -1 if not supported
-
getPredefined
Gets model predefined if supports.- Parameters:
obj
- the object, cannot benull
- Returns:
- the predefined,
null
if not supported
-
getPredefinedItemCode
Gets predefined item code.- Parameters:
item
- the item, cannot benull
- Returns:
- the code,
null
if not supported
-
getPredefinedItemCodeFeature
public static org.eclipse.emf.ecore.EStructuralFeature getPredefinedItemCodeFeature(PredefinedItem item) Gets predefined item code.- Parameters:
item
- the item, cannot benull
- Returns:
- the code,
null
if not supported
-
findPredefinedItemByName
public static PredefinedItem findPredefinedItemByName(org.eclipse.emf.ecore.EObject parent, String name) Find predefined item in specified parent object by given name- Parameters:
parent
- the parent of predefained items, cannot benull
name
- the name of searched predefained item, cannot benull
- Returns:
- instance of
PredefinedItem
finded in parent object predefined items ornull
-
getItemsContainer
public static org.eclipse.emf.ecore.EObject getItemsContainer(org.eclipse.emf.ecore.EObject predefinedContainer) Returns predefined item container.- Parameters:
predefinedContainer
- the predefined data container, cannot benull
- Returns:
- the predefined item container (predefined or predefined item), otherwise
null
-
getItemsFeature
public static org.eclipse.emf.ecore.EReference getItemsFeature(org.eclipse.emf.ecore.EObject eObject) Returns predefined data items feature if object supports one.- Parameters:
eObject
- the e-object, cannot benull
- Returns:
- the feature or
null
if not supports
-
getPredefinedFeature
public static org.eclipse.emf.ecore.EReference getPredefinedFeature(org.eclipse.emf.ecore.EObject eObject) Returns predefined data feature if object supports one.- Parameters:
eObject
- the model, cannot benull
- Returns:
- the feature or
null
if not supports
-
getPredefinedChildItems
public static List<? extends PredefinedItem> getPredefinedChildItems(org.eclipse.emf.ecore.EObject parent) Gets model predefined child items if supports.- Parameters:
obj
- the object, cannot benull
- Returns:
- the child predefined items, empty list if not supported
-
hasOwners
Returnstrue
if the object has owners.- Parameters:
obj
- the object, cannot benull
- Returns:
- true if has owners
-
getDescriptionLength
Gets description length.- Parameters:
obj
- the object, cannot benull
- Returns:
- the description length
-
isAutonumbering
Returntrue
if autonumbering used.- Parameters:
obj
- the object, cannot benull
- Returns:
true
if autonumbering
-
isFixedStringCode
Checks if object code type is fixed.- Parameters:
obj
- the object, cannot benull
- Returns:
true
if fixed
-
isHierarchical
public static boolean isHierarchical(org.eclipse.emf.ecore.EObject obj) Returnstrue
if hierarchical model.- Parameters:
obj
- the object, cannot benull
- Returns:
true
if is
-
isHierarchyFoldersAndItems
Returnstrue
if folders and items hierarchy.- Parameters:
obj
- the object, cannot benull
- Returns:
true
if is
-
isHierarchyOfItems
Returnstrue
if items hierarchy.- Parameters:
obj
- the object, cannot benull
- Returns:
true
if is
-
isNumberCode
Cheks if object has number type code.- Parameters:
obj
- the object, cannot benull
- Returns:
true
is number type code
-
isNumberCodeType
public static boolean isNumberCodeType(org.eclipse.emf.common.util.Enumerator codeType) Cheks if code type is number.- Parameters:
codeType
- the code type, can benull
- Returns:
true
is number
-
isNumberZeroLengthCode
Checks if object has zero length code.- Parameters:
obj
- the object, can benull
- Returns:
true
is zero
-
isPredefinedItemFolder
Returnstrue
if predefined item is folder.- Parameters:
item
- the predefined item, cannot benull
- Returns:
true
if is folder
-
isStringCode
Cheks if object has string type code.- Parameters:
obj
- the object, cannot benull
- Returns:
true
is string type code
-
isStringCodeType
public static boolean isStringCodeType(org.eclipse.emf.common.util.Enumerator codeType) Cheks if code type is string.- Parameters:
codeType
- the code type, can benull
- Returns:
true
is string
-
isWholeObjectCodeSeries
Returnstrue
if model has whole object code series selected.- Parameters:
obj
- the object, cannot benull
- Returns:
true
is whole object code series
-
isAddEnabledForSelectedPredefinedItem
public static boolean isAddEnabledForSelectedPredefinedItem(BasicDbObject basicDbObject, Object selectedObject, boolean isFolder) Checks is element adding enabled for selected object for predefined container hierarchy type.- Parameters:
basicDbObject
- the predefined container, cannot benull
selectedObject
- the selected object, cannot benull
isFolder
- is selected object is predefined item folder.- Returns:
true
is adding enable
-
isPredefinedSupports
Checks if object supports predefined data.- Parameters:
obj
- the object-candidate, cannot benull
- Returns:
true
if supports
-
mapStringToValue
Maps string code value to metadata model type value by hisBasicDbObject
code type.- Parameters:
stringCodeVaule
- the string code value, can benull
basicDbObject
- theBasicDbObject
- predefined elements owner, cannot benull
- Returns:
- the metadata model type value for code or
String
} if codeType isnull
-
generatePredefinedItemUniqueCode
Generates unique code for new predefined item in the given parent object.- Parameters:
parent
- the object in which predefined item will be stored- Returns:
- generated unique code, never
null
-
generatePredefinedItemUniqueName
Generates unique name for new predefined item in the given parent object.- Parameters:
parent
- the object in which predefined item will be storedisFolder
- flag indicating that new predefined item will be a folder- Returns:
- generated unique name, never
null
-
isCheckUnique
Returntrue
if check unique used.- Parameters:
obj
- the object, cannot benull
- Returns:
true
if object checks code uniqueness,false
otherwise
-
getCodeAllowedLengthFeature
public static org.eclipse.emf.ecore.EAttribute getCodeAllowedLengthFeature(org.eclipse.emf.ecore.EObject eObject) Returns e-object code allowed length feature if present.- Parameters:
eObject
- the e-object, cannot benull
- Returns:
- the feature or
null
if not present
-
getCodeLengthFeature
public static org.eclipse.emf.ecore.EAttribute getCodeLengthFeature(org.eclipse.emf.ecore.EObject eObject) Returns e-object code length feature if present.- Parameters:
eObject
- the e-object, cannot benull
- Returns:
- the feature or
null
if not present
-
getCodeTypeFeature
public static org.eclipse.emf.ecore.EAttribute getCodeTypeFeature(org.eclipse.emf.ecore.EObject eObject) Returns e-object code type feature if present.- Parameters:
eObject
- the e-object, cannot benull
- Returns:
- the feature or
null
if not present
-
getDescriptionLengthFeature
public static org.eclipse.emf.ecore.EAttribute getDescriptionLengthFeature(org.eclipse.emf.ecore.EObject eObject) Returns e-object description length feature if present.- Parameters:
eObject
- the e-object, cannot benull
- Returns:
- the feature or
null
if not present
-
canCodeEdit
public static boolean canCodeEdit(org.eclipse.emf.ecore.EObject eObject) Checks code edit ability.- Parameters:
eObject
- the e-object, cannot benull
- Returns:
true
if can,false
otherwise
-
canDescriptionEdit
public static boolean canDescriptionEdit(org.eclipse.emf.ecore.EObject eObject) Checks description edit ability.- Parameters:
eObject
- the e-object, cannot benull
- Returns:
true
if can,false
otherwise
-
canTypeDescriptionEdit
public static boolean canTypeDescriptionEdit(org.eclipse.emf.ecore.EObject eObject) Checks type description edit ability.- Parameters:
eObject
- the e-object, cannot benull
- Returns:
true
if can,false
otherwise
-
normalizeCode
public static String normalizeCode(boolean fixedStringCodeType, boolean numberCodeType, int codeLength, String code) Normalizes code for fixed string code or empty number code or null code.- Parameters:
fixedStringCodeType
- the fixed string code typenumberCodeType
- the fixed string code typecodeLength
- the code lengthcode
- the initial code, can benull
- Returns:
- normalized code, cannot be
null
-