com.ibm.mm.sdk.common

Class DKParts

  • All Implemented Interfaces:
    dkCollection, java.io.Serializable


    public class DKParts
    extends DKSequentialCollection
    implements java.io.Serializable
    Collection class for managing document content parts (LOBs) in CM8.

    DKParts extends DKSequentialCollection to provide specialized functionality for managing content elements (Large Objects/LOBs) associated with a document. It wraps FileNet's ContentElementList and provides CM8-style access to document content.

    Key Features:

    • Manages document content elements (LOBs)
    • Automatic document checkout/checkin for content modifications
    • Wraps FileNet ContentElementList for CM8 compatibility
    • Supports adding and removing content parts
    • Lazy loading of existing content from documents

    Usage Pattern:

     DKDDO document = datastore.createDDO("Document");
     DKParts parts = new DKParts(document, datastore);
    
     DKLobICM lob = new DKLobICM(contentBytes, "application/pdf", datastore);
     parts.addElement(lob);
    
     // Or use addMember for immediate persistence
     parts.addMember(document, lob);
     
    See Also:
    DKSequentialCollection, DKLobICM, DKDDO, DKDatastoreICM, Serialized Form
    • Constructor Detail

      • DKParts

        public DKParts(DKDDO parentDocument,
                       DKDatastoreICM datastore)
        Constructs a new DKParts collection for the specified document.

        Initializes the content element list by loading any existing content from the document or creating a new empty list. The document is automatically checked out if needed for content modifications.

        Parameters:
        parentDocument - the parent document that owns this content collection
        datastore - the datastore instance for content operations
    • Method Detail

      • getParentDocument

        public DKDDO getParentDocument()
        Gets the parent document that owns this content collection.
        Returns:
        the parent DKDDO document
      • getContentElementList

        public com.filenet.api.collection.ContentElementList getContentElementList()
        Gets the underlying FileNet ContentElementList.
        Returns:
        the FileNet content element list
      • addMember

        public void addMember(DKDDO parentDoc,
                              DKLobICM element)
                       throws DKUsageError,
                              DKException
        Adds a content element and immediately persists the changes.

        This method adds the LOB element to the collection, then checks in and saves the document to persist the changes immediately. Use this for single additions. For bulk operations, use addElement(Object) followed by a manual save.

        Parameters:
        parentDoc - the parent document
        element - the LOB element to add
        Throws:
        DKUsageError - if the operation fails
        DKException - if persistence fails
      • removeAllElements

        public void removeAllElements()
                               throws DKUsageError
        Removes all content elements from the collection and persists the changes.

        This method clears all LOB elements, creates a new empty content list, and immediately persists the changes by checking in and saving the document.

        Specified by:
        removeAllElements in interface dkCollection
        Overrides:
        removeAllElements in class DKSequentialCollection
        Throws:
        DKUsageError - if the content element list is not initialized
Copyright © 2024 IBM Corporation

Copyright © 2024 IBM Corporation. All rights reserved.