public abstract class Collection<E extends CollectionMember> extends Object implements C2KLocalObject
In parallel with the OO meta-model, Items can be linked to other Items in different ways. These links are modelled with Collections, which are local objects stored in an Item which reference a number of other Items in the same server. The Collections holds a CollectionMember, sometimes known as a slot, to reference each Item and store additional information about the link.
Features:
GraphModel to lay out its slots on a two-dimensional canvas, for modelling real
world compositions.
Collections are managed through predefined steps.
| Modifier and Type | Field and Description |
|---|---|
protected CollectionMemberList<E> |
mMembers |
protected String |
mName |
protected Integer |
mVersion |
| Constructor and Description |
|---|
Collection() |
| Modifier and Type | Method and Description |
|---|---|
abstract E |
addMember(ItemPath itemPath,
CastorHashMap props,
String classProps)
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.
|
boolean |
contains(ItemPath itemPath) |
boolean |
equals(Object obj) |
String |
getClusterPath()
Each C2KLocalObject is stored with a path identifier starting with the ClusterType:
Properties: /Property/Name
Workflow: /LifeCycle/workflow
Collections: /Collection/Name/Version (default Name='last')
Outcomes: /Outcome/SchemaName/SchemaVersion/EventID
Viewpoints: /ViewPoint/SchemaName/Name (default Name='last')
Events: /AuditTrail/EventID
Jobs: /Job/JobID
|
ClusterType |
getClusterType()
Each object belongs to a specific type defined in
ClusterStorage |
int |
getCounter()
Fetch the current highest member ID of the collection.
|
String |
getDescVer(E mem)
Gets the description version referenced by the given collection member.
|
E |
getMember(int memberId)
Find collection member by integer ID
|
CollectionMemberList<E> |
getMembers() |
String |
getName()
Gets the name of the C2KLocalObject
|
Integer |
getVersion()
Get the collection version.
|
String |
getVersionName()
Get the version name for storage, which is 'last' unless the version number is set.
|
int |
hashCode() |
boolean |
isFull()
Check if all slots have an assigned Item
|
abstract void |
removeMember(int memberId)
Removes the slot with the given ID from the collection.
|
List<E> |
resolveMembers(int slotID,
ItemPath childPath)
Helper method to find all the members with the combination of the input parameters.
|
List<E> |
resolveMembers(ItemPath childPath)
Helper method to find all the members for the given item.
|
void |
setMembers(CollectionMemberList<E> newMembers) |
void |
setName(String name)
Sets the collection name
|
void |
setVersion(Integer version)
Set a named version for this collection.
|
int |
size() |
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, waitenforceValidNameprotected CollectionMemberList<E extends CollectionMember> mMembers
protected String mName
protected Integer mVersion
public int getCounter()
public int size()
public void setName(String name)
setName in interface C2KLocalObjectname - Name of the C2KLocalObjectpublic String getName()
C2KLocalObjectgetName in interface C2KLocalObjectpublic Integer getVersion()
public void setVersion(Integer version)
version - the version to setpublic String getVersionName()
public ClusterType getClusterType()
C2KLocalObjectClusterStoragegetClusterType in interface C2KLocalObjectpublic String getClusterPath()
C2KLocalObjectgetClusterPath in interface C2KLocalObjectpublic void setMembers(CollectionMemberList<E> newMembers)
public boolean contains(ItemPath itemPath)
public String getDescVer(E mem)
mem - The member in questionpublic boolean isFull()
public E getMember(int memberId) throws ObjectNotFoundException
memberId - to findObjectNotFoundException - when the ID wasn't foundpublic CollectionMemberList<E> getMembers()
public abstract E addMember(ItemPath itemPath, CastorHashMap props, String classProps) throws InvalidCollectionModification, ObjectAlreadyExistsException
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.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 attemptedpublic abstract void removeMember(int memberId)
throws ObjectNotFoundException
memberId - to removeObjectNotFoundException - when there was no slot with this ID found.public List<E> resolveMembers(ItemPath childPath) throws ObjectNotFoundException
childPath - the UUID of the item in the slotsObjectNotFoundException - there is not member found for the given input parameterspublic List<E> resolveMembers(int slotID, ItemPath childPath) throws ObjectNotFoundException
slotID - The id of the slot (aka memberID). When it is set to -1, only the chilPath is used for searching.childPath - The UUID of the item in the slots. When it is set to null, only the slotID is used for searching.ObjectNotFoundException - if no member was found for the given input parametersCopyright © 1997–2020 CRISTAL-iSE. All rights reserved.