Package com.primavera.common.value
Class ObjectId
java.lang.Object
com.primavera.common.value.ObjectId
- All Implemented Interfaces:
Externalizable,Serializable,Comparable<ObjectId>
- Direct Known Subclasses:
JobId
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:
-
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionObjectId()Constructs an emptyObjectIdobject.ObjectId(int id) Constructs anObjectIdobject with a given key value.ObjectId(int[] iaPKVals) Constructs anObjectIdobject with up to two given key values.ObjectId(int iId1, int iId2) Constructs anObjectIdobject with two int values.Constructs anObjectIdobject with a given key value.Constructs anObjectIdobject with the given array of Objects.Constructs anObjectIdobject with two date values.ObjectId(Collection<?> p_pkVals) Constructs anObjectIdobject with the given Collection of Objects. -
Method Summary
Modifier and TypeMethodDescriptionvoidaddPrimaryKeyObject(Object p_obj) Adds an object that represents a primary key data type to this object.intCompares twoObjectIdobjects.booleanCompares thisObjectIdto the specified object.static ObjectIdfromString(String sId) Creates anObjectIdfrom a String.Gets the Date represented by this object.Gets the Integer represented by this object.Gets the key values represented by this object.intGets the key value represented by this object.inthashCode()Gets a hashcode used when ObjectIds are stored in hashtables, etc.booleanDetermines if thisObjectIdobject contains multiple key values.voidreadExternal(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.Returns an Integer representation of the object.toString()Returns a string representation of the object.voidImplementation 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.
-
Field Details
-
SECURITY_OVERRIDE_WBSCONTEXT_ID
-
USESSION_OVERRIDE_ID
-
-
Constructor Details
-
ObjectId
public ObjectId()Constructs an emptyObjectIdobject. Must use the addPrimaryKeyObject() method to populate -
ObjectId
public ObjectId(int[] iaPKVals) Constructs anObjectIdobject with up to two given key values.- Parameters:
iaPKVals- the array of key values.
-
ObjectId
Constructs anObjectIdobject with the given array of Objects.- Parameters:
p_pkVals- the Object array holding primary key objects
-
ObjectId
Constructs anObjectIdobject with the given Collection of Objects.- Parameters:
p_pkVals- the Collection holding the primary key objects
-
ObjectId
public ObjectId(int iId1, int iId2) Constructs anObjectIdobject with two int values.- Parameters:
iId1- the first key value.iId2- the second key value.
-
ObjectId
Constructs anObjectIdobject with two date values.- Parameters:
dtId1- the first key value.dtId2- the second key value.
-
ObjectId
public ObjectId(int id) Constructs anObjectIdobject with a given key value.- Parameters:
id- the key value.
-
ObjectId
Constructs anObjectIdobject with a given key value.- Parameters:
id- the key value.
-
-
Method Details
-
addPrimaryKeyObject
Adds an object that represents a primary key data type to this object.- Parameters:
p_obj- the object representing the primary key
-
fromString
Creates anObjectIdfrom a String.- Parameters:
sId- String to be converted- Returns:
- a valid
ObjectIdif the string was valid, otherwise returns null
-
getPrimaryKeyObjects
Gets the key values represented by this object.- Returns:
- an List of the key values
-
getPrimaryKeyValue
Gets the key value represented by this object.- Returns:
- the key value
- Throws:
MultipartObjectIdException- if this object contains more than one key value
-
getPrimaryKeyObject
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
-
getPrimaryKeyDate
Gets the Date represented by this object.- Returns:
- the key value as an Integer
- Throws:
MultipartObjectIdException- if this object contains more than one key value
-
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 -
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 thisObjectIdobject contains multiple key values.- Returns:
- true if this object contains multiple key values
-
equals
Compares thisObjectIdto the specified object. The result is true if and only if the argument is not null and is anObjectIdobject that contains the same sequence of key values. -
hashCode
public int hashCode()Gets a hashcode used when ObjectIds are stored in hashtables, etc. -
compareTo
Compares twoObjectIdobjects.- Specified by:
compareToin interfaceComparable<ObjectId>- Parameters:
id- theObjectto be compared.- Returns:
- the value
0if the argument is anObjectIdand equal to thisObjectId; a value less than0if the argument is anObjectId, and the length of its key values is greater than that of thisObjectId,or its key values are greater than the key values of thisObjectId, or if the argument is not anObjectId; a value greater than0if the argument is anObjectId, and the length of its key values is less than that of thisObjectId,or its key values are less than the key values of thisObjectId.
-
writeExternal
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:
writeExternalin interfaceExternalizable- Parameters:
oos- the stream to write the object to- Throws:
IOException- Includes any I/O exceptions that may occur
-
readExternal
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:
readExternalin interfaceExternalizable- Parameters:
ois- the stream to read data from in order to restore the object- Throws:
IOException- if I/O errors occurClassNotFoundException- If the class for an object being restored cannot be found.
-