Package org.cristalise.kernel.collection
Class Dependency
java.lang.Object
org.cristalise.kernel.collection.Collection<DependencyMember>
org.cristalise.kernel.collection.Dependency
- All Implemented Interfaces:
C2KLocalObject
- Direct Known Subclasses:
DependencyDescription
A Collection implementation that contains a variable number of members of the
same type, like a variable-length array. CollectionMembers are created and
destroyed as needed. A Dependency never contains empty slots, nor duplicated
members.
ClassProps are stored at the collection level and duplicated in each slot. Slots may still have their own individual properties annotating their link.
-
Nested Class Summary
Nested classes/interfaces inherited from class org.cristalise.kernel.collection.Collection
Collection.Cardinality, Collection.Type -
Field Summary
FieldsFields inherited from class org.cristalise.kernel.collection.Collection
mMembers, mName, mVersion -
Constructor Summary
ConstructorsConstructorDescriptionDependency(String name) Dependency(String name, Integer version) Dependency(BuiltInCollections collection) Dependency(BuiltInCollections collection, Integer version) -
Method Summary
Modifier and TypeMethodDescriptionvoidaddMember(DependencyMember depMember) addMember(ItemPath itemPath, TransactionKey transactionKey) Add a member to the DependencyaddMember(ItemPath itemPath, CastorHashMap props, String classProps, TransactionKey transactionKey) Add a member to this collection, with the given property and class properties and optionally an Item to assign, which may be null if the collection allows empty slots.voidaddToItemProperties(PropertyArrayList props, TransactionKey transactionKey) Add Dependency specific values to ItemProperties.voidaddToVertexProperties(CastorHashMap props, TransactionKey transactionKey) Add Dependency specific values to VertexProperties (CastorHashMap).compare(Dependency other) Returns all DependencyMember that are members of the other collection but not members of this one.booleanMethod of convenience to check if property existscreateMember(ItemPath itemPath, TransactionKey transactionKey) createMember(ItemPath itemPath, CastorHashMap props, TransactionKey transactionKey) protected ObjectevaluateScript(TransactionKey transactionKey) Method of convenience to get property value using BuiltInVertexPropertiesgetBuiltInProperty(BuiltInVertexProperties prop, Object defValue) Method of convenience to get property value using BuiltInVertexPropertiesProperty[]getToDependencyName(ItemPath referencedItem, TransactionKey transactionKey) Reads the DependencyTo property to retrieve the name of the dependency.getType()voidsetClassProps(String classProps) voidsetKeyValuePairs(KeyValuePair[] pairs) voidsetProperties(CastorHashMap props) toString()voidupdateMember(ItemPath childPath, int memberID, CastorHashMap memberNewProps) voidupdateMember(ItemPath childPath, CastorHashMap memberNewProps) Methods inherited from class org.cristalise.kernel.collection.Collection
contains, equals, getClusterPath, getClusterType, getCounter, getDescVer, getMember, getMember, getMembers, getName, getVersion, getVersionName, hashCode, isFull, removeMember, removeMember, resolveMembers, resolveMembers, resolveMembers, setMembers, setName, setVersion, size
-
Field Details
-
mProperties
-
mClassProps
-
-
Constructor Details
-
Dependency
public Dependency() -
Dependency
-
Dependency
-
Dependency
-
Dependency
-
-
Method Details
-
getProperties
-
setProperties
-
getKeyValuePairs
-
setKeyValuePairs
-
setClassProps
-
getClassProps
-
getClassProperties
- Returns:
- array of Property instances fully initialised from classProps (comma separated values)
-
updateMember
public void updateMember(ItemPath childPath, CastorHashMap memberNewProps) throws ObjectNotFoundException, InvalidDataException, InvalidCollectionModification - Parameters:
childPath-memberNewProps-- Throws:
ObjectNotFoundExceptionInvalidDataExceptionInvalidCollectionModification
-
updateMember
public void updateMember(ItemPath childPath, int memberID, CastorHashMap memberNewProps) throws ObjectNotFoundException, InvalidDataException, InvalidCollectionModification - Parameters:
childPath-memberID-memberNewProps-- Throws:
ObjectNotFoundExceptionInvalidDataExceptionInvalidCollectionModification
-
addMember
public DependencyMember addMember(ItemPath itemPath, TransactionKey transactionKey) throws InvalidCollectionModification, ObjectAlreadyExistsException Add a member to the Dependency- Parameters:
itemPath- the Item to be added as a Member- Returns:
- DependencyMember the newly created DependencyMember
- Throws:
InvalidCollectionModification- if Item is null or the Properties of the Item (e.g. Type) does not match the Collection'sObjectAlreadyExistsException- Item is already a member
-
addMember
public void addMember(DependencyMember depMember) throws InvalidCollectionModification, ObjectAlreadyExistsException - Parameters:
depMember-- Throws:
InvalidCollectionModificationObjectAlreadyExistsException
-
createMember
public DependencyMember createMember(ItemPath itemPath, TransactionKey transactionKey) throws InvalidCollectionModification, ObjectAlreadyExistsException - Parameters:
itemPath-- Returns:
- Throws:
InvalidCollectionModificationObjectAlreadyExistsException
-
compare
Returns all DependencyMember that are members of the other collection but not members of this one.- Parameters:
other- - The collection to compare- Returns:
- List of Members
-
addMember
public DependencyMember addMember(ItemPath itemPath, CastorHashMap props, String classProps, TransactionKey transactionKey) throws InvalidCollectionModification, ObjectAlreadyExistsException Description copied from class:CollectionAdd a member to this collection, with the given property and class properties and optionally an Item to assign, which may be null if the collection allows empty slots.- Specified by:
addMemberin classCollection<DependencyMember>- Parameters:
itemPath- the Item to assign to the new slot. Optional for collections that allow empty slotsprops- the Properties of the new memberclassProps- the names of the properties that dictate the type of assigned Items.- Returns:
- the new CollectionMember instance
- Throws:
InvalidCollectionModification- when the assignment was invalid because of collection constraints, such as global type constraints, or not allowing empty slots.ObjectAlreadyExistsException- some collections don't allow multiple slots assigned to the same Item, and throw this Exception if it is attempted
-
createMember
public DependencyMember createMember(ItemPath itemPath, CastorHashMap props, TransactionKey transactionKey) throws InvalidCollectionModification, ObjectAlreadyExistsException - Parameters:
itemPath-props-- Returns:
- Throws:
InvalidCollectionModificationObjectAlreadyExistsException
-
addToItemProperties
public void addToItemProperties(PropertyArrayList props, TransactionKey transactionKey) throws InvalidDataException, ObjectNotFoundException Add Dependency specific values to ItemProperties. First checks if there is a Script to be executed, if no Script defined it will use the default conversion implemented for BuiltInCollections- Parameters:
props- the current list of ItemPropertiestransactionKey- the key of the transaction- Throws:
InvalidDataExceptionObjectNotFoundException
-
addToVertexProperties
public void addToVertexProperties(CastorHashMap props, TransactionKey transactionKey) throws InvalidDataException, ObjectNotFoundException Add Dependency specific values to VertexProperties (CastorHashMap). First checks if there is a Script to be executed, if no Script defined it will use the default conversion implemented for BuiltInCollections- Parameters:
props- the current list of VertexProperties- Throws:
InvalidDataException- inconsistent data was providedObjectNotFoundException- objects were not found while reading the properties
-
getBuiltInProperty
Method of convenience to get property value using BuiltInVertexProperties- Parameters:
prop- the property to read- Returns:
- the value, can be null
-
getBuiltInProperty
Method of convenience to get property value using BuiltInVertexProperties- Parameters:
prop- the property to readdefValue- default value- Returns:
- the value, can be null
-
containsBuiltInProperty
Method of convenience to check if property exists- Parameters:
prop- the property to check- Returns:
- true if property exist, false otherwise
-
evaluateScript
protected Object evaluateScript(TransactionKey transactionKey) throws InvalidDataException, ObjectNotFoundException - Returns:
- either PropertyArrayList or CastorHashMap
- Throws:
InvalidDataExceptionObjectNotFoundException
-
getType
-
getCardinality
-
getToDependencyName
public String getToDependencyName(ItemPath referencedItem, TransactionKey transactionKey) throws InvalidDataException Reads the DependencyTo property to retrieve the name of the dependency. The property may contain a single Dependency name or a mapping of ItemType to a Dependency e.g.: 'Employee:Employees, Guest:Guests'- Parameters:
referencedItem-transactionKey-- Returns:
- Throws:
InvalidDataException
-
toString
-