Search in sources :

Example 11 with AuthorityInfo

use of org.alfresco.repo.security.authority.AuthorityInfo in project alfresco-remote-api by Alfresco.

the class GroupsFilter method getGroups.

public CollectionWithPagingInfo<Group> getGroups(final Parameters parameters) {
    Paging paging = parameters.getPaging();
    // Retrieve sort column. This is limited for now to sort column due to
    // v0 api implementation. Should be improved in the future.
    Pair<String, Boolean> sortProp = getGroupsSortProp(parameters);
    // Parse where clause properties.
    GroupsFilter groupsFilters = getGroupsFilterFromQueryParameters(parameters.getQuery());
    final AuthorityType authorityType = AuthorityType.GROUP;
    final Set<String> rootAuthorities = getAllRootAuthorities(authorityType);
    PagingResults<AuthorityInfo> pagingResult;
    try {
        pagingResult = getAuthoritiesInfo(authorityType, groupsFilters, rootAuthorities, sortProp, paging);
    } catch (UnknownAuthorityException e) {
        // Non-existent zone
        pagingResult = new EmptyPagingResults<>();
    }
    List<Group> groups = createGroupsResponse(pagingResult.getPage(), parameters.getInclude(), rootAuthorities);
    int totalItems = pagingResult.getTotalResultCount().getFirst();
    return CollectionWithPagingInfo.asPaged(paging, groups, pagingResult.hasMoreItems(), totalItems);
}
Also used : Group(org.alfresco.rest.api.model.Group) Paging(org.alfresco.rest.framework.resource.parameters.Paging) AuthorityType(org.alfresco.service.cmr.security.AuthorityType) AuthorityInfo(org.alfresco.repo.security.authority.AuthorityInfo) UnknownAuthorityException(org.alfresco.repo.security.authority.UnknownAuthorityException) EmptyPagingResults(org.alfresco.query.EmptyPagingResults)

Aggregations

AuthorityInfo (org.alfresco.repo.security.authority.AuthorityInfo)11 Paging (org.alfresco.rest.framework.resource.parameters.Paging)8 AuthorityType (org.alfresco.service.cmr.security.AuthorityType)8 AbstractList (java.util.AbstractList)7 Query (org.alfresco.rest.framework.resource.parameters.where.Query)7 EmptyPagingResults (org.alfresco.query.EmptyPagingResults)6 UnknownAuthorityException (org.alfresco.repo.security.authority.UnknownAuthorityException)6 Group (org.alfresco.rest.api.model.Group)6 GroupMember (org.alfresco.rest.api.model.GroupMember)6 UnsupportedResourceOperationException (org.alfresco.rest.framework.core.exceptions.UnsupportedResourceOperationException)6 MapBasedQueryWalkerOrSupported (org.alfresco.rest.workflow.api.impl.MapBasedQueryWalkerOrSupported)6 ArrayList (java.util.ArrayList)5 Collator (java.text.Collator)4 Arrays (java.util.Arrays)4 Collections (java.util.Collections)4 Comparator (java.util.Comparator)4 HashMap (java.util.HashMap)4 HashSet (java.util.HashSet)4 List (java.util.List)4 Map (java.util.Map)4