com.biocomfort.TO
Class UserSettingTO

java.lang.Object
  extended by com.biocomfort.TO.UserSettingTO
All Implemented Interfaces:
TO, java.io.Serializable, java.lang.Cloneable

public class UserSettingTO
extends java.lang.Object
implements TO, java.io.Serializable, java.lang.Cloneable

The UserSettingTO is a data class to store user setting information, such as available users and the currently activated user of a medical device. The manipulation of this data object can result in inconsistency. Therefore the object's state is set to 'unvalidated' after each data manipulation. Call the method validate() to revalidate a UserSettingTO object.

This data class is part of the class MedicalDeviceTO but initially not instantiated. To store user setting information for a medical device create a new instance of this class and assign it to the MedicalDeviceTO object.

See Also:
MedicalDeviceTO.setUserSetting(UserSettingTO), MedicalDeviceTO.getUserSetting(), validate(), Serialized Form

Constructor Summary
UserSettingTO()
          Constructs a UserSettingTO object with initializing it so that all users are deactivated, the current active user is set to user 1 and the validation state is set to 'no user set'.
UserSettingTO(int currentActiveUser, boolean activateUser1, boolean activateUser2, boolean activateUser3, boolean activateUser4, boolean activateUser5, boolean activateUser6, boolean activateUser7, boolean activateUser8)
          Constructs a UserSettingTO object with specifying the current active user by the given argument currentActiveUser and with specifying which users are active and available (for the medical device to whose MedicalDeviceTO object this user setting data object is assign to) by the arguments activateUser1 till activateUser8.
 
Method Summary
 java.lang.Object clone()
          Returns a deep clone of this UserSettingTO object.
 int getActiveUserCount()
          Returns the number of all currently activated users of the medical device to whose MedicalDeviceTO object this user setting data object is assign to.
 int[] getActiveUsers()
          Returns an integer array with the user numbers of all currently activated users of the medical device to whose MedicalDeviceTO object this user setting data object is assign to.
 int getCurrentActiveUser()
          Returns the current active user of the medical device to whose MedicalDeviceTO object this user setting data object is assign to.
 boolean[] getUserActive()
          This function is only used for serialization issues.
 boolean isNoUserSet()
          Returns true if the current object's validation state is 'no user set'.
 boolean isUnvalidated()
          Returns true if the current object's validation state is 'unvalidated'.
 boolean isUserActive(int userNumber)
          Returns true if the user specified by the parameter userNumber is activated.
 boolean isValid()
          Returns true if the current object's validation state is 'valid'.
 void reset()
          Resets this UserSettingTO object so that all users are deactivated, the current active user is set to user 1 and the validation state is set to 'no user set'.
 void setCurrentActiveUser(int userNumber)
          Sets the current active user of the medical device to whose MedicalDeviceTO object this user setting data object is assign to.
 void setUserActive(boolean[] userActive)
          This function is only used for serialization issues.
 void setUserActive(int userNumber, boolean active)
          Activates or deactivates the user specified by the parameter userNumber.
 java.lang.String toString()
          Converts this UserSettingTO object to a String of the form: UserSettingTO (currentActiveUser:c,userActive:[a,a,a,a,a,a,a,a],state:s).
 void validate()
          Validates this UserSettingTO object if it is unvalidated.
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

UserSettingTO

public UserSettingTO()
Constructs a UserSettingTO object with initializing it so that all users are deactivated, the current active user is set to user 1 and the validation state is set to 'no user set'.


UserSettingTO

public UserSettingTO(int currentActiveUser,
                     boolean activateUser1,
                     boolean activateUser2,
                     boolean activateUser3,
                     boolean activateUser4,
                     boolean activateUser5,
                     boolean activateUser6,
                     boolean activateUser7,
                     boolean activateUser8)
Constructs a UserSettingTO object with specifying the current active user by the given argument currentActiveUser and with specifying which users are active and available (for the medical device to whose MedicalDeviceTO object this user setting data object is assign to) by the arguments activateUser1 till activateUser8.

Parameters:
currentActiveUser - the current active user
activateUser1 - true if the user 1 is activated, false otherwise
activateUser2 - true if the user 2 is activated, false otherwise
activateUser3 - true if the user 3 is activated, false otherwise
activateUser4 - true if the user 4 is activated, false otherwise
activateUser5 - true if the user 5 is activated, false otherwise
activateUser6 - true if the user 6 is activated, false otherwise
activateUser7 - true if the user 7 is activated, false otherwise
activateUser8 - true if the user 8 is activated, false otherwise
Method Detail

reset

public void reset()
Resets this UserSettingTO object so that all users are deactivated, the current active user is set to user 1 and the validation state is set to 'no user set'.


validate

public void validate()
Validates this UserSettingTO object if it is unvalidated. If the current active user is not activated it will be set to the first activated user that is found. The current data object's validation state is set to 'no user activated' in case that no users are activated otherwise it is set to 'valid'.

All methods that manipulates this user setting data object will set the data object's state to 'unvalidated'. Call this method to revalidate the state.

See Also:
isUnvalidated(), isValid(), isNoUserSet()

isNoUserSet

public boolean isNoUserSet()
Returns true if the current object's validation state is 'no user set'. This will only be the case after calling the validate() method of an UserSettingTO object thats users are all deactivate.

Returns:
true if the current data object's state is 'no user set'
See Also:
validate()

isUnvalidated

public boolean isUnvalidated()
Returns true if the current object's validation state is 'unvalidated'. The object's validation state will be set automatically to 'unvalidated' after an object's manipulation method was called. The method validate() will revalidate a UserSettingTO object.

Returns:
true if the current data object's state is 'unvalidated'.
See Also:
validate()

isValid

public boolean isValid()
Returns true if the current object's validation state is 'valid'. The object's validation state will be set to 'valid' within the method validate() in case that any user is activated.

Returns:
true if the current data object's state is 'valid'
See Also:
validate()

isUserActive

public boolean isUserActive(int userNumber)
Returns true if the user specified by the parameter userNumber is activated. This parameter must be a number between 1-8.

Parameters:
userNumber - the medical device's user number between 1-8
Returns:
true if the medical device's user is activated

setUserActive

public void setUserActive(int userNumber,
                          boolean active)
Activates or deactivates the user specified by the parameter userNumber. This parameter must be a number between 1 and 8.

This method can result in inconsistency of the object's data. Therefore the validation state of this UserSettingTO object will be set to 'unvalidated'. Call the method validate() to revalidate this object.

Parameters:
userNumber - the medical device's user number between 1-8
active - true activates the medical device's user, false deactivates it
See Also:
validate()

getCurrentActiveUser

public int getCurrentActiveUser()
Returns the current active user of the medical device to whose MedicalDeviceTO object this user setting data object is assign to.

Returns:
the current medival device's active user number between 1-8

setCurrentActiveUser

public void setCurrentActiveUser(int userNumber)
Sets the current active user of the medical device to whose MedicalDeviceTO object this user setting data object is assign to.

This method can result in inconsistency of the object's data. Therefore the validation state of this UserSettingTO object will be set to 'unvalidated'. Call the method validate() to revalidate this object.

Parameters:
userNumber - the medival device's active user number between 1-8
See Also:
validate()

getActiveUserCount

public int getActiveUserCount()
Returns the number of all currently activated users of the medical device to whose MedicalDeviceTO object this user setting data object is assign to.

Returns:
the number of all currently activated users

getActiveUsers

public int[] getActiveUsers()
Returns an integer array with the user numbers of all currently activated users of the medical device to whose MedicalDeviceTO object this user setting data object is assign to. Each element of the returned array represents a medical device's user number of an activated user. These numbers are between 1-8.

Returns:
an int array containing all currently activated user numbers (each between 1-8)

toString

public java.lang.String toString()
Converts this UserSettingTO object to a String of the form:
 UserSettingTO (currentActiveUser:c,userActive:[a,a,a,a,a,a,a,a],state:s).
 
where:

Overrides:
toString in class java.lang.Object

clone

public java.lang.Object clone()
                       throws java.lang.CloneNotSupportedException
Returns a deep clone of this UserSettingTO object.

Overrides:
clone in class java.lang.Object
Returns:
a deep clone of this instance
Throws:
java.lang.CloneNotSupportedException

getUserActive

public boolean[] getUserActive()
This function is only used for serialization issues. Do not use it. The methods isUserActive(int) or getActiveUsers() can be used instead.

Returns:
a boolean array that describes which medical device's users are activate
See Also:
isUserActive(int), getActiveUsers()

setUserActive

public void setUserActive(boolean[] userActive)
This function is only used for serialization issues. Do not use it. The method setUserActive(int, boolean) can be used instead.

Parameters:
userActive - a boolean array that describes which medical device's users are activated
See Also:
setUserActive(int, boolean)