Package com._1c.g5.v8.dt.md
Class PredefinedItemUtil
- java.lang.Object
-
- com._1c.g5.v8.dt.md.PredefinedItemUtil
-
public final class PredefinedItemUtil extends Object
PredefinedItemutil.
-
-
Constructor Summary
Constructors Constructor Description PredefinedItemUtil()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static booleancanCodeEdit(org.eclipse.emf.ecore.EObject eObject)Checks code edit ability.static booleancanDescriptionEdit(org.eclipse.emf.ecore.EObject eObject)Checks description edit ability.static booleancanTypeDescriptionEdit(org.eclipse.emf.ecore.EObject eObject)Checks type description edit ability.static PredefinedItemfindPredefinedItemByName(org.eclipse.emf.ecore.EObject parent, String name)Find predefined item in specified parent object by given namestatic StringgeneratePredefinedItemUniqueCode(BasicDbObject parent)Generates unique code for new predefined item in the given parent object.static StringgeneratePredefinedItemUniqueName(BasicDbObject parent, boolean isFolder)Generates unique name for new predefined item in the given parent object.static AllowedLengthgetCodeAllowedLength(BasicDbObject obj)Gets code allowed length.static org.eclipse.emf.ecore.EAttributegetCodeAllowedLengthFeature(org.eclipse.emf.ecore.EObject eObject)Returns e-object code allowed length feature if present.static intgetCodeLength(BasicDbObject obj)Gets code length.static org.eclipse.emf.ecore.EAttributegetCodeLengthFeature(org.eclipse.emf.ecore.EObject eObject)Returns e-object code length feature if present.static org.eclipse.emf.common.util.EnumeratorgetCodeType(BasicDbObject obj)Gets code type if supports.static org.eclipse.emf.ecore.EAttributegetCodeTypeFeature(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 intgetDescriptionLength(BasicDbObject obj)Gets description length.static org.eclipse.emf.ecore.EAttributegetDescriptionLengthFeature(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 orPredefinedpredefined items.static org.eclipse.emf.ecore.EObjectgetItemsContainer(org.eclipse.emf.ecore.EObject predefinedContainer)Returns predefined item container.static org.eclipse.emf.ecore.EReferencegetItemsFeature(org.eclipse.emf.ecore.EObject eObject)Returns predefined data items feature if object supports one.static intgetLevelCount(org.eclipse.emf.ecore.EObject obj)Gets level count if supports.static PredefinedgetPredefined(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.EReferencegetPredefinedFeature(org.eclipse.emf.ecore.EObject eObject)Returns predefined data feature if object supports one.static ObjectgetPredefinedItemCode(PredefinedItem item)Gets predefined item code.static org.eclipse.emf.ecore.EStructuralFeaturegetPredefinedItemCodeFeature(PredefinedItem item)Gets predefined item code.static booleanhasOwners(BasicDbObject obj)Returnstrueif the object has owners.static booleanisAddEnabledForSelectedPredefinedItem(BasicDbObject basicDbObject, Object selectedObject, boolean isFolder)Checks is element adding enabled for selected object for predefined container hierarchy type.static booleanisAutonumbering(BasicDbObject obj)Returntrueif autonumbering used.static booleanisCheckUnique(BasicDbObject obj)Returntrueif check unique used.static booleanisFixedStringCode(BasicDbObject obj)Checks if object code type is fixed.static booleanisHierarchical(org.eclipse.emf.ecore.EObject obj)Returnstrueif hierarchical model.static booleanisHierarchyFoldersAndItems(BasicDbObject obj)Returnstrueif folders and items hierarchy.static booleanisHierarchyOfItems(BasicDbObject obj)Returnstrueif items hierarchy.static booleanisNumberCode(BasicDbObject obj)Cheks if object has number type code.static booleanisNumberCodeType(org.eclipse.emf.common.util.Enumerator codeType)Cheks if code type is number.static booleanisNumberZeroLengthCode(BasicDbObject obj)Checks if object has zero length code.static booleanisPredefinedItemFolder(Object item)Returnstrueif predefined item is folder.static booleanisPredefinedSupports(Object obj)Checks if object supports predefined data.static booleanisStringCode(BasicDbObject obj)Cheks if object has string type code.static booleanisStringCodeType(org.eclipse.emf.common.util.Enumerator codeType)Cheks if code type is string.static booleanisWholeObjectCodeSeries(BasicDbObject obj)Returnstrueif model has whole object code series selected.static ObjectmapStringToValue(String stringCodeVaule, BasicDbObject basicDbObject)Maps string code value to metadata model type value by hisBasicDbObjectcode type.static StringnormalizeCode(boolean fixedStringCodeType, boolean numberCodeType, int codeLength, String code)Normalizes code for fixed string code or empty number code or null code.
-
-
-
Method Detail
-
getCodeAllowedLength
public static AllowedLength getCodeAllowedLength(BasicDbObject obj)
Gets code allowed length.- Parameters:
obj- the object, cannot benull- Returns:
- the allowed length
-
getCodeLength
public static int getCodeLength(BasicDbObject obj)
Gets code length.- Parameters:
obj- the object, cannot benull- Returns:
- the code length
-
getCodeType
public static org.eclipse.emf.common.util.Enumerator getCodeType(BasicDbObject obj)
Gets code type if supports.- Parameters:
obj- the object, cannot benull- Returns:
- the code type, if not supported returns
null
-
getContent
public static List<? extends PredefinedItem> getContent(org.eclipse.emf.ecore.EObject item)
Get predefined item content.- Parameters:
item- the predefined item, cannot benull- Returns:
- the content
-
getItems
public static List<? extends PredefinedItem> getItems(org.eclipse.emf.ecore.EObject obj)
Gets model orPredefinedpredefined 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
public static Predefined getPredefined(org.eclipse.emf.ecore.EObject obj)
Gets model predefined if supports.- Parameters:
obj- the object, cannot benull- Returns:
- the predefined,
nullif not supported
-
getPredefinedItemCode
public static Object getPredefinedItemCode(PredefinedItem item)
Gets predefined item code.- Parameters:
item- the item, cannot benull- Returns:
- the code,
nullif 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,
nullif 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 benullname- the name of searched predefained item, cannot benull- Returns:
- instance of
PredefinedItemfinded 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
nullif 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
nullif 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
public static boolean hasOwners(BasicDbObject obj)
Returnstrueif the object has owners.- Parameters:
obj- the object, cannot benull- Returns:
- true if has owners
-
getDescriptionLength
public static int getDescriptionLength(BasicDbObject obj)
Gets description length.- Parameters:
obj- the object, cannot benull- Returns:
- the description length
-
isAutonumbering
public static boolean isAutonumbering(BasicDbObject obj)
Returntrueif autonumbering used.- Parameters:
obj- the object, cannot benull- Returns:
trueif autonumbering
-
isFixedStringCode
public static boolean isFixedStringCode(BasicDbObject obj)
Checks if object code type is fixed.- Parameters:
obj- the object, cannot benull- Returns:
trueif fixed
-
isHierarchical
public static boolean isHierarchical(org.eclipse.emf.ecore.EObject obj)
Returnstrueif hierarchical model.- Parameters:
obj- the object, cannot benull- Returns:
trueif is
-
isHierarchyFoldersAndItems
public static boolean isHierarchyFoldersAndItems(BasicDbObject obj)
Returnstrueif folders and items hierarchy.- Parameters:
obj- the object, cannot benull- Returns:
trueif is
-
isHierarchyOfItems
public static boolean isHierarchyOfItems(BasicDbObject obj)
Returnstrueif items hierarchy.- Parameters:
obj- the object, cannot benull- Returns:
trueif is
-
isNumberCode
public static boolean isNumberCode(BasicDbObject obj)
Cheks if object has number type code.- Parameters:
obj- the object, cannot benull- Returns:
trueis 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:
trueis number
-
isNumberZeroLengthCode
public static boolean isNumberZeroLengthCode(BasicDbObject obj)
Checks if object has zero length code.- Parameters:
obj- the object, can benull- Returns:
trueis zero
-
isPredefinedItemFolder
public static boolean isPredefinedItemFolder(Object item)
Returnstrueif predefined item is folder.- Parameters:
item- the predefined item, cannot benull- Returns:
trueif is folder
-
isStringCode
public static boolean isStringCode(BasicDbObject obj)
Cheks if object has string type code.- Parameters:
obj- the object, cannot benull- Returns:
trueis 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:
trueis string
-
isWholeObjectCodeSeries
public static boolean isWholeObjectCodeSeries(BasicDbObject obj)
Returnstrueif model has whole object code series selected.- Parameters:
obj- the object, cannot benull- Returns:
trueis 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 benullselectedObject- the selected object, cannot benullisFolder- is selected object is predefined item folder.- Returns:
trueis adding enable
-
isPredefinedSupports
public static boolean isPredefinedSupports(Object obj)
Checks if object supports predefined data.- Parameters:
obj- the object-candidate, cannot benull- Returns:
trueif supports
-
mapStringToValue
public static Object mapStringToValue(String stringCodeVaule, BasicDbObject basicDbObject)
Maps string code value to metadata model type value by hisBasicDbObjectcode type.- Parameters:
stringCodeVaule- the string code value, can benullbasicDbObject- theBasicDbObject- predefined elements owner, cannot benull- Returns:
- the metadata model type value for code or
String} if codeType isnull
-
generatePredefinedItemUniqueCode
public static String generatePredefinedItemUniqueCode(BasicDbObject parent)
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
public static String generatePredefinedItemUniqueName(BasicDbObject parent, boolean isFolder)
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
public static boolean isCheckUnique(BasicDbObject obj)
Returntrueif check unique used.- Parameters:
obj- the object, cannot benull- Returns:
trueif object checks code uniqueness,falseotherwise
-
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
nullif 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
nullif 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
nullif 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
nullif 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:
trueif can,falseotherwise
-
canDescriptionEdit
public static boolean canDescriptionEdit(org.eclipse.emf.ecore.EObject eObject)
Checks description edit ability.- Parameters:
eObject- the e-object, cannot benull- Returns:
trueif can,falseotherwise
-
canTypeDescriptionEdit
public static boolean canTypeDescriptionEdit(org.eclipse.emf.ecore.EObject eObject)
Checks type description edit ability.- Parameters:
eObject- the e-object, cannot benull- Returns:
trueif can,falseotherwise
-
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
-
-