com.tivoli.twg.engine
Class TWGManagedObjectStatusGroup

java.lang.Object
  extended bycom.tivoli.twg.engine.TWGObject
      extended bycom.tivoli.twg.engine.TWGPersistentObject
          extended bycom.tivoli.twg.engine.TWGManagedObjectStatusGroup
All Implemented Interfaces:
TWGBaseShadowedObject, TWGGetSetDescInterface, TWGGetSetInterface, TWGShadowedObject

public class TWGManagedObjectStatusGroup
extends TWGPersistentObject
implements TWGShadowedObject, TWGGetSetDescInterface

Class for providing a related group of managed object status definitions. The group has a token name and presentation labels, as well as one or more status definitions. Each status definition includes a token ID, image set (for the small and large icons used for displaying the status), a descriptive label and hover text, status flags, and an optional task association. Managed object status definitions are associated or disassociated with a managed object by using the status set token ID and status definition token ID. The status set maintains a set of managed object IDs for tracking which managed objects have been associated with a given definition. The state of the status set is reflected to the console using the TWGConManagedObjectStatusGroup class.


Field Summary
 
Fields inherited from class com.tivoli.twg.engine.TWGPersistentObject
CLASS_NAME, SIZEOF_BYTE, SIZEOF_CHAR, SIZEOF_DOUBLE, SIZEOF_FLOAT, SIZEOF_INT, SIZEOF_LONG, SIZEOF_SHORT
 
Constructor Summary
TWGManagedObjectStatusGroup()
          Default constructor - used during restore only
TWGManagedObjectStatusGroup(java.lang.String id, DataValue lab, DataValue hover_str, TWGExtension extension)
          Standard constructor for creating a status set - need to call save() once object definition is complete to make definition persistent
 
Method Summary
 void addStatusDefinition(java.lang.String id, DataValue lab, DataValue hover, int flgs, java.lang.String task_id, java.lang.String subtask_id, TWGImageSet img_set)
          Add new status definition - need to call save() after updates complete
 void addStatusDefinition(java.lang.String id, DataValue lab, DataValue hover, int flgs, java.lang.String task_id, java.lang.String subtask_id, TWGImageSet img_set, int sev, int sortwt)
          Add new status definition - need to call save() after updates complete
 void Delete()
          Handle delete of object
 boolean deleteStatusDefinition(java.lang.String id)
          Delete status definition - need to call save() after updates complete
static TWGManagedObjectStatusGroup findStatusGroup(java.lang.String id)
          Find status group with given ID
static TWGManagedObjectStatusGroup[] getAllStatusGroups()
          Get all status groups
 java.lang.String[] getAllStatusIDs()
          Get all status definition IDs
 java.lang.String getAttributeDescription(java.lang.String id, java.util.Locale loc)
          Get description string for given attribute in given locale
 java.lang.String[] getAttributeIDList()
          Attribute ID enumeration : this method is expected to return a List of strings containing the String names of the attributes supported for a given object.
 int getAttributeType(java.lang.String id)
          Get type of attribute value for given attribute
 DataValue getAttributeValue(java.lang.String id, java.util.Locale loc)
          Get value of attribute with given ID
 java.lang.String getAttributeValueString(java.lang.String id, java.util.Locale loc)
          Get descriptive value string for given attribute in given locale
 java.lang.String GetConShadowClass()
          Get name of console shadow class.
 java.lang.String getExtensionClassname()
          Get extension class associated with status group
 int getGroupFlags()
          Get status group flags
 DataValue getGroupHoverHelp()
          Get status group hover help, as DataValue
 java.lang.String getGroupHoverHelp(java.util.Locale loc)
          Get status group hover help for given locale
 java.lang.String getGroupID()
          Get status group token ID
 TWGImageSet getGroupImageSet()
          Get group image set
 DataValue getGroupLabel()
          Get status group label, as DataValue
 java.lang.String getGroupLabel(java.util.Locale loc)
          Get status group label for given locale
 int getGroupSortWeight()
          Get status group sort weight
 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.
 TWGImageSet getStatusImageSet(java.lang.String id)
          Get status image set for status definition with given ID
 DataValue getStatusLabel(java.lang.String id)
          Get status label for status definition with given ID
static boolean isValidStatusDefinition(java.lang.String grp_id, java.lang.String stat_id)
          Test if given group ID and definition ID are valid
protected  void restoreData(TWGPersistentObjectDictionary dictionary, boolean resolveObjectReferences)
          Method for restoring persistent object data.
protected  void saveData(TWGPersistentObjectDictionary dictionary)
          Method for saving persistent object data.
 boolean setAttributeValue(java.lang.String id, DataValue val)
          Set value of attribute with given ID
 void setExtensionClassname(java.lang.String ext)
          Set extension class associated with status group - need to call save() after updates complete
 void setGroupFlags(int f)
          Set status group flags - need to call save() after updates complete
 void setGroupHoverHelp(DataValue lab)
          Set status group hover help - need to call save() after updates complete
 void setGroupImageSet(TWGImageSet img)
          Set group image set - need to call save() after updates complete
 void setGroupLabel(DataValue lab)
          Set status group label - need to call save() after updates complete
 void setGroupSortWeight(int sw)
          Set status group sort weight - need to call save() after updates complete
 void UpdateShadowVersion()
          Update object state version.
 
Methods inherited from class com.tivoli.twg.engine.TWGPersistentObject
Destroy, enableAsyncWrites, fromPersistID, initialize, isNewPersistentStore, isSaveRequired, PersistID, restore, restoreAll, save, save, setSaveRequired, terminate, toPersistID
 
Methods inherited from class com.tivoli.twg.engine.TWGObject
AllObjects, AllObjects, 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
 

Constructor Detail

TWGManagedObjectStatusGroup

public TWGManagedObjectStatusGroup()
Default constructor - used during restore only


TWGManagedObjectStatusGroup

public TWGManagedObjectStatusGroup(java.lang.String id,
                                   DataValue lab,
                                   DataValue hover_str,
                                   TWGExtension extension)
                            throws DuplicateObjectIDException
Standard constructor for creating a status set - need to call save() once object definition is complete to make definition persistent

Parameters:
id - - token ID for status group (must be unique)
lab - - Display label/name for status set
hover_str - - Hover help string for status set (if null, lab is used)
extension - - Extension associated with status set (set will be dropped when extension is not active), null if none
Throws:
DuplicateObjectIDExtension - if token ID is match with existing set
DuplicateObjectIDException
Method Detail

Delete

public void Delete()
Handle delete of object

Overrides:
Delete in class TWGObject

saveData

protected void saveData(TWGPersistentObjectDictionary dictionary)
                 throws TWGPersistentObjectSaveException
Method for saving persistent object data.

Overrides:
saveData in class TWGPersistentObject
Throws:
TWGPersistentObjectSaveException - thrown to abort save procedure.

restoreData

protected void restoreData(TWGPersistentObjectDictionary dictionary,
                           boolean resolveObjectReferences)
                    throws TWGPersistentObjectRestoreException
Method for restoring persistent object data.

Overrides:
restoreData in class TWGPersistentObject
Parameters:
resolveObjectReferences - used to indicate if object references should be resolved during restore.
Throws:
TWGPersistentObjectRestoreException - thrown to abort restore procedure.

isValidStatusDefinition

public static boolean isValidStatusDefinition(java.lang.String grp_id,
                                              java.lang.String stat_id)
Test if given group ID and definition ID are valid

Parameters:
grp_id - - token ID for status group
stat_id - - token ID for status definition
Returns:
true if defined, false if not

findStatusGroup

public static TWGManagedObjectStatusGroup findStatusGroup(java.lang.String id)
Find status group with given ID

Parameters:
id - - status group ID
Returns:
status group, or null if not found

getAllStatusGroups

public static TWGManagedObjectStatusGroup[] getAllStatusGroups()
Get all status groups

Returns:
status groups

getAllStatusIDs

public java.lang.String[] getAllStatusIDs()
Get all status definition IDs

Returns:
status definition IDs

getStatusLabel

public DataValue getStatusLabel(java.lang.String id)
Get status label for status definition with given ID

Parameters:
id - - status ID
Returns:
DataValue of status label, or null if none

getStatusImageSet

public TWGImageSet getStatusImageSet(java.lang.String id)
Get status image set for status definition with given ID

Parameters:
id - - status ID
Returns:
TWGImageSet of status, or null if none

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.

getGroupLabel

public DataValue getGroupLabel()
Get status group label, as DataValue

Returns:
DataValue for status group label

getGroupLabel

public java.lang.String getGroupLabel(java.util.Locale loc)
Get status group label for given locale

Parameters:
loc - - locale to resolve label to
Returns:
label, or null if not found

setGroupLabel

public void setGroupLabel(DataValue lab)
Set status group label - need to call save() after updates complete

Parameters:
lab - - new value for status group label

getGroupHoverHelp

public DataValue getGroupHoverHelp()
Get status group hover help, as DataValue

Returns:
DataValue for status group hover help

getGroupHoverHelp

public java.lang.String getGroupHoverHelp(java.util.Locale loc)
Get status group hover help for given locale

Parameters:
loc - - locale to resolve label to
Returns:
label, or null if not found

setGroupHoverHelp

public void setGroupHoverHelp(DataValue lab)
Set status group hover help - need to call save() after updates complete

Parameters:
lab - - new value for status group hover help

getGroupID

public java.lang.String getGroupID()
Get status group token ID

Returns:
token ID

getExtensionClassname

public java.lang.String getExtensionClassname()
Get extension class associated with status group

Returns:
extension classname, or "" if none

setExtensionClassname

public void setExtensionClassname(java.lang.String ext)
Set extension class associated with status group - need to call save() after updates complete

Parameters:
ext - - extension classname

getGroupFlags

public int getGroupFlags()
Get status group flags

Returns:
flags

setGroupFlags

public void setGroupFlags(int f)
Set status group flags - need to call save() after updates complete

Parameters:
f - - new flags value

getGroupSortWeight

public int getGroupSortWeight()
Get status group sort weight

Returns:
sort weight

setGroupSortWeight

public void setGroupSortWeight(int sw)
Set status group sort weight - need to call save() after updates complete

Parameters:
sw - - new sort weight value

getGroupImageSet

public TWGImageSet getGroupImageSet()
Get group image set

Returns:
image set, or null if none

setGroupImageSet

public void setGroupImageSet(TWGImageSet img)
Set group image set - need to call save() after updates complete

Parameters:
img - - image set
Throws:
InvalidObjectIDException - if invalid image set

addStatusDefinition

public void addStatusDefinition(java.lang.String id,
                                DataValue lab,
                                DataValue hover,
                                int flgs,
                                java.lang.String task_id,
                                java.lang.String subtask_id,
                                TWGImageSet img_set,
                                int sev,
                                int sortwt)
                         throws DuplicateObjectIDException
Add new status definition - need to call save() after updates complete

Parameters:
id - - status definition ID (must be unique within status group)
lab - - status definition label
hover - - status definition hover help
flgs - - status definition flags
task_id - - task ID of task associated with definition, null if none
subtask_id - - subtask ID of subtask associated with definition, null if none
img_set - - image set for status definition
sev - - severity of status (STATUS_SEVERITY_*)
sortwt - - sort weight of status
Throws:
DuplicateObjectIDException - if ID already exists

addStatusDefinition

public void addStatusDefinition(java.lang.String id,
                                DataValue lab,
                                DataValue hover,
                                int flgs,
                                java.lang.String task_id,
                                java.lang.String subtask_id,
                                TWGImageSet img_set)
                         throws DuplicateObjectIDException
Add new status definition - need to call save() after updates complete

Parameters:
id - - status definition ID (must be unique within status group)
lab - - status definition label
hover - - status definition hover help
flgs - - status definition flags
task_id - - task ID of task associated with definition, null if none
subtask_id - - subtask ID of subtask associated with definition, null if none
img_set - - image set for status definition
Throws:
DuplicateObjectIDException - if ID already exists

deleteStatusDefinition

public boolean deleteStatusDefinition(java.lang.String id)
Delete status definition - need to call save() after updates complete

Parameters:
id - - ID of status definition to drop
Returns:
true if deleted, false if not deleted

getAttributeIDList

public java.lang.String[] getAttributeIDList()
Attribute ID enumeration : this method is expected to return a List of strings containing the String names of the attributes supported for a given object. Subclasses of base classes implementing the interface should report additional attributes by adding them to the list returned by the base class.

Specified by:
getAttributeIDList in interface TWGGetSetInterface

getAttributeValue

public DataValue getAttributeValue(java.lang.String id,
                                   java.util.Locale loc)
Get value of attribute with given ID

Specified by:
getAttributeValue in interface TWGGetSetInterface
Parameters:
id - - attribute ID requested
loc - - locale to use for value, if applicable
Returns:
value object, or null if no value

setAttributeValue

public boolean setAttributeValue(java.lang.String id,
                                 DataValue val)
Set value of attribute with given ID

Specified by:
setAttributeValue in interface TWGGetSetInterface
Parameters:
id - - attribute ID to be set
val - - attribute value to be set
Returns:
true if set successful, false if not successful

getAttributeType

public int getAttributeType(java.lang.String id)
Get type of attribute value for given attribute

Specified by:
getAttributeType in interface TWGGetSetInterface
Parameters:
id - - attribute ID
Returns:
DataValue type of attribute, or DataValue.NONE_TYPE if undefined

getAttributeDescription

public java.lang.String getAttributeDescription(java.lang.String id,
                                                java.util.Locale loc)
Get description string for given attribute in given locale

Specified by:
getAttributeDescription in interface TWGGetSetDescInterface
Parameters:
id - - attribute ID
loc - - locale to use for description
Returns:
description string, or null if not available

getAttributeValueString

public java.lang.String getAttributeValueString(java.lang.String id,
                                                java.util.Locale loc)
Get descriptive value string for given attribute in given locale

Specified by:
getAttributeValueString in interface TWGGetSetDescInterface
Parameters:
id - - attribute ID
loc - - locale to use for description
Returns:
descriptive string for attribute value, or null if not available