Class UserAccount
- java.lang.Object
-
- org.salespointframework.core.AbstractEntity<UserAccountIdentifier>
-
- org.salespointframework.useraccount.UserAccount
-
- All Implemented Interfaces:
org.springframework.data.domain.Persistable<UserAccountIdentifier>
@Entity public class UserAccount extends AbstractEntity<UserAccountIdentifier>
Domain class for a user.- Author:
- Oliver Gierke, Paul Henke
-
-
Constructor Summary
Constructors Constructor Description UserAccount()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
add(Role role)
Adds aRole
to theUserAccount
.String
getEmail()
String
getFirstname()
UserAccountIdentifier
getId()
Get the unique identifier of thisUserAccount
.String
getLastname()
Password.EncryptedPassword
getPassword()
org.springframework.data.util.Streamable<Role>
getRoles()
String
getUsername()
Returns the user's username.boolean
hasRole(Role role)
Checks if aUserAccount
has a specificRole
boolean
isEnabled()
boolean
remove(Role role)
Removes aRole
from aUserAccount
.void
setEmail(String email)
void
setEnabled(boolean enabled)
void
setFirstname(String firstname)
void
setLastname(String lastname)
String
toString()
-
Methods inherited from class org.salespointframework.core.AbstractEntity
equals, hashCode, isNew
-
-
-
-
Method Detail
-
getId
public UserAccountIdentifier getId()
Get the unique identifier of thisUserAccount
.- Returns:
- the
UserAccountIdentifier
of thisUserAccount
-
getUsername
public String getUsername()
Returns the user's username.- Returns:
- will never be null.
-
add
public boolean add(Role role)
Adds aRole
to theUserAccount
.- Parameters:
role
-role
which theuser
will receive, must not be null.- Returns:
- true if successful, false otherwise.
-
remove
public boolean remove(Role role)
Removes aRole
from aUserAccount
.- Parameters:
role
-role
which will be removed fromuser
, must not be null.- Returns:
- true if successful, false otherwise.
-
hasRole
public boolean hasRole(Role role)
Checks if aUserAccount
has a specificRole
- Parameters:
role
-Role
for which theuser
will be checked for, must not be null.- Returns:
- true if
role
was granted touser
-
getRoles
public org.springframework.data.util.Streamable<Role> getRoles()
- Returns:
- A
Streamable/code> with all
Role
s of the user
-
getPassword
public Password.EncryptedPassword getPassword()
-
getFirstname
public String getFirstname()
-
setFirstname
public void setFirstname(String firstname)
-
getLastname
public String getLastname()
-
setLastname
public void setLastname(String lastname)
-
getEmail
public String getEmail()
-
setEmail
public void setEmail(String email)
-
isEnabled
public boolean isEnabled()
-
setEnabled
public void setEnabled(boolean enabled)
-
-