com.ibm.mm.sdk.common

Class DKPidICM

  • All Implemented Interfaces:
    java.io.Serializable, java.lang.Comparable<DKPid>


    public class DKPidICM
    extends DKPid
    IBM Content Manager (ICM) implementation of persistent identifier.

    This class extends DKPid to provide FileNet P8-specific persistent identifier functionality. It wraps FileNet's Id class and maintains references to FileNet Document objects and DKDDO wrappers.

    Key Features:

    • Wraps FileNet Id for CM8 compatibility
    • Maintains references to FileNet Document and DKDDO
    • Factory method for creating PIDs from DKDDO objects
    • Version number retrieval for documents
    • Enhanced equality comparison using FileNet Ids

    Example usage:

     // Create PID from DKDDO
     DKDDO document = datastore.createDDO("Document");
     document.add();
     DKPidICM pid = DKPidICM.fromDKDDO(document);
    
     // Get version number
     String version = pid.getVersionNumber();
     logger.info("Document version: {}", version);
    
     // Use in equality checks
     DKPidICM otherPid = DKPidICM.fromDKDDO(otherDocument);
     if (pid.equals(otherPid)) {
         logger.info("Same document");
     }
     
    See Also:
    DKPid, DKDDO, Id, Serialized Form
    • Constructor Detail

      • DKPidICM

        public DKPidICM(java.lang.String objectStore,
                        java.lang.String className,
                        java.lang.String itemIdString)
        Constructs a PID with the specified components.
        Parameters:
        objectStore - the object store name
        className - the class name
        itemIdString - the item ID as a string
    • Method Detail

      • setDocument

        public void setDocument(com.filenet.api.core.Document document)
        Sets the FileNet Document reference.
        Parameters:
        document - the FileNet document
      • setDdo

        public void setDdo(DKDDO ddo)
        Sets the DKDDO wrapper reference.
        Parameters:
        ddo - the DKDDO wrapper
      • fromDKDDO

        public static DKPidICM fromDKDDO(DKDDO ddo)
                                  throws DKException
        Factory method to create a DKPidICM from a DKDDO object.

        Extracts the object store name, class name, and ID from the DKDDO's underlying FileNet Document or Folder. The created PID maintains a reference to the DKDDO for version number retrieval.

        Parameters:
        ddo - the DKDDO to create a PID from
        Returns:
        a new DKPidICM instance
        Throws:
        DKException - if the DKDDO is null or doesn't contain a valid document/folder
      • setId

        public void setId(com.filenet.api.util.Id fileNetId)
        Sets the FileNet Id reference.
        Parameters:
        fileNetId - the FileNet Id
      • equals

        public boolean equals(java.lang.Object o)
        Compares this PID with another object for equality.

        If both objects are DKPidICM instances with FileNet Ids set, uses FileNet Id comparison for more accurate equality checking. Otherwise, falls back to the parent class's string-based comparison.

        Overrides:
        equals in class DKPid
        Parameters:
        o - the object to compare with
        Returns:
        true if the objects represent the same persistent identifier
      • hashCode

        public int hashCode()
        Returns the hash code for this PID.

        Uses the FileNet Id's hash code if available, otherwise falls back to the parent class's hash code implementation.

        Overrides:
        hashCode in class DKPid
        Returns:
        the hash code value
      • getItemId

        public java.lang.String getItemId()
        Returns the item identifier.
        Overrides:
        getItemId in class DKPid
        Returns:
        the item ID
      • getPrimaryId

        public java.lang.String getPrimaryId()
        Returns the primary identifier (alias for DKPid.getId()).
        Overrides:
        getPrimaryId in class DKPid
        Returns:
        the primary item ID
      • pidType

        public java.lang.String pidType()
        Returns the PID type (the simple class name).
        Overrides:
        pidType in class DKPid
        Returns:
        the PID type
      • getVersionNumber

        public java.lang.String getVersionNumber()
                                          throws DKException
        Gets the version number of the document.

        Returns the version number using the stored DDO reference (if available from the fromDKDDO(DKDDO) factory method). For non-document objects (e.g., folders), returns "1" since folders don't have versions.

        Note: This method requires the PID to be created via fromDKDDO(DKDDO) or have the DDO set via setDdo(DKDDO).

        Returns:
        the version number as a string, or "1" for folders
        Throws:
        DKException - if the DDO is not set, datastore is not available, or version retrieval fails
Copyright © 2024 IBM Corporation

Copyright © 2024 IBM Corporation. All rights reserved.