Interface MetadataEntityManager

    • Method Detail

      • getAllClassesLight

        List<ClassMetadataLight> getAllClassesLight​(boolean includeListTypes,
                                                    boolean includeIndesign)
                                             throws MetadataObjectNotFoundException
        Retrieves the simplified list of classes, This list won't include either those classes marked as dummy
        Parameters:
        includeListTypes - boolean to indicate if the list should include the subclasses of GenericObjectList
        includeIndesign - Include all the data model classes or only the classes in production
        Returns:
        The list of type classes
        Throws:
        MetadataObjectNotFoundException - If GenericListType class does not exist.
      • getSubClassesLightNoRecursive

        List<ClassMetadataLight> getSubClassesLightNoRecursive​(String className,
                                                               boolean includeAbstractClasses,
                                                               boolean includeSelf)
                                                        throws MetadataObjectNotFoundException
        Gets the direct subclasses of a given class
        Parameters:
        className - The class name
        includeAbstractClasses - If abstract classes should be included.
        includeSelf - Also return the metadata of class className
        Returns:
        The list of subclasses
        Throws:
        MetadataObjectNotFoundException - If the class could not be found.
      • getSuperClassesLight

        List<ClassMetadataLight> getSuperClassesLight​(String className,
                                                      boolean includeSelf)
                                               throws MetadataObjectNotFoundException
        Retrieves the superclasses of a given class up to InventoryObject.
        Parameters:
        className - The class to be evaluated.
        includeSelf - If the result should include the the very class that was provided in className parameter
        Returns:
        The list of super classes.
        Throws:
        MetadataObjectNotFoundException - If the class provided could not be found
      • getAllClasses

        List<ClassMetadata> getAllClasses​(boolean includeListTypes,
                                          boolean includeIndesign)
        Retrieves all the class metadata except for classes marked as dummy
        Parameters:
        includeListTypes - boolean to indicate if the list should include the subclasses of GenericObjectList
        includeIndesign - Include classes marked as "in design"
        Returns:
        An array with the metadata of the classes
      • getClasses

        List<ClassMetadata> getClasses​(String classNameTofilter,
                                       int page,
                                       int limit)
        Gets a list of classes, its attributes and Category with a given class name to filter
        Parameters:
        classNameTofilter - The class name to filter for
        page - the number of results to skip or the page
        limit - The number of results per page
        Returns:
        A list of Classes that contains the filter in the classMetada name
      • createAttribute

        void createAttribute​(String className,
                             AttributeMetadata attributeDefinition,
                             boolean recursive)
                      throws MetadataObjectNotFoundException,
                             InvalidArgumentException
        Adds an attribute to a class.
        Parameters:
        className - The class the attribute will be added to.
        attributeDefinition - An object with the definition of the attribute.
        recursive - Defines if the subclasses that has an attribute with name equal to the name of the new attribute can conserve (false) it or must be removed (true), in the case when the attribute must be removed throws an exception
        Throws:
        MetadataObjectNotFoundException - if there is no a class with such className
        InvalidArgumentException - if any of the parameters to create the attribute has a wrong value
      • hasAttribute

        boolean hasAttribute​(String className,
                             String attributeName)
                      throws MetadataObjectNotFoundException
        Checks if a class has a attribute with a given name
        Parameters:
        className - Class name
        attributeName - Attribute name
        Returns:
        True if the given class has the attribute
        Throws:
        MetadataObjectNotFoundException - If there is no a class with such className
      • setAttributeProperties

        ChangeDescriptor setAttributeProperties​(long classId,
                                                long attributeId,
                                                HashMap<String,​Object> newProperties)
                                         throws MetadataObjectNotFoundException,
                                                InvalidArgumentException,
                                                BusinessObjectNotFoundException
        Changes an attribute definition belonging to a class metadata using the class id as key
        Parameters:
        classId - Id of the class the attribute belongs to.
        attributeId -
        newProperties - A hashmap with the properties to be updated. The possible key values are: name, color, displayName, description, icon, smallIcon, countable, abstract, inDesign and custom. See user manual for a more complete explanation on what each one of them are for.
        Returns:
        The summary of the changes that were made.
        Throws:
        MetadataObjectNotFoundException - If the class could not be found.
        InvalidArgumentException - If any of the new attribute parameters has a wrong value.
        BusinessObjectNotFoundException - If an object can't be find, while it is checking if every object of the class (or subclasses) has a value in an attribute marked as mandatory
      • setAttributeProperties

        ChangeDescriptor setAttributeProperties​(String className,
                                                long attributeId,
                                                HashMap<String,​Object> newProperties)
                                         throws MetadataObjectNotFoundException,
                                                InvalidArgumentException,
                                                BusinessObjectNotFoundException
        Changes an attribute definition belonging to a class metadata use the class name as id
        Parameters:
        className - Class the attribute belongs to.
        attributeId - Id of the attribute to be updated.
        newProperties - A hashmap with the properties to be updated. The possible key values are: name, color, displayName, description, icon, smallIcon, countable, abstract, inDesign and custom. See user manual for a more complete explanation on what each one of them are for.
        Returns:
        The summary of the changes that were made.
        Throws:
        MetadataObjectNotFoundException - If the class could not be found.
        InvalidArgumentException - If any of the new attribute parameters has a wrong value.
        BusinessObjectNotFoundException - If an object can't be find, while it is checking if every object of the class (or subclasses) has a value in an attribute marked as mandatory
      • getPossibleChildren

        List<ClassMetadataLight> getPossibleChildren​(String parentClassName,
                                                     boolean ignoreAbstract)
                                              throws MetadataObjectNotFoundException
        Gets all classes whose instances can be contained into the given parent class.This method is recursive, so the result include the possible children in children classes
        Parameters:
        parentClassName - The name of the class.
        ignoreAbstract - true to ignore abstract classes.
        Returns:
        An array with the list of direct possible children classes in the containment hierarchy.
        Throws:
        MetadataObjectNotFoundException - If the class can not be found.
      • getPossibleSpecialChildren

        List<ClassMetadataLight> getPossibleSpecialChildren​(String parentClassName)
                                                     throws MetadataObjectNotFoundException
        Gets all classes whose instances can be contained into the given parent class, but using a CHILD_OF_SPECIAL relationship instead of a CHILD_OF one. This is mostly used in complex models, such as the physical layer model. This method is recursive, so the result include the possible children in children classes
        Parameters:
        parentClassName - The name of the class.
        Returns:
        An array with the list of direct possible children classes in the containment hierarchy.
        Throws:
        MetadataObjectNotFoundException - If the class can not be found.
      • getPossibleChildrenNoRecursive

        List<ClassMetadataLight> getPossibleChildrenNoRecursive​(String parentClassName)
                                                         throws MetadataObjectNotFoundException
        Same as getPossibleChildren but this one only gets the direct possible children for the given class, this is, subclasses are not included
        Parameters:
        parentClassName - The name of the class.
        Returns:
        An array with the list of possible children classes in the containment hierarchy, including the subclasses of the abstract classes.
        Throws:
        MetadataObjectNotFoundException - If the class could not be found.
      • getPossibleSpecialChildrenNoRecursive

        List<ClassMetadataLight> getPossibleSpecialChildrenNoRecursive​(String parentClassName)
                                                                throws MetadataObjectNotFoundException
        Same as getPossibleSpecialChildren but this one only gets the direct special possible children for the given class, this is, subclasses are not included
        Parameters:
        parentClassName - The name of the class.
        Returns:
        An array with the list of possible children classes in the containment hierarchy, including the subclasses of the abstract classes.
        Throws:
        MetadataObjectNotFoundException - If the class could not be found.
      • canBeChild

        boolean canBeChild​(String allegedParent,
                           String childToBeEvaluated)
                    throws MetadataObjectNotFoundException
        Finds out if an instance of a given class can be child of an instance of allegedParent. This is a sort of reverse getPossibleChildren
        Parameters:
        allegedParent - Possible parent
        childToBeEvaluated - Class to be evaluated
        Returns:
        True an instance of class childToBeEvaluated be a contained into an instance of allegedParent. False otherwise.
        Throws:
        MetadataObjectNotFoundException - If any of the classes involved doesn't exist
      • canBeSpecialChild

        boolean canBeSpecialChild​(String allegedParent,
                                  String childToBeEvaluated)
                           throws MetadataObjectNotFoundException
        Same as canBeChild, but using the special containment hierarchy
        Parameters:
        allegedParent - Possible parent
        childToBeEvaluated - Class to be evaluated
        Returns:
        True an instance of class childToBeEvaluated be a contained into an instance of allegedParent (as in the special containment hierarchy). False otherwise.
        Throws:
        MetadataObjectNotFoundException
      • addPossibleChildren

        void addPossibleChildren​(long parentClassId,
                                 long[] possibleChildren)
                          throws MetadataObjectNotFoundException,
                                 InvalidArgumentException
        Adds to a given class a list of possible children classes whose instances can be contained using the class id to find the parent class
        Parameters:
        parentClassId - Id of the class whose instances can contain the instances of the classes in possibleChildren. Use -1 to refer to the DummyRoot
        possibleChildren - ids of the candidates to be contained
        Throws:
        MetadataObjectNotFoundException - if any of the possible children or the parent doesn't exist
        InvalidArgumentException - If any of the possible children classes already are possible children or if one of the possible children is not an instance of a subclass of InventoryObject or if the parent class is abstract.
      • addPossibleSpecialChildren

        void addPossibleSpecialChildren​(long parentClassId,
                                        long[] possibleSpecialChildren)
                                 throws MetadataObjectNotFoundException,
                                        InvalidArgumentException
        Adds to a given class a list of possible special children classes whose instances can be contained using the class id to find the parent class
        Parameters:
        parentClassId - Id of the class whose instances can contain the instances of the classes in possibleChildren.
        possibleSpecialChildren - ids of the candidates to be contained
        Throws:
        MetadataObjectNotFoundException - If any of the possible children or the parent doesn't exist
        InvalidArgumentException - If any of the possible children classes already are possible special children or if one of the possible children is not an instance of a subclass of InventoryObject or if the parent class is abstract or if it's attempted to use the navigation tree root as parent class (addPossibleChildren(java.lang.String, java.lang.String[]) supports -1 as parent class id)
      • addPossibleChildren

        void addPossibleChildren​(String parentClassName,
                                 String[] possibleChildren)
                          throws MetadataObjectNotFoundException,
                                 InvalidArgumentException
        Adds to a given class a list of possible children classes whose instances can be contained using the class name to find the parent class
        Parameters:
        parentClassName - parent class name. Use DummyRoot for the Navigation Tree root
        possibleChildren - list of possible children
        Throws:
        MetadataObjectNotFoundException - if the parent class or any of the possible children can not be found
        InvalidArgumentException - if any of the given possible children can not be a possible children of parentClassName or if one of the possible children is not an instance of a subclass of InventoryObject or if the parent class is abstract.
      • addPossibleSpecialChildren

        void addPossibleSpecialChildren​(String parentClassName,
                                        String[] possibleSpecialChildren)
                                 throws MetadataObjectNotFoundException,
                                        InvalidArgumentException
        Adds to a given class a list of possible special children classes whose instances can be contained, using the class name to find the parent class
        Parameters:
        parentClassName - parent class name.
        possibleSpecialChildren - list of possible children
        Throws:
        MetadataObjectNotFoundException - if the parent class or any of the possible children can not be found
        InvalidArgumentException - if any of the given possible children can not be a possible children of parentClassName or if one of the possible children is not an instance of a subclass of InventoryObject or if the parent class is abstract.
      • removePossibleChildren

        void removePossibleChildren​(long parentClassId,
                                    long[] childrenToBeRemoved)
                             throws MetadataObjectNotFoundException
        The opposite of addPossibleChildren. It removes the given possible children TODO: Make this method safe. This is, check if there's already intances of the given "children to be deleted" with parentClass as their parent
        Parameters:
        parentClassId - Id of the class whos instances can contain the instances of the next param
        childrenToBeRemoved - ids of the candidates to be deleted
        Throws:
        MetadataObjectNotFoundException - If any of the ids provided can't be found
      • removePossibleSpecialChildren

        void removePossibleSpecialChildren​(long parentClassId,
                                           long[] childrenToBeRemoved)
                                    throws MetadataObjectNotFoundException
        The opposite of addPossibleSpecialChildren. It removes the given possible special children
        Parameters:
        parentClassId - Id of the class whos instances can contain the instances of the next param
        childrenToBeRemoved - ids of the candidates to be deleted
        Throws:
        MetadataObjectNotFoundException - If any of the ids provided can't be found
      • setSpecialRelationshipDisplayName

        void setSpecialRelationshipDisplayName​(String relationshipName,
                                               String relationshipDisplayName)
        Sets the display name of a special relationship used in a model
        Parameters:
        relationshipName - The name of the relationship the display name is going to be set
        relationshipDisplayName - The display name
      • getSpecialRelationshipDisplayName

        String getSpecialRelationshipDisplayName​(String relationshipName)
        Returns the display name of a special relationship. The display name is useful to improve the way the relationship is displayed on trees and other modules
        Parameters:
        relationshipName - The name of the relationship
        Returns:
        The display name for the relationship name provided. If it can not be found, the relationship name is returned instead
      • isSubclassOf

        boolean isSubclassOf​(String allegedParent,
                             String classToBeEvaluated)
                      throws MetadataObjectNotFoundException
        Assess if a given class is subclass of another
        Parameters:
        allegedParent - Alleged super class
        classToBeEvaluated - class to be evaluated
        Returns:
        True if classToBeEvaluated is subclass of allegedParent. False otherwise. This method also returns true if allegedParent == classToBeEvaluated
        Throws:
        MetadataObjectNotFoundException - If any of the classes provided doesn't exist
      • getUpstreamContainmentHierarchy

        List<ClassMetadataLight> getUpstreamContainmentHierarchy​(String className,
                                                                 boolean recursive)
                                                          throws MetadataObjectNotFoundException
        Get the upstream containment hierarchy for a given class, unlike getPossibleChildren (which will give you the downstream hierarchy).
        Parameters:
        className - Class name
        recursive - Get only the direct possible parents, or go up into the containment hierarchy. Beware: don't mistake the class hierarchy for the containment one
        Returns:
        An sorted list with the upstream containment hierarchy. Repeated elements are omitted
        Throws:
        MetadataObjectNotFoundException - if className does not correspond to any existing class
      • getUpstreamSpecialContainmentHierarchy

        List<ClassMetadataLight> getUpstreamSpecialContainmentHierarchy​(String className,
                                                                        boolean recursive)
                                                                 throws MetadataObjectNotFoundException
        Gets the upstream special containment hierarchy for a given class, unlike getPossibleChildren (which will give you the downstream hierarchy).
        Parameters:
        className - Class name
        recursive - Get only the direct possible parents, or go up into the containment hierarchy. Beware: don't mistake the class hierarchy for the containment one
        Returns:
        An sorted list with the special upstream containment hierarchy. Repeated elements are omitted
        Throws:
        MetadataObjectNotFoundException - if className does not correspond to any existing class
      • getUpstreamClassHierarchy

        List<ClassMetadataLight> getUpstreamClassHierarchy​(String className,
                                                           boolean includeSelf)
                                                    throws MetadataObjectNotFoundException
        Gets the parent classes of a given class up to InventoryObject. Please note that RootObject is being deliberately omitted.
        Parameters:
        className - The class to get the superclasses from
        includeSelf - If the result should also include the class in className
        Returns:
        The list of super classes until the root of the hierarchy
        Throws:
        MetadataObjectNotFoundException - If the class provided could not be found