com.tivoli.twg.engine
Class TWGRelationship

java.lang.Object
  extended bycom.tivoli.twg.engine.TWGObject
      extended bycom.tivoli.twg.engine.TWGRelationship
All Implemented Interfaces:
TWGBaseShadowedObject, TWGConsoleSpecShadowedObject

public class TWGRelationship
extends TWGObject
implements TWGConsoleSpecShadowedObject

The TWGRelationship class is used to represent relationship "nodes" within a relationship set (TWGRelationshipSet). TWGRelationship objects cannot be shared between TWGRelationshipSets. Each TWGRelationship object consists of a list of one or more links, each of which is upward (towards the root of a tree representation) or downward (away from the root). peer relationships are represented by two downward links under the same TWGRelationship object. One upward link (if any exist) must be marked primary, allowing a simple tree view to be presented. Each link is directed to either a TWGManagedObject (downward links only) or another TWGRelationship. Also, each TWGRelationship instance is either named or contains a reference to a TWGManagedObject which "is" the middle of the TWGRelationship (i.e. the server in a client-server relationship might be set to the middle reference, with one downward link for each client, while the TWGRelationship representing a "Workgroup" would just be named based on the workgroup name).

TWGRelationship instances should be assigned ID strings when constructed, to allow easier lookup of existing instances in a TWGRelationshipSet by TWGAssociation subclasses. If an ID isn't provided, the ID will be generated based on the object ID of the TWGRelationship instance.

See Also:
TWGAssociation, TWGManagedObject, TWGRelationshipSet, IntValueSet

Field Summary
static int ATTRIB_FLAGS_USE_REL_DATA
          Attribute flag denoting console should use mo data instead of ro
static long NO_IS_A_MANAGED_OBJECT
          No is-a managed object associated with relationship
static long NO_PRIMARY_UPLINK_ID
          ID returned when no primary uplink is defined
 
Constructor Summary
TWGRelationship(TWGRelationship parent, TWGRelationshipSet rel_set, java.lang.String relationship_id)
          Constructor for relationship instance : creates instance of relationship with given parent relationship and given relationship set.
TWGRelationship(TWGRelationship parent, TWGRelationshipSet rel_set, java.lang.String relationship_id, TWGImageSet imageset)
          Constructor for relationship instance : creates instance of relationship with given parent relationship and given relationship set.
 
Method Summary
 void AddDownLink(long oid)
          Add downward link to object ID
 void AddDownLink(LongValueSet oids)
          Add downward link to object IDs
 void AddDownLink(TWGManagedObject obj)
          Add downward link to TWGManagedObject instance
 void AddDownLink(TWGRelationship obj)
          Add downward link to TWGRelationship instance
 void AddUpLink(TWGRelationship obj)
          Add upward link to TWGRelationship
 void AttachObjectToConsole(TWGActiveConsole act_con)
          Associate the object with the given TWGActiveConsole instance.
 boolean containsDownLink(long oid)
          Test if given object is a down-link
 void Delete()
          Delete method for object
 void DetachObjectFromAllConsoles()
          Disassociate the object from all TWGActiveConsoles.
 void DetachObjectFromConsole(TWGActiveConsole act_con)
          Disassociate the object from the given TWGActiveConsole instance.
 java.lang.String GetConShadowClass()
          Get name of console shadow class.
 LongValueSet getDownLinks()
          Get the set of downlinks for this relationship
 TWGManagedObject getIsAObject()
          Get object associated with relationship
 java.lang.String getName()
          Get name of relationship (use default locale)
 java.lang.String getName(java.util.Locale loc)
          Get name of relationship (using given locale)
 long getPrimaryUplinkID()
          Get object ID of the primary up-link, or NO_PRIMARY_UPLINK_ID if none defined.
 java.lang.String getRelationshipID()
          Get relationship ID string
 byte[] GetShadowRecord(java.util.Locale locale)
          Get buffer containing current values of the shadowed attributes to be delivered to the console shadow class.
 long GetShadowVersion()
          Get object state version.
 boolean isRelationshipConsoleInfo()
          Test if the console should get the image to display and the name to label the object with from the relationship object rather than from the managed object for the case where the relationship object is a managed object.
 void removeAllLinksToManagedObject(TWGManagedObject mo)
          Remove all links to given managed object: used when TWGManagedObject is deleted.
 void removeAllLinksToManagedObjectList(IntValueSet mo_set)
          Remove all links to list of managed object IDs
 void removeAllLinksToManagedObjectList(LongValueSet mo_set)
          Remove all links to list of managed object IDs
 void RemoveDownLink(long oid)
          Remove downward link to object ID
 void RemoveDownLink(LongValueSet oids)
          Remove downward link to object IDs
 void RemoveDownLink(TWGManagedObject obj)
          Remove downward link to TWGManagedObject
 void RemoveDownLink(TWGRelationship obj)
          Remove downward link to TWGRelationship
 void RemoveUpLink(TWGRelationship obj)
          Remove upward link to TWGRelationship
 void setIsAObject(TWGManagedObject obj)
          Set managed object association with relationship
 void setName(java.lang.String n)
          Set name of relationship
 void setName(java.lang.String nameid, java.lang.String namerb)
          Set name of relationship using resouce bundle name and ID
 void setPrimaryUplinkID(long new_oid)
          Set object ID of the primary up-link, or zero if none defined
 void setRelationshipConsoleInfo(boolean useRelData)
          Set attribute flag indicating that for this relationship object, if the relationship is a managed object, then the console should get the image to display and the name to label the object with from the relationship object instead of from the managed object.
 void setRelationshipID(java.lang.String new_id)
          Set relationship ID string
 void UpdateShadowVersion()
          Update object state version.
 
Methods inherited from class com.tivoli.twg.engine.TWGObject
AllObjects, AllObjects, Destroy, DumpTWGObjects, FindObject, isDeleted, isNewObject, isPersistent, isPersistent, isValid, isValid, ObjectID, setDistinctObjectID, SetObjectID
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

NO_PRIMARY_UPLINK_ID

public static final long NO_PRIMARY_UPLINK_ID
ID returned when no primary uplink is defined

See Also:
Constant Field Values

NO_IS_A_MANAGED_OBJECT

public static final long NO_IS_A_MANAGED_OBJECT
No is-a managed object associated with relationship

See Also:
Constant Field Values

ATTRIB_FLAGS_USE_REL_DATA

public static final int ATTRIB_FLAGS_USE_REL_DATA
Attribute flag denoting console should use mo data instead of ro

See Also:
Constant Field Values
Constructor Detail

TWGRelationship

public TWGRelationship(TWGRelationship parent,
                       TWGRelationshipSet rel_set,
                       java.lang.String relationship_id)
                throws InvalidObjectIDException
Constructor for relationship instance : creates instance of relationship with given parent relationship and given relationship set. If a parent is specified, a downlink from the parent to the new relationship object is automatically added.

Parameters:
parent - - Parent ("primary up-link") TWGRelationship, or null if none
rel_set - - TWGRelationshipSet to contain new TWGRelationship
relationship_id - - ID string of relationship object
Throws:
InvalidObjectIDException - if invalid object
InvalidObjectIDException

TWGRelationship

public TWGRelationship(TWGRelationship parent,
                       TWGRelationshipSet rel_set,
                       java.lang.String relationship_id,
                       TWGImageSet imageset)
                throws InvalidObjectIDException
Constructor for relationship instance : creates instance of relationship with given parent relationship and given relationship set. If a parent is specified, a downlink from the parent to the new relationship object is automatically added.

Parameters:
parent - - Parent ("primary up-link") TWGRelationship, or null if none
rel_set - - TWGRelationshipSet to contain new TWGRelationship
relationship_id - - ID string of relationship object
imageset - - Set of images for association - images needed:

index 0 is 16x16 'open'

index 1 is 16x16 'closed'

index 2 is 32x32 'open'

index 3 is 32x32 'closed'

null if no images for relationship

Throws:
InvalidObjectIDException - if invalid object
InvalidObjectIDException
Method Detail

Delete

public void Delete()
Delete method for object

Overrides:
Delete in class TWGObject

AddDownLink

public void AddDownLink(TWGManagedObject obj)
                 throws InvalidObjectIDException
Add downward link to TWGManagedObject instance

Parameters:
obj - - object to be added
Throws:
InvalidObjectIDException - if invalid object
InvalidObjectIDException

AddDownLink

public void AddDownLink(TWGRelationship obj)
                 throws InvalidObjectIDException
Add downward link to TWGRelationship instance

Parameters:
obj - - object to be added
Throws:
InvalidObjectIDException - if invalid object
InvalidObjectIDException

AddDownLink

public void AddDownLink(long oid)
Add downward link to object ID

Parameters:
oid - - object ID to be added

AddDownLink

public void AddDownLink(LongValueSet oids)
Add downward link to object IDs

Parameters:
oids - - object IDs to be added

RemoveDownLink

public void RemoveDownLink(TWGManagedObject obj)
                    throws InvalidObjectIDException
Remove downward link to TWGManagedObject

Parameters:
obj - - object to be removed
Throws:
InvalidObjectIDException - if invalid object
InvalidObjectIDException

RemoveDownLink

public void RemoveDownLink(TWGRelationship obj)
                    throws InvalidObjectIDException
Remove downward link to TWGRelationship

Parameters:
obj - - object to be removed
Throws:
InvalidObjectIDException - if invalid object
InvalidObjectIDException

RemoveDownLink

public void RemoveDownLink(long oid)
Remove downward link to object ID

Parameters:
oid - - object ID to be removed

RemoveDownLink

public void RemoveDownLink(LongValueSet oids)
Remove downward link to object IDs

Parameters:
oids - - object IDs to be removed

AddUpLink

public void AddUpLink(TWGRelationship obj)
               throws InvalidObjectIDException
Add upward link to TWGRelationship

Parameters:
obj - - object to be added
Throws:
InvalidObjectIDException - if invalid object
InvalidObjectIDException

RemoveUpLink

public void RemoveUpLink(TWGRelationship obj)
                  throws InvalidObjectIDException
Remove upward link to TWGRelationship

Parameters:
obj - - object to be removed
Throws:
InvalidObjectIDException - if invalid object
InvalidObjectIDException

containsDownLink

public boolean containsDownLink(long oid)
Test if given object is a down-link

Parameters:
oid - - object ID to be tested
Returns:
true if present, false if not

getName

public java.lang.String getName()
Get name of relationship (use default locale)

Returns:
name

getName

public java.lang.String getName(java.util.Locale loc)
Get name of relationship (using given locale)

Parameters:
loc - - locale of request
Returns:
name

setName

public void setName(java.lang.String n)
Set name of relationship

Parameters:
n - - new name

setName

public void setName(java.lang.String nameid,
                    java.lang.String namerb)
Set name of relationship using resouce bundle name and ID

Parameters:
nameid - - identifier for name
namerb - - name of resouce bundle containing name

setIsAObject

public void setIsAObject(TWGManagedObject obj)
                  throws InvalidObjectIDException
Set managed object association with relationship

Parameters:
obj - - TWGManagedObject associated with relationship, or null if none
Throws:
InvalidObjectIDException - if invalid object
InvalidObjectIDException

getIsAObject

public TWGManagedObject getIsAObject()
Get object associated with relationship

Returns:
reference to TWGManagedObject, or null if none

getRelationshipID

public java.lang.String getRelationshipID()
Get relationship ID string

Returns:
relationship ID string, or null if none

setRelationshipID

public void setRelationshipID(java.lang.String new_id)
Set relationship ID string

Parameters:
new_id - - new ID string value

setRelationshipConsoleInfo

public void setRelationshipConsoleInfo(boolean useRelData)
Set attribute flag indicating that for this relationship object, if the relationship is a managed object, then the console should get the image to display and the name to label the object with from the relationship object instead of from the managed object.

Parameters:
useRelData - if true, use the data from the relationship object, otherwise use the data from the managed object.

isRelationshipConsoleInfo

public boolean isRelationshipConsoleInfo()
Test if the console should get the image to display and the name to label the object with from the relationship object rather than from the managed object for the case where the relationship object is a managed object.

Returns:
if true, use the data from the relationship object, otherwise use the data from the managed object.

UpdateShadowVersion

public void UpdateShadowVersion()
Update object state version. This method must call the TWGActiveConsole.nextShadowVersion() to update its internal state_version attribute (a long instance variable).

This method should be called by any methods of the object's class or subclasses which modify attributes which are send to the shadow objects on the console).

Specified by:
UpdateShadowVersion in interface TWGBaseShadowedObject

GetShadowVersion

public long GetShadowVersion()
Get object state version. This returns value of state_version.

Specified by:
GetShadowVersion in interface TWGBaseShadowedObject
Returns:
state_version attribute value

GetConShadowClass

public java.lang.String GetConShadowClass()
Get name of console shadow class. This returns the name of TWGConObject subclass which is used to hold the attributes shadowed to the console.

Specified by:
GetConShadowClass in interface TWGBaseShadowedObject
Returns:
com.tivoli.twg.engine.TWGConObject subclass which object shadows to

GetShadowRecord

public byte[] GetShadowRecord(java.util.Locale locale)
Get buffer containing current values of the shadowed attributes to be delivered to the console shadow class. This data is delivered along with the ObjectID (so the ObjectID shouldn't be included in the shadowed data record).

Specified by:
GetShadowRecord in interface TWGBaseShadowedObject
Parameters:
locale - - Locale of requested data
Returns:
byte array containing opaque data representation of attribute values to be delivered to the console shadow class.

AttachObjectToConsole

public void AttachObjectToConsole(TWGActiveConsole act_con)
Associate the object with the given TWGActiveConsole instance. This method should simply call the TWGActiveConsole.objectAddToConsole() method.

Specified by:
AttachObjectToConsole in interface TWGConsoleSpecShadowedObject
Parameters:
act_con - - Active console instance to be associated with

DetachObjectFromConsole

public void DetachObjectFromConsole(TWGActiveConsole act_con)
Disassociate the object from the given TWGActiveConsole instance. This method should simply call the TWGActiveConsole.objectRemoveFromConsole() method.

Specified by:
DetachObjectFromConsole in interface TWGConsoleSpecShadowedObject
Parameters:
act_con - - Active console instance to be disassociated from

DetachObjectFromAllConsoles

public void DetachObjectFromAllConsoles()
Disassociate the object from all TWGActiveConsoles. This method should simply call the TWGActiveConsole.objectRemoveFromAllConsoles() method.

Specified by:
DetachObjectFromAllConsoles in interface TWGConsoleSpecShadowedObject

getPrimaryUplinkID

public long getPrimaryUplinkID()
Get object ID of the primary up-link, or NO_PRIMARY_UPLINK_ID if none defined.

Returns:
Object ID of primary up-link, or NO_PRIMARY_UPLINK_ID if none

setPrimaryUplinkID

public void setPrimaryUplinkID(long new_oid)
Set object ID of the primary up-link, or zero if none defined

Parameters:
new_oid - - new value for uplink object, or NO_PRIMARY_UPLINK_ID if none

getDownLinks

public LongValueSet getDownLinks()
Get the set of downlinks for this relationship

Returns:
down_links or empty LongValueSet if none

removeAllLinksToManagedObject

public void removeAllLinksToManagedObject(TWGManagedObject mo)
Remove all links to given managed object: used when TWGManagedObject is deleted.

Parameters:
mo - - managed object to be scrubbed from TWGRelationship

removeAllLinksToManagedObjectList

public void removeAllLinksToManagedObjectList(LongValueSet mo_set)
Remove all links to list of managed object IDs

Parameters:
mo_set - - list of managed object IDs to be scrubbed

removeAllLinksToManagedObjectList

public void removeAllLinksToManagedObjectList(IntValueSet mo_set)
Remove all links to list of managed object IDs

Parameters:
mo_set - - list of managed object persistent IDs to be scrubbed