|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectbr.com.arsmachina.authentication.entity.User
public final class User
Class that represents an application user. Each user can belong to any number of
Permissions. When a given user belongs to a Permission, but cannot be granted
some Permission in that group, this permission must be added to the list of removed
permissions (removedPermissions property).
| Field Summary | |
|---|---|
static int |
MAXIMUM_EMAIL_LENGTH
Minimum e-mail length. |
static int |
MAXIMUM_LOGIN_LENGTH
Maximum e-mail length. |
static int |
MAXIMUM_NAME_LENGTH
Maximum name length. |
static int |
MAXIMUM_PASSWORD_LENGTH
Maximum name length. |
static int |
MINIMUM_EMAIL_LENGTH
Minimum e-mail length. |
static int |
MINIMUM_LOGIN_LENGTH
Minimum login length. |
static int |
MINIMUM_NAME_LENGTH
Minimum name length. |
static int |
MINIMUM_PASSWORD_LENGTH
Minimum name length. |
| Constructor Summary | |
|---|---|
User()
|
|
| Method Summary | ||
|---|---|---|
void |
add(PermissionGroup permissionGroup)
Adds a permission group to this user. |
|
void |
add(Role role)
Adds a role to this user. |
|
void |
addRemovedPermission(Permission permission)
Adds a removed permission to this user. |
|
int |
compareTo(User o)
|
|
boolean |
equals(Object obj)
|
|
String |
getEmail()
Returns the value of the email property. |
|
Integer |
getId()
Returns the value of the id property. |
|
String |
getLogin()
Returns the value of the login property. |
|
String |
getName()
Returns the value of the name property. |
|
String |
getPassword()
Returns the value of the password property. |
|
List<PermissionGroup> |
getPermissionGroups()
Returns the value of the permissionGroups property. |
|
List<Permission> |
getPermissions()
Returns an unmodifiable list containing all the permissions granted to this user. |
|
List<Permission> |
getRemovedPermissions()
Returns the value of the removedPermissions property. |
|
|
getRole(Class<T> clasz)
Given a Class object, returns the corresponding Role instance or null if this
user has no such role. |
|
List<Role> |
getRoles()
Returns the value of the roles property. |
|
int |
hashCode()
|
|
|
hasRole(Class<R> roleClass)
Tells if this user has some a given role type. |
|
boolean |
isCredentialsExpired()
Is this user's credentials expired? |
|
boolean |
isEnabled()
Is this user's account enabled?. |
|
boolean |
isExpired()
Is this user's account expired? |
|
boolean |
isLocked()
Is this user's account locked? |
|
boolean |
isLoggedIn()
Is this user's logged in now? |
|
void |
remove(PermissionGroup permissionGroup)
Removes a permission group from this user. |
|
void |
remove(Role role)
Removes a role from this user. |
|
void |
removeRemovedPermission(Permission permission)
Removes a removed permission from this user. |
|
|
removeRole(Class<T> roleClass)
Removes all roles from a given type from this user. |
|
void |
setCredentialsExpired(boolean credentialsExpired)
Changes the value of the credentialsExpired property. |
|
void |
setEmail(String email)
Changes the value of the email property. |
|
void |
setEnabled(boolean enabled)
Changes the value of the enabled property. |
|
void |
setExpired(boolean accountExpired)
Changes the value of the expired property. |
|
void |
setId(Integer id)
Changes the value of the id property. |
|
void |
setLocked(boolean accountLocked)
Changes the value of the locked property. |
|
void |
setLoggedIn(boolean loggedIn)
Changes the value of the loggedIn property. |
|
void |
setLogin(String login)
Changes the value of the login property. |
|
void |
setName(String name)
Changes the value of the name property. |
|
void |
setPassword(String password)
Changes the value of the password property. |
|
void |
setPermissionGroups(List<PermissionGroup> permissionGroups)
Deprecated. Use add(PermissionGroup) and remove(PermissionGroup) instead. |
|
void |
setRemovedPermissions(List<Permission> removedRoles)
Deprecated. Use addRemovedPermission(Permission) and
#removeRemovedPermisson(Permission) instead. |
|
void |
setRoles(List<Role> roles)
Deprecated. Use add(Role) and remove(Role) instead. |
|
String |
toString()
Returns the name property. |
|
| Methods inherited from class java.lang.Object |
|---|
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
| Field Detail |
|---|
public static final int MINIMUM_EMAIL_LENGTH
public static final int MAXIMUM_EMAIL_LENGTH
public static final int MINIMUM_LOGIN_LENGTH
public static final int MAXIMUM_LOGIN_LENGTH
public static final int MINIMUM_NAME_LENGTH
public static final int MAXIMUM_NAME_LENGTH
public static final int MINIMUM_PASSWORD_LENGTH
public static final int MAXIMUM_PASSWORD_LENGTH
| Constructor Detail |
|---|
public User()
| Method Detail |
|---|
public void add(PermissionGroup permissionGroup)
permissionGroup - a PermissionGroup.public void add(Role role)
role - a Role.public <R extends Role> boolean hasRole(Class<R> roleClass)
R - a Role subclass.roleClass - a Class.
boolean.public void addRemovedPermission(Permission permission)
permission - a PermissionGroup.public int compareTo(User o)
compareTo in interface Comparable<User>Comparable.compareTo(java.lang.Object)public boolean equals(Object obj)
equals in class ObjectObject.equals(java.lang.Object)
@Email
@Length(min=3,
max=50)
public String getEmail()
email property.
String.public Integer getId()
id property.
Integer.
@NotNull
@Length(min=2,
max=50)
public String getLogin()
login property.
String.
@NotNull
@Length(min=2,
max=50)
public String getName()
name property.
String.
@NotNull
@Length(min=6,
max=40)
public String getPassword()
password property.
String.public List<PermissionGroup> getPermissionGroups()
permissionGroups property.
List.public final List<Permission> getPermissions()
List of Permissions.public List<Permission> getRemovedPermissions()
removedPermissions property.
List.public final <T extends Role> T getRole(Class<T> clasz)
Class object, returns the corresponding Role instance or null if this
user has no such role.
T - a Role subclass.clasz - a Class.
#T.public List<Role> getRoles()
roles property.
List.public int hashCode()
hashCode in class ObjectObject.hashCode()public boolean isCredentialsExpired()
boolean.public boolean isEnabled()
boolean.public boolean isExpired()
boolean.public boolean isLocked()
boolean.public boolean isLoggedIn()
boolean.public void remove(Role role)
role - a Role.public <T extends Role> void removeRole(Class<T> roleClass)
roleClass - a Class.public void remove(PermissionGroup permissionGroup)
permissionGroup - a PermissionGroup.public void removeRemovedPermission(Permission permission)
permission - a Permission.public void setCredentialsExpired(boolean credentialsExpired)
credentialsExpired property.
credentialsExpired - a boolean.public void setEmail(String email)
email property.
email - a String.public void setEnabled(boolean enabled)
enabled property.
enabled - a boolean.public void setExpired(boolean accountExpired)
expired property.
expired - a boolean.public void setId(Integer id)
id property.
id - a Integer.public void setLocked(boolean accountLocked)
locked property.
locked - a boolean.public void setLoggedIn(boolean loggedIn)
loggedIn property.
loggedIn - a boolean.public void setLogin(String login)
login property.
login - a String.public void setName(String name)
name property.
name - a String.public void setPassword(String password)
password property.
password - a String.@Deprecated public void setPermissionGroups(List<PermissionGroup> permissionGroups)
add(PermissionGroup) and remove(PermissionGroup) instead.
permissionGroups property.
permissionGroups - a List.@Deprecated public void setRemovedPermissions(List<Permission> removedRoles)
addRemovedPermission(Permission) and
#removeRemovedPermisson(Permission) instead.
removedPermissions property.
removedPermissions - a List.@Deprecated public void setRoles(List<Role> roles)
add(Role) and remove(Role) instead.
roles property.
roles - a List.public String toString()
name property.
toString in class ObjectString.
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||