public abstract class UserProfile extends Object implements Serializable, Externalizable
Modifier and Type | Field and Description |
---|---|
protected org.slf4j.Logger |
logger |
static String |
SEPARATOR |
Constructor and Description |
---|
UserProfile() |
Modifier and Type | Method and Description |
---|---|
void |
addAttribute(String key,
Object value)
Add an attribute.
|
void |
addAttributes(Map<String,Object> attributes)
Add attributes.
|
void |
addPermission(String permission)
Add a permission.
|
void |
addPermissions(Collection<String> permissions)
Add permissions.
|
void |
addRole(String role)
Add a role.
|
void |
addRoles(Collection<String> roles)
Add roles.
|
void |
addRoles(Set<String> roles)
Add roles.
|
void |
build(Object id,
Map<String,Object> attributes)
Build a profile from user identifier and attributes.
|
void |
clearSensitiveData() |
boolean |
containsAttribute(String name)
Check to see if profile contains attribute name.
|
Object |
getAttribute(String name)
Return the attribute with name.
|
<T> T |
getAttribute(String name,
Class<T> clazz)
Return the attribute with name.
|
Map<String,Object> |
getAttributes()
Get all attributes as immutable map.
|
String |
getClientName() |
String |
getId()
Get the user identifier.
|
String |
getLinkedId() |
Set<String> |
getPermissions()
Get the permissions of the user.
|
Set<String> |
getRoles()
Get the roles of the user.
|
String |
getTypedId()
Get the user identifier with a prefix which is the profile type (full class name with package).
|
boolean |
isRemembered()
Is the user remembered?
|
void |
readExternal(ObjectInput in) |
void |
removeAttribute(String key)
Remove an attribute byt its key.
|
void |
setClientName(String clientName) |
void |
setId(Object id)
Set the identifier and convert it if necessary.
|
void |
setLinkedId(String linkedId) |
void |
setRemembered(boolean rme)
Define if this profile is remembered.
|
String |
toString() |
void |
writeExternal(ObjectOutput out) |
protected final transient org.slf4j.Logger logger
public static final transient String SEPARATOR
public void build(Object id, Map<String,Object> attributes)
id
- user identifierattributes
- user attributespublic void addAttribute(String key, Object value)
key
- key of the attributevalue
- value of the attributepublic void addAttributes(Map<String,Object> attributes)
attributes
- use attributespublic void removeAttribute(String key)
key
- the keypublic void setId(Object id)
id
- user identifierpublic String getId()
public String getTypedId()
public Map<String,Object> getAttributes()
public Object getAttribute(String name)
name
- attribute namepublic boolean containsAttribute(String name)
name
- the namepublic <T> T getAttribute(String name, Class<T> clazz)
T
- the type of the attributename
- the attribute nameclazz
- the class of the attributepublic void addRole(String role)
role
- the role to add.public void addRoles(Collection<String> roles)
roles
- the roles to add.public void addPermission(String permission)
permission
- the permission to add.public void addPermissions(Collection<String> permissions)
permissions
- the permissions to add.public void setRemembered(boolean rme)
rme
- whether the user is remembered.public Set<String> getPermissions()
public boolean isRemembered()
public void writeExternal(ObjectOutput out) throws IOException
writeExternal
in interface Externalizable
IOException
public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException
readExternal
in interface Externalizable
IOException
ClassNotFoundException
public void clearSensitiveData()
public String getClientName()
public void setClientName(String clientName)
public String getLinkedId()
public void setLinkedId(String linkedId)
Copyright © 2017. All rights reserved.