com.ibm.mm.sdk.common

Class DKPid

  • java.lang.Object
    • com.ibm.mm.sdk.common.DKPid
  • All Implemented Interfaces:
    java.io.Serializable, java.lang.Comparable<DKPid>
    Direct Known Subclasses:
    DKPidICM


    public class DKPid
    extends java.lang.Object
    implements java.io.Serializable, java.lang.Comparable<DKPid>
    Persistent Identifier (PID) for CM8 objects.

    A DKPid uniquely identifies an object in a CM8 datastore using three components:

    • Object Store - The name of the datastore/object store
    • Class Name - The type/class of the object
    • Item ID - The unique identifier within the class

    PIDs are immutable and follow the format: ObjectStore:ClassName:ItemId

    This class is serializable and comparable, making it suitable for use in collections, distributed systems, and as map keys.

    See Also:
    DKPidICM, DKDDO, Serialized Form
    • Nested Class Summary

      Nested Classes 
      Modifier and Type Class and Description
      static class  DKPid.Builder
      Builder for constructing DKPid instances.
    • Constructor Summary

      Constructors 
      Modifier Constructor and Description
      protected DKPid(java.lang.String objectStore, java.lang.String className, java.lang.String itemId)
      Protected constructor for creating a PID from its components.
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method and Description
      int compareTo(DKPid o)
      Compares this PID to another PID for ordering.
      boolean equals(java.lang.Object o)
      Compares this PID to another object for equality.
      java.lang.String getClassName()
      Returns the class name of the object.
      java.lang.String getDatastoreName()
      Returns the datastore name (alias for getObjectStore()).
      java.lang.String getId()
      Returns the item identifier.
      java.lang.String getIdString()
      Returns the complete PID as a string.
      java.lang.String getIdString(int index)
      Returns the ID string at the specified index.
      java.lang.String getItemId()
      Returns the item identifier.
      java.lang.String getObjectStore()
      Returns the object store name.
      java.lang.String getObjectType()
      Returns the object type (alias for getClassName()).
      java.lang.String getPrimaryId()
      Returns the primary identifier (alias for getId()).
      int hashCode()
      Returns the hash code for this PID.
      static DKPid of(java.lang.String objectStore, java.lang.String className, java.lang.String itemId)
      Creates a new PID from the specified components.
      static DKPid parse(java.lang.String pidString)
      Parses a PID string in the format "ObjectStore:ClassName:ItemId".
      java.lang.String pidString()
      Returns the PID as a string (alias for toString()).
      java.lang.String pidType()
      Returns the PID type (the simple class name).
      java.lang.String toString()
      Returns the canonical CM8-style PID string: "ObjectStore:ClassName:ItemId".
      • Methods inherited from class java.lang.Object

        clone, finalize, getClass, notify, notifyAll, wait, wait, wait
    • Constructor Detail

      • DKPid

        protected DKPid(java.lang.String objectStore,
                        java.lang.String className,
                        java.lang.String itemId)
        Protected constructor for creating a PID from its components.

        Use the static factory methods of(String, String, String) or parse(String) instead of calling this constructor directly.

        Parameters:
        objectStore - the object store name (cannot be null or empty)
        className - the class name (cannot be null or empty)
        itemId - the item identifier (cannot be null or empty)
        Throws:
        java.lang.IllegalArgumentException - if any parameter is null or empty
    • Method Detail

      • of

        public static DKPid of(java.lang.String objectStore,
                               java.lang.String className,
                               java.lang.String itemId)
        Creates a new PID from the specified components.
        Parameters:
        objectStore - the object store name
        className - the class name
        itemId - the item identifier
        Returns:
        a new DKPid instance
        Throws:
        java.lang.IllegalArgumentException - if any parameter is null or empty
      • parse

        public static DKPid parse(java.lang.String pidString)
        Parses a PID string in the format "ObjectStore:ClassName:ItemId".
        Parameters:
        pidString - the PID string to parse
        Returns:
        a new DKPid instance
        Throws:
        java.lang.IllegalArgumentException - if the string is null, empty, or not in the correct format
      • getObjectStore

        public java.lang.String getObjectStore()
        Returns the object store name.
        Returns:
        the object store name
      • getDatastoreName

        public java.lang.String getDatastoreName()
        Returns the datastore name (alias for getObjectStore()).
        Returns:
        the datastore name
      • getClassName

        public java.lang.String getClassName()
        Returns the class name of the object.
        Returns:
        the class name
      • getIdString

        public java.lang.String getIdString()
        Returns the complete PID as a string.
        Returns:
        the PID string in format "ObjectStore:ClassName:ItemId"
      • getId

        public java.lang.String getId()
        Returns the item identifier.
        Returns:
        the item ID
      • getPrimaryId

        public java.lang.String getPrimaryId()
        Returns the primary identifier (alias for getId()).
        Returns:
        the primary item ID
      • getIdString

        public java.lang.String getIdString(int index)
        Returns the ID string at the specified index.

        For FileNet implementation, only indices 0 and 1 are supported, both returning the item ID. Composite PIDs are not supported.

        Parameters:
        index - the index (0 or 1)
        Returns:
        the item ID
        Throws:
        java.lang.UnsupportedOperationException - if index is not 0 or 1
      • getItemId

        public java.lang.String getItemId()
        Returns the item identifier.
        Returns:
        the item ID
      • pidString

        public java.lang.String pidString()
        Returns the PID as a string (alias for toString()).
        Returns:
        the PID string
      • getObjectType

        public java.lang.String getObjectType()
        Returns the object type (alias for getClassName()).
        Returns:
        the object type/class name
      • pidType

        public java.lang.String pidType()
        Returns the PID type (the simple class name).
        Returns:
        the PID type
      • toString

        public java.lang.String toString()
        Returns the canonical CM8-style PID string: "ObjectStore:ClassName:ItemId".
        Overrides:
        toString in class java.lang.Object
        Returns:
        the PID string representation
      • equals

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

        Equality is based strictly on (objectStore, className, itemId).

        Overrides:
        equals in class java.lang.Object
        Parameters:
        o - the object to compare with
        Returns:
        true if the PIDs are equal, false otherwise
      • hashCode

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

        Hash is based on (objectStore, className, itemId).

        Overrides:
        hashCode in class java.lang.Object
        Returns:
        the hash code
      • compareTo

        public int compareTo(DKPid o)
        Compares this PID to another PID for ordering.

        Natural order: by objectStore, then className, then itemId.

        Specified by:
        compareTo in interface java.lang.Comparable<DKPid>
        Parameters:
        o - the PID to compare with
        Returns:
        a negative integer, zero, or a positive integer as this PID is less than, equal to, or greater than the specified PID
Copyright © 2024 IBM Corporation

Copyright © 2024 IBM Corporation. All rights reserved.