REPO-1304: Create a group

- added create group logic; fixed a sorting bug for get groups/group members; updated test framework - post/create action; fix toJSON issue for parentIds and zones.

git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/BRANCHES/DEV/5.2.N/root@134310 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
Cristian Turlica
2017-01-12 16:11:40 +00:00
parent 9f34aa9f85
commit 93fc6fe945
8 changed files with 270 additions and 25 deletions

View File

@@ -28,6 +28,8 @@ 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.WebApiParam;
import org.alfresco.rest.framework.core.ResourceParameter;
import org.alfresco.rest.framework.core.exceptions.EntityNotFoundException;
import org.alfresco.rest.framework.resource.EntityResource;
import org.alfresco.rest.framework.resource.actions.interfaces.EntityResourceAction;
@@ -36,13 +38,16 @@ import org.alfresco.rest.framework.resource.parameters.Parameters;
import org.alfresco.util.ParameterCheck;
import org.springframework.beans.factory.InitializingBean;
import java.util.ArrayList;
import java.util.List;
/**
* An implementation of an Entity Resource for a Group
*
* @author cturlica
*/
@EntityResource(name = "groups", title = "Groups")
public class GroupsEntityResource implements EntityResourceAction.Read<Group>, EntityResourceAction.ReadById<Group>, InitializingBean
public class GroupsEntityResource implements EntityResourceAction.Read<Group>, EntityResourceAction.ReadById<Group>, EntityResourceAction.Create<Group>, InitializingBean
{
private Groups groups;
@@ -70,4 +75,15 @@ public class GroupsEntityResource implements EntityResourceAction.Read<Group>, E
{
return groups.getGroup(groupId, parameters);
}
@Override
@WebApiDescription(title="Create group", description="Create group")
@WebApiParam(name="entity", title="A single group", description="A single group, multiple groups are not supported.",
kind= ResourceParameter.KIND.HTTP_BODY_OBJECT, allowMultiple=false)
public List<Group> create(List<Group> entity, Parameters parameters)
{
List<Group> result = new ArrayList<>(1);
result.add(groups.create(entity.get(0), parameters));
return result;
}
}