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 dkCollection interface 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
    • 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
      void addAllElements(dkCollection elements)
      Adds all elements from another collection to this collection.
      void addElement(java.lang.Object element)
      Adds an element to the collection.
      int cardinality()
      Returns the number of items in the collection.
      dkIterator createIterator()
      Creates and returns an iterator for this collection.
      java.lang.String getAssociatedAttrName()
      Returns the name of the attribute associated with this collection.
      java.lang.Object getFileNetCollection()
      Gets the FileNet collection if set.
      java.lang.String getName()
      Returns the name of this collection.
      dkDataObjectBase getOwner()
      Returns the data object that owns this collection.
      void insertElementAt(java.lang.Object element, dkIterator where)
      Inserts an element at the position specified by the iterator.
      java.lang.Object nextElement()
      Retrieves the next element in the collection and advances the cursor.
      void removeAllElements()
      Removes all elements from the collection.
      void removeElementAt(dkIterator where)
      Removes the element at the position specified by the iterator.
      void replaceElementAt(java.lang.Object element, dkIterator where)
      Replaces the element at the position specified by the iterator with a new element.
      void reset()
      Resets the cursor to the beginning of the collection.
      java.lang.Object retrieveElementAt(dkIterator where)
      Retrieves the element at the position specified by the iterator.
      void setAssociatedAttrName(java.lang.String associatedAttrName)
      Sets the associated attribute name for this collection.
      void setFileNetCollection(java.lang.Object collection)
      Sets a FileNet collection for lazy iteration.
      void setName(java.lang.String name)
      Sets the name of this collection.
      void setOwner(dkDataObjectBase owner)
      Sets the owner data object for this collection.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • 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
      • 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.NoSuchElementException
        Retrieves 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 DKUsageError
        Description copied from interface: dkCollection
        Adds an element to the collection.
        Specified by:
        addElement in interface dkCollection
        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: dkCollection
        Adds all elements from another collection to this collection.
        Specified by:
        addAllElements in interface dkCollection
        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 DKUsageError
        Description copied from interface: dkCollection
        Inserts an element at the position specified by the iterator.
        Specified by:
        insertElementAt in interface dkCollection
        Parameters:
        element - the element to insert
        where - 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: dkCollection
        Removes the element at the position specified by the iterator.
        Specified by:
        removeElementAt in interface dkCollection
        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 DKUsageError
        Description copied from interface: dkCollection
        Replaces the element at the position specified by the iterator with a new element.
        Specified by:
        replaceElementAt in interface dkCollection
        Parameters:
        element - the new element to replace the existing one
        where - 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: dkCollection
        Retrieves the element at the position specified by the iterator.
        Specified by:
        retrieveElementAt in interface dkCollection
        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: dkCollection
        Returns the name of this collection.
        Specified by:
        getName in interface dkCollection
        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: dkCollection
        Returns 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:
        getAssociatedAttrName in interface dkCollection
        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: dkCollection
        Returns the data object that owns this collection.
        Specified by:
        getOwner in interface dkCollection
        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
Copyright © 2024 IBM Corporation

Copyright © 2024 IBM Corporation. All rights reserved.