public interface RoleAPI
OrganizationAPI
and gives access to all the Administration operations available on
Roles: creation, deletion,
search, etc...SearchResult for general knowledege on Search mechanism in Bonita.
,
Role
Modifier and Type | Method and Description |
---|---|
Role |
createRole(RoleCreator creator)
Create the role.
|
Role |
createRole(String roleName)
Creates a role.
|
void |
deleteRole(long roleId)
Deletes the role.
|
void |
deleteRoles(List<Long> roleIds)
Deletes the roles.
|
long |
getNumberOfRoles()
Returns the total number of roles.
|
Role |
getRole(long roleId)
Retrieves the role.
|
Role |
getRoleByName(String roleName)
Retrieves the role.
|
List<Role> |
getRoles(int startIndex,
int maxResults,
RoleCriterion criterion)
Retrieves the paginated list of roles.
|
Map<Long,Role> |
getRoles(List<Long> roleIds)
Retrieves the roles.
|
SearchResult<Role> |
searchRoles(SearchOptions options)
Searches roles according to the criteria containing in the options.
|
Role |
updateRole(long roleId,
RoleUpdater updater)
Updates the group according to the updater values.
|
Role createRole(String roleName) throws AlreadyExistsException, CreationException
roleName
- the name of the roleAlreadyExistsException
- If the name is already taken by an existing roleCreationException
- If an exception occurs during the role creationInvalidSessionException
- If the session is invalid (expired, unknown, ...)Role createRole(RoleCreator creator) throws AlreadyExistsException, CreationException
It takes the values of the creator in order to create the role.
creator
- the role creatorAlreadyExistsException
- If the name is already taken by an existing roleCreationException
- If an exception occurs during the role creationInvalidSessionException
- If the session is invalid (expired, unknown, ...)Role updateRole(long roleId, RoleUpdater updater) throws RoleNotFoundException, UpdateException
This method also allow to update the icon of the role.
When you update it, the iconId will be set on the role and you can later get it using
UserAPI.getIcon(long)
.
Changing the content of the icon will create a new icon and change the iconId of the role.
roleId
- the identifier of the roleupdater
- the role updaterRoleNotFoundException
- If the role identifier does not refer to an existing roleUpdateException
- If an exception occurs during the role updateInvalidSessionException
- If the session is invalid (expired, unknown, ...)void deleteRole(long roleId) throws DeletionException
roleId
- the role identifierDeletionException
- If an exception occurs during the role deletionInvalidSessionException
- If the session is invalid (expired, unknown, ...)void deleteRoles(List<Long> roleIds) throws DeletionException
roleIds
- the list of role identifiersDeletionException
- If an exception occurs during the role deletionInvalidSessionException
- If the session is invalid (expired, unknown, ...)Role getRole(long roleId) throws RoleNotFoundException
roleId
- the identifier of the roleRoleNotFoundException
- If the role identifier does not refer to an existing roleRetrieveException
- If an exception occurs during the role retrievingInvalidSessionException
- If the session is invalid (expired, unknown, ...)Role getRoleByName(String roleName) throws RoleNotFoundException
roleName
- the name of the role.RoleNotFoundException
- If the role name does not refer to an existing roleRetrieveException
- If an exception occurs during the role retrievingInvalidSessionException
- If the session is invalid (expired, unknown, ...)long getNumberOfRoles()
RetrieveException
- If an exception occurs during the count retrievingInvalidSessionException
- If the session is invalid (expired, unknown, ...)List<Role> getRoles(int startIndex, int maxResults, RoleCriterion criterion)
It retrieves from the startIndex to the startIndex + maxResults.
startIndex
- the start indexmaxResults
- the max number of rolescriterion
- the sorting criterionRetrieveException
- If an exception occurs during the role retrievingInvalidSessionException
- If the session is invalid (expired, unknown, ...)Map<Long,Role> getRoles(List<Long> roleIds)
If a role does not exists, no exception is thrown and no value is added in the map.
roleIds
- the identifiers of the rolesRetrieveException
- If an exception occurs during the role retrievingInvalidSessionException
- If the session is invalid (expired, unknown, ...)SearchResult<Role> searchRoles(SearchOptions options) throws SearchException
options
- the search criteriaSearchException
- If an exception occurs during the role searchingInvalidSessionException
- If the session is invalid (expired, unknown, ...)Copyright © 2020 Bonitasoft S.A. All rights reserved.