com.gisgraphy.model
Class User

java.lang.Object
  extended by com.gisgraphy.model.BaseObject
      extended by com.gisgraphy.model.User
All Implemented Interfaces:
Serializable, org.acegisecurity.userdetails.UserDetails

public class User
extends BaseObject
implements Serializable, org.acegisecurity.userdetails.UserDetails

This class represents the basic "user" object in AppFuse that allows for authentication and user management. It implements Acegi Security's UserDetails interface.

Author:
Matt Raible Updated by Dan Kibler (dan@getrolling.com) Extended to implement Acegi UserDetails interface by David Carter david@carter.net
See Also:
Serialized Form

Constructor Summary
User()
          Default constructor - creates a new instance with no values set.
User(String username)
          Create a new instance and set the username.
 
Method Summary
 void addRole(Role role)
          Adds a role for the user
 boolean equals(Object o)
          Compares object equality.
 Address getAddress()
           
 org.acegisecurity.GrantedAuthority[] getAuthorities()
           
 String getConfirmPassword()
           
 String getEmail()
           
 String getFirstName()
           
 String getFullName()
          Returns the full name.
 Long getId()
           
 String getLastName()
           
 String getPassword()
           
 String getPasswordHint()
           
 String getPhoneNumber()
           
 List<LabelValue> getRoleList()
          Convert user roles to LabelValue objects for convenience.
 Set<Role> getRoles()
           
 String getUsername()
           
 Integer getVersion()
           
 String getWebsite()
           
 int hashCode()
          When you override equals, you should override hashCode.
 boolean isAccountExpired()
           
 boolean isAccountLocked()
           
 boolean isAccountNonExpired()
           
 boolean isAccountNonLocked()
           
 boolean isCredentialsExpired()
           
 boolean isCredentialsNonExpired()
           
 boolean isEnabled()
           
 void setAccountExpired(boolean accountExpired)
           
 void setAccountLocked(boolean accountLocked)
           
 void setAddress(Address address)
           
 void setConfirmPassword(String confirmPassword)
           
 void setCredentialsExpired(boolean credentialsExpired)
           
 void setEmail(String email)
           
 void setEnabled(boolean enabled)
           
 void setFirstName(String firstName)
           
 void setId(Long id)
           
 void setLastName(String lastName)
           
 void setPassword(String password)
           
 void setPasswordHint(String passwordHint)
           
 void setPhoneNumber(String phoneNumber)
           
 void setRoles(Set<Role> roles)
           
 void setUsername(String username)
           
 void setVersion(Integer version)
           
 void setWebsite(String website)
           
 String toString()
          Returns a multi-line String with key=value pairs.
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

User

public User()
Default constructor - creates a new instance with no values set.


User

public User(String username)
Create a new instance and set the username.

Parameters:
username - login name for user.
Method Detail

getId

public Long getId()

getUsername

public String getUsername()
Specified by:
getUsername in interface org.acegisecurity.userdetails.UserDetails

getPassword

public String getPassword()
Specified by:
getPassword in interface org.acegisecurity.userdetails.UserDetails

getConfirmPassword

public String getConfirmPassword()

getPasswordHint

public String getPasswordHint()

getFirstName

public String getFirstName()

getLastName

public String getLastName()

getEmail

public String getEmail()

getPhoneNumber

public String getPhoneNumber()

getWebsite

public String getWebsite()

getFullName

public String getFullName()
Returns the full name.

Returns:
firstName + ' ' + lastName

getAddress

public Address getAddress()

getRoles

public Set<Role> getRoles()

getRoleList

public List<LabelValue> getRoleList()
Convert user roles to LabelValue objects for convenience.

Returns:
a list of LabelValue objects with role information

addRole

public void addRole(Role role)
Adds a role for the user

Parameters:
role - the fully instantiated role

getAuthorities

public org.acegisecurity.GrantedAuthority[] getAuthorities()
Specified by:
getAuthorities in interface org.acegisecurity.userdetails.UserDetails
Returns:
GrantedAuthority[] an array of roles.
See Also:
UserDetails.getAuthorities()

getVersion

public Integer getVersion()

isEnabled

public boolean isEnabled()
Specified by:
isEnabled in interface org.acegisecurity.userdetails.UserDetails

isAccountExpired

public boolean isAccountExpired()

isAccountNonExpired

public boolean isAccountNonExpired()
Specified by:
isAccountNonExpired in interface org.acegisecurity.userdetails.UserDetails
See Also:
UserDetails.isAccountNonExpired()

isAccountLocked

public boolean isAccountLocked()

isAccountNonLocked

public boolean isAccountNonLocked()
Specified by:
isAccountNonLocked in interface org.acegisecurity.userdetails.UserDetails
See Also:
UserDetails.isAccountNonLocked()

isCredentialsExpired

public boolean isCredentialsExpired()

isCredentialsNonExpired

public boolean isCredentialsNonExpired()
Specified by:
isCredentialsNonExpired in interface org.acegisecurity.userdetails.UserDetails
See Also:
UserDetails.isCredentialsNonExpired()

setId

public void setId(Long id)

setUsername

public void setUsername(String username)

setPassword

public void setPassword(String password)

setConfirmPassword

public void setConfirmPassword(String confirmPassword)

setPasswordHint

public void setPasswordHint(String passwordHint)

setFirstName

public void setFirstName(String firstName)

setLastName

public void setLastName(String lastName)

setEmail

public void setEmail(String email)

setPhoneNumber

public void setPhoneNumber(String phoneNumber)

setWebsite

public void setWebsite(String website)

setAddress

public void setAddress(Address address)

setRoles

public void setRoles(Set<Role> roles)

setVersion

public void setVersion(Integer version)

setEnabled

public void setEnabled(boolean enabled)

setAccountExpired

public void setAccountExpired(boolean accountExpired)

setAccountLocked

public void setAccountLocked(boolean accountLocked)

setCredentialsExpired

public void setCredentialsExpired(boolean credentialsExpired)

equals

public boolean equals(Object o)
Compares object equality. When using Hibernate, the primary key should not be a part of this comparison.

Specified by:
equals in class BaseObject
Parameters:
o - object to compare to
Returns:
true/false based on equality tests

hashCode

public int hashCode()
When you override equals, you should override hashCode. See "Why are equals() and hashCode() importation" for more information: http://www.hibernate.org/109.html

Specified by:
hashCode in class BaseObject
Returns:
hashCode

toString

public String toString()
Returns a multi-line String with key=value pairs.

Specified by:
toString in class BaseObject
Returns:
a String representation of this class.


Copyright © 2012. All Rights Reserved.