Primavera Integration API 8.0

com.primavera.common.value
Class ObjectId

java.lang.Object
  extended by com.primavera.common.value.ObjectId
All Implemented Interfaces:
Externalizable, Serializable, Comparable<ObjectId>
Direct Known Subclasses:
JobId

public class ObjectId
extends Object
implements Comparable<ObjectId>, Externalizable

This value type is used as the primary key of a business object. It may contain one or more key values, usually Integers. Business objects that have multi-part object ids include ActivityCodeAssignment, ActivityPeriodActual, ProjectCodeAssignment, ProjectResourceQuantity, ResourceAccess, ResourceAssignmentPeriodActual, ResourceCodeAssignment, ResourceRole, ScheduleOptions, Timesheet, UDFValue, and UserOBS. Note that for ProjectResourceQuantity, the keys consist of an Integer and two Dates.

See Also:
Serialized Form

Field Summary
static ObjectId SECURITY_OVERRIDE_WBSCONTEXT_ID
           
static ObjectId USESSION_OVERRIDE_ID
           
 
Constructor Summary
ObjectId()
          Constructs an empty ObjectId object.
ObjectId(Collection<?> p_pkVals)
          Constructs an ObjectId object with the given Collection of Objects.
ObjectId(Date dtId1, Date dtId2)
          Constructs an ObjectId object with two date values.
ObjectId(int id)
          Constructs an ObjectId object with a given key value.
ObjectId(int[] iaPKVals)
          Constructs an ObjectId object with up to two given key values.
ObjectId(int iId1, int iId2)
          Constructs an ObjectId object with two int values.
ObjectId(Number id)
          Constructs an ObjectId object with a given key value.
ObjectId(Object[] p_pkVals)
          Constructs an ObjectId object with the given array of Objects.
 
Method Summary
 void addPrimaryKeyObject(Object p_obj)
          Adds an object that represents a primary key data type to this object.
 int compareTo(ObjectId id)
          Compares two ObjectId objects.
 boolean equals(Object object)
          Compares this ObjectId to the specified object.
static ObjectId fromString(String sId)
          Creates an ObjectId from a String.
 Integer getPrimaryKeyObject()
          Gets the Integer represented by this object.
 List<Object> getPrimaryKeyObjects()
          Gets the key values represented by this object.
 int getPrimaryKeyValue()
          Gets the key value represented by this object.
 int hashCode()
          Gets a hashcode used when ObjectIds are stored in hashtables, etc.
 boolean isMultiPartKey()
          Determines if this ObjectId object contains multiple key values.
 void readExternal(ObjectInput ois)
          Implementation of the readExternal method to restore its contents by calling the methods of DataInput for primitive types and readObject for objects, strings and arrays.
 Integer toInteger()
          Returns an Integer representation of the object.
 String toString()
          Returns a string representation of the object.
 void writeExternal(ObjectOutput oos)
          Implementation of the writeExternal method to save its contents by calling the methods of DataOutput for its primitive values or calling the writeObject method of ObjectOutput for objects, strings, and arrays.
 
Methods inherited from class java.lang.Object
getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

SECURITY_OVERRIDE_WBSCONTEXT_ID

public static final ObjectId SECURITY_OVERRIDE_WBSCONTEXT_ID

USESSION_OVERRIDE_ID

public static final ObjectId USESSION_OVERRIDE_ID
Constructor Detail

ObjectId

public ObjectId()
Constructs an empty ObjectId object. Must use the addPrimaryKeyObject() method to populate


ObjectId

public ObjectId(int[] iaPKVals)
Constructs an ObjectId object with up to two given key values.

Parameters:
iaPKVals - the array of key values.

ObjectId

public ObjectId(Object[] p_pkVals)
Constructs an ObjectId object with the given array of Objects.

Parameters:
p_pkVals - the Object array holding primary key objects

ObjectId

public ObjectId(Collection<?> p_pkVals)
Constructs an ObjectId object with the given Collection of Objects.

Parameters:
p_pkVals - the Collection holding the primary key objects

ObjectId

public ObjectId(int iId1,
                int iId2)
Constructs an ObjectId object with two int values.

Parameters:
iId1 - the first key value.
iId2 - the second key value.

ObjectId

public ObjectId(Date dtId1,
                Date dtId2)
Constructs an ObjectId object with two date values.

Parameters:
dtId1 - the first key value.
dtId2 - the second key value.

ObjectId

public ObjectId(int id)
Constructs an ObjectId object with a given key value.

Parameters:
id - the key value.

ObjectId

public ObjectId(Number id)
Constructs an ObjectId object with a given key value.

Parameters:
id - the key value.
Method Detail

addPrimaryKeyObject

public void addPrimaryKeyObject(Object p_obj)
Adds an object that represents a primary key data type to this object.

Parameters:
p_obj - the object representing the primary key

fromString

public static ObjectId fromString(String sId)
Creates an ObjectId from a String.

Parameters:
sId - String to be converted
Returns:
a valid ObjectId if the string was valid, otherwise returns null

getPrimaryKeyObjects

public List<Object> getPrimaryKeyObjects()
Gets the key values represented by this object.

Returns:
an List of the key values

getPrimaryKeyValue

public int getPrimaryKeyValue()
                       throws MultipartObjectIdException
Gets the key value represented by this object.

Returns:
the key value
Throws:
MultipartObjectIdException - if this object contains more than one key value

getPrimaryKeyObject

public Integer getPrimaryKeyObject()
                            throws MultipartObjectIdException
Gets the Integer represented by this object.

Returns:
the key value as an Integer
Throws:
MultipartObjectIdException - if this object contains more than one key value

toString

public String toString()
Returns a string representation of the object. Returns an Id as a string, or a comma separated list if it has a multi-part key. Mixed type multi-part key supported

Overrides:
toString in class Object
Returns:
a string representation of the object

toInteger

public Integer toInteger()
Returns an Integer representation of the object. Mixed type multi-part keys are NOT supported

Returns:
a string representation of the object

isMultiPartKey

public boolean isMultiPartKey()
Determines if this ObjectId object contains multiple key values.

Returns:
true if this object contains multiple key values

equals

public boolean equals(Object object)
Compares this ObjectId to the specified object. The result is true if and only if the argument is not null and is an ObjectId object that contains the same sequence of key values.

Overrides:
equals in class Object
Parameters:
object - the object to compare this ObjectId against.
Returns:
true if the ObjectIds are equal; false otherwise.

hashCode

public int hashCode()
Gets a hashcode used when ObjectIds are stored in hashtables, etc.

Overrides:
hashCode in class Object
Returns:
a hash code value for this object.

compareTo

public int compareTo(ObjectId id)
Compares two ObjectId objects.

Specified by:
compareTo in interface Comparable<ObjectId>
Parameters:
id - the Object to be compared.
Returns:
the value 0 if the argument is an ObjectId and equal to this ObjectId; a value less than 0 if the argument is an ObjectId, and the length of its key values is greater than that of this ObjectId ,or its key values are greater than the key values of this ObjectId, or if the argument is not an ObjectId; a value greater than 0 if the argument is an ObjectId, and the length of its key values is less than that of this ObjectId ,or its key values are less than the key values of this ObjectId.

writeExternal

public void writeExternal(ObjectOutput oos)
                   throws IOException
Implementation of the writeExternal method to save its contents by calling the methods of DataOutput for its primitive values or calling the writeObject method of ObjectOutput for objects, strings, and arrays.

Specified by:
writeExternal in interface Externalizable
Parameters:
oos - the stream to write the object to
Throws:
IOException - Includes any I/O exceptions that may occur

readExternal

public void readExternal(ObjectInput ois)
                  throws ClassNotFoundException,
                         IOException
Implementation of the readExternal method to restore its contents by calling the methods of DataInput for primitive types and readObject for objects, strings and arrays. The readExternal method must read the values in the same sequence and with the same types as were written by writeExternal.

Specified by:
readExternal in interface Externalizable
Parameters:
ois - the stream to read data from in order to restore the object
Throws:
IOException - if I/O errors occur
ClassNotFoundException - If the class for an object being restored cannot be found.

Primavera Integration API 8.0

Copyright © 2003, 2010, Oracle and/or its affiliates. All rights reserved.