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 int
MAX_NUMBER_CODE_LENGTH
static int
MAX_NUMBER_NUMBER_LENGTH
static int
MAX_STRING_CODE_LENGTH
static int
MAX_STRING_NUMBER_LENGTH
-
Constructor Summary
Constructors Constructor Description ValidationUtil()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static void
addError(org.eclipse.emf.common.util.DiagnosticChain diagnostics, int code, String message, Object[] data)
Adds error into EMF diagnostics.static void
addWarning(org.eclipse.emf.common.util.DiagnosticChain diagnostics, int code, String message, Object[] data)
Adds warning into EMF diagnostics.static boolean
checkCompatibilityMode(CompatibilityMode current, CompatibilityMode modeToCheck)
Checks ifcurrent
compatibility mode is less or equalsmodeToCheck
static boolean
checkCompatibilityMode(Configuration configuration, CompatibilityMode mode)
Checks configuration compatibility modestatic boolean
containsBoolean(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.EReference
getAttributesFeature(MdObject mdObject)
Gets md-object attributes feature.static CompatibilityMode
getCompatibilityMode(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.EReference
getDimensionsFeature(MdObject mdObject)
Gets md-object dimensions feature.static int
getMaxDescriptionLength(BasicDbObject basicDbObject)
Returns max description length forBasicDbObject
.static MdObject
getMdObjectByType(TypeItem type)
Gets md-object of type.static List<CommonAttribute>
getMdObjectDataSeparators(MdObject mdObject, Configuration configuration)
Gets md-object data separators.static String
getName(MdObject mdObject)
Gets md-object name as last segment of canonical name.static Type
getNumberType(List<? extends TypeItem> types)
Gets number type from types.static List<?>
getResources(MdObject mdObject)
Gets md-object resources.static org.eclipse.emf.ecore.EReference
getResourcesFeature(MdObject mdObject)
Gets md-object resources feature.static Type
getStringType(List<? extends TypeItem> types)
Gets string type from types.static List<?>
getTabularSections(MdObject mdObject)
Gets md-object tabular sections.static org.eclipse.emf.ecore.EReference
getTabularSectionsFeature(MdObject mdObject)
Gets md-object tabular sections feature.static Type
getTypeDescriptionType(List<? extends TypeItem> types)
Gets type description type from types.static Type
getValueStorageType(List<? extends TypeItem> types)
Gets value storage type from types.static boolean
hasDomainIntersection(TypeDescription primaryType, TypeDescription secondaryType, List<? extends TypeItem> secondaryTypeItems)
Returns is type domains has intersection.static boolean
isDataLockReady(Field field, Set<FixedFieldDescriptor> fixedFields)
Returns true is field is data lock ready.static boolean
isInputByStringReady(Field field, Set<FixedFieldDescriptor> fixedFields)
Returns true is fileld is input by string ready.static boolean
isTemplateSegmentsValid(String template)
Checks if URL template segments valid.static boolean
isTemplateValid(String template)
Checks if URL template valid.static boolean
isTypeDescriptionSubsetOtherTypeDescription(TypeDescription typeSet, TypeDescription typeSubset)
Checks is one type description subset of the other type description.static boolean
isValidUrlSegment(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 ifcurrent
compatibility mode is less or equalsmodeToCheck
- Parameters:
current
- current compatibility mode (notnull
)modeToCheck
- mode to check (notnull
)- Returns:
- true if
current
compatibility 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
configuration
compatibility 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:
true
if 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:
true
if vaild
-
isTemplateSegmentsValid
public static boolean isTemplateSegmentsValid(String template)
Checks if URL template segments valid.- Parameters:
template
- the URL template, cannot benull
- Returns:
true
if vaild
-
isValidUrlSegment
public static boolean isValidUrlSegment(char[] rootUrl)
Checks if root URL valid.- Parameters:
rootUrl
- the root URL, cannot benull
- Returns:
true
if vaild
-
findHTTPServicesWithSameRootUrl
public static List<HTTPService> findHTTPServicesWithSameRootUrl(Configuration configuration, String rootURL)
Finds configuretion HTTP services with same root URL.- Parameters:
configuration
- the configuration, cannot benull
rootURL
- 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 benull
httpMethod
- 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 benull
namespaceURL
- 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
-
-