|
Primavera Integration API 7.0 | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.primavera.integration.util.BOHierarchyMap
public class BOHierarchyMap
This utility class is used to aid in the building of hierarchies of business objects loaded from the database. The hierarchical business objects (ActivityCode, CostAccount, Document, EPS, FundingSource, OBS, ProjectCode, ResourceCode, Resource, Role, WBS) are usually retrieved from the database in a non-hierarchical order. Using this class can help ensure that the hierarchy is fully loaded.
Add business objects to the map using the addKey() method. When all business objects have been added, you can verify that the hierarchy is complete by calling validateIntegrity(). You can use the getRootKeys() method and recursively call the getKeyChildren() method to quickly traverse the entire hierarchy.
For dealing with incomplete hierarchies, there are getMissingParents(), getOrphans(), and moveOrphansToRoot() methods. An orphan is an object whose parent was specified when addKey was called, but whose parent object itself was never explicitly added.
To visually inspect the hierarchy, use the toString() method.
Constructor Summary | |
---|---|
BOHierarchyMap()
Class constructor |
|
BOHierarchyMap(java.lang.String sName)
Class constructor specifying a business object class name associated with this map |
Method Summary | |
---|---|
void |
addKey(ObjectId objectId,
ObjectId parentObjectId)
Adds a new key to the map |
void |
addKey(ObjectId objectId,
ObjectId parentObjectId,
java.lang.Object oValue)
Adds a new key and its value to the map |
void |
clear()
Removes all mappings from this map. |
ObjectId[] |
getAllKeys()
Gets all keys in this map |
ObjectId[] |
getKeyChildren(ObjectId objectId)
Gets a key's children object ids |
ObjectId |
getKeyParent(ObjectId objectId)
Gets a key's parent object id |
ObjectId[] |
getMissingParents()
Gets ObjectIds of parents that were never added |
java.lang.String |
getName()
Gets the name of the business object class associated with this map |
ObjectId[] |
getOrphans()
Gets ObjectIds of all orphans (keys with parents that were never added) |
ObjectId[] |
getRootKeys()
Gets the root key(s) in this map. |
java.util.Set<com.primavera.integration.util.KeyInfo> |
getUniqueValues()
Gets all unique values in this map |
java.lang.Object |
getValue(ObjectId objectId)
Gets the value for a particular key |
boolean |
isEmpty()
Returns true if this map contains no key-value mappings. |
void |
moveOrphansToRoot()
Moves all orphans (keys with parents that were never added) to the root |
void |
setName(java.lang.String sName)
Sets the name of the business object class associated with this map |
void |
setValue(ObjectId objectId,
java.lang.Object o)
Sets the value for a particular key |
int |
size()
Returns the number of key-value mappings in this map. |
java.lang.String |
toString()
Gets a string representation of this object. |
void |
validateIntegrity()
Checks the tree for parents that were never added. |
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Constructor Detail |
---|
public BOHierarchyMap()
public BOHierarchyMap(java.lang.String sName)
sName
- the name of the business object class name associated with this mapMethod Detail |
---|
public int size()
public boolean isEmpty()
public void clear()
public void setName(java.lang.String sName)
sName
- the class namepublic java.lang.String getName()
public void addKey(ObjectId objectId, ObjectId parentObjectId)
objectId
- the object id of the keyparentObjectId
- the object id of the key's parent. This parameter is null for root
keyspublic void addKey(ObjectId objectId, ObjectId parentObjectId, java.lang.Object oValue)
objectId
- the object id of the keyparentObjectId
- the object id of the key's parent. This parameter is null for root
keysoValue
- the value associated with the key, usually the business object referencepublic void setValue(ObjectId objectId, java.lang.Object o) throws KeyNotFoundException
objectId
- the object id of the keyo
- the value to be associated with the key
KeyNotFoundException
- if the key does not exist in the mappublic java.lang.Object getValue(ObjectId objectId) throws KeyNotFoundException
objectId
- the object id of the key
KeyNotFoundException
- if the key does not exist in the mappublic ObjectId getKeyParent(ObjectId objectId) throws KeyNotFoundException
objectId
- the object id of the key
KeyNotFoundException
- if the key does not exist in the mappublic ObjectId[] getKeyChildren(ObjectId objectId) throws KeyNotFoundException
objectId
- the object id of the key
KeyNotFoundException
- if the key does not exist in the mappublic ObjectId[] getRootKeys()
public ObjectId[] getAllKeys()
public java.util.Set<com.primavera.integration.util.KeyInfo> getUniqueValues()
public ObjectId[] getMissingParents()
public void validateIntegrity() throws KeyNotFoundException
KeyNotFoundException
- if a parent was never addedpublic ObjectId[] getOrphans()
public void moveOrphansToRoot()
public java.lang.String toString()
toString
in class java.lang.Object
|
Primavera Integration API 7.0 | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |