Class Poid

java.lang.Object
com.portal.pcm.Poid
All Implemented Interfaces:
Serializable

public class Poid extends Object implements Serializable
The Poid class encapsulates the Portal POID data type. Each storable object has a unique POID in Portal. The POID's fields identify the object's database, ID, storable class type, and revision level. You use the POID to locate a storable object in the database. Only the database subfield (db) must be valid at all times.

For more information about the POID data type, see Understanding the Portal Data Types in the Portal online documentation.

See Also:
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    static final Poid
     
  • Constructor Summary

    Constructors
    Constructor
    Description
    Poid(long db)
    Constructs a partial Poid from a database ID.
    Poid(long db, long id)
    Constructs a partial Poid from a database ID and an object ID.
    Poid(long db, long id, String type)
    Constructs a complete Poid from a database ID, object ID, and type string.
    Poid(long db, long id, String type, int rev)
    Constructs a complete Poid from a database ID, object ID, type string, and revision level.
  • Method Summary

    Modifier and Type
    Method
    Description
    int
    compareTo(Poid other)
    Determines the sort order of two Poids by comparing their fields.
    int
    Determines the sort order of two Poids by comparing their fields.
    boolean
    equals(Poid that)
    Compares the database, type, and ID of two Poids to determine if they refer to the same storable class instance.
    boolean
    Object.equals() override.
    long
    Returns the object's database number specified in the Poid.
    long
    Returns the object ID specified in the Poid.
    long
    Returns the object's revision level specified in the Poid.
    Returns the object's storable class type name specified in the Poid.
    int
    Object.hashCode override
    boolean
    Checks for 'null poid' - defined as: 0 / 0 0
    boolean
    This is to find whether the given two poids have the same schema or not.
    Converts the Poid to a string.
    static Poid
    Returns a new Poid with the values specified in the str parameter.
    static Poid
    valueOf(String str, long defaultDatabase)
    Returns a new Poid with the values specified in the str parameter.

    Methods inherited from class java.lang.Object

    clone, finalize, getClass, notify, notifyAll, wait, wait, wait
  • Field Details

    • NULL_POID

      public static final Poid NULL_POID
  • Constructor Details

    • Poid

      public Poid(long db, long id, String type)
      Constructs a complete Poid from a database ID, object ID, and type string. The revision level is initialized to 0.
      Parameters:
      db - The object's database number.
      id - The unique object ID number.
      type - The object's storable class type. For example, /account.
    • Poid

      public Poid(long db, long id, String type, int rev)
      Constructs a complete Poid from a database ID, object ID, type string, and revision level.
      Parameters:
      db - The object's database number.
      id - The unique object ID number.
      type - The object's storable class type.
      rev - The object's revision level.
    • Poid

      public Poid(long db, long id)
      Constructs a partial Poid from a database ID and an object ID.
      Parameters:
      db - The object's database number.
      id - The unique object ID number.
    • Poid

      public Poid(long db)
      Constructs a partial Poid from a database ID.
      Parameters:
      db - The object's database number.
  • Method Details

    • getDb

      public long getDb()
      Returns the object's database number specified in the Poid.
      Returns:
      The database number.
    • getType

      public String getType()
      Returns the object's storable class type name specified in the Poid. For example, /event/billing/invoice.
      Returns:
      The storable class type name.
    • getId

      public long getId()
      Returns the object ID specified in the Poid.
      Returns:
      The object ID.
    • getRev

      public long getRev()
      Returns the object's revision level specified in the Poid.
      Returns:
      the object's revision level.
    • isSameSchema

      public boolean isSameSchema(Poid other)
      This is to find whether the given two poids have the same schema or not. Two poids considered to be having same schema number if their DB_NO ( <RES>.<LP_NO>.<RES>.<SCHEMA_NO> ), have the same <SCHEMA_NO>.
      Parameters:
      other - A second Poid to compare.
      Returns:
      true if the Poids have the same schema number.
    • compareTo

      public int compareTo(Poid other)
      Determines the sort order of two Poids by comparing their fields. The fields are compared in this order: db, type, id, rev. NOTE: While comparing db, lp number would be ignored. To consider lp number, compareToWithLp API needs to be used. The result is returned when the first inequality is encountered.
      Parameters:
      other - A second Poid to compare.
      Returns:
      1 if the Poid passed in is first in the sort, -1 if the Poid passed in is second in the sort, or 0 if the Poids sort equally.
    • compareToWithLp

      public int compareToWithLp(Poid other)
      Determines the sort order of two Poids by comparing their fields. The fields are compared in this order: db, type, id, rev. The result is returned when the first inequality is encountered. NOTE: While comparing db, lp number would be considered. To ignore lp number, compareTo API needs to be used.
      Parameters:
      other - A second Poid to compare.
      Returns:
      1 if the Poid passed in is first in the sort, -1 if the Poid passed in is second in the sort, or 0 if the Poids sort equally.
    • equals

      public boolean equals(Poid that)
      Compares the database, type, and ID of two Poids to determine if they refer to the same storable class instance.
      Parameters:
      that - A second Poid to compare.
      Returns:
      true if the two Poids refer to the same storable class, otherwise, returns false.
    • equals

      public boolean equals(Object o)
      Object.equals() override. Compares the database, type, and ID of two Poids to determine if they refer to the same storable class instance. This method calls the equals(Poid that) method after verifying the object passed in is an instance of Poid.
      Overrides:
      equals in class Object
      Parameters:
      o - The Poid to compare.
      Returns:
      true if the two Poids have the same database, type, and ID. If the o parameter is not an instance of Poid, false is returned.
    • hashCode

      public int hashCode()
      Object.hashCode override
      Overrides:
      hashCode in class Object
      Returns:
      A hash code.
    • isNull

      public boolean isNull()
      Checks for 'null poid' - defined as: 0 / 0 0
      Returns:
      true if the Poid is a null object reference.
    • toString

      public String toString()
      Converts the Poid to a string.
      Overrides:
      toString in class Object
      Returns:
      A string representation of the Poid. For example, "0.0.0.1 /account 1234 0".
    • valueOf

      public static Poid valueOf(String str, long defaultDatabase)
      Returns a new Poid with the values specified in the str parameter.
      Parameters:
      str - A String representation of a Poid. For example, "0.0.0.1 /account 1234 0". The database portion of the string can be specified as '$DB' if you want to use the defaultDatabase parameter. For example. "$DB /account 1234 0".
      defaultDatabase - A specified database number. If the str parameter contains the substring '$DB', the database number specified in this parameter will replace it. For example:
       defaultDatabase = 0.0.0.2
       str = "$DB /account 4567 0"
       Resulting Poid = "0.0.0.2 /account 4567 0" 
      If the str parameter contains a database number, the defaultDatabase parameter is ignored.
      Returns:
      A new Poid initialized with the values specified by the string.
    • valueOf

      public static Poid valueOf(String str)
      Returns a new Poid with the values specified in the str parameter.
      Parameters:
      str - A string representation of a Poid. For example, "0.0.0.1 /account 1234 0"
      Returns:
      A new Poid initialized with the values specified by the string.