public class User
extends java.lang.Object
Constructor and Description |
---|
User(ResourceLink resourceLink,
java.lang.String id)
Constructs a User object for the specified resource link and user ID.
|
Modifier and Type | Method and Description |
---|---|
void |
addGroup(java.lang.String id)
Add a group ID for the user.
|
boolean |
delete()
Delete the user from the database.
|
java.util.Calendar |
getCreated()
Returns the date/time when the object was created.
|
java.lang.String |
getEmail()
Returns the user's email.
|
java.lang.String |
getFirstname()
Returns the user's firstname.
|
java.lang.String |
getFullname()
Returns the user's fullname.
|
java.util.List<java.lang.String> |
getGroups()
Returns a list of group IDs for which the user is a member.
|
java.lang.String |
getId()
Return the user ID using the default scope.
|
java.lang.String |
getId(java.lang.Integer idScope)
Return the user ID using the specified scope.
|
java.lang.String |
getLastname()
Returns the user's lastname.
|
java.lang.String |
getLtiResultSourcedId()
Returns the user's result sourcedId value.
|
ResourceLink |
getResourceLink()
Return the resource link object for the user.
|
java.util.Calendar |
getUpdated()
Returns the date/time when the object was last updated.
|
void |
initialise()
Initialise the user object properties.
|
boolean |
isAdmin()
Return
true if the user is an administrator. |
boolean |
isLearner()
Return
true if the user is a learner. |
boolean |
isStaff()
Return
true if the user is staff. |
boolean |
load()
Load the user from the database.
|
boolean |
save()
Save the user to the database.
|
void |
setCreated(java.util.Calendar created)
Sets the creation date/time for the object.
|
void |
setEmail(java.lang.String email)
Set the user's email.
|
void |
setEmail(java.lang.String email,
java.lang.String defaultEmail)
Set the user's email address.
|
void |
setFirstname(java.lang.String firstname)
Set the user's firstname.
|
void |
setFullname(java.lang.String fullname)
Set the user's fullname.
|
void |
setLastname(java.lang.String lastname)
Set the user's lastname.
|
void |
setLtiResultSourcedId(java.lang.String ltiResultSourcedId)
Sets the user's result sourcedId value.
|
void |
setNames(java.lang.String firstname,
java.lang.String lastname,
java.lang.String fullname)
Set the user's name using values for first, last and/or full names.
|
void |
setRoles(java.util.List<java.lang.String> rolesList)
Set the user's roles to those specified in the list provided.
|
void |
setRoles(java.lang.String rolesString)
Set the user's roles to those specified in the comma separated list provided.
|
void |
setUpdated(java.util.Calendar updated)
Sets the last update date/time for the object.
|
java.lang.String |
toString()
Returns a string representation of this user.
|
public User(ResourceLink resourceLink, java.lang.String id)
resourceLink
- ResourceLink objectid
- User ID valuepublic final void initialise()
public final boolean load()
true
if the user object was successfully loadedpublic boolean save()
true
if the user object was successfully savedpublic boolean delete()
true
if the user object was successfully deletedpublic ResourceLink getResourceLink()
public java.lang.String getId()
The ID value may be a compound of the tool consumer and resource link IDs.
ToolProvider.setIdScope(int)
public java.lang.String getId(java.lang.Integer idScope)
The ID value may be a compound of the tool consumer and resource link IDs.
public void setNames(java.lang.String firstname, java.lang.String lastname, java.lang.String fullname)
A default name based on the user's ID is generated if no values are passed.
firstname
- User's first name.lastname
- User's last name.fullname
- User's full name.public void setEmail(java.lang.String email, java.lang.String defaultEmail)
If the default value passed begins with @
it is prefixed
with the user's ID if no email is provided.
email
- Email address valuedefaultEmail
- Value to use if no email is providedpublic void setRoles(java.util.List<java.lang.String> rolesList)
rolesList
- a list of role valuespublic void setRoles(java.lang.String rolesString)
rolesString
- a string containing a list of rolespublic java.lang.String getLtiResultSourcedId()
public void setLtiResultSourcedId(java.lang.String ltiResultSourcedId)
ltiResultSourcedId
- result sourcedId valuepublic java.util.Calendar getCreated()
public void setCreated(java.util.Calendar created)
created
- date/time of creationpublic java.util.Calendar getUpdated()
public void setUpdated(java.util.Calendar updated)
updated
- date/time of last updatepublic boolean isAdmin()
true
if the user is an administrator.true
if the user has a role of administratorpublic boolean isStaff()
true
if the user is staff.true
if the user has a role of instructor, contentdeveloper or teachingassistantpublic boolean isLearner()
true
if the user is a learner.true
if the user has a role of learnerpublic java.lang.String getFirstname()
public void setFirstname(java.lang.String firstname)
firstname
- string containing the user's firstnamesetNames(String, String, String)
public java.lang.String getLastname()
public void setLastname(java.lang.String lastname)
lastname
- string containing the user's lastnamesetNames(String, String, String)
public java.lang.String getFullname()
public void setFullname(java.lang.String fullname)
fullname
- string containing the user's fullnamesetNames(String, String, String)
public java.lang.String getEmail()
public void setEmail(java.lang.String email)
email
- user's email addresspublic java.util.List<java.lang.String> getGroups()
public void addGroup(java.lang.String id)
id
- group IDpublic java.lang.String toString()
The string representation consists of the user's ID, firstname, lastname, fullname, email address, result sourcedId, roles and groups.
toString
in class java.lang.Object