ca.bc.gov.webade.user
Class AbstractWebADEUserInfo

java.lang.Object
  extended byca.bc.gov.webade.user.AbstractWebADEUserInfo
All Implemented Interfaces:
java.io.Serializable, WebADEUserInfo
Direct Known Subclasses:
DefaultBusinessPartnerUserInfo, DefaultGovernmentUserInfo, DefaultIndividualUserInfo

public abstract class AbstractWebADEUserInfo
extends java.lang.Object
implements WebADEUserInfo, java.io.Serializable

Default implementation of the WebADEUserInfo. Each setter can only be called once, after which the set methods will throw a RuntimeException.

Author:
jason
See Also:
Serialized Form

Field Summary
protected static java.util.Date MAX_DATE
           
 
Fields inherited from interface ca.bc.gov.webade.user.WebADEUserInfo
DISPLAY_NAME, EMAIL_ADDRESS, EXPIRY_DATE, FIRST_NAME, IS_VISIBLE, LAST_NAME, MIDDLE_INITIAL, PHONE_NUMBER, USER_CREDENTIALS
 
Constructor Summary
AbstractWebADEUserInfo()
          Default Constructor.
AbstractWebADEUserInfo(AbstractWebADEUserInfo user)
          Copy constructor.
AbstractWebADEUserInfo(UserCredentials userCredentials)
          User Credentials Constructor.
 
Method Summary
abstract  java.lang.Object clone()
          Clones the WebADEUserInfo object.
 boolean equals(java.lang.Object obj)
           
 java.lang.String[] getAttributeNames()
          Returns the set of attribute names for user attributes supported by this object instance.
 java.lang.Object getAttributeValue(java.lang.String attributeName)
          Returns the value for the attribute with the given name.
 java.lang.String getDisplayName()
           
 java.lang.String getEmailAddress()
           
 java.util.Date getExpiryDate()
           
 java.lang.String getFirstName()
           
 java.lang.String getLastName()
           
 java.lang.String getMiddleInitial()
           
 java.lang.String getPhoneNumber()
           
 UserCredentials getUserCredentials()
           
 boolean hasAttribute(java.lang.String attributeName)
          Returns whether this object instance supports the attribute with the given name.
 int hashCode()
           
 boolean isReadOnly()
           
 boolean isVisible()
           
 void setDisplayName(java.lang.String displayName)
          Sets this user's displayName attribute to the given value.
 void setEmailAddress(java.lang.String emailAddress)
          Sets this user's emailAddress attribute to the given value.
 void setExpiryDate(java.util.Date expiryDate)
          Sets this user's expiryDate attribute to the given value.
 void setFirstName(java.lang.String firstName)
          Sets this user's firstName attribute to the given value.
 void setLastName(java.lang.String lastName)
          Sets this user's lastName attribute to the given value.
 void setMiddleInitial(java.lang.String middleInitial)
          Sets this user's middleInitial attribute to the given value.
 void setPhoneNumber(java.lang.String phoneNumber)
          Sets this user's phoneNumber attribute to the given value.
 void setReadOnly()
          Sets the attributes of this object are non-editable.
 void setUserCredentials(UserCredentials userCredentials)
          Sets this instance's user credentials to the given settings.
 void setVisible(boolean visible)
          Sets this user's visible flag attribute to the given value.
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

MAX_DATE

protected static final java.util.Date MAX_DATE
Constructor Detail

AbstractWebADEUserInfo

public AbstractWebADEUserInfo()
Default Constructor.


AbstractWebADEUserInfo

public AbstractWebADEUserInfo(UserCredentials userCredentials)
User Credentials Constructor. Creates an empty user object with the given user credentials.

Parameters:
userCredentials - The user credentials to set for this user.

AbstractWebADEUserInfo

public AbstractWebADEUserInfo(AbstractWebADEUserInfo user)
Copy constructor. Copies all user details from the given object to this instance.

Parameters:
user - The user object to copy.
Method Detail

getUserCredentials

public final UserCredentials getUserCredentials()
Specified by:
getUserCredentials in interface WebADEUserInfo
Returns:
Returns the user's credentials.
See Also:
WebADEUserInfo.getUserCredentials()

getDisplayName

public final java.lang.String getDisplayName()
Specified by:
getDisplayName in interface WebADEUserInfo
Returns:
Returns the user's display name.
See Also:
WebADEUserInfo.getDisplayName()

getLastName

public final java.lang.String getLastName()
Specified by:
getLastName in interface WebADEUserInfo
Returns:
Returns the lastName.
See Also:
WebADEUserInfo.getLastName()

getFirstName

public final java.lang.String getFirstName()
Specified by:
getFirstName in interface WebADEUserInfo
Returns:
Returns the firstName.
See Also:
WebADEUserInfo.getFirstName()

getMiddleInitial

public final java.lang.String getMiddleInitial()
Specified by:
getMiddleInitial in interface WebADEUserInfo
Returns:
Returns the middleInitial.
See Also:
WebADEUserInfo.getMiddleInitial()

getEmailAddress

public final java.lang.String getEmailAddress()
Specified by:
getEmailAddress in interface WebADEUserInfo
Returns:
Returns the emailAddress.
See Also:
WebADEUserInfo.getEmailAddress()

getPhoneNumber

public final java.lang.String getPhoneNumber()
Specified by:
getPhoneNumber in interface WebADEUserInfo
Returns:
Returns the phoneNumber.
See Also:
WebADEUserInfo.getPhoneNumber()

getExpiryDate

public final java.util.Date getExpiryDate()
Specified by:
getExpiryDate in interface WebADEUserInfo
Returns:
Returns the expiryDate or null if none is set.
See Also:
WebADEUserInfo.getExpiryDate()

isVisible

public final boolean isVisible()
Specified by:
isVisible in interface WebADEUserInfo
Returns:
Returns true if this user object's information is visible to the requesting user.
See Also:
WebADEUserInfo.isVisible()

getAttributeNames

public java.lang.String[] getAttributeNames()
Description copied from interface: WebADEUserInfo
Returns the set of attribute names for user attributes supported by this object instance.

Specified by:
getAttributeNames in interface WebADEUserInfo
Returns:
The array of attribute name constants.
See Also:
WebADEUserInfo.getAttributeNames()

getAttributeValue

public java.lang.Object getAttributeValue(java.lang.String attributeName)
Description copied from interface: WebADEUserInfo
Returns the value for the attribute with the given name.

Specified by:
getAttributeValue in interface WebADEUserInfo
Parameters:
attributeName - The name constant assigned to the user attribute.
Returns:
The attribute value, or null if the attribute is not found.
See Also:
WebADEUserInfo.getAttributeValue(java.lang.String)

hasAttribute

public boolean hasAttribute(java.lang.String attributeName)
Description copied from interface: WebADEUserInfo
Returns whether this object instance supports the attribute with the given name.

Specified by:
hasAttribute in interface WebADEUserInfo
Parameters:
attributeName - The name constant assigned to the target user attribute.
Returns:
True if the attribute name is supported, otherwise false.
See Also:
WebADEUserInfo.hasAttribute(java.lang.String)

setDisplayName

public final void setDisplayName(java.lang.String displayName)
Sets this user's displayName attribute to the given value. If this user object is read-only, a runtime exception is thrown.

Parameters:
displayName - The displayName to set.

setEmailAddress

public final void setEmailAddress(java.lang.String emailAddress)
Sets this user's emailAddress attribute to the given value. If this user object is read-only, a runtime exception is thrown.

Parameters:
emailAddress - The emailAddress to set.

setExpiryDate

public final void setExpiryDate(java.util.Date expiryDate)
Sets this user's expiryDate attribute to the given value. If this user object is read-only, a runtime exception is thrown.

Parameters:
expiryDate - The expiryDate to set.

setFirstName

public final void setFirstName(java.lang.String firstName)
Sets this user's firstName attribute to the given value. If this user object is read-only, a runtime exception is thrown.

Parameters:
firstName - The firstName to set.

setLastName

public final void setLastName(java.lang.String lastName)
Sets this user's lastName attribute to the given value. If this user object is read-only, a runtime exception is thrown.

Parameters:
lastName - The lastName to set.

setMiddleInitial

public final void setMiddleInitial(java.lang.String middleInitial)
Sets this user's middleInitial attribute to the given value. If this user object is read-only, a runtime exception is thrown.

Parameters:
middleInitial - The middleInitial to set.

setPhoneNumber

public final void setPhoneNumber(java.lang.String phoneNumber)
Sets this user's phoneNumber attribute to the given value. If this user object is read-only, a runtime exception is thrown.

Parameters:
phoneNumber - The phoneNumber to set.

setUserCredentials

public final void setUserCredentials(UserCredentials userCredentials)
Sets this instance's user credentials to the given settings. If this instance's credentials are already set but incomplete, the given user credentials will be merged in with any existing settings. If this instance's credentials are already set and complete, a runtime exception is thrown.

Parameters:
userCredentials - The user's credentials to set.

setVisible

public final void setVisible(boolean visible)
Sets this user's visible flag attribute to the given value. If this user object is read-only, a runtime exception is thrown.

Parameters:
visible - The visible to set.

setReadOnly

public final void setReadOnly()
Sets the attributes of this object are non-editable. Used to prevent an application from editing the attributes of the session user object.

Specified by:
setReadOnly in interface WebADEUserInfo

isReadOnly

public final boolean isReadOnly()
Specified by:
isReadOnly in interface WebADEUserInfo
Returns:
True is the attributes of this object are non-editable.

clone

public abstract java.lang.Object clone()
Clones the WebADEUserInfo object. The cloned object will have the isReadOnly() flag set to false, making it editable.

Specified by:
clone in interface WebADEUserInfo

toString

public java.lang.String toString()

equals

public boolean equals(java.lang.Object obj)
See Also:
Object.equals(java.lang.Object)

hashCode

public int hashCode()
See Also:
Object.hashCode()