Class DKPidICM
- java.lang.Object
-
- com.ibm.mm.sdk.common.DKPid
-
- com.ibm.mm.sdk.common.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
DKPidto 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
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class com.ibm.mm.sdk.common.DKPid
DKPid.Builder
-
-
Constructor Summary
Constructors Constructor and Description DKPidICM(java.lang.String objectStore, java.lang.String className, java.lang.String itemIdString)Constructs a PID with the specified components.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method and Description booleanequals(java.lang.Object o)Compares this PID with another object for equality.static DKPidICMfromDKDDO(DKDDO ddo)Factory method to create a DKPidICM from a DKDDO object.java.lang.StringgetItemId()Returns the item identifier.java.lang.StringgetPrimaryId()Returns the primary identifier (alias forDKPid.getId()).java.lang.StringgetVersionNumber()Gets the version number of the document.inthashCode()Returns the hash code for this PID.java.lang.StringpidType()Returns the PID type (the simple class name).voidsetDdo(DKDDO ddo)Sets the DKDDO wrapper reference.voidsetDocument(com.filenet.api.core.Document document)Sets the FileNet Document reference.voidsetId(com.filenet.api.util.Id fileNetId)Sets the FileNet Id reference.-
Methods inherited from class com.ibm.mm.sdk.common.DKPid
compareTo, getClassName, getDatastoreName, getId, getIdString, getIdString, getObjectStore, getObjectType, of, parse, pidString, toString
-
-
-
-
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 nameclassName- the class nameitemIdString- 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.
-
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.
-
getItemId
public java.lang.String getItemId()
Returns the item identifier.
-
getPrimaryId
public java.lang.String getPrimaryId()
Returns the primary identifier (alias forDKPid.getId()).- Overrides:
getPrimaryIdin classDKPid- Returns:
- the primary item ID
-
pidType
public java.lang.String pidType()
Returns the PID type (the simple class name).
-
getVersionNumber
public java.lang.String getVersionNumber() throws DKExceptionGets 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 viasetDdo(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
-
-