Class ValidationUtil
- java.lang.Object
-
- com._1c.g5.v8.dt.metadata.mdclass.impl.ValidationUtil
-
public final class ValidationUtil extends Object
Validation util.
-
-
Field Summary
Fields Modifier and Type Field Description static intMAX_NUMBER_CODE_LENGTHstatic intMAX_NUMBER_NUMBER_LENGTHstatic intMAX_STRING_CODE_LENGTHstatic intMAX_STRING_NUMBER_LENGTH
-
Constructor Summary
Constructors Constructor Description ValidationUtil()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static voidaddError(org.eclipse.emf.common.util.DiagnosticChain diagnostics, int code, String message, Object[] data)Adds error into EMF diagnostics.static voidaddWarning(org.eclipse.emf.common.util.DiagnosticChain diagnostics, int code, String message, Object[] data)Adds warning into EMF diagnostics.static booleancheckCompatibilityMode(CompatibilityMode current, CompatibilityMode modeToCheck)Checks ifcurrentcompatibility mode is less or equalsmodeToCheckstatic booleancheckCompatibilityMode(Configuration configuration, CompatibilityMode mode)Checks configuration compatibility modestatic booleancontainsBoolean(org.eclipse.emf.common.util.EList<? extends TypeItem> types)Checks types contains if boolean type.static Object[]dataToArray(Object... elements)Adds error data to array.static List<MdObject>filterDuplicateNameMdObjects(List<?> firsts, List<?> seconds)Filters md-objects with duplicate name.static List<HTTPService>findHTTPServicesWithSameRootUrl(Configuration configuration, String rootURL)Finds configuretion HTTP services with same root URL.static List<Method>findMethodWithSameHttpMethod(URLTemplate urlTemplate, HTTPMethod httpMethod)Finds URL template method with same HTTP method.static List<XDTOPackage>findXDTOPackagesWithSameNamespace(Configuration configuration, String namespaceURL)Finds configuration XDTO packages with the same namespace.static List<CommonAttribute>getAllDataSeparators(Configuration configuration)Gets all configuration data separators.static List<? extends BasicFeature>getAttributes(MdObject mdObject)Gets md-object attributes.static org.eclipse.emf.ecore.EReferencegetAttributesFeature(MdObject mdObject)Gets md-object attributes feature.static CompatibilityModegetCompatibilityMode(Map<Object,Object> context)Returns configuration compatibility mode from the context.static List<?>getDimensions(MdObject mdObject)Gets md-object dimensions.static org.eclipse.emf.ecore.EReferencegetDimensionsFeature(MdObject mdObject)Gets md-object dimensions feature.static intgetMaxDescriptionLength(BasicDbObject basicDbObject)Returns max description length forBasicDbObject.static MdObjectgetMdObjectByType(TypeItem type)Gets md-object of type.static List<CommonAttribute>getMdObjectDataSeparators(MdObject mdObject, Configuration configuration)Gets md-object data separators.static StringgetName(MdObject mdObject)Gets md-object name as last segment of canonical name.static TypegetNumberType(List<? extends TypeItem> types)Gets number type from types.static List<?>getResources(MdObject mdObject)Gets md-object resources.static org.eclipse.emf.ecore.EReferencegetResourcesFeature(MdObject mdObject)Gets md-object resources feature.static TypegetStringType(List<? extends TypeItem> types)Gets string type from types.static List<?>getTabularSections(MdObject mdObject)Gets md-object tabular sections.static org.eclipse.emf.ecore.EReferencegetTabularSectionsFeature(MdObject mdObject)Gets md-object tabular sections feature.static TypegetTypeDescriptionType(List<? extends TypeItem> types)Gets type description type from types.static TypegetValueStorageType(List<? extends TypeItem> types)Gets value storage type from types.static booleanhasDomainIntersection(TypeDescription primaryType, TypeDescription secondaryType, List<? extends TypeItem> secondaryTypeItems)Returns is type domains has intersection.static booleanisDataLockReady(Field field, Set<FixedFieldDescriptor> fixedFields)Returns true is field is data lock ready.static booleanisInputByStringReady(Field field, Set<FixedFieldDescriptor> fixedFields)Returns true is fileld is input by string ready.static booleanisTemplateSegmentsValid(String template)Checks if URL template segments valid.static booleanisTemplateValid(String template)Checks if URL template valid.static booleanisTypeDescriptionSubsetOtherTypeDescription(TypeDescription typeSet, TypeDescription typeSubset)Checks is one type description subset of the other type description.static booleanisValidUrlSegment(char[] rootUrl)Checks if root URL valid.
-
-
-
Field Detail
-
MAX_NUMBER_CODE_LENGTH
public static final int MAX_NUMBER_CODE_LENGTH
- See Also:
- Constant Field Values
-
MAX_NUMBER_NUMBER_LENGTH
public static final int MAX_NUMBER_NUMBER_LENGTH
- See Also:
- Constant Field Values
-
MAX_STRING_CODE_LENGTH
public static final int MAX_STRING_CODE_LENGTH
- See Also:
- Constant Field Values
-
MAX_STRING_NUMBER_LENGTH
public static final int MAX_STRING_NUMBER_LENGTH
- See Also:
- Constant Field Values
-
-
Method Detail
-
addError
public static void addError(org.eclipse.emf.common.util.DiagnosticChain diagnostics, int code, String message, Object[] data)Adds error into EMF diagnostics.- Parameters:
diagnostics- EMF diagnosticscode- error codemessage- error messagedata- error data
-
addWarning
public static void addWarning(org.eclipse.emf.common.util.DiagnosticChain diagnostics, int code, String message, Object[] data)Adds warning into EMF diagnostics.- Parameters:
diagnostics- EMF diagnosticscode- error codemessage- error messagedata- error data
-
checkCompatibilityMode
public static boolean checkCompatibilityMode(CompatibilityMode current, CompatibilityMode modeToCheck)
Checks ifcurrentcompatibility mode is less or equalsmodeToCheck- Parameters:
current- current compatibility mode (notnull)modeToCheck- mode to check (notnull)- Returns:
- true if
currentcompatibility mode is less or equalsmodeToCheck, false otherwise
-
checkCompatibilityMode
public static boolean checkCompatibilityMode(Configuration configuration, CompatibilityMode mode)
Checks configuration compatibility mode- Parameters:
configuration- the configuration metadata object (notnull)mode- the compatibility mode to check (notnull)- Returns:
- true if
configurationcompatibility mode is less or equalsmode, false otherwise
-
containsBoolean
public static boolean containsBoolean(org.eclipse.emf.common.util.EList<? extends TypeItem> types)
Checks types contains if boolean type.- Parameters:
types- types from type descriptor- Returns:
- if contains
-
dataToArray
public static Object[] dataToArray(Object... elements)
Adds error data to array.- Parameters:
elements- error data- Returns:
- error data array
-
filterDuplicateNameMdObjects
public static List<MdObject> filterDuplicateNameMdObjects(List<?> firsts, List<?> seconds)
Filters md-objects with duplicate name.- Parameters:
firsts- etalon md-objectsseconds- checked md-objects- Returns:
- md-objects from seconds with duplicate name in firsts
-
getAllDataSeparators
public static List<CommonAttribute> getAllDataSeparators(Configuration configuration)
Gets all configuration data separators.- Parameters:
configuration- the configuration- Returns:
- all data separators
-
getAttributes
public static List<? extends BasicFeature> getAttributes(MdObject mdObject)
Gets md-object attributes.- Parameters:
mdObject- the md-object- Returns:
- md-objects attributes
-
getAttributesFeature
public static org.eclipse.emf.ecore.EReference getAttributesFeature(MdObject mdObject)
Gets md-object attributes feature.- Parameters:
mdObject- the md-object- Returns:
- md-objects attributes feature
-
getCompatibilityMode
public static CompatibilityMode getCompatibilityMode(Map<Object,Object> context)
Returns configuration compatibility mode from the context. If compatibility mode is not contains in the context will be return 'Don't use' compatibility mode value.- Parameters:
context- the context- Returns:
- the compatibility mode, can't be
null- always present in context
-
getDimensions
public static List<?> getDimensions(MdObject mdObject)
Gets md-object dimensions.- Parameters:
mdObject- the md-object- Returns:
- dimensions
-
getDimensionsFeature
public static org.eclipse.emf.ecore.EReference getDimensionsFeature(MdObject mdObject)
Gets md-object dimensions feature.- Parameters:
mdObject- the md-object- Returns:
- dimensions feature
-
getMdObjectByType
public static MdObject getMdObjectByType(TypeItem type)
Gets md-object of type.- Parameters:
type- selected type- Returns:
- md-object of type
-
getMdObjectDataSeparators
public static List<CommonAttribute> getMdObjectDataSeparators(MdObject mdObject, Configuration configuration)
Gets md-object data separators.- Parameters:
mdObject- the md-objectconfiguration- md-object container- Returns:
- md-object data separators
-
getName
public static String getName(MdObject mdObject)
Gets md-object name as last segment of canonical name.- Parameters:
mdObject- md-object- Returns:
- md-object name
-
getNumberType
public static Type getNumberType(List<? extends TypeItem> types)
Gets number type from types.- Parameters:
types- types- Returns:
- number type or
null
-
getResources
public static List<?> getResources(MdObject mdObject)
Gets md-object resources.- Parameters:
mdObject- the md-object- Returns:
- md-object resources
-
getResourcesFeature
public static org.eclipse.emf.ecore.EReference getResourcesFeature(MdObject mdObject)
Gets md-object resources feature.- Parameters:
mdObject- the md-object- Returns:
- md-object resources feature
-
getStringType
public static Type getStringType(List<? extends TypeItem> types)
Gets string type from types.- Parameters:
types- types- Returns:
- string type or
null
-
getTabularSections
public static List<?> getTabularSections(MdObject mdObject)
Gets md-object tabular sections.- Parameters:
mdObject- the md-object- Returns:
- tabular sections
-
getTabularSectionsFeature
public static org.eclipse.emf.ecore.EReference getTabularSectionsFeature(MdObject mdObject)
Gets md-object tabular sections feature.- Parameters:
mdObject- the md-object- Returns:
- tabular sections feature
-
getTypeDescriptionType
public static Type getTypeDescriptionType(List<? extends TypeItem> types)
Gets type description type from types.- Parameters:
types- types- Returns:
- type description type or
null
-
getValueStorageType
public static Type getValueStorageType(List<? extends TypeItem> types)
Gets value storage type from types.- Parameters:
types- types- Returns:
- value storage type or
null
-
hasDomainIntersection
public static boolean hasDomainIntersection(TypeDescription primaryType, TypeDescription secondaryType, List<? extends TypeItem> secondaryTypeItems)
Returns is type domains has intersection.- Parameters:
primaryType- the primary type domainsecondaryType- the secondary type domainsecondaryTypeItems- the secondary type domain types- Returns:
trueif has
-
isDataLockReady
public static boolean isDataLockReady(Field field, Set<FixedFieldDescriptor> fixedFields)
Returns true is field is data lock ready.- Parameters:
field- fieldfixedFields- fixed fields for contained EObject- Returns:
- true if is
-
isInputByStringReady
public static boolean isInputByStringReady(Field field, Set<FixedFieldDescriptor> fixedFields)
Returns true is fileld is input by string ready.- Parameters:
field- fieldfixedFields- fixed fields descriptor for contained EObject- Returns:
- true if is
-
isTypeDescriptionSubsetOtherTypeDescription
public static boolean isTypeDescriptionSubsetOtherTypeDescription(TypeDescription typeSet, TypeDescription typeSubset)
Checks is one type description subset of the other type description.- Parameters:
typeSet- - the type descriptiontypeSubset- - the subset type description- Returns:
- true if is
-
isTemplateValid
public static boolean isTemplateValid(String template)
Checks if URL template valid.- Parameters:
template- the URL template, cannot benull- Returns:
trueif vaild
-
isTemplateSegmentsValid
public static boolean isTemplateSegmentsValid(String template)
Checks if URL template segments valid.- Parameters:
template- the URL template, cannot benull- Returns:
trueif vaild
-
isValidUrlSegment
public static boolean isValidUrlSegment(char[] rootUrl)
Checks if root URL valid.- Parameters:
rootUrl- the root URL, cannot benull- Returns:
trueif vaild
-
findHTTPServicesWithSameRootUrl
public static List<HTTPService> findHTTPServicesWithSameRootUrl(Configuration configuration, String rootURL)
Finds configuretion HTTP services with same root URL.- Parameters:
configuration- the configuration, cannot benullrootURL- the root URL, cannot benull- Returns:
- the http services.
-
findMethodWithSameHttpMethod
public static List<Method> findMethodWithSameHttpMethod(URLTemplate urlTemplate, HTTPMethod httpMethod)
Finds URL template method with same HTTP method.- Parameters:
urlTemplate- the URL template, cannot benullhttpMethod- the HTTP method, cannot benull- Returns:
-
findXDTOPackagesWithSameNamespace
public static List<XDTOPackage> findXDTOPackagesWithSameNamespace(Configuration configuration, String namespaceURL)
Finds configuration XDTO packages with the same namespace.- Parameters:
configuration- the configuration, cannot benullnamespaceURL- the namespace URL, cannot benull- Returns:
- the list XDTO packages with the same namespace if founded or empty.
-
getMaxDescriptionLength
public static int getMaxDescriptionLength(BasicDbObject basicDbObject)
Returns max description length forBasicDbObject.- Parameters:
basicDbObject- the basic db-object, cannot benull- Returns:
- max description length for
BasicDbObject
-
-