mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-08-14 17:58:59 +00:00
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:
@@ -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);
|
||||
|
@@ -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);
|
||||
}
|
||||
}
|
@@ -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();
|
||||
|
Reference in New Issue
Block a user