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 |
|---|---|
static short |
EMPTY |
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 |
getClusterType() |
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() |
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.
|
void |
setMembers(CollectionMemberList<E> newMembers) |
void |
setName(String name)
Sets the collection name
|
void |
setVersion(Integer mVersion)
Set a named version for this collection.
|
int |
size() |
public static final short EMPTY
protected 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 C2KLocalObjectpublic String getName()
getName in interface C2KLocalObjectpublic Integer getVersion()
public void setVersion(Integer mVersion)
Integer - versionpublic String getVersionName()
public String getClusterType()
getClusterType 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.Copyright © 1997–2016 CRISTAL-iSE. All rights reserved.