com.ibm.mm.sdk.common
Class DKSequentialCollection
- java.lang.Object
-
- com.ibm.mm.sdk.common.DKSequentialCollection
-
- All Implemented Interfaces:
- dkCollection, java.io.Serializable
- Direct Known Subclasses:
- DKChildCollection, DKFolder, DKLinkCollection, DKParts, dkQueryableCollection
public class DKSequentialCollection extends java.lang.Object implements dkCollection, java.io.Serializable
Sequential collection implementation for CM8 data objects.DKSequentialCollection provides an ordered collection of elements with support for both materialized (in-memory) and lazy (FileNet-backed) iteration. It implements the
dkCollectioninterface and provides full CRUD operations on collection elements.Key Features:
- Sequential access to elements via iterators
- Support for FileNet collections with lazy iteration
- Insert, remove, replace operations at iterator positions
- Collection ownership and attribute association
Usage Modes:
- Materialized Mode: Elements stored in memory (ArrayList)
- Lazy Mode: Elements fetched on-demand from FileNet collections
Example usage:
DKSequentialCollection collection = new DKSequentialCollection(); collection.addElement(ddo1); collection.addElement(ddo2); dkIterator iterator = collection.createIterator(); while (iterator.more()) { Object element = iterator.next(); // Process element }- See Also:
dkCollection,dkIterator,dkDataObjectBase, Serialized Form
-
-
Field Summary
Fields Modifier and Type Field and Description protected java.lang.StringassociatedAttrNameprotected intcurrentPositionprotected java.lang.ObjectfileNetCollectionprotected java.util.List<java.lang.Object>itemsprotected java.lang.Stringnameprotected dkDataObjectBaseowner
-
Constructor Summary
Constructors Constructor and Description DKSequentialCollection()Constructs a new DKSequentialCollection.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method and Description voidaddAllElements(dkCollection elements)Adds all elements from another collection to this collection.voidaddElement(java.lang.Object element)Adds an element to the collection.intcardinality()Returns the number of items in the collection.dkIteratorcreateIterator()Creates and returns an iterator for this collection.java.lang.StringgetAssociatedAttrName()Returns the name of the attribute associated with this collection.java.lang.ObjectgetFileNetCollection()Gets the FileNet collection if set.java.lang.StringgetName()Returns the name of this collection.dkDataObjectBasegetOwner()Returns the data object that owns this collection.voidinsertElementAt(java.lang.Object element, dkIterator where)Inserts an element at the position specified by the iterator.java.lang.ObjectnextElement()Retrieves the next element in the collection and advances the cursor.voidremoveAllElements()Removes all elements from the collection.voidremoveElementAt(dkIterator where)Removes the element at the position specified by the iterator.voidreplaceElementAt(java.lang.Object element, dkIterator where)Replaces the element at the position specified by the iterator with a new element.voidreset()Resets the cursor to the beginning of the collection.java.lang.ObjectretrieveElementAt(dkIterator where)Retrieves the element at the position specified by the iterator.voidsetAssociatedAttrName(java.lang.String associatedAttrName)Sets the associated attribute name for this collection.voidsetFileNetCollection(java.lang.Object collection)Sets a FileNet collection for lazy iteration.voidsetName(java.lang.String name)Sets the name of this collection.voidsetOwner(dkDataObjectBase owner)Sets the owner data object for this collection.
-
-
-
Field Detail
-
items
protected java.util.List<java.lang.Object> items
-
currentPosition
protected int currentPosition
-
name
protected java.lang.String name
-
associatedAttrName
protected java.lang.String associatedAttrName
-
owner
protected dkDataObjectBase owner
-
fileNetCollection
protected java.lang.Object fileNetCollection
-
-
Constructor Detail
-
DKSequentialCollection
public DKSequentialCollection()
Constructs a new DKSequentialCollection.
-
-
Method Detail
-
setFileNetCollection
public void setFileNetCollection(java.lang.Object collection)
Sets a FileNet collection for lazy iteration. This allows iteration over FileNet collections without materializing all data. Accepts any FileNet collection object (ReferentialContainmentRelationshipSet, IndependentObjectSet, AnnotationSet, etc.) or Iterable.- Parameters:
collection- FileNet collection or Iterable
-
getFileNetCollection
public java.lang.Object getFileNetCollection()
Gets the FileNet collection if set.- Returns:
- the FileNet collection or null if not set
-
createIterator
public dkIterator createIterator()
Creates and returns an iterator for this collection. The iterator allows traversal of the collection elements. If a FileNet collection is set, returns a FileNetCollectionIterator. Otherwise, returns a SequentialCollectionIterator for materialized data.- Returns:
- a new dkIterator instance for this collection
-
cardinality
public int cardinality()
Returns the number of items in the collection.- Returns:
- the number of items
-
nextElement
public java.lang.Object nextElement() throws java.util.NoSuchElementExceptionRetrieves the next element in the collection and advances the cursor.- Returns:
- the next element
- Throws:
java.util.NoSuchElementException- if no more elements exist
-
reset
public void reset()
Resets the cursor to the beginning of the collection.
-
addElement
public void addElement(java.lang.Object element) throws DKUsageErrorDescription copied from interface:dkCollectionAdds an element to the collection.- Specified by:
addElementin interfacedkCollection- Parameters:
element- the element to add to the collection- Throws:
DKUsageError- if the element is null or cannot be added
-
addAllElements
public void addAllElements(dkCollection elements) throws DKUsageError
Description copied from interface:dkCollectionAdds all elements from another collection to this collection.- Specified by:
addAllElementsin interfacedkCollection- Parameters:
elements- the collection whose elements are to be added- Throws:
DKUsageError- if the elements collection is null or elements cannot be added
-
insertElementAt
public void insertElementAt(java.lang.Object element, dkIterator where) throws DKUsageErrorDescription copied from interface:dkCollectionInserts an element at the position specified by the iterator.- Specified by:
insertElementAtin interfacedkCollection- Parameters:
element- the element to insertwhere- the iterator position where the element should be inserted- Throws:
DKUsageError- if the element is null, the iterator is invalid, or insertion fails
-
removeElementAt
public void removeElementAt(dkIterator where) throws DKUsageError
Description copied from interface:dkCollectionRemoves the element at the position specified by the iterator.- Specified by:
removeElementAtin interfacedkCollection- Parameters:
where- the iterator position of the element to remove- Throws:
DKUsageError- if the iterator is invalid or removal fails
-
replaceElementAt
public void replaceElementAt(java.lang.Object element, dkIterator where) throws DKUsageErrorDescription copied from interface:dkCollectionReplaces the element at the position specified by the iterator with a new element.- Specified by:
replaceElementAtin interfacedkCollection- Parameters:
element- the new element to replace the existing onewhere- the iterator position of the element to replace- Throws:
DKUsageError- if the element is null, the iterator is invalid, or replacement fails
-
retrieveElementAt
public java.lang.Object retrieveElementAt(dkIterator where) throws DKUsageError
Description copied from interface:dkCollectionRetrieves the element at the position specified by the iterator.- Specified by:
retrieveElementAtin interfacedkCollection- Parameters:
where- the iterator position of the element to retrieve- Returns:
- the element at the specified position
- Throws:
DKUsageError- if the iterator is invalid or retrieval fails
-
getName
public java.lang.String getName()
Description copied from interface:dkCollectionReturns the name of this collection.- Specified by:
getNamein interfacedkCollection- Returns:
- the collection name, or null if not named
-
setName
public void setName(java.lang.String name)
Sets the name of this collection.- Parameters:
name- the name to set
-
getAssociatedAttrName
public java.lang.String getAssociatedAttrName()
Description copied from interface:dkCollectionReturns the name of the attribute associated with this collection.Collections can be associated with specific attributes of data objects. This method returns the name of that attribute, if any.
- Specified by:
getAssociatedAttrNamein interfacedkCollection- Returns:
- the associated attribute name, or null if not associated with an attribute
-
setAssociatedAttrName
public void setAssociatedAttrName(java.lang.String associatedAttrName)
Sets the associated attribute name for this collection.- Parameters:
associatedAttrName- the associated attribute name to set
-
getOwner
public dkDataObjectBase getOwner()
Description copied from interface:dkCollectionReturns the data object that owns this collection.- Specified by:
getOwnerin interfacedkCollection- Returns:
- the owner data object, or null if this collection is not owned
-
setOwner
public void setOwner(dkDataObjectBase owner)
Sets the owner data object for this collection.- Parameters:
owner- the owner data object to set
-
removeAllElements
public void removeAllElements() throws DKUsageErrorDescription copied from interface:dkCollectionRemoves all elements from the collection.- Specified by:
removeAllElementsin interfacedkCollection- Throws:
DKUsageError- if the removal operation fails
-
-