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
PredefinedItem
util.
-
-
Constructor Summary
Constructors Constructor Description PredefinedItemUtil()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static 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 String
generatePredefinedItemUniqueCode(BasicDbObject parent)
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
getCodeAllowedLength(BasicDbObject obj)
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
getCodeLength(BasicDbObject obj)
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
getDescriptionLength(BasicDbObject obj)
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
getPredefinedItemCode(PredefinedItem item)
Gets predefined item code.static org.eclipse.emf.ecore.EStructuralFeature
getPredefinedItemCodeFeature(PredefinedItem item)
Gets predefined item code.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
isAutonumbering(BasicDbObject obj)
Returntrue
if autonumbering used.static boolean
isCheckUnique(BasicDbObject obj)
Returntrue
if check unique used.static boolean
isFixedStringCode(BasicDbObject obj)
Checks if object code type is fixed.static boolean
isHierarchical(org.eclipse.emf.ecore.EObject obj)
Returnstrue
if hierarchical model.static boolean
isHierarchyFoldersAndItems(BasicDbObject obj)
Returnstrue
if folders and items hierarchy.static boolean
isHierarchyOfItems(BasicDbObject obj)
Returnstrue
if items hierarchy.static boolean
isNumberCode(BasicDbObject obj)
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
isNumberZeroLengthCode(BasicDbObject obj)
Checks if object has zero length code.static boolean
isPredefinedItemFolder(Object item)
Returnstrue
if predefined item is folder.static boolean
isPredefinedSupports(Object obj)
Checks if object supports predefined data.static boolean
isStringCode(BasicDbObject obj)
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
isWholeObjectCodeSeries(BasicDbObject obj)
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 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 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
public static Predefined getPredefined(org.eclipse.emf.ecore.EObject obj)
Gets model predefined if supports.- Parameters:
obj
- the object, cannot benull
- Returns:
- the predefined,
null
if not supported
-
getPredefinedItemCode
public static Object getPredefinedItemCode(PredefinedItem item)
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
-
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
public static boolean hasOwners(BasicDbObject obj)
Returnstrue
if 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)
Returntrue
if autonumbering used.- Parameters:
obj
- the object, cannot benull
- Returns:
true
if autonumbering
-
isFixedStringCode
public static boolean isFixedStringCode(BasicDbObject obj)
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
public static boolean isHierarchyFoldersAndItems(BasicDbObject obj)
Returnstrue
if folders and items hierarchy.- Parameters:
obj
- the object, cannot benull
- Returns:
true
if is
-
isHierarchyOfItems
public static boolean isHierarchyOfItems(BasicDbObject obj)
Returnstrue
if items hierarchy.- Parameters:
obj
- the object, cannot benull
- Returns:
true
if is
-
isNumberCode
public static boolean isNumberCode(BasicDbObject obj)
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
public static boolean isNumberZeroLengthCode(BasicDbObject obj)
Checks if object has zero length code.- Parameters:
obj
- the object, can benull
- Returns:
true
is zero
-
isPredefinedItemFolder
public static boolean isPredefinedItemFolder(Object item)
Returnstrue
if predefined item is folder.- Parameters:
item
- the predefined item, cannot benull
- Returns:
true
if is folder
-
isStringCode
public static boolean isStringCode(BasicDbObject obj)
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
public static boolean isWholeObjectCodeSeries(BasicDbObject obj)
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
public static boolean isPredefinedSupports(Object obj)
Checks if object supports predefined data.- Parameters:
obj
- the object-candidate, cannot benull
- Returns:
true
if supports
-
mapStringToValue
public static Object mapStringToValue(String stringCodeVaule, BasicDbObject basicDbObject)
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
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)
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
-
-