|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.openmrs.BaseOpenmrsObject org.openmrs.BaseOpenmrsMetadata org.openmrs.User
public class User
Defines a User Account in the system. This account belongs to a 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)
Field Summary | |
---|---|
static long |
serialVersionUID
|
Constructor Summary | |
---|---|
User()
default constructor |
|
User(java.lang.Integer userId)
constructor with id |
|
User(Person person)
constructor with person object |
Method Summary | |
---|---|
void |
addName(PersonName name)
|
User |
addRole(Role role)
Add the given Role to the list of roles for this User |
boolean |
equals(java.lang.Object obj)
Compares two objects for similarity |
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 |
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.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()
|
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. |
int |
hashCode()
The hashcode for a user is used to index the objects in a tree |
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 |
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 |
void |
setId(java.lang.Integer id)
|
void |
setPerson(Person person)
|
void |
setPersonId(java.lang.Integer personId)
Deprecated. see setPerson(Person) |
void |
setRoles(java.util.Set<Role> roles)
|
void |
setSecretQuestion(java.lang.String secretQuestion)
|
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()
|
void |
validateSerialization(java.util.Map<?,?> sessionMap)
|
Methods inherited from class org.openmrs.BaseOpenmrsMetadata |
---|
getChangedBy, getCreator, getDateChanged, getDateCreated, getDateRetired, getDescription, getName, getRetired, getRetiredBy, getRetireReason, isRetired, setChangedBy, setCreator, setDateChanged, setDateCreated, setDateRetired, setDescription, setName, setRetired, setRetiredBy, setRetireReason |
Methods inherited from class org.openmrs.BaseOpenmrsObject |
---|
getUuid, setUuid |
Methods inherited from class java.lang.Object |
---|
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
Methods inherited from interface org.openmrs.OpenmrsObject |
---|
getUuid, setUuid |
Field Detail |
---|
public static final long serialVersionUID
Constructor Detail |
---|
public User()
public User(java.lang.Integer userId)
public User(Person person)
Method Detail |
---|
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 check
public 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 boolean equals(java.lang.Object obj)
equals
in class java.lang.Object
obj
-
public int hashCode()
hashCode
in class java.lang.Object
Person.hashCode()
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.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.public java.lang.String getSecretQuestion()
public void setSecretQuestion(java.lang.String secretQuestion)
secretQuestion
- The secretQuestion to set.public java.lang.String toString()
toString
in class java.lang.Object
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)
defaultValue
prop
- 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 information
OpenmrsUtil.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 OpenmrsObject
OpenmrsObject.getId()
public void setId(java.lang.Integer id)
setId
in interface OpenmrsObject
id
- - The unique Identifier for the objectOpenmrsObject.setId(java.lang.Integer)
|
OpenMRS-1.7.x | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |