public class User extends BaseOpenmrsMetadata implements java.io.Serializable, Attributable<User>
Person in the system,
although that person may have other user accounts. Users have login credentials
(username/password) and can have special user properties. User properties are just simple
key-value pairs for either quick info or display specific info that needs to be persisted (like
locale preferences, search options, etc)| Modifier and Type | Field and Description |
|---|---|
static long |
serialVersionUID |
| Constructor and Description |
|---|
User()
default constructor
|
User(java.lang.Integer userId)
constructor with id
|
User(Person person)
constructor with person object
|
| Modifier and Type | Method and Description |
|---|---|
void |
addName(PersonName name) |
User |
addRole(Role role)
Add the given Role to the list of roles for this User
|
java.util.List<User> |
findPossibleValues(java.lang.String searchText)
Search for possible values of this object using the given search string
|
java.util.Set<Role> |
getAllRoles()
Returns all roles attributed to this user by expanding the role list to include the parents
of the assigned roles
|
java.lang.String |
getDisplayString()
Gets a descriptive String used for display purposes This is meant as an alternative to using
the toString() to display this object to a user
|
java.lang.String |
getFamilyName()
Get familyName on the Person this user account belongs to
|
java.lang.String |
getFirstName()
Deprecated.
use getGivenName on Person
|
java.lang.String |
getGivenName()
Get givenName on the Person this user account belongs to
|
java.lang.Integer |
getId() |
java.lang.String |
getLastName()
Deprecated.
use getFamilyName on Person
|
java.util.Set<PersonName> |
getNames() |
Person |
getPerson() |
PersonName |
getPersonName() |
java.util.List<User> |
getPossibleValues()
Find all possible values of this object.
|
java.util.Collection<Privilege> |
getPrivileges()
Get all privileges this user has.
|
java.util.List<java.util.Locale> |
getProficientLocales()
Returns a list of Locales for which the User is considered proficient.
|
java.util.Set<Role> |
getRoles() |
java.lang.String |
getSecretQuestion()
Deprecated.
Use LoginCredentials
|
java.lang.String |
getSystemId() |
java.lang.Integer |
getUserId() |
java.lang.String |
getUsername() |
java.util.Map<java.lang.String,java.lang.String> |
getUserProperties() |
java.lang.String |
getUserProperty(java.lang.String prop)
Get prop property from this user's properties.
|
java.lang.String |
getUserProperty(java.lang.String prop,
java.lang.String defaultValue)
Get prop property from this user's properties.
|
boolean |
hasPrivilege(java.lang.String privilege)
This method shouldn't be used directly.
|
boolean |
hasRole(java.lang.String r)
Check if this user has the given String role
|
boolean |
hasRole(java.lang.String r,
boolean ignoreSuperUser)
Checks if this user has the given String role
|
User |
hydrate(java.lang.String userId)
Deserialize the given string into a full object
|
boolean |
isSuperUser()
Return true if this user has all privileges
|
User |
removeRole(Role role)
Remove the given Role from the list of roles for this User
|
void |
removeUserProperty(java.lang.String prop)
Convenience method.
|
User |
replaceSerialization(java.util.Map<?,?> sessionMap)
If the serializer wishes, don't serialize this entire object, just the important parts
|
java.lang.String |
serialize()
Turn the current object into an identifying string that can be retrieved later
|
void |
setId(java.lang.Integer id) |
void |
setPerson(Person person) |
void |
setPersonId(java.lang.Integer personId)
Deprecated.
|
void |
setRoles(java.util.Set<Role> roles) |
void |
setSecretQuestion(java.lang.String secretQuestion)
Deprecated.
Use LoginCredentials
|
void |
setSystemId(java.lang.String systemId) |
void |
setUserId(java.lang.Integer userId) |
void |
setUsername(java.lang.String username) |
void |
setUserProperties(java.util.Map<java.lang.String,java.lang.String> userProperties) |
void |
setUserProperty(java.lang.String prop,
java.lang.String value)
Convenience method.
|
java.lang.String |
toString()
Returns a string consisting of the name of the class of which the object is an instance and
the
uuid field surrounded by [ and ]. |
void |
validateSerialization(java.util.Map<?,?> sessionMap) |
getChangedBy, getCreator, getDateChanged, getDateCreated, getDateRetired, getDescription, getName, getRetired, getRetiredBy, getRetireReason, isRetired, setChangedBy, setCreator, setDateChanged, setDateCreated, setDateRetired, setDescription, setName, setRetired, setRetiredBy, setRetireReasonequals, getUuid, hashCode, setUuidclone, finalize, getClass, notify, notifyAll, wait, wait, waitgetUuid, setUuidpublic static final long serialVersionUID
public User()
public User(java.lang.Integer userId)
public User(Person person)
public boolean isSuperUser()
public boolean hasPrivilege(java.lang.String privilege)
privilege - public boolean hasRole(java.lang.String r)
r - String name of a role to checkpublic boolean hasRole(java.lang.String r,
boolean ignoreSuperUser)
r - String name of a role to checkignoreSuperUser - If this is false, then this method will always return true for a
superuser.public java.util.Collection<Privilege> getPrivileges()
public java.util.Set<Role> getAllRoles()
public java.util.Set<Role> getRoles()
public void setRoles(java.util.Set<Role> roles)
roles - The roles to set.public User addRole(Role role)
role - public User removeRole(Role role)
role - public java.util.List<User> findPossibleValues(java.lang.String searchText)
AttributablefindPossibleValues in interface Attributable<User>searchText - String to search onAttributable.findPossibleValues(java.lang.String)public java.util.List<User> getPossibleValues()
AttributablegetPossibleValues in interface Attributable<User>Attributable.getPossibleValues()public User hydrate(java.lang.String userId)
Attributablehydrate in interface Attributable<User>userId - String to deserializeAttributable.hydrate(java.lang.String)public java.lang.String serialize()
Attributableserialize in interface Attributable<User>Attributable.serialize()public java.lang.String getDisplayString()
AttributablegetDisplayString in interface Attributable<User>Attributable.getDisplayString()public java.lang.String getSystemId()
public void setSystemId(java.lang.String systemId)
systemId - The systemId to set.public java.lang.Integer getUserId()
public void setUserId(java.lang.Integer userId)
userId - The userId to set.@Deprecated public void setPersonId(java.lang.Integer personId)
setPerson(Person)public Person getPerson()
public void setPerson(Person person)
person - the person to setpublic java.lang.String getUsername()
public void setUsername(java.lang.String username)
username - The username to set.@Deprecated public java.lang.String getSecretQuestion()
@Deprecated public void setSecretQuestion(java.lang.String secretQuestion)
secretQuestion - The secretQuestion to set.public java.lang.String toString()
BaseOpenmrsObjectuuid field surrounded by [ and ]. In other words,
this method returns a string equal to the value of: getClass().getName() + '[' + uuid + ']'
If the uuid field is null, it delegates to
Object.toString()
toString in class BaseOpenmrsObjectObject.toString()public java.util.Map<java.lang.String,java.lang.String> getUserProperties()
public void setUserProperties(java.util.Map<java.lang.String,java.lang.String> userProperties)
userProperties - A Mappublic void setUserProperty(java.lang.String prop,
java.lang.String value)
public void removeUserProperty(java.lang.String prop)
public java.lang.String getUserProperty(java.lang.String prop)
prop - public java.lang.String getUserProperty(java.lang.String prop,
java.lang.String defaultValue)
defaultValueprop - defaultValue - getUserProperty(java.lang.String)public void addName(PersonName name)
Person.addName(PersonName)public PersonName getPersonName()
Person.getPersonName()public java.lang.String getGivenName()
Person.getGivenName()public java.lang.String getFamilyName()
Person.getFamilyName()public java.util.Set<PersonName> getNames()
Person.getNames()@Deprecated public java.lang.String getFirstName()
@Deprecated public java.lang.String getLastName()
public User replaceSerialization(java.util.Map<?,?> sessionMap)
sessionMap - serialization session informationOpenmrsUtil.isShortSerialization(Map)public void validateSerialization(java.util.Map<?,?> sessionMap)
public java.util.List<java.util.Locale> getProficientLocales()
public java.lang.Integer getId()
getId in interface OpenmrsObjectOpenmrsObject.getId()public void setId(java.lang.Integer id)
setId in interface OpenmrsObjectid - - The unique Identifier for the objectOpenmrsObject.setId(java.lang.Integer)Copyright © 2018 OpenMRS Inc.. All Rights Reserved.