com.tivoli.twg.engine
Class TWGUser

java.lang.Object
  extended bycom.tivoli.twg.engine.TWGObject
      extended bycom.tivoli.twg.engine.TWGPersistentObject
          extended bycom.tivoli.twg.engine.TWGUser
All Implemented Interfaces:
TWGBaseShadowedObject, TWGConsoleSpecShadowedObject, TWGGetSetInterface, TWGProtectedGetSetInterface

public class TWGUser
extends TWGPersistentObject
implements TWGProtectedGetSetInterface, TWGConsoleSpecShadowedObject

User (administrator) accounts defined for the Director Server.


Field Summary
 
Fields inherited from class com.tivoli.twg.engine.TWGPersistentObject
SIZEOF_BYTE, SIZEOF_CHAR, SIZEOF_DOUBLE, SIZEOF_FLOAT, SIZEOF_INT, SIZEOF_LONG, SIZEOF_SHORT
 
Constructor Summary
TWGUser()
          default constructor (required by TWGPersistentObject).
TWGUser(java.lang.String uid, java.lang.String password)
          constructor.
 
Method Summary
 void addFilterToFilterAccessList(long new_foid)
          Add new filter ID to access list
 void addTaskToTaskAccessList(long new_toid)
          Add new task ID to access list
 void AttachObjectToConsole(TWGActiveConsole act_con)
          Associate the object with the given TWGActiveConsole instance.
 void Destroy()
          method for destroying user (e.g.
 void DetachObjectFromAllConsoles()
          Disassociate the object from all TWGActiveConsoles.
 void DetachObjectFromConsole(TWGActiveConsole act_con)
          Disassociate the object from the given TWGActiveConsole instance.
static void filterDeleted(TWGFilter flt)
          Handle destroy of a given filter instance
static TWGUser find(java.lang.String name)
          class method for finding user object by name.
static java.lang.String[] getAllUserIDs()
          Get all user ID names
static TWGUser[] getAllUsers()
          Get all users
 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 identifier)
          Get type of attribute value for given attribute
 DataValue getAttributeValue(java.lang.String identifier, java.util.Locale locale)
          Get value of attribute with given ID
 DataValue getAttributeValue(java.lang.String id, java.util.Locale loc, TWGUser usr)
          Get value of attribute with given ID
 java.lang.String GetConShadowClass()
          Get name of console shadow class.
 java.lang.String getDescription()
          method for getting user description.
 java.lang.String getEmail()
          method for getting user email address.
 LongValueSet getFilterAccessList()
          Get filter access list
 java.lang.String getFullName()
          method for getting users full name.
 java.lang.String getLocale()
          Get locale for user
 java.lang.String getName()
          method for getting user name.
 java.lang.String getPager()
          method for getting user pager info.
 java.lang.String getPassword()
          method for getting user password.
 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.
 LongValueSet getTaskAccessList()
          Get task access list
static void handlePropertiesCommand(Command command)
          Properties command handler.
 boolean hasPrivilege(java.lang.String priv_id)
          Test if user has given privilege
static void initializationComplete()
          Update and validate all user properties
static void initialize()
          Initialize user information and profiles
 boolean isFilterAccessable(TWGFilter flt)
          Test if specific filter is accessable by user
 boolean isFilterLimited()
          Test if filter restrictions are active
 boolean isReadOnlyFilterAccess()
          Is user limited to read-only access to filters
 boolean isTaskAccessable(TWGTask tsk)
          Test if specific task is accessable by user
 boolean isTaskLimited()
          Test if task restrictions are active
static LongValueSet parseLongListString(java.lang.String p)
          Parse string into long value set
static StringValueSet parseStringListString(java.lang.String p)
          Parse string into string value set
static java.lang.String printLongListString(LongValueSet s)
          Write long value set to string
static java.lang.String printStringListString(StringValueSet s)
          Write string value set to string
static void removeFilterID(TWGFilter filter)
          Delete all references to given filter
static void removeTaskID(TWGTask task)
          Delete all references to given task
protected  void restoreData(TWGPersistentObjectDictionary dictionary, boolean resolveObjectReferences)
          method for restoring persistent object data.
protected  void saveData(TWGPersistentObjectDictionary dictionary)
          method for saving persistent object data.
static void saveDefaults()
          Save updated defaults
 void setAccessFlags(int new_af)
          Update access flags
 boolean setAttributeValue(java.lang.String identifier, DataValue value)
          Set value of attribute with given ID
 boolean setAttributeValue(java.lang.String id, DataValue val, TWGUser usr)
          Set value of attribute with given ID
 void setDescription(java.lang.String desc)
          method for setting user description.
 void setEmail(java.lang.String Email)
          method for setting user email address.
 void setFilterAccessList(long[] new_flt)
          Replace filter access list with new list
 void setFullName(java.lang.String fName)
          method for setting users full name.
 void setLocale(java.lang.String loc)
          Set locale for user
 void SetObjectID(long oid)
          Set object ID.
 void setPager(java.lang.String Pager)
          method for setting user pager info.
 void setPassword(java.lang.String pwd)
          method for setting user password.
 void setTaskAccessList(long[] new_tal)
          Replace task access list with new list
static void taskDeleted(TWGTask tsk)
          Handle destroy of a given task instance
 java.lang.String toString()
          Returns a string representation of the object.
 void UpdateShadowVersion()
          Update object state version.
 
Methods inherited from class com.tivoli.twg.engine.TWGPersistentObject
enableAsyncWrites, fromPersistID, isNewPersistentStore, isSaveRequired, PersistID, restore, restoreAll, save, save, setSaveRequired, terminate, toPersistID
 
Methods inherited from class com.tivoli.twg.engine.TWGObject
AllObjects, AllObjects, Delete, DumpTWGObjects, FindObject, isDeleted, isNewObject, isPersistent, isPersistent, isValid, isValid, ObjectID, setDistinctObjectID
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

TWGUser

public TWGUser()
default constructor (required by TWGPersistentObject).


TWGUser

public TWGUser(java.lang.String uid,
               java.lang.String password)
constructor.

Parameters:
uid - user name.
password - user password.
Method Detail

find

public static TWGUser find(java.lang.String name)
class method for finding user object by name.

Parameters:
name - user name.
Returns:
TWGUser user object or null if not found.

Destroy

public void Destroy()
             throws TWGObjectDestroyException
method for destroying user (e.g. properties).

Overrides:
Destroy in class TWGPersistentObject
Throws:
TWGObjectDestroyException - thrown when unable to destroy object.

getName

public java.lang.String getName()
method for getting user name.

Returns:
String user name.

getFullName

public java.lang.String getFullName()
method for getting users full name.

Returns:
String full name.

getDescription

public java.lang.String getDescription()
method for getting user description.

Returns:
String description.

getPassword

public java.lang.String getPassword()
method for getting user password.

Returns:
String user password.

getEmail

public java.lang.String getEmail()
method for getting user email address.

Returns:
String email address.

getPager

public java.lang.String getPager()
method for getting user pager info.

Returns:
String pager info.

getLocale

public java.lang.String getLocale()
Get locale for user

Returns:
locale code, as 2-char language code, followed by 2-char country code

setFullName

public void setFullName(java.lang.String fName)
method for setting users full name.

Parameters:
fName - users full name.

setDescription

public void setDescription(java.lang.String desc)
method for setting user description.

Parameters:
desc - user description.

setPassword

public void setPassword(java.lang.String pwd)
method for setting user password.

Parameters:
pwd - user password.

setEmail

public void setEmail(java.lang.String Email)
method for setting user email address.

Parameters:
Email - user email address.

setPager

public void setPager(java.lang.String Pager)
method for setting user pager info.

Parameters:
Pager - user pager info.

setLocale

public void setLocale(java.lang.String loc)
Set locale for user

Parameters:
loc - - locale for user (4 characters (2 language+2 country))

handlePropertiesCommand

public static void handlePropertiesCommand(Command command)
Properties command handler.


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.

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
Returns:
String[] list of attribute ID strings

getAttributeValue

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

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

setAttributeValue

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

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

getAttributeValue

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

Specified by:
getAttributeValue in interface TWGProtectedGetSetInterface
Parameters:
id - - attribute ID requested
loc - - locale to use for value, if applicable
usr - - user requesting attribute
Returns:
value object, or null if no value
Throws:
UserNotAuthorizedException - if request not allowed

setAttributeValue

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

Specified by:
setAttributeValue in interface TWGProtectedGetSetInterface
Parameters:
id - - attribute ID to be set
val - - attribute value to be set
usr - - user setting attribute
Returns:
true if set successful, false if not successful
Throws:
UserNotAuthorizedException - if request not allowed

getAttributeType

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

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

getAllUserIDs

public static java.lang.String[] getAllUserIDs()
Get all user ID names

Returns:
list of user ids

getAllUsers

public static TWGUser[] getAllUsers()
Get all users

Returns:
list of users

removeTaskID

public static void removeTaskID(TWGTask task)
Delete all references to given task

Parameters:
task - - task to remove

removeFilterID

public static void removeFilterID(TWGFilter filter)
Delete all references to given filter

Parameters:
filter - - filter to be removed

toString

public java.lang.String toString()
Returns a string representation of the object.

See Also:
Object.toString()

hasPrivilege

public boolean hasPrivilege(java.lang.String priv_id)
Test if user has given privilege

Parameters:
priv_id - - privilege ID to test for
Returns:
true if user has given privilege

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

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.

initialize

public static void initialize()
Initialize user information and profiles


initializationComplete

public static void initializationComplete()
Update and validate all user properties


saveDefaults

public static void saveDefaults()
Save updated defaults


printLongListString

public static java.lang.String printLongListString(LongValueSet s)
Write long value set to string

Parameters:
s - - long value set to write
Returns:
string representation

parseLongListString

public static LongValueSet parseLongListString(java.lang.String p)
Parse string into long value set

Parameters:
p - - string to be parsed
Returns:
value set containing long values parsed

printStringListString

public static java.lang.String printStringListString(StringValueSet s)
Write string value set to string

Parameters:
s - - string value set to write
Returns:
string representation

parseStringListString

public static StringValueSet parseStringListString(java.lang.String p)
Parse string into string value set

Parameters:
p - - string to be parsed
Returns:
value set containing string values parsed

filterDeleted

public static void filterDeleted(TWGFilter flt)
Handle destroy of a given filter instance

Parameters:
flt - - Filter which is being destroyed

taskDeleted

public static void taskDeleted(TWGTask tsk)
Handle destroy of a given task instance

Parameters:
tsk - - Task which is being destroyed

isFilterLimited

public boolean isFilterLimited()
Test if filter restrictions are active

Returns:
true if filters limited to specific IDs

isTaskLimited

public boolean isTaskLimited()
Test if task restrictions are active

Returns:
true if task limited to specific IDs

isReadOnlyFilterAccess

public boolean isReadOnlyFilterAccess()
Is user limited to read-only access to filters

Returns:
true if user is limited to read-only filter access

isFilterAccessable

public boolean isFilterAccessable(TWGFilter flt)
Test if specific filter is accessable by user

Parameters:
flt - - filter to be tested
Returns:
true if accesable, false if not

isTaskAccessable

public boolean isTaskAccessable(TWGTask tsk)
Test if specific task is accessable by user

Parameters:
tsk - - task to be tested
Returns:
true if accesable, false if not

setTaskAccessList

public void setTaskAccessList(long[] new_tal)
Replace task access list with new list

Returns:
new_tal - new task access list

getTaskAccessList

public LongValueSet getTaskAccessList()
Get task access list

Returns:
read-only reference to task access list

addTaskToTaskAccessList

public void addTaskToTaskAccessList(long new_toid)
Add new task ID to access list

Returns:
new_toid - new task OID

setFilterAccessList

public void setFilterAccessList(long[] new_flt)
Replace filter access list with new list

Returns:
new_flt - new filter access list

getFilterAccessList

public LongValueSet getFilterAccessList()
Get filter access list

Returns:
read-only reference to filter access list

addFilterToFilterAccessList

public void addFilterToFilterAccessList(long new_foid)
Add new filter ID to access list

Returns:
new_foid - new filter OID

setAccessFlags

public void setAccessFlags(int new_af)
Update access flags

Returns:
new_af - new access flags

SetObjectID

public void SetObjectID(long oid)
                 throws DuplicateObjectIDException
Set object ID. This method subclasses the TWGObject class's SetObjectID.

Overrides:
SetObjectID in class TWGObject
Parameters:
oid - - new object ID, or INVALID_OBJECT_ID if none
Throws:
DuplicateObjectIDException - if ID is duplicate