public interface GroupAPI
OrganizationAPI
and gives access to all the Administration operations available on Groups: creation, deletion, updating,
search, etc...Group
Modifier and Type | Method and Description |
---|---|
Group |
createGroup(GroupCreator creator)
Creates a group.
|
Group |
createGroup(String name,
String parentPath)
Creates a group from its name and parent path.
|
void |
deleteGroup(long groupId)
Deletes the group.
|
void |
deleteGroups(List<Long> groupIds)
Deletes the groups.
|
Group |
getGroup(long groupId)
Retrieves the group.
|
Group |
getGroupByPath(String groupPath)
Retrieves the group according to its full path.
|
List<Group> |
getGroups(int startIndex,
int maxResults,
GroupCriterion criterion)
Retrieves the paginated list of groups.
|
Map<Long,Group> |
getGroups(List<Long> groupIds)
Retrieves the groups.
|
long |
getNumberOfGroups()
Returns the total number of groups.
|
SearchResult<Group> |
searchGroups(SearchOptions options)
Searches groups according to the criteria containing in the options.
|
Group |
updateGroup(long groupId,
GroupUpdater updater)
Updates the group according to the updater values.
|
Group createGroup(String name, String parentPath) throws AlreadyExistsException, CreationException
If the group is a top level one, the parent path must be null.
name
- the name of the groupparentPath
- the parent path of the group (null means no parent)AlreadyExistsException
- If the couple name/parentPath is already taken by an existing groupCreationException
- If an exception occurs during the group creationInvalidSessionException
- If the session is invalid (expired, unknown, ...)Group createGroup(GroupCreator creator) throws AlreadyExistsException, CreationException
It takes the values of the creator in order to create a group.
creator
- the group creatorAlreadyExistsException
- If the couple name/parentPath is already taken by an existing groupCreationException
- If an exception occurs during group creationInvalidSessionException
- If the session is invalid (expired, unknown, ...)Group updateGroup(long groupId, GroupUpdater updater) throws GroupNotFoundException, UpdateException, AlreadyExistsException
This method also allow to update the icon of the group.
When you update it, the iconId will be set on the group 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 group.
groupId
- the identifier of the groupupdater
- the group updaterGroupNotFoundException
- If the group identifier does not refer to an existing groupUpdateException
- If an exception occurs during the group updateInvalidSessionException
- If the session is invalid (expired, unknown, ...)AlreadyExistsException
void deleteGroup(long groupId) throws DeletionException
groupId
- the identifier of the groupDeletionException
- If an exception occurs during the group deletionInvalidSessionException
- If the session is invalid (expired, unknown, ...)void deleteGroups(List<Long> groupIds) throws DeletionException
groupIds
- the list of group identifiersDeletionException
- If an exception occurs during the group deletionInvalidSessionException
- If the session is invalid (expired, unknown, ...)Group getGroup(long groupId) throws GroupNotFoundException
groupId
- the group identifierGroupNotFoundException
- If the group identifier does not refer to an existing groupRetrieveException
- If an exception occurs during the group retrievingInvalidSessionException
- If the session is invalid (expired, unknown, ...)Group getGroupByPath(String groupPath) throws GroupNotFoundException
groupPath
- the full path of the group (parentPath/name)GroupNotFoundException
- If the group path does not refer to an existing groupRetrieveException
- If an exception occurs during the group retrievingInvalidSessionException
- If the session is invalid (expired, unknown, ...)long getNumberOfGroups()
RetrieveException
- If an exception occurs during the count retrievingInvalidSessionException
- If the session is invalid (expired, unknown, ...)List<Group> getGroups(int startIndex, int maxResults, GroupCriterion criterion)
It retrieves from the startIndex to the startIndex + maxResults.
startIndex
- the start indexmaxResults
- the max number of groupscriterion
- the sorting criterionRetrieveException
- If an exception occurs during the group retrievingInvalidSessionException
- If the session is invalid (expired, unknown, ...)Map<Long,Group> getGroups(List<Long> groupIds)
The map contains the couples groupId/Group. If a group does not exists, no exception is thrown and no value is added in the map.
groupIds
- the identifiers of the groupsRetrieveException
- If an exception occurs during the group retrievingInvalidSessionException
- If the session is invalid (expired, unknown, ...)SearchResult<Group> searchGroups(SearchOptions options) throws SearchException
options
- the search criteriaSearchException
- If an exception occurs during the group searchingInvalidSessionException
- If the session is invalid (expired, unknown, ...)Copyright © 2018 Bonitasoft S.A.. All rights reserved.