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 void
addPossibleChildren(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 classvoid
addPossibleChildren(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 classvoid
addPossibleSpecialChildren(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 classvoid
addPossibleSpecialChildren(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 classvoid
buildClassCache()
Clears the class cache and re-built it.boolean
canBeChild(String allegedParent, String childToBeEvaluated)
Finds out if an instance of a given class can be child of an instance of allegedParent.boolean
canBeSpecialChild(String allegedParent, String childToBeEvaluated)
Same ascanBeChild
, but using the special containment hierarchyvoid
createAttribute(long classId, AttributeMetadata attributeDefinition)
Adds an attribute to a classvoid
createAttribute(String className, AttributeMetadata attributeDefinition, boolean recursive)
Adds an attribute to a class.long
createClass(ClassMetadata classDefinition)
Creates a class metadata with its attributes (some new and others inherited from the parent class).void
deleteAttribute(long classId, String attributeName)
Deletes an attribute from a class.void
deleteAttribute(String className, String attributeName)
Deletes an attribute from a class.void
deleteClass(long classId)
Deletes a class metadata, its attributes and category relationshipsvoid
deleteClass(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 dummyAttributeMetadata
getAttribute(long classId, long attributeId)
Gets an attribute belonging to a classAttributeMetadata
getAttribute(String className, String attributeName)
Gets an attribute belonging to a classClassMetadata
getClass(long classId)
Gets a class metadata, its attributes and CategoryClassMetadata
getClass(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 includedString
getSpecialRelationshipDisplayName(String relationshipName)
Returns the display name of a special relationship.long
getSubClassesCount(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).boolean
hasAttribute(String className, String attributeName)
Checks if a class has a attribute with a given namevoid
initCache()
This optional method clears and builds the cache components needed in the current entity manager.boolean
isSubclassOf(String allegedParent, String classToBeEvaluated)
Assess if a given class is subclass of anothervoid
removePossibleChildren(long parentClassId, long[] childrenToBeRemoved)
The opposite of addPossibleChildren.void
removePossibleSpecialChildren(long parentClassId, long[] specialChildrenToBeRemoved)
The opposite of addPossibleSpecialChildren.ChangeDescriptor
setAttributeProperties(long classId, long attributeId, HashMap<String,Object> newProperties)
Changes an attribute definition belonging to a class metadata using the class id as keyChangeDescriptor
setAttributeProperties(String className, long attributeId, HashMap<String,Object> newProperties)
Changes an attribute definition belonging to a class metadata use the class name as idChangeDescriptor
setAttributeProperties(org.neo4j.graphdb.Node classNode, long attributeId, HashMap<String,Object> newProperties)
ChangeDescriptor
setClassProperties(long classId, HashMap<String,Object> newProperties)
Changes a class metadata definition.void
setConfiguration(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).void
setSpecialRelationshipDisplayName(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:AbstractEntityManager
This optional method clears and builds the cache components needed in the current entity manager.- Specified by:
initCache
in interfaceAbstractEntityManager
-
setConfiguration
public void setConfiguration(Properties configuration)
Description copied from interface:AbstractEntityManager
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).- Specified by:
setConfiguration
in 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:MetadataEntityManager
Creates a class metadata with its attributes (some new and others inherited from the parent class).- Specified by:
createClass
in 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:MetadataEntityManager
Changes a class metadata definition.- Specified by:
setClassProperties
in 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, InvalidArgumentException
Description copied from interface:MetadataEntityManager
Deletes a class metadata, its attributes and category relationships- Specified by:
deleteClass
in 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:MetadataEntityManager
Deletes a class metadata, its attributes and category relationships- Specified by:
deleteClass
in 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:MetadataEntityManager
Retrieves the simplified list of classes, This list won't include either those classes marked as dummy- Specified by:
getAllClassesLight
in 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:MetadataEntityManager
Gets the subclasses of a given class recursively.- Specified by:
getSubClassesLight
in 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:MetadataEntityManager
Gets the direct subclasses of a given class- Specified by:
getSubClassesLightNoRecursive
in 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:MetadataEntityManager
Retrieves the superclasses of a given class up to InventoryObject.- Specified by:
getSuperClassesLight
in interfaceMetadataEntityManager
- Parameters:
className
- The class to be evaluated.includeSelf
- If the result should include the the very class that was provided inclassName
parameter- 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:MetadataEntityManager
Get the subclasses count given a parent class name.- Specified by:
getSubClassesCount
in 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:MetadataEntityManager
Retrieves all the class metadata except for classes marked as dummy- Specified by:
getAllClasses
in 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:MetadataEntityManager
Gets a class metadata, its attributes and Category- Specified by:
getClass
in 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:MetadataEntityManager
Gets a list of classes, its attributes and Category with a given class name to filter- Specified by:
getClasses
in 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:MetadataEntityManager
Gets a class metadata, its attributes and Category- Specified by:
getClass
in 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:MetadataEntityManager
Adds an attribute to a class.- Specified by:
createAttribute
in 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, InvalidArgumentException
Description copied from interface:MetadataEntityManager
Adds an attribute to a class- Specified by:
createAttribute
in 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:MetadataEntityManager
Checks if a class has a attribute with a given name- Specified by:
hasAttribute
in 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:MetadataEntityManager
Gets an attribute belonging to a class- Specified by:
getAttribute
in 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:MetadataEntityManager
Gets an attribute belonging to a class- Specified by:
getAttribute
in 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:MetadataEntityManager
Changes an attribute definition belonging to a class metadata using the class id as key- Specified by:
setAttributeProperties
in 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:MetadataEntityManager
Changes an attribute definition belonging to a class metadata use the class name as id- Specified by:
setAttributeProperties
in 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:MetadataEntityManager
Deletes an attribute from a class.- Specified by:
deleteAttribute
in 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, InvalidArgumentException
Description copied from interface:MetadataEntityManager
Deletes an attribute from a class.- Specified by:
deleteAttribute
in 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:MetadataEntityManager
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- Specified by:
getPossibleChildren
in 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:MetadataEntityManager
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- Specified by:
getPossibleSpecialChildren
in 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:MetadataEntityManager
Same as getPossibleChildren but this one only gets the direct possible children for the given class, this is, subclasses are not included- Specified by:
getPossibleChildrenNoRecursive
in 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:MetadataEntityManager
Same as getPossibleSpecialChildren but this one only gets the direct special possible children for the given class, this is, subclasses are not included- Specified by:
getPossibleSpecialChildrenNoRecursive
in 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:MetadataEntityManager
Finds 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:
canBeChild
in 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:MetadataEntityManager
Same ascanBeChild
, but using the special containment hierarchy- Specified by:
canBeSpecialChild
in 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, InvalidArgumentException
Description copied from interface:MetadataEntityManager
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- Specified by:
addPossibleChildren
in 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, InvalidArgumentException
Description copied from interface:MetadataEntityManager
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- Specified by:
addPossibleSpecialChildren
in 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:MetadataEntityManager
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- Specified by:
addPossibleChildren
in 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:MetadataEntityManager
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- Specified by:
addPossibleSpecialChildren
in 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 MetadataObjectNotFoundException
Description copied from interface:MetadataEntityManager
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- Specified by:
removePossibleChildren
in 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 MetadataObjectNotFoundException
Description copied from interface:MetadataEntityManager
The opposite of addPossibleSpecialChildren. It removes the given possible special children- Specified by:
removePossibleSpecialChildren
in 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:MetadataEntityManager
Get the upstream containment hierarchy for a given class, unlike getPossibleChildren (which will give you the downstream hierarchy).- Specified by:
getUpstreamContainmentHierarchy
in 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:MetadataEntityManager
Gets the upstream special containment hierarchy for a given class, unlike getPossibleChildren (which will give you the downstream hierarchy).- Specified by:
getUpstreamSpecialContainmentHierarchy
in 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:MetadataEntityManager
Gets the parent classes of a given class up toInventoryObject
. Please note thatRootObject
is being deliberately omitted.- Specified by:
getUpstreamClassHierarchy
in 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:MetadataEntityManager
Sets the display name of a special relationship used in a model- Specified by:
setSpecialRelationshipDisplayName
in 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:MetadataEntityManager
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- Specified by:
getSpecialRelationshipDisplayName
in 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:MetadataEntityManager
Assess if a given class is subclass of another- Specified by:
isSubclassOf
in 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:MetadataEntityManager
Retrieves the list of the attributes marked as mandatory- Specified by:
getMandatoryAttributesInClass
in 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:
InvalidArgumentException
MetadataObjectNotFoundException
-
buildClassCache
public void buildClassCache() throws InvalidArgumentException
Description copied from interface:MetadataEntityManager
Clears the class cache and re-built it.- Specified by:
buildClassCache
in interfaceMetadataEntityManager
- Throws:
InvalidArgumentException
- If the unique attributes cache cannot be load.
-
-