com.elasticpath.domain.cmuser.impl
Class CmUserImpl

java.lang.Object
  extended by com.elasticpath.domain.impl.AbstractEpDomainImpl
      extended by com.elasticpath.domain.impl.AbstractPersistenceImpl
          extended by com.elasticpath.domain.impl.AbstractEntityImpl
              extended by com.elasticpath.domain.cmuser.impl.CmUserImpl
All Implemented Interfaces:
CmUser, Entity, EpDomain, Persistence, java.io.Serializable, org.acegisecurity.userdetails.UserDetails

public class CmUserImpl
extends AbstractEntityImpl
implements CmUser, java.io.Serializable

The default implementation of CmUser.

See Also:
Serialized Form

Field Summary
static long serialVersionUID
          Serial version id.
 
Constructor Summary
CmUserImpl()
          The default constructor.
 
Method Summary
 void addUserRole(UserRole userRole)
          Adds an UserRole to the list of userRoles.
 org.acegisecurity.GrantedAuthority[] getAuthorities()
          Returns the authorities granted to the user.
 java.lang.String getClearTextPassword()
          Gets the clear-text password (only available at the creation time).
 java.lang.String getConfirmClearTextPassword()
          Gets the clear-text confirm password (only available at the creation time).
 java.util.Date getCreationDate()
          Gets this cmUser's creationDate.
 java.lang.String getEmail()
          Gets the email address of this Customer.
 java.lang.String getFirstName()
          Gets the Customer's first name.
 java.util.Date getLastLoginDate()
          Gets this cmUser's last login date.
 java.lang.String getLastName()
          Gets the Customer's last name.
 java.lang.String getPassword()
          Gets the encrypted password.
 java.lang.String getUsername()
          Returns the username used to authenticate the user.
 java.lang.String getUserName()
          Gets the user name for this CmUser.
 java.util.Set getUserRoles()
          Gets the UserRoles associated with this CmUser.
 boolean hasPermission(java.lang.String authority)
          Return a boolean that indicates whether this CmUser has the permission with the given authority value.
 boolean hasUserRole(long userRoleID)
          Return a boolean that indicates whether this CmUser has the userRole with the given userRoleID.
 boolean hasUserRole(java.lang.String userRoleName)
          Return a boolean that indicates whether this CmUser has the userRole with the given name.
 boolean isAccountNonExpired()
          Indicates whether the user's account has expired.
 boolean isAccountNonLocked()
          Indicates whether the user is locked or unlocked.
 boolean isCmAccess()
          True if this CmUser has access to Commerce Manager functionality.
 boolean isCredentialsNonExpired()
          Indicates whether the user's credentials (password) has expired.
 boolean isEnabled()
          Indicates whether the user is enabled or disabled.
 boolean isWsAccess()
          True if this CmUser has access to Web Services.
 void removeUserRole(UserRole userRole)
          Removes an UserRole from the list of userRoles.
 java.lang.String resetPassword()
          Reset the customer's password.
 void setClearTextPassword(java.lang.String clearTextPassword)
          Sets the clear-text password.
 void setCmAccess(boolean cmAccess)
          Sets whether this CmUser has access to Commerce Manager functionality.
 void setConfirmClearTextPassword(java.lang.String confirmClearTextPassword)
          Sets the confirm clear-text password.
 void setCreationDate(java.util.Date creationDate)
          Sets this cmUser's creationDate.
 void setDefaultValues()
          Set default values for those fields need default values.
 void setEmail(java.lang.String email)
          Sets the email address of this Customer.
 void setFirstName(java.lang.String firstName)
          Sets the Customer's first name.
 void setLastLoginDate(java.util.Date lastLoginDate)
          Sets this cmUser's last login date.
 void setLastName(java.lang.String lastName)
          Sets the Customer's last name.
 void setPassword(java.lang.String password)
          Sets the encrypted password.
 void setUserName(java.lang.String userName)
          Sets the user name for this CmUser.
 void setUserRoles(java.util.Set userRoles)
          Sets the UserRoles associated with this CmUser.
 void setWsAccess(boolean wsAccess)
          Sets whether this CmUser has access to Web Services.
 
Methods inherited from class com.elasticpath.domain.impl.AbstractEntityImpl
convertAttributeGroupAttributes, getGuid, setGuid
 
Methods inherited from class com.elasticpath.domain.impl.AbstractPersistenceImpl
executeBeforePersistAction, getUidPk, isPersistent, setUidPk
 
Methods inherited from class com.elasticpath.domain.impl.AbstractEpDomainImpl
getElasticPath, setElasticPath
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface com.elasticpath.domain.Entity
getGuid, setGuid
 
Methods inherited from interface com.elasticpath.domain.Persistence
executeBeforePersistAction, getUidPk, isPersistent, setUidPk
 
Methods inherited from interface com.elasticpath.domain.EpDomain
getElasticPath, setElasticPath
 

Field Detail

serialVersionUID

public static final long serialVersionUID
Serial version id.

See Also:
Constant Field Values
Constructor Detail

CmUserImpl

public CmUserImpl()
The default constructor.

Method Detail

addUserRole

public void addUserRole(UserRole userRole)
Adds an UserRole to the list of userRoles.

Specified by:
addUserRole in interface CmUser
Parameters:
userRole - the userRole to add.

getAuthorities

public org.acegisecurity.GrantedAuthority[] getAuthorities()
Returns the authorities granted to the user. Cannot return null.

Specified by:
getAuthorities in interface org.acegisecurity.userdetails.UserDetails
Returns:
the authorities (never null)

getClearTextPassword

public java.lang.String getClearTextPassword()
Gets the clear-text password (only available at the creation time).

Specified by:
getClearTextPassword in interface CmUser
Returns:
the clear-text password.

getConfirmClearTextPassword

public java.lang.String getConfirmClearTextPassword()
Gets the clear-text confirm password (only available at the creation time).

Specified by:
getConfirmClearTextPassword in interface CmUser
Returns:
the clear-text confirm password.

getCreationDate

public java.util.Date getCreationDate()
Gets this cmUser's creationDate.

Specified by:
getCreationDate in interface CmUser
Returns:
cmUser's creation date.

getEmail

public java.lang.String getEmail()
Gets the email address of this Customer.

Specified by:
getEmail in interface CmUser
Returns:
the email address.

getFirstName

public java.lang.String getFirstName()
Gets the Customer's first name.

Specified by:
getFirstName in interface CmUser
Returns:
the first name.

getLastLoginDate

public java.util.Date getLastLoginDate()
Gets this cmUser's last login date.

Specified by:
getLastLoginDate in interface CmUser
Returns:
cmUser's last login date.

getLastName

public java.lang.String getLastName()
Gets the Customer's last name.

Specified by:
getLastName in interface CmUser
Returns:
the last name.

getPassword

public java.lang.String getPassword()
Gets the encrypted password.

Specified by:
getPassword in interface CmUser
Specified by:
getPassword in interface org.acegisecurity.userdetails.UserDetails
Returns:
the encrypted password.

getUsername

public java.lang.String getUsername()
Returns the username used to authenticate the user. Cannot return null.

Specified by:
getUsername in interface org.acegisecurity.userdetails.UserDetails
Returns:
the username (never null)

getUserName

public java.lang.String getUserName()
Gets the user name for this CmUser.

Specified by:
getUserName in interface CmUser
Returns:
the user name.

getUserRoles

public java.util.Set getUserRoles()
Gets the UserRoles associated with this CmUser.

Specified by:
getUserRoles in interface CmUser
Returns:
the set of userRoles.

hasPermission

public boolean hasPermission(java.lang.String authority)
Return a boolean that indicates whether this CmUser has the permission with the given authority value.

Specified by:
hasPermission in interface CmUser
Parameters:
authority - - authority value.
Returns:
true if cmUser has the permission with the given authority value; otherwise, false.

hasUserRole

public boolean hasUserRole(long userRoleID)
Return a boolean that indicates whether this CmUser has the userRole with the given userRoleID.

Specified by:
hasUserRole in interface CmUser
Parameters:
userRoleID - - userRole ID.
Returns:
true if cmUser belongs to userRole with the given userRoleID; otherwise, false.

hasUserRole

public boolean hasUserRole(java.lang.String userRoleName)
Return a boolean that indicates whether this CmUser has the userRole with the given name.

Specified by:
hasUserRole in interface CmUser
Parameters:
userRoleName - - userRole name.
Returns:
true if cmUser belongs to userRole with the given userRole name; otherwise, false.

isAccountNonExpired

public boolean isAccountNonExpired()
Indicates whether the user's account has expired. An expired account cannot be authenticated.

Specified by:
isAccountNonExpired in interface org.acegisecurity.userdetails.UserDetails
Returns:
true if the user's account is valid (ie non-expired), false if no longer valid (ie expired)

isAccountNonLocked

public boolean isAccountNonLocked()
Indicates whether the user is locked or unlocked. A locked user cannot be authenticated.

Specified by:
isAccountNonLocked in interface org.acegisecurity.userdetails.UserDetails
Returns:
true if the user is not locked, false otherwise

isCmAccess

public boolean isCmAccess()
True if this CmUser has access to Commerce Manager functionality.

Specified by:
isCmAccess in interface CmUser
Returns:
true if this cmUser has access to Commerce Manager functionality.

isCredentialsNonExpired

public boolean isCredentialsNonExpired()
Indicates whether the user's credentials (password) has expired. Expired credentials prevent authentication.

Specified by:
isCredentialsNonExpired in interface org.acegisecurity.userdetails.UserDetails
Returns:
true if the user's credentials are valid (ie non-expired), false if no longer valid (ie expired)

isEnabled

public boolean isEnabled()
Indicates whether the user is enabled or disabled. A disabled user cannot be authenticated.

Specified by:
isEnabled in interface org.acegisecurity.userdetails.UserDetails
Returns:
true if the user is enabled, false otherwise

isWsAccess

public boolean isWsAccess()
True if this CmUser has access to Web Services.

Specified by:
isWsAccess in interface CmUser
Returns:
true if this cmUser has access to Web Services.

removeUserRole

public void removeUserRole(UserRole userRole)
Removes an UserRole from the list of userRoles.

Specified by:
removeUserRole in interface CmUser
Parameters:
userRole - the userRole to remove.

resetPassword

public java.lang.String resetPassword()
Reset the customer's password.

Specified by:
resetPassword in interface CmUser
Returns:
the reseted password

setClearTextPassword

public void setClearTextPassword(java.lang.String clearTextPassword)
Sets the clear-text password. The password will be encrypted using a secure hash like MD5 or SHA1 and saved as password.

Specified by:
setClearTextPassword in interface CmUser
Parameters:
clearTextPassword - the clear-text password.

setCmAccess

public void setCmAccess(boolean cmAccess)
Sets whether this CmUser has access to Commerce Manager functionality.

Specified by:
setCmAccess in interface CmUser
Parameters:
cmAccess - Set to true for commercial addresses.

setConfirmClearTextPassword

public void setConfirmClearTextPassword(java.lang.String confirmClearTextPassword)
Sets the confirm clear-text password. This is to compare with the ClearTextPassword and make sure they are the same.

Specified by:
setConfirmClearTextPassword in interface CmUser
Parameters:
confirmClearTextPassword - the user confirmClearTextPassword.

setCreationDate

public void setCreationDate(java.util.Date creationDate)
Sets this cmUser's creationDate.

Specified by:
setCreationDate in interface CmUser
Parameters:
creationDate - cmUser's creationDate.

setDefaultValues

public void setDefaultValues()
Set default values for those fields need default values.

Specified by:
setDefaultValues in interface Persistence
Overrides:
setDefaultValues in class AbstractEntityImpl

setEmail

public void setEmail(java.lang.String email)
Sets the email address of this Customer.

Specified by:
setEmail in interface CmUser
Parameters:
email - the new email address.

setFirstName

public void setFirstName(java.lang.String firstName)
Sets the Customer's first name.

Specified by:
setFirstName in interface CmUser
Parameters:
firstName - the new first name.

setLastLoginDate

public void setLastLoginDate(java.util.Date lastLoginDate)
Sets this cmUser's last login date.

Specified by:
setLastLoginDate in interface CmUser
Parameters:
lastLoginDate - cmUser's last login date.

setLastName

public void setLastName(java.lang.String lastName)
Sets the Customer's last name.

Specified by:
setLastName in interface CmUser
Parameters:
lastName - the new last name.

setPassword

public void setPassword(java.lang.String password)
Sets the encrypted password. By default, the clear-text user input password will be encrypted using the SHA1 secure hash algorithm

Specified by:
setPassword in interface CmUser
Parameters:
password - the encrypted password.

setUserName

public void setUserName(java.lang.String userName)
                 throws EpDomainException
Sets the user name for this CmUser.

Specified by:
setUserName in interface CmUser
Parameters:
userName - the new user name.
Throws:
EpDomainException - if the given identifier is null.

setUserRoles

public void setUserRoles(java.util.Set userRoles)
Sets the UserRoles associated with this CmUser.

Specified by:
setUserRoles in interface CmUser
Parameters:
userRoles - the new set of userRoles.

setWsAccess

public void setWsAccess(boolean wsAccess)
Sets whether this CmUser has access to Web Services.

Specified by:
setWsAccess in interface CmUser
Parameters:
wsAccess - Set to true if has access to Web Services.