Class UserBuilder

java.lang.Object
com.avoka.tm.svc.UserBuilder

public class UserBuilder extends 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 a User object.

 import com.avoka.tm.svc.*
 import com.avoka.tm.vo.*

 User user = new UserBuilder("Work Space")
                .setEmail("[email protected]")
                .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("[email protected]")
                .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("[email protected]")
                .setUserType(User.TYPE_SSO)
                .createOrUpdate() 

Unlock a temporarily locked User

The example below shows how to unlock an existing user. For a user to be successfully unlocked the account must be in Locked Temporarily status and the Lockout End Time passed

 import com.avoka.tm.svc.*
 import com.avoka.tm.vo.*

 User user = new UserBuilder(request)
                  .setLoginName("dsmith")
                  .setEmail("[email protected]")
                  .withUpdatedLockStatus()
                  .update() 
Since:
5.0.0
  • Constructor Details

  • Method Details

    • setLoginName

      public UserBuilder setLoginName(String loginName)
      Set the user login name parameter.
      Parameters:
      loginName - the user login name parameter
      Returns:
      the user service
    • setAccountStatus

      public UserBuilder setAccountStatus(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(String email)
      Set the user email parameter.
      Parameters:
      email - the user email parameter
      Returns:
      the user service
    • setFirstName

      public UserBuilder setFirstName(String firstName)
      Set the user first name parameter.
      Parameters:
      firstName - the user first name parameter
      Returns:
      the user service
    • setLastName

      public UserBuilder setLastName(String lastName)
      Set the user last name parameter.
      Parameters:
      lastName - the user last name parameter
      Returns:
      the user service
    • setMobile

      public UserBuilder setMobile(String mobile)
      Set the user mobile number parameter.
      Parameters:
      mobile - the user mobile number parameter
      Returns:
      the user service
    • setPassword

      public UserBuilder setPassword(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
    • setPhone

      public UserBuilder setPhone(String phone)
      Set the user phone number parameter.
      Parameters:
      phone - the user mobile number parameter
      Returns:
      the user service
      Since:
      22.10.4
    • setChangePassword

      public UserBuilder setChangePassword(boolean isChangePassword)
      Set the flag to force the user to update their password on next login.
      Parameters:
      isChangePassword - true if you want to force the user to update their password next login
      Returns:
      the user service
      Since:
      19.11.0
    • setGlobalAccessFlag

      public UserBuilder setGlobalAccessFlag(boolean isGlobalAccess)
      Set the flag to set the user global access.
      Parameters:
      isGlobalAccess - true if you want the user to have global access
      Returns:
      the user service
      Since:
      23.4.0
    • setUserType

      public UserBuilder setUserType(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(Map<String,String> profileMap)
      Set the user profile values map parameter.
      Parameters:
      profileMap - the user profile values map parameter
      Returns:
      the user service
    • setGroupNames

      @FluentSecurityPermission(permissions="group-assign") public UserBuilder setGroupNames(Set<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

      @FluentSecurityPermission(permissions="group-assign") public UserBuilder addGroupName(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

      @FluentSecurityPermission(permissions="group-assign") public UserBuilder removeGroupName(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(Set<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(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(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

      @FluentSecurityPermission(permissions="role-assign") public UserBuilder setRoleNames(Set<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

      @FluentSecurityPermission(permissions="role-assign") public UserBuilder addRoleName(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

      @FluentSecurityPermission(permissions="role-assign") public UserBuilder removeRoleName(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(Set<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(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(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
    • setSvcSpaceName

      public void setSvcSpaceName(String svcSpaceName)
      Set the service form space name the builder will use.
      Parameters:
      svcSpaceName - svcSpaceName
    • withUpdatedLockStatus

      public UserBuilder withUpdatedLockStatus()
      Set the flag to unlock user if they were locked temporarily and the lockout duration has passed.
      Returns:
      the user service
      Since:
      19.11.0
    • 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