Class MetadataEntityManagerImpl
- java.lang.Object
-
- org.neotropic.kuwaiba.core.persistence.reference.neo4j.MetadataEntityManagerImpl
-
- All Implemented Interfaces:
AbstractEntityManager,MetadataEntityManager
@Service public class MetadataEntityManagerImpl extends Object implements MetadataEntityManager
MetadataEntityManager implementation for Neo4j.- Author:
- Adrian Martinez Molina <adrian.martinez@kuwaiba.org>
-
-
Constructor Summary
Constructors Constructor Description MetadataEntityManagerImpl()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaddPossibleChildren(long parentClassId, long[] possibleChildren)Adds to a given class a list of possible children classes whose instances can be contained using the class id to find the parent classvoidaddPossibleChildren(String parentClassName, String[] possibleChildren)Adds to a given class a list of possible children classes whose instances can be contained using the class name to find the parent classvoidaddPossibleSpecialChildren(long parentClassId, long[] possibleSpecialChildren)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 classvoidaddPossibleSpecialChildren(String parentClassName, String[] possibleSpecialChildren)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 classvoidbuildClassCache()Clears the class cache and re-built it.booleancanBeChild(String allegedParent, String childToBeEvaluated)Finds out if an instance of a given class can be child of an instance of allegedParent.booleancanBeSpecialChild(String allegedParent, String childToBeEvaluated)Same ascanBeChild, but using the special containment hierarchyvoidcreateAttribute(long classId, AttributeMetadata attributeDefinition)Adds an attribute to a classvoidcreateAttribute(String className, AttributeMetadata attributeDefinition, boolean recursive)Adds an attribute to a class.longcreateClass(ClassMetadata classDefinition)Creates a class metadata with its attributes (some new and others inherited from the parent class).voiddeleteAttribute(long classId, String attributeName)Deletes an attribute from a class.voiddeleteAttribute(String className, String attributeName)Deletes an attribute from a class.voiddeleteClass(long classId)Deletes a class metadata, its attributes and category relationshipsvoiddeleteClass(String className)Deletes a class metadata, its attributes and category relationshipsList<ClassMetadata>getAllClasses(boolean includeListTypes, boolean includeIndesign)Retrieves all the class metadata except for classes marked as dummyList<ClassMetadataLight>getAllClassesLight(boolean includeListTypes, boolean includeIndesign)Retrieves the simplified list of classes, This list won't include either those classes marked as dummyAttributeMetadatagetAttribute(long classId, long attributeId)Gets an attribute belonging to a classAttributeMetadatagetAttribute(String className, String attributeName)Gets an attribute belonging to a classClassMetadatagetClass(long classId)Gets a class metadata, its attributes and CategoryClassMetadatagetClass(String className)Gets a class metadata, its attributes and CategoryList<ClassMetadata>getClasses(String classNameTofilter, int page, int limit)Gets a list of classes, its attributes and Category with a given class name to filterList<AttributeMetadata>getMandatoryAttributesInClass(String className)Retrieves the list of the attributes marked as mandatoryList<ClassMetadataLight>getPossibleChildren(String parentClassName, boolean ignoreAbstract)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 classesList<ClassMetadataLight>getPossibleChildrenNoRecursive(String parentClassName)Same as getPossibleChildren but this one only gets the direct possible children for the given class, this is, subclasses are not includedList<ClassMetadataLight>getPossibleSpecialChildren(String parentClassName)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.List<ClassMetadataLight>getPossibleSpecialChildrenNoRecursive(String parentClassName)Same as getPossibleSpecialChildren but this one only gets the direct special possible children for the given class, this is, subclasses are not includedStringgetSpecialRelationshipDisplayName(String relationshipName)Returns the display name of a special relationship.longgetSubClassesCount(String className)Get the subclasses count given a parent class name.List<ClassMetadataLight>getSubClassesLight(String className, boolean includeAbstractClasses, boolean includeSelf)Gets the subclasses of a given class recursively.List<ClassMetadataLight>getSubClassesLightNoRecursive(String className, boolean includeAbstractClasses, boolean includeSelf)Gets the direct subclasses of a given classList<ClassMetadataLight>getSuperClassesLight(String className, boolean includeSelf)Retrieves the superclasses of a given class up to InventoryObject.List<ClassMetadataLight>getUpstreamClassHierarchy(String className, boolean includeSelf)Gets the parent classes of a given class up toInventoryObject.List<ClassMetadataLight>getUpstreamContainmentHierarchy(String className, boolean recursive)Get the upstream containment hierarchy for a given class, unlike getPossibleChildren (which will give you the downstream hierarchy).List<ClassMetadataLight>getUpstreamSpecialContainmentHierarchy(String className, boolean recursive)Gets the upstream special containment hierarchy for a given class, unlike getPossibleChildren (which will give you the downstream hierarchy).booleanhasAttribute(String className, String attributeName)Checks if a class has a attribute with a given namevoidinitCache()This optional method clears and builds the cache components needed in the current entity manager.booleanisSubclassOf(String allegedParent, String classToBeEvaluated)Assess if a given class is subclass of anothervoidremovePossibleChildren(long parentClassId, long[] childrenToBeRemoved)The opposite of addPossibleChildren.voidremovePossibleSpecialChildren(long parentClassId, long[] specialChildrenToBeRemoved)The opposite of addPossibleSpecialChildren.ChangeDescriptorsetAttributeProperties(long classId, long attributeId, HashMap<String,Object> newProperties)Changes an attribute definition belonging to a class metadata using the class id as keyChangeDescriptorsetAttributeProperties(String className, long attributeId, HashMap<String,Object> newProperties)Changes an attribute definition belonging to a class metadata use the class name as idChangeDescriptorsetAttributeProperties(org.neo4j.graphdb.Node classNode, long attributeId, HashMap<String,Object> newProperties)ChangeDescriptorsetClassProperties(long classId, HashMap<String,Object> newProperties)Changes a class metadata definition.voidsetConfiguration(Properties configuration)Configuration variables (usually, yet not necessarily read from a config file) that will be used to process some calls (for example file paths or constants).voidsetSpecialRelationshipDisplayName(String relationshipName, String relationshipDisplayName)Sets the display name of a special relationship used in a model
-
-
-
Method Detail
-
initCache
public void initCache()
Description copied from interface:AbstractEntityManagerThis optional method clears and builds the cache components needed in the current entity manager.- Specified by:
initCachein interfaceAbstractEntityManager
-
setConfiguration
public void setConfiguration(Properties configuration)
Description copied from interface:AbstractEntityManagerConfiguration variables (usually, yet not necessarily read from a config file) that will be used to process some calls (for example file paths or constants).- Specified by:
setConfigurationin interfaceAbstractEntityManager- Parameters:
configuration- The set of properties. Each EM should document its variables and what are their default values.
-
createClass
public long createClass(ClassMetadata classDefinition) throws MetadataObjectNotFoundException, DatabaseException, InvalidArgumentException
Description copied from interface:MetadataEntityManagerCreates a class metadata with its attributes (some new and others inherited from the parent class).- Specified by:
createClassin interfaceMetadataEntityManager- Parameters:
classDefinition- the class definition, name, display name, etc- Returns:
- the Id of the newClassMetadata
- Throws:
MetadataObjectNotFoundException- if the specified parent class doesn't existDatabaseException- if the reference node doesn't existInvalidArgumentException- if any of the fields of the class definition has an invalid value
-
setClassProperties
public ChangeDescriptor setClassProperties(long classId, HashMap<String,Object> newProperties) throws MetadataObjectNotFoundException, InvalidArgumentException, BusinessObjectNotFoundException
Description copied from interface:MetadataEntityManagerChanges a class metadata definition.- Specified by:
setClassPropertiesin interfaceMetadataEntityManager- Parameters:
classId- The id of the class. A class metadata definition can not be updated using the name as the key, because the name itself could change.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 no be found.InvalidArgumentException- If any of the property names provided is unknown or if the name has invalid characters, the new name is empty or if that name already exists.BusinessObjectNotFoundException- If there is any problem retrieving an object while checking if every created object of the class with an attributes marked as mandatory has value.
-
deleteClass
public void deleteClass(long classId) throws MetadataObjectNotFoundException, InvalidArgumentExceptionDescription copied from interface:MetadataEntityManagerDeletes a class metadata, its attributes and category relationships- Specified by:
deleteClassin interfaceMetadataEntityManager- Parameters:
classId- the class id- Throws:
MetadataObjectNotFoundException- if there is not a class with de ClassNameInvalidArgumentException- If the class is a core class, has instances, has incoming relationships or is a list type that is used by another class.
-
deleteClass
public void deleteClass(String className) throws MetadataObjectNotFoundException, InvalidArgumentException
Description copied from interface:MetadataEntityManagerDeletes a class metadata, its attributes and category relationships- Specified by:
deleteClassin interfaceMetadataEntityManager- Parameters:
className- the class name- Throws:
MetadataObjectNotFoundException- if there is not a class with de ClassNameInvalidArgumentException- If the class is a core class, has instances, has incoming relationships or is a list type that is used by another class.
-
getAllClassesLight
public List<ClassMetadataLight> getAllClassesLight(boolean includeListTypes, boolean includeIndesign) throws MetadataObjectNotFoundException
Description copied from interface:MetadataEntityManagerRetrieves the simplified list of classes, This list won't include either those classes marked as dummy- Specified by:
getAllClassesLightin interfaceMetadataEntityManager- Parameters:
includeListTypes- boolean to indicate if the list should include the subclasses of GenericObjectListincludeIndesign- 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.
-
getSubClassesLight
public List<ClassMetadataLight> getSubClassesLight(String className, boolean includeAbstractClasses, boolean includeSelf) throws MetadataObjectNotFoundException
Description copied from interface:MetadataEntityManagerGets the subclasses of a given class recursively.- Specified by:
getSubClassesLightin interfaceMetadataEntityManager- Parameters:
className- Class nameincludeAbstractClasses- Should the list include the abstract subclassesincludeSelf- Should the list include the subclasses and the parent class?- Returns:
- The list of subclasses
- Throws:
MetadataObjectNotFoundException- If the class can not be found
-
getSubClassesLightNoRecursive
public List<ClassMetadataLight> getSubClassesLightNoRecursive(String className, boolean includeAbstractClasses, boolean includeSelf) throws MetadataObjectNotFoundException
Description copied from interface:MetadataEntityManagerGets the direct subclasses of a given class- Specified by:
getSubClassesLightNoRecursivein interfaceMetadataEntityManager- Parameters:
className- The class nameincludeAbstractClasses- If abstract classes should be included.includeSelf- Also return the metadata of classclassName- Returns:
- The list of subclasses
- Throws:
MetadataObjectNotFoundException- If the class could not be found.
-
getSuperClassesLight
public List<ClassMetadataLight> getSuperClassesLight(String className, boolean includeSelf) throws MetadataObjectNotFoundException
Description copied from interface:MetadataEntityManagerRetrieves the superclasses of a given class up to InventoryObject.- Specified by:
getSuperClassesLightin interfaceMetadataEntityManager- Parameters:
className- The class to be evaluated.includeSelf- If the result should include the the very class that was provided inclassNameparameter- Returns:
- The list of super classes.
- Throws:
MetadataObjectNotFoundException- If the class provided could not be found
-
getSubClassesCount
public long getSubClassesCount(String className) throws MetadataObjectNotFoundException
Description copied from interface:MetadataEntityManagerGet the subclasses count given a parent class name.- Specified by:
getSubClassesCountin interfaceMetadataEntityManager- Parameters:
className- parent class Name.- Returns:
- Number of direct subclasses.
- Throws:
MetadataObjectNotFoundException- If the class provided could not be found.
-
getAllClasses
public List<ClassMetadata> getAllClasses(boolean includeListTypes, boolean includeIndesign)
Description copied from interface:MetadataEntityManagerRetrieves all the class metadata except for classes marked as dummy- Specified by:
getAllClassesin interfaceMetadataEntityManager- Parameters:
includeListTypes- boolean to indicate if the list should include the subclasses of GenericObjectListincludeIndesign- Include classes marked as "in design"- Returns:
- An array with the metadata of the classes
-
getClass
public ClassMetadata getClass(long classId) throws MetadataObjectNotFoundException
Description copied from interface:MetadataEntityManagerGets a class metadata, its attributes and Category- Specified by:
getClassin interfaceMetadataEntityManager- Parameters:
classId- The class id- Returns:
- A ClassMetadata with the classId
- Throws:
MetadataObjectNotFoundException- If there is no class with such classId
-
getClasses
public List<ClassMetadata> getClasses(String classNameTofilter, int page, int limit)
Description copied from interface:MetadataEntityManagerGets a list of classes, its attributes and Category with a given class name to filter- Specified by:
getClassesin interfaceMetadataEntityManager- Parameters:
classNameTofilter- The class name to filter forpage- the number of results to skip or the pagelimit- The number of results per page- Returns:
- A list of Classes that contains the filter in the classMetada name
-
getClass
public ClassMetadata getClass(String className) throws MetadataObjectNotFoundException
Description copied from interface:MetadataEntityManagerGets a class metadata, its attributes and Category- Specified by:
getClassin interfaceMetadataEntityManager- Parameters:
className- The class name- Returns:
- A ClassMetadata with the className
- Throws:
MetadataObjectNotFoundException- If there is no class with such className
-
createAttribute
public void createAttribute(String className, AttributeMetadata attributeDefinition, boolean recursive) throws MetadataObjectNotFoundException, InvalidArgumentException
Description copied from interface:MetadataEntityManagerAdds an attribute to a class.- Specified by:
createAttributein interfaceMetadataEntityManager- 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 classNameInvalidArgumentException- if any of the parameters to create the attribute has a wrong value
-
createAttribute
public void createAttribute(long classId, AttributeMetadata attributeDefinition) throws MetadataObjectNotFoundException, InvalidArgumentExceptionDescription copied from interface:MetadataEntityManagerAdds an attribute to a class- Specified by:
createAttributein interfaceMetadataEntityManager- Parameters:
classId- The id of the class the attribute will be added to.attributeDefinition- An object with the definition of the attribute.- Throws:
MetadataObjectNotFoundException- if there is no a class with such classIdInvalidArgumentException- if any of the parameters to create the attribute has a wrong value
-
hasAttribute
public boolean hasAttribute(String className, String attributeName) throws MetadataObjectNotFoundException
Description copied from interface:MetadataEntityManagerChecks if a class has a attribute with a given name- Specified by:
hasAttributein interfaceMetadataEntityManager- Parameters:
className- Class nameattributeName- Attribute name- Returns:
- True if the given class has the attribute
- Throws:
MetadataObjectNotFoundException- If there is no a class with such className
-
getAttribute
public AttributeMetadata getAttribute(String className, String attributeName) throws MetadataObjectNotFoundException, InvalidArgumentException
Description copied from interface:MetadataEntityManagerGets an attribute belonging to a class- Specified by:
getAttributein interfaceMetadataEntityManager- Parameters:
className- Class name.attributeName- Attribute name.- Returns:
- AttributeMetata of the requested attribute.
- Throws:
MetadataObjectNotFoundException- if there is no a class with such classNameInvalidArgumentException- if the attributeName does not exist
-
getAttribute
public AttributeMetadata getAttribute(long classId, long attributeId) throws MetadataObjectNotFoundException, InvalidArgumentException
Description copied from interface:MetadataEntityManagerGets an attribute belonging to a class- Specified by:
getAttributein interfaceMetadataEntityManager- Parameters:
classId- Class id.attributeId- Attribute id.- Returns:
- AttributeMetata of the requested attribute.
- Throws:
MetadataObjectNotFoundException- if there is no a class with such classIdInvalidArgumentException- if the attributeName does not exist
-
setAttributeProperties
public ChangeDescriptor setAttributeProperties(long classId, long attributeId, HashMap<String,Object> newProperties) throws MetadataObjectNotFoundException, InvalidArgumentException, BusinessObjectNotFoundException
Description copied from interface:MetadataEntityManagerChanges an attribute definition belonging to a class metadata using the class id as key- Specified by:
setAttributePropertiesin interfaceMetadataEntityManager- Parameters:
classId- Id of the class the attribute belongs to.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
public ChangeDescriptor setAttributeProperties(String className, long attributeId, HashMap<String,Object> newProperties) throws MetadataObjectNotFoundException, InvalidArgumentException, BusinessObjectNotFoundException
Description copied from interface:MetadataEntityManagerChanges an attribute definition belonging to a class metadata use the class name as id- Specified by:
setAttributePropertiesin interfaceMetadataEntityManager- 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
-
deleteAttribute
public void deleteAttribute(String className, String attributeName) throws MetadataObjectNotFoundException, InvalidArgumentException
Description copied from interface:MetadataEntityManagerDeletes an attribute from a class.- Specified by:
deleteAttributein interfaceMetadataEntityManager- Parameters:
className- Class name.attributeName- Attribute name.- Throws:
MetadataObjectNotFoundException- If the class could not be found.InvalidArgumentException- If the attributes name or creationDate are to be deleted.
-
deleteAttribute
public void deleteAttribute(long classId, String attributeName) throws MetadataObjectNotFoundException, InvalidArgumentExceptionDescription copied from interface:MetadataEntityManagerDeletes an attribute from a class.- Specified by:
deleteAttributein interfaceMetadataEntityManager- Parameters:
classId- Class id.attributeName- Attribute name.- Throws:
MetadataObjectNotFoundException- If the class could not be found.InvalidArgumentException- If the attributes name or creationDate are to be deleted.
-
getPossibleChildren
public List<ClassMetadataLight> getPossibleChildren(String parentClassName, boolean ignoreAbstract) throws MetadataObjectNotFoundException
Description copied from interface:MetadataEntityManagerGets 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- Specified by:
getPossibleChildrenin interfaceMetadataEntityManager- 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
public List<ClassMetadataLight> getPossibleSpecialChildren(String parentClassName) throws MetadataObjectNotFoundException
Description copied from interface:MetadataEntityManagerGets 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- Specified by:
getPossibleSpecialChildrenin interfaceMetadataEntityManager- 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
public List<ClassMetadataLight> getPossibleChildrenNoRecursive(String parentClassName) throws MetadataObjectNotFoundException
Description copied from interface:MetadataEntityManagerSame as getPossibleChildren but this one only gets the direct possible children for the given class, this is, subclasses are not included- Specified by:
getPossibleChildrenNoRecursivein interfaceMetadataEntityManager- 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
public List<ClassMetadataLight> getPossibleSpecialChildrenNoRecursive(String parentClassName) throws MetadataObjectNotFoundException
Description copied from interface:MetadataEntityManagerSame as getPossibleSpecialChildren but this one only gets the direct special possible children for the given class, this is, subclasses are not included- Specified by:
getPossibleSpecialChildrenNoRecursivein interfaceMetadataEntityManager- 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
public boolean canBeChild(String allegedParent, String childToBeEvaluated) throws MetadataObjectNotFoundException
Description copied from interface:MetadataEntityManagerFinds out if an instance of a given class can be child of an instance of allegedParent. This is a sort of reverse getPossibleChildren- Specified by:
canBeChildin interfaceMetadataEntityManager- Parameters:
allegedParent- Possible parentchildToBeEvaluated- 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
public boolean canBeSpecialChild(String allegedParent, String childToBeEvaluated) throws MetadataObjectNotFoundException
Description copied from interface:MetadataEntityManagerSame ascanBeChild, but using the special containment hierarchy- Specified by:
canBeSpecialChildin interfaceMetadataEntityManager- Parameters:
allegedParent- Possible parentchildToBeEvaluated- 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
public void addPossibleChildren(long parentClassId, long[] possibleChildren) throws MetadataObjectNotFoundException, InvalidArgumentExceptionDescription copied from interface:MetadataEntityManagerAdds to a given class a list of possible children classes whose instances can be contained using the class id to find the parent class- Specified by:
addPossibleChildrenin interfaceMetadataEntityManager- Parameters:
parentClassId- Id of the class whose instances can contain the instances of the classes in possibleChildren. Use -1 to refer to the DummyRootpossibleChildren- ids of the candidates to be contained- Throws:
MetadataObjectNotFoundException- if any of the possible children or the parent doesn't existInvalidArgumentException- 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
public void addPossibleSpecialChildren(long parentClassId, long[] possibleSpecialChildren) throws MetadataObjectNotFoundException, InvalidArgumentExceptionDescription copied from interface:MetadataEntityManagerAdds 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- Specified by:
addPossibleSpecialChildrenin interfaceMetadataEntityManager- 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 existInvalidArgumentException- 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 (MetadataEntityManager.addPossibleChildren(java.lang.String, java.lang.String[])supports -1 as parent class id)
-
addPossibleChildren
public void addPossibleChildren(String parentClassName, String[] possibleChildren) throws MetadataObjectNotFoundException, InvalidArgumentException
Description copied from interface:MetadataEntityManagerAdds to a given class a list of possible children classes whose instances can be contained using the class name to find the parent class- Specified by:
addPossibleChildrenin interfaceMetadataEntityManager- Parameters:
parentClassName- parent class name. Use DummyRoot for the Navigation Tree rootpossibleChildren- list of possible children- Throws:
MetadataObjectNotFoundException- if the parent class or any of the possible children can not be foundInvalidArgumentException- 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
public void addPossibleSpecialChildren(String parentClassName, String[] possibleSpecialChildren) throws MetadataObjectNotFoundException, InvalidArgumentException
Description copied from interface:MetadataEntityManagerAdds 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- Specified by:
addPossibleSpecialChildrenin interfaceMetadataEntityManager- 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 foundInvalidArgumentException- 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
public void removePossibleChildren(long parentClassId, long[] childrenToBeRemoved) throws MetadataObjectNotFoundExceptionDescription copied from interface:MetadataEntityManagerThe 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- Specified by:
removePossibleChildrenin interfaceMetadataEntityManager- Parameters:
parentClassId- Id of the class whos instances can contain the instances of the next paramchildrenToBeRemoved- ids of the candidates to be deleted- Throws:
MetadataObjectNotFoundException- If any of the ids provided can't be found
-
removePossibleSpecialChildren
public void removePossibleSpecialChildren(long parentClassId, long[] specialChildrenToBeRemoved) throws MetadataObjectNotFoundExceptionDescription copied from interface:MetadataEntityManagerThe opposite of addPossibleSpecialChildren. It removes the given possible special children- Specified by:
removePossibleSpecialChildrenin interfaceMetadataEntityManager- Parameters:
parentClassId- Id of the class whos instances can contain the instances of the next paramspecialChildrenToBeRemoved- ids of the candidates to be deleted- Throws:
MetadataObjectNotFoundException- If any of the ids provided can't be found
-
getUpstreamContainmentHierarchy
public List<ClassMetadataLight> getUpstreamContainmentHierarchy(String className, boolean recursive) throws MetadataObjectNotFoundException
Description copied from interface:MetadataEntityManagerGet the upstream containment hierarchy for a given class, unlike getPossibleChildren (which will give you the downstream hierarchy).- Specified by:
getUpstreamContainmentHierarchyin interfaceMetadataEntityManager- Parameters:
className- Class namerecursive- 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
public List<ClassMetadataLight> getUpstreamSpecialContainmentHierarchy(String className, boolean recursive) throws MetadataObjectNotFoundException
Description copied from interface:MetadataEntityManagerGets the upstream special containment hierarchy for a given class, unlike getPossibleChildren (which will give you the downstream hierarchy).- Specified by:
getUpstreamSpecialContainmentHierarchyin interfaceMetadataEntityManager- Parameters:
className- Class namerecursive- 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
public List<ClassMetadataLight> getUpstreamClassHierarchy(String className, boolean includeSelf) throws MetadataObjectNotFoundException
Description copied from interface:MetadataEntityManagerGets the parent classes of a given class up toInventoryObject. Please note thatRootObjectis being deliberately omitted.- Specified by:
getUpstreamClassHierarchyin interfaceMetadataEntityManager- Parameters:
className- The class to get the superclasses fromincludeSelf- 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
-
setSpecialRelationshipDisplayName
public void setSpecialRelationshipDisplayName(String relationshipName, String relationshipDisplayName)
Description copied from interface:MetadataEntityManagerSets the display name of a special relationship used in a model- Specified by:
setSpecialRelationshipDisplayNamein interfaceMetadataEntityManager- Parameters:
relationshipName- The name of the relationship the display name is going to be setrelationshipDisplayName- The display name
-
getSpecialRelationshipDisplayName
public String getSpecialRelationshipDisplayName(String relationshipName)
Description copied from interface:MetadataEntityManagerReturns 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- Specified by:
getSpecialRelationshipDisplayNamein interfaceMetadataEntityManager- 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
public boolean isSubclassOf(String allegedParent, String classToBeEvaluated) throws MetadataObjectNotFoundException
Description copied from interface:MetadataEntityManagerAssess if a given class is subclass of another- Specified by:
isSubclassOfin interfaceMetadataEntityManager- Parameters:
allegedParent- Alleged super classclassToBeEvaluated- 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
-
getMandatoryAttributesInClass
public List<AttributeMetadata> getMandatoryAttributesInClass(String className) throws MetadataObjectNotFoundException
Description copied from interface:MetadataEntityManagerRetrieves the list of the attributes marked as mandatory- Specified by:
getMandatoryAttributesInClassin interfaceMetadataEntityManager- Parameters:
className- the class name- Returns:
- a list of AttributeMetadata
- Throws:
MetadataObjectNotFoundException- if the class doesn't exist
-
setAttributeProperties
public ChangeDescriptor setAttributeProperties(org.neo4j.graphdb.Node classNode, long attributeId, HashMap<String,Object> newProperties) throws InvalidArgumentException, MetadataObjectNotFoundException
- Parameters:
classNode-attributeId-newProperties-- Returns:
- Throws:
InvalidArgumentExceptionMetadataObjectNotFoundException
-
buildClassCache
public void buildClassCache() throws InvalidArgumentExceptionDescription copied from interface:MetadataEntityManagerClears the class cache and re-built it.- Specified by:
buildClassCachein interfaceMetadataEntityManager- Throws:
InvalidArgumentException- If the unique attributes cache cannot be load.
-
-