ca.bc.gov.webade.user
Class UserCredentials

java.lang.Object
  extended byca.bc.gov.webade.user.UserCredentials
All Implemented Interfaces:
java.io.Serializable
Direct Known Subclasses:
DatabaseUserCredentials

public class UserCredentials
extends java.lang.Object
implements java.io.Serializable

Author:
jross
See Also:
Serialized Form

Field Summary
static UserCredentials UNAUTHENTICATED_USER_CREDENTIALS
          Complete empty user credentials for un-authenticated user permissions.
 
Constructor Summary
UserCredentials()
          Default Constructor.
UserCredentials(boolean acceptsNullAttributes)
          Constructor indicating that this instance will accept null values as valid attibutes (Default is false).
UserCredentials(UserCredentials credentials)
          Copy Constructor.
UserCredentials(UserCredentials credentials, boolean acceptsNullAttributes)
          Copy Constructor.
UserCredentials(UserTypeCode userTypeCode)
          User type code constructor.
 
Method Summary
 boolean areCredentialsComplete()
           
static boolean areUnauthenticated(UserCredentials creds)
          Returns true if the given credentials match the static UNAUTHENTICATED_USER_CREDENTIALS settings.
 boolean compareCredentials(UserCredentials credentials)
          Compares the given credentials to this instance.
 boolean equals(java.lang.Object obj)
           
 java.lang.String getAccountName()
           
 java.lang.String getSourceDirectory()
           
 GUID getUserGuid()
           
 java.lang.String getUserId()
           
 UserTypeCode getUserTypeCode()
           
 int hashCode()
           
 boolean isReadOnly()
           
 void mergeCredentials(UserCredentials credentials)
          Merges the given credentials into this instance, adopting credential attributes from the given object where no matching ones are set for this object.
 void setAccountName(java.lang.String accountName)
           
 void setReadOnly()
          Sets the attributes of this object are non-editable.
 void setSourceDirectory(java.lang.String sourceDirectory)
           
 void setUserGuid(GUID userGuid)
           
 void setUserTypeCode(UserTypeCode userTypeCode)
           
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

UNAUTHENTICATED_USER_CREDENTIALS

public static final UserCredentials UNAUTHENTICATED_USER_CREDENTIALS
Complete empty user credentials for un-authenticated user permissions.

Constructor Detail

UserCredentials

public UserCredentials()
Default Constructor.


UserCredentials

public UserCredentials(boolean acceptsNullAttributes)
Constructor indicating that this instance will accept null values as valid attibutes (Default is false). Used by the WebADE to allow for authenticated users that cannot be located by the WebADE.

Parameters:
acceptsNullAttributes - Flag that determines whether null values are valid values.

UserCredentials

public UserCredentials(UserCredentials credentials)
Copy Constructor.

Parameters:
credentials - The credentials to copy.

UserCredentials

public UserCredentials(UserCredentials credentials,
                       boolean acceptsNullAttributes)
Copy Constructor.

Parameters:
credentials - The credentials to copy.
acceptsNullAttributes - Flag that determines whether null values are valid values.

UserCredentials

public UserCredentials(UserTypeCode userTypeCode)
User type code constructor.

Parameters:
userTypeCode - The user type code instance for this credentials instance.
Method Detail

areUnauthenticated

public static final boolean areUnauthenticated(UserCredentials creds)
Returns true if the given credentials match the static UNAUTHENTICATED_USER_CREDENTIALS settings.

Parameters:
creds - The credentials to test.
Returns:
True if the given credentials are a match.

getAccountName

public final java.lang.String getAccountName()
Returns:
Returns the accountName.

setAccountName

public final void setAccountName(java.lang.String accountName)
Parameters:
accountName - The accountName to set.

getSourceDirectory

public final java.lang.String getSourceDirectory()
Returns:
Returns the sourceDirectory.

setSourceDirectory

public final void setSourceDirectory(java.lang.String sourceDirectory)
Parameters:
sourceDirectory - The sourceDirectory to set.

getUserId

public final java.lang.String getUserId()
Returns:
Returns the user's fully-qualified id, including source directory and account name.

getUserGuid

public final GUID getUserGuid()
Returns:
Returns the userGuid.

setUserGuid

public final void setUserGuid(GUID userGuid)
Parameters:
userGuid - The userGuid to set.

getUserTypeCode

public final UserTypeCode getUserTypeCode()
Returns:
Returns the userTypeCode.

setUserTypeCode

public final void setUserTypeCode(UserTypeCode userTypeCode)
Parameters:
userTypeCode - The userTypeCode to set.

areCredentialsComplete

public boolean areCredentialsComplete()
Returns:
True if all credential fields for this instance are set.

mergeCredentials

public void mergeCredentials(UserCredentials credentials)
                      throws java.lang.RuntimeException
Merges the given credentials into this instance, adopting credential attributes from the given object where no matching ones are set for this object.

Parameters:
credentials - The given credentials to merge.
Throws:
java.lang.RuntimeException - Thrown if the given credentials' attributes do not match any attributes already set on this object.

compareCredentials

public boolean compareCredentials(UserCredentials credentials)
Compares the given credentials to this instance. If these objects have an attribute value that does not match, this method will return false. Attributes that either object does not have set are ignored.

Parameters:
credentials - The credentials to compare.
Returns:
True if the credential attributes that are set match.

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.


isReadOnly

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

equals

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

hashCode

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

toString

public final java.lang.String toString()
See Also:
Object.toString()