Class MdClassUtil
java.lang.Object
com._1c.g5.v8.dt.metadata.mdclass.util.MdClassUtil
Utilities for working with MdClass model.
-
Field Summary
Fields -
Method Summary
Modifier and TypeMethodDescriptionstatic BasicCommandfindCommandByName(MdObject object, String commandName) Searches for command (by name) in md objectstatic BasicFormfindFormByName(MdObject object, String formName) Searches for forms (by name) in md objectstatic BasicTemplatefindTemplateByName(MdObject object, String templateName) Searches for templates (by name) in md objectstatic Optional<List<BasicFeature>>getAttributes(MdObject owner) Searches for attributes, that are contained in owner objectstatic List<BasicCommand>getCommands(MdObject owner) Searches for commands, that are contained in owner objectstatic CompatibilityModegetCompatibilityMode(int major, int minor, int micro) Convert version numerical components to configurationCompatibilityModeenumstatic ConfigurationgetConfiguration(org.eclipse.emf.ecore.EObject eObject) Returns the configuration object for the given object, loaded in the same resource set as the given object.static org.eclipse.emf.ecore.EStructuralFeaturegetConfigurationFeature(MdObject mdObject) Gets configuration feature by md-object.static BasicFormgetDefaultForm(MdObject object, String defaultFormType) Searches for default form in Md object If such type of form is not presented in current object, assertion error will be throwngetDimensions(MdObject owner) Searches for dimension, that are contained in owner objectstatic org.eclipse.emf.ecore.EStructuralFeaturegetFeatureByCode(org.eclipse.emf.ecore.EClass eClass, String code) Returns the feature of the child MdClass for the given code, ornull.Searches for forms, that are contained in owner objectstatic StringgetMdClassCode(org.eclipse.emf.ecore.EModelElement feature) Returns the code of the child MdClass for the given feature, ornullif the code cannot be resolved.static StringgetMdClassCodeRu(org.eclipse.emf.ecore.EModelElement feature) Returns the code_ru of the child MdClass for the given feature, ornullif the code cannot be resolved.static StringgetPluralFormOfModelObjectName(String modelObjectName) Returns the plural form of the given model object name.static MdTypesgetProducedTypes(MdObject mdObject) Produced types of specifiedMdObjectstatic TypeDescriptiongetRealTypeDescription(TypeDescription typeDescription) Returns a real type description in case of a defined type.getResources(MdObject owner) Searches for resources, that are contained in owner objectstatic StringgetSingularFormOfModelObjectName(String modelObjectName) Returns the singular form of the given model object name.static Optional<List<BasicTabularSection>>getTabularSections(MdObject owner) Searches for tabular section, that are contained in owner objectstatic List<BasicTemplate>getTemplates(MdObject owner) Searches for templates, that are contained in owner objectstatic booleanisCommonAttributeTarget(org.eclipse.emf.ecore.EClass eClass) Returns whether objects of the givenEClassare potential targets for common attribute application.static booleanisMdClass(org.eclipse.emf.ecore.EModelElement element) Returns whether the given element is annotated asMdClass.static booleanisMobileApplicationUsePurposes(Collection<ApplicationUsePurpose> usePurposes) The specified collection ofApplicationUsePurpose-s is only for mobile applications
-
Field Details
-
GET_NAME
-
-
Method Details
-
getConfiguration
Returns the configuration object for the given object, loaded in the same resource set as the given object. Returnsnullif the configuration object cannot be resolved for the given object.- Parameters:
eObject- notnull, must be contained by a resource in a resource set- Returns:
- the configuration object for the given object, loaded in the same
resource set as the given object;
nullif the configuration object cannot be resolved for the given object
-
getConfigurationFeature
Gets configuration feature by md-object.- Parameters:
mdObject- thr md-object- Returns:
- the structural feature
-
getDefaultForm
Searches for default form in Md object If such type of form is not presented in current object, assertion error will be thrown- Parameters:
object- - Md object where to searchdefaultFormType- - name of the feature, containing default form- Returns:
- default form if found, or null otherwise
- Throws:
AssertionError- - if passed defaultFormType is not presented in current Md object
-
getFeatureByCode
public static org.eclipse.emf.ecore.EStructuralFeature getFeatureByCode(org.eclipse.emf.ecore.EClass eClass, String code) Returns the feature of the child MdClass for the given code, ornull.- Parameters:
code- of the child MdClass (notnull)- Returns:
- structural feature of the child MdClass for the given code,
or
nullif the feature cannot be resolved
-
getForms
Searches for forms, that are contained in owner object- Parameters:
owner- metadata object where to search. Cannot benull- Returns:
- a list of basic forms, if they were found in owner, never
null
-
getCommands
Searches for commands, that are contained in owner object- Parameters:
owner- metadata object where to search. Cannot benull- Returns:
- a list of basic commands, if they were found in owner, never
null
-
getTemplates
Searches for templates, that are contained in owner object- Parameters:
owner- metadata object where to search. Cannot benull- Returns:
- a list of basic templates, if they were found in owner, never
null
-
getAttributes
Searches for attributes, that are contained in owner object- Parameters:
owner- metadata object where to search. Cannot benull- Returns:
- a list of basic features, if they were found in owner, never
null
-
getTabularSections
Searches for tabular section, that are contained in owner object- Parameters:
owner- metadata object where to search. Cannot benull- Returns:
- a list of basic tabular sections, if they were found in owner, never
null
-
getResources
Searches for resources, that are contained in owner object- Parameters:
owner- metadata object where to search. Cannot benull- Returns:
- a list of resources, if they were found in owner, never
null
-
getDimensions
Searches for dimension, that are contained in owner object- Parameters:
owner- metadata object where to search. Cannot benull- Returns:
- a list of basic features, if they were found in owner, never
null
-
getMdClassCode
Returns the code of the child MdClass for the given feature, ornullif the code cannot be resolved. The code should be specified in theMdClassannotation on the feature.- Parameters:
feature- a structural feature (notnull)- Returns:
- the code of the child MdClass for the given feature,
or
nullif the code cannot be resolved
-
getMdClassCodeRu
Returns the code_ru of the child MdClass for the given feature, ornullif the code cannot be resolved. The code should be specified in theMdClassannotation on the feature.- Parameters:
feature- a structural feature (notnull)- Returns:
- the code_ru of the child MdClass for the given feature,
or
nullif the code cannot be resolved
-
findFormByName
Searches for forms (by name) in md object- Parameters:
object- - an object where to searchformName- - name of the form to searchfindDefault- - if true, method will return default form.- Returns:
- Form md object, or null if form not found
-
findCommandByName
Searches for command (by name) in md object- Parameters:
object- - an object where to searchcommandName- - name of the command to search- Returns:
- Form md object, or null if form not found
-
findTemplateByName
Searches for templates (by name) in md object- Parameters:
object- - an object where to searchtemplateName- - name of the template to search- Returns:
- Template md object, or null if template not found
-
isMdClass
public static boolean isMdClass(org.eclipse.emf.ecore.EModelElement element) Returns whether the given element is annotated asMdClass.- Parameters:
element- a model element (notnull)- Returns:
trueif the given element hasMdClassannotation; otherwisefalse
-
isCommonAttributeTarget
public static boolean isCommonAttributeTarget(org.eclipse.emf.ecore.EClass eClass) Returns whether objects of the givenEClassare potential targets for common attribute application.- Parameters:
eClass-- Returns:
trueif objects of the givenEClassare potential targets for common attribute application;falseotherwise
-
getCompatibilityMode
Convert version numerical components to configurationCompatibilityModeenum- Parameters:
major- Major component of the version identifier, not negative.minor- Minor component of the version identifier, not negative.micro- Micro component of the version identifier, not negative.- Returns:
- the compatibility mode for given version or
null
-
getRealTypeDescription
Returns a real type description in case of a defined type. Otherwise, returns it as is.- Parameters:
typeDescription- the type description, cannot benull- Returns:
- real type description, cannot be
null
-
getProducedTypes
Produced types of specifiedMdObject -
getPluralFormOfModelObjectName
Returns the plural form of the given model object name.- Parameters:
modelObjectName- the singular form of the model object name, cannot benull- Returns:
- the plural form, never
null
-
getSingularFormOfModelObjectName
Returns the singular form of the given model object name.- Parameters:
modelObjectName- the plural form of the model object name, cannot benull- Returns:
- the singular form, never
null
-
isMobileApplicationUsePurposes
The specified collection ofApplicationUsePurpose-s is only for mobile applications- Parameters:
usePurposes- the collection ofApplicationUsePurposeelements for check, cannot benull- Returns:
trueif given collection is only for mobile applications,falsein otherwise
-