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:ItemIdThis 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 classDKPid.BuilderBuilder for constructing DKPid instances.
-
Constructor Summary
Constructors Modifier Constructor and Description protectedDKPid(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 intcompareTo(DKPid o)Compares this PID to another PID for ordering.booleanequals(java.lang.Object o)Compares this PID to another object for equality.java.lang.StringgetClassName()Returns the class name of the object.java.lang.StringgetDatastoreName()Returns the datastore name (alias forgetObjectStore()).java.lang.StringgetId()Returns the item identifier.java.lang.StringgetIdString()Returns the complete PID as a string.java.lang.StringgetIdString(int index)Returns the ID string at the specified index.java.lang.StringgetItemId()Returns the item identifier.java.lang.StringgetObjectStore()Returns the object store name.java.lang.StringgetObjectType()Returns the object type (alias forgetClassName()).java.lang.StringgetPrimaryId()Returns the primary identifier (alias forgetId()).inthashCode()Returns the hash code for this PID.static DKPidof(java.lang.String objectStore, java.lang.String className, java.lang.String itemId)Creates a new PID from the specified components.static DKPidparse(java.lang.String pidString)Parses a PID string in the format "ObjectStore:ClassName:ItemId".java.lang.StringpidString()Returns the PID as a string (alias fortoString()).java.lang.StringpidType()Returns the PID type (the simple class name).java.lang.StringtoString()Returns the canonical CM8-style PID string: "ObjectStore:ClassName:ItemId".
-
-
-
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)orparse(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 nameclassName- the class nameitemId- 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 forgetObjectStore()).- 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 forgetId()).- 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 fortoString()).- Returns:
- the PID string
-
getObjectType
public java.lang.String getObjectType()
Returns the object type (alias forgetClassName()).- 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:
toStringin classjava.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:
equalsin classjava.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:
hashCodein classjava.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:
compareToin interfacejava.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
-
-