Class ValidationUtil


  • public final class ValidationUtil
    extends Object
    Validation util.
    • Constructor Detail

      • ValidationUtil

        public ValidationUtil()
    • 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 diagnostics
        code - error code
        message - error message
        data - 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 diagnostics
        code - error code
        message - error message
        data - error data
      • checkCompatibilityMode

        public static boolean checkCompatibilityMode​(CompatibilityMode current,
                                                     CompatibilityMode modeToCheck)
        Checks if current compatibility mode is less or equals modeToCheck
        Parameters:
        current - current compatibility mode (not null)
        modeToCheck - mode to check (not null)
        Returns:
        true if current compatibility mode is less or equals modeToCheck, false otherwise
      • checkCompatibilityMode

        public static boolean checkCompatibilityMode​(Configuration configuration,
                                                     CompatibilityMode mode)
        Checks configuration compatibility mode
        Parameters:
        configuration - the configuration metadata object (not null)
        mode - the compatibility mode to check (not null)
        Returns:
        true if configuration compatibility mode is less or equals mode, 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-objects
        seconds - 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-object
        configuration - 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 domain
        secondaryType - the secondary type domain
        secondaryTypeItems - 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 - field
        fixedFields - 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 - field
        fixedFields - 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 description
        typeSubset - - 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 be null
        Returns:
        true if vaild
      • isTemplateSegmentsValid

        public static boolean isTemplateSegmentsValid​(String template)
        Checks if URL template segments valid.
        Parameters:
        template - the URL template, cannot be null
        Returns:
        true if vaild
      • isValidUrlSegment

        public static boolean isValidUrlSegment​(char[] rootUrl)
        Checks if root URL valid.
        Parameters:
        rootUrl - the root URL, cannot be null
        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 be null
        rootURL - the root URL, cannot be null
        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 be null
        httpMethod - the HTTP method, cannot be null
        Returns:
      • findXDTOPackagesWithSameNamespace

        public static List<XDTOPackage> findXDTOPackagesWithSameNamespace​(Configuration configuration,
                                                                          String namespaceURL)
        Finds configuration XDTO packages with the same namespace.
        Parameters:
        configuration - the configuration, cannot be null
        namespaceURL - the namespace URL, cannot be null
        Returns:
        the list XDTO packages with the same namespace if founded or empty.
      • getMaxDescriptionLength

        public static int getMaxDescriptionLength​(BasicDbObject basicDbObject)
        Returns max description length for BasicDbObject.
        Parameters:
        basicDbObject - the basic db-object, cannot be null
        Returns:
        max description length for BasicDbObject