Merged 5.2.N (5.2.2) to HEAD (5.2)

133709 cturlica: REPO-1301: Retrieve a group
      - first commit


git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@137320 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
Andrei Rebegea
2017-06-14 16:51:30 +00:00
parent e8e52ae6d0
commit ff2fc3a9cb
5 changed files with 134 additions and 8 deletions

View File

@@ -27,6 +27,7 @@ package org.alfresco.rest.api;
import org.alfresco.rest.api.model.Group;
import org.alfresco.rest.api.model.GroupMember;
import org.alfresco.rest.framework.core.exceptions.EntityNotFoundException;
import org.alfresco.rest.framework.resource.parameters.CollectionWithPagingInfo;
import org.alfresco.rest.framework.resource.parameters.Parameters;
@@ -46,13 +47,25 @@ public interface Groups
String PARAM_MEMBER_TYPE_GROUP = "GROUP";
String PARAM_MEMBER_TYPE_PERSON = "PERSON";
/**
* Get a group by it's id.
*
* @param groupId the identifier of a group.
* @param parameters the {@link Parameters} object to get the parameters passed into the request
* including:
* - include param (parentIds, zones)
* @return a {@code org.alfresco.rest.api.model.Group} object
* @throws EntityNotFoundException
*/
Group getGroup(String groupId, Parameters parameters) throws EntityNotFoundException;
/**
* Gets a list of groups.
*
* @param parameters the {@link Parameters} object to get the parameters passed into the request
* including:
* - filter, sort & paging params (where, orderBy, skipCount, maxItems)
* - incFiles, incFolders (both true by default)
* - include param (parentIds, zones)
* @return a paged list of {@code org.alfresco.rest.api.model.Group} objects
*/
CollectionWithPagingInfo<Group> getGroups(Parameters parameters);
@@ -64,7 +77,7 @@ public interface Groups
* @param parameters the {@link Parameters} object to get the parameters passed into the request
* including:
* - filter, sort & paging params (where, orderBy, skipCount, maxItems)
* - incFiles, incFolders (both true by default)
* - include param (parentIds, zones)
* @return a paged list of {@code org.alfresco.rest.api.model.GroupMember} objects
*/
CollectionWithPagingInfo<GroupMember> getGroupMembers(String groupId, Parameters parameters);

View File

@@ -28,6 +28,7 @@ package org.alfresco.rest.api.groups;
import org.alfresco.rest.api.Groups;
import org.alfresco.rest.api.model.Group;
import org.alfresco.rest.framework.WebApiDescription;
import org.alfresco.rest.framework.core.exceptions.EntityNotFoundException;
import org.alfresco.rest.framework.resource.EntityResource;
import org.alfresco.rest.framework.resource.actions.interfaces.EntityResourceAction;
import org.alfresco.rest.framework.resource.parameters.CollectionWithPagingInfo;
@@ -41,7 +42,7 @@ import org.springframework.beans.factory.InitializingBean;
* @author cturlica
*/
@EntityResource(name = "groups", title = "Groups")
public class GroupsEntityResource implements EntityResourceAction.Read<Group>, InitializingBean
public class GroupsEntityResource implements EntityResourceAction.Read<Group>, EntityResourceAction.ReadById<Group>, InitializingBean
{
private Groups groups;
@@ -62,4 +63,11 @@ public class GroupsEntityResource implements EntityResourceAction.Read<Group>, I
{
return groups.getGroups(params);
}
@Override
@WebApiDescription(title="Returns group information for group id")
public Group readById(String groupId, Parameters parameters) throws EntityNotFoundException
{
return groups.getGroup(groupId, parameters);
}
}

View File

@@ -100,6 +100,16 @@ public class GroupsImpl implements Groups
this.authorityService = authorityService;
}
public Group getGroup(String groupId, Parameters parameters) throws EntityNotFoundException
{
AuthorityInfo authorityInfo = getAuthorityInfo(groupId);
final Set<String> rootAuthorities = getAllRootAuthorities(AuthorityType.GROUP);
final List<String> includeParam = parameters.getInclude();
return getGroup(authorityInfo, includeParam, rootAuthorities);
}
public CollectionWithPagingInfo<Group> getGroups(final Parameters parameters)
{
final List<String> includeParam = parameters.getInclude();