Class UserBuilder
public class UserBuilder
extends java.lang.Object
Provides a User value object builder class. Examples Please find the user
builder examples below.
Create a User
This example shows how to create aUser
object.
import com.avoka.tm.svc.*
import com.avoka.tm.vo.*
User user = new UserBuilder("Work Space")
.setEmail("my@email.com")
.setUserType(User.TYPE_LOCAL)
.setLoginName("login")
.setPassword("secret!23")
.create()
Update a User's Email Address
This example shows how to update an user's email address. import com.avoka.tm.svc.*
import com.avoka.tm.vo.*
User user = new UserBuilder(request)
.setLoginName("dsmith")
.setEmail("dsmith@email.com")
.update()
Create/Update a User
The example below shows how to create or update an 'SSO' type user. import com.avoka.tm.svc.*
import com.avoka.tm.vo.*
User user = new UserBuilder(request)
.setLoginName("dsmith")
.setEmail("dsmith@email.com")
.setUserType(User.TYPE_SSO)
.createOrUpdate()
- Since:
- 5.0.0
Constructor Summary
ConstructorsConstructor | Description |
---|---|
UserBuilder(java.lang.String spaceName) |
Create a User service object with the given request. |
UserBuilder(javax.servlet.http.HttpServletRequest request)
|
Create a User service object with the given request. |
Method Summary
All Methods Instance Methods Concrete MethodsModifier and Type | Method | Description |
---|---|---|
UserBuilder |
addGroupName(java.lang.String groupName) |
Add the group names the user should be assigned to. |
UserBuilder |
addOrgName(java.lang.String orgName) |
Add the organization name the user should be associated with. |
UserBuilder |
addRoleName(java.lang.String roleName) |
Add the role name the user should be assigned to. |
UserBuilder |
addSpaceName(java.lang.String spaceName) |
Add the form space names the user should be assigned to. |
User |
create() |
Create a new User account based on the specified parameter and return the new User value object. |
User |
createOrUpdate() |
Create or update the user account specified by the given parameters, and return current User value object. |
UserBuilder |
removeGroupName(java.lang.String groupName) |
Remove the group names the user should be assigned to. |
UserBuilder |
removeOrgName(java.lang.String orgName) |
Remove the organization name the user should be associated with. |
UserBuilder |
removeRoleName(java.lang.String roleName) |
Remove the role name the user should be assigned to. |
UserBuilder |
removeSpaceName(java.lang.String spaceName) |
Remove the form space names the user should be assigned to. |
UserBuilder |
setAccountStatus(java.lang.String accountStatus) |
Set the user account status parameter [ Active | Inactive | Locked | Locked Temporarily | Pending | Rejected ]. |
UserBuilder |
setEmail(java.lang.String email) |
Set the user email parameter. |
UserBuilder |
setFirstName(java.lang.String firstName) |
Set the user first name parameter. |
UserBuilder |
setGroupNames(java.util.Set<java.lang.String> groupNames)
|
Set the group names the user should be assigned to. |
UserBuilder |
setLastName(java.lang.String lastName) |
Set the user last name parameter. |
UserBuilder |
setLoginName(java.lang.String loginName) |
Set the user login name parameter. |
UserBuilder |
setMobile(java.lang.String mobile) |
Set the user mobile number parameter. |
UserBuilder |
setOrgNames(java.util.Set<java.lang.String> orgNames)
|
Set the organization names the user should be associated with. |
UserBuilder |
setPassword(java.lang.String password) |
Set the user password, only applicable for "Local" type users and not for LDAP or SSO user types. |
UserBuilder |
setProfileMap(java.util.Map<java.lang.String,java.lang.String> profileMap)
|
Set the user profile values map parameter. |
UserBuilder |
setRoleNames(java.util.Set<java.lang.String> roleNames)
|
Set the role names the user should be assigned to. |
UserBuilder |
setSpaceNames(java.util.Set<java.lang.String> spaceNames)
|
Set the form space names the user should be assigned to. |
UserBuilder |
setUserType(java.lang.String userType) |
Set the user type parameter [ Local | LDAP | SSO ]. |
User |
update() |
Update the user account specified by the loginName parameter and return the update User value object. |
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString,
wait, wait, wait
Constructor Detail
UserBuilder
public UserBuilder(javax.servlet.http.HttpServletRequest request)
Create a User service object with the given request.
- Parameters:
request
- the servlet request
UserBuilder
public UserBuilder(java.lang.String spaceName)
Create a User service object with the given request.
- Parameters:
spaceName
- the form space name request
Method Detail
setLoginName
public UserBuilder setLoginName(java.lang.String loginName)
Set the user login name parameter.
- Parameters:
loginName
- the user login name parameter- Returns:
- the user service
setAccountStatus
public UserBuilder setAccountStatus(java.lang.String accountStatus)
Set the user account status parameter [ Active | Inactive | Locked | Locked
Temporarily | Pending | Rejected ].
- Parameters:
-
accountStatus
- the user account status parameter [ Active | Inactive | Locked | Locked Temporarily | Pending | Rejected ] - Returns:
- the user service
setEmail
public UserBuilder setEmail(java.lang.String email)
Set the user email parameter.
- Parameters:
email
- the user email parameter- Returns:
- the user service
setFirstName
public UserBuilder setFirstName(java.lang.String firstName)
Set the user first name parameter.
- Parameters:
firstName
- the user first name parameter- Returns:
- the user service
setLastName
public UserBuilder setLastName(java.lang.String lastName)
Set the user last name parameter.
- Parameters:
lastName
- the user last name parameter- Returns:
- the user service
setMobile
public UserBuilder setMobile(java.lang.String mobile)
Set the user mobile number parameter.
- Parameters:
mobile
- the user mobile number parameter- Returns:
- the user service
setPassword
public UserBuilder setPassword(java.lang.String password)
Set the user password, only applicable for "Local" type users and not for LDAP
or SSO user types.
- Parameters:
password
- the user password to set- Returns:
- the user service
setUserType
public UserBuilder setUserType(java.lang.String userType)
Set the user type parameter [ Local | LDAP | SSO ].
- Parameters:
-
userType
- the user type parameter [ Local | LDAP | SSO ] - Returns:
- the user service
setProfileMap
public UserBuilder setProfileMap(java.util.Map<java.lang.String,java.lang.String> profileMap)
Set the user profile values map parameter.
- Parameters:
profileMap
- the user profile values map parameter- Returns:
- the user service
setGroupNames
public UserBuilder setGroupNames(java.util.Set<java.lang.String> groupNames)
Set the group names the user should be assigned to.
- Parameters:
-
groupNames
- the group names the user should be assigned to - Returns:
- the user service
addGroupName
public UserBuilder addGroupName(java.lang.String groupName)
Add the group names the user should be assigned to.
- Parameters:
-
groupName
- the group name the user should be assigned to - Returns:
- the user service
removeGroupName
public UserBuilder removeGroupName(java.lang.String groupName)
Remove the group names the user should be assigned to.
- Parameters:
-
groupName
- the group name the user should not be assigned to - Returns:
- the user service
setOrgNames
public UserBuilder setOrgNames(java.util.Set<java.lang.String> orgNames)
Set the organization names the user should be associated with.
- Parameters:
-
orgNames
- the organization names the user should be associated with - Returns:
- the user service
addOrgName
public UserBuilder addOrgName(java.lang.String orgName)
Add the organization name the user should be associated with.
- Parameters:
-
orgName
- the organization name the user should be associated with - Returns:
- the user service
removeOrgName
public UserBuilder removeOrgName(java.lang.String orgName)
Remove the organization name the user should be associated with.
- Parameters:
-
orgName
- the organization name the user should not be associated with - Returns:
- the user service
setRoleNames
public UserBuilder setRoleNames(java.util.Set<java.lang.String> roleNames)
Set the role names the user should be assigned to.
- Parameters:
-
roleNames
- the role names the user should be assigned to - Returns:
- the user service
addRoleName
public UserBuilder addRoleName(java.lang.String roleName)
Add the role name the user should be assigned to.
- Parameters:
roleName
- the role name the user should be assigned to- Returns:
- the user service
removeRoleName
public UserBuilder removeRoleName(java.lang.String roleName)
Remove the role name the user should be assigned to.
- Parameters:
-
roleName
- the role name the user should not be assigned to - Returns:
- the user service
setSpaceNames
public UserBuilder setSpaceNames(java.util.Set<java.lang.String> spaceNames)
Set the form space names the user should be assigned to.
- Parameters:
-
spaceNames
- the form space names the user should be assigned to - Returns:
- the user service
addSpaceName
public UserBuilder addSpaceName(java.lang.String spaceName)
Add the form space names the user should be assigned to.
- Parameters:
-
spaceName
- the form space name the user should be assigned to - Returns:
- the user service
removeSpaceName
public UserBuilder removeSpaceName(java.lang.String spaceName)
Remove the form space names the user should be assigned to.
- Parameters:
-
spaceName
- the form space name the user should not be assigned to - Returns:
- the user service
create
public User create()
Create a new User account based on the specified parameter and return the new
User value object.
- Returns:
- the newly created User value object
update
public User update()
Update the user account specified by the loginName parameter and return the
update User value object. This method will throw a IllegalArgumentException if
the specified user specified by loginName parameter was not found.
- Returns:
- the update User value object
createOrUpdate
public User createOrUpdate()
Create or update the user account specified by the given parameters, and return
current User value object. If the user specified by the loginName is not found
then a new user account will be created.
- Returns:
- create or update the user account specified by the given parameters, and return current User value object