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 BasicCommand
findCommandByName
(MdObject object, String commandName) Searches for command (by name) in md objectstatic BasicForm
findFormByName
(MdObject object, String formName) Searches for forms (by name) in md objectstatic BasicTemplate
findTemplateByName
(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 CompatibilityMode
getCompatibilityMode
(int major, int minor, int micro) Convert version numerical components to configurationCompatibilityMode
enumstatic Configuration
getConfiguration
(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.EStructuralFeature
getConfigurationFeature
(MdObject mdObject) Gets configuration feature by md-object.static BasicForm
getDefaultForm
(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.EStructuralFeature
getFeatureByCode
(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 String
getMdClassCode
(org.eclipse.emf.ecore.EModelElement feature) Returns the code of the child MdClass for the given feature, ornull
if the code cannot be resolved.static String
getMdClassCodeRu
(org.eclipse.emf.ecore.EModelElement feature) Returns the code_ru of the child MdClass for the given feature, ornull
if the code cannot be resolved.static String
getPluralFormOfModelObjectName
(String modelObjectName) Returns the plural form of the given model object name.static MdTypes
getProducedTypes
(MdObject mdObject) Produced types of specifiedMdObject
static TypeDescription
getRealTypeDescription
(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 String
getSingularFormOfModelObjectName
(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 boolean
isCommonAttributeTarget
(org.eclipse.emf.ecore.EClass eClass) Returns whether objects of the givenEClass
are potential targets for common attribute application.static boolean
isMdClass
(org.eclipse.emf.ecore.EModelElement element) Returns whether the given element is annotated asMdClass
.static boolean
isMobileApplicationUsePurposes
(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. Returnsnull
if 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;
null
if 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
null
if 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, ornull
if the code cannot be resolved. The code should be specified in theMdClass
annotation on the feature.- Parameters:
feature
- a structural feature (notnull
)- Returns:
- the code of the child MdClass for the given feature,
or
null
if the code cannot be resolved
-
getMdClassCodeRu
Returns the code_ru of the child MdClass for the given feature, ornull
if the code cannot be resolved. The code should be specified in theMdClass
annotation on the feature.- Parameters:
feature
- a structural feature (notnull
)- Returns:
- the code_ru of the child MdClass for the given feature,
or
null
if 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:
true
if the given element hasMdClass
annotation; otherwisefalse
-
isCommonAttributeTarget
public static boolean isCommonAttributeTarget(org.eclipse.emf.ecore.EClass eClass) Returns whether objects of the givenEClass
are potential targets for common attribute application.- Parameters:
eClass
-- Returns:
true
if objects of the givenEClass
are potential targets for common attribute application;false
otherwise
-
getCompatibilityMode
Convert version numerical components to configurationCompatibilityMode
enum- 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 ofApplicationUsePurpose
elements for check, cannot benull
- Returns:
true
if given collection is only for mobile applications,false
in otherwise
-