ACS-5506 Proper Group serialization

This commit is contained in:
MichalKinas
2023-07-05 19:34:46 +02:00
parent 7a8cf67c2e
commit 05f0df1b2f
2 changed files with 15 additions and 2 deletions

View File

@@ -120,8 +120,7 @@ public class GroupsTests extends RestTest
//ListPersonMembership
restClient.authenticateUser(userModel).withCoreAPI().usingUser(userModel).listGroupMemberships()
.assertThat().entriesListContains("id", "GROUP_"+groupName)
.and().entriesListContains("id", "GROUP_"+subGroupName);
.assertThat().entriesListContains("id", "GROUP_"+groupName);
restClient.assertStatusCodeIs(HttpStatus.OK);
//CheckListDetails

View File

@@ -58,7 +58,9 @@ public class Group extends org.alfresco.rest.api.model.Group implements Serializ
AssertUtil.assertEquals("id", getId(), other.getId());
AssertUtil.assertEquals("displayName", getDisplayName(), other.getDisplayName());
AssertUtil.assertEquals("description", getDescription(), other.getDescription());
AssertUtil.assertEquals("isRoot", getIsRoot(), other.getIsRoot());
AssertUtil.assertEquals("hasSubgroups", getHasSubgroups(), other.getHasSubgroups());
AssertUtil.assertEquals("parentIds", getParentIds(), other.getParentIds());
AssertUtil.assertEquals("zones", getZones(), other.getZones());
}
@@ -73,11 +75,21 @@ public class Group extends org.alfresco.rest.api.model.Group implements Serializ
groupJson.put("displayName", getDisplayName());
if (getDescription() != null)
{
groupJson.put("description", getDescription());
}
if (getIsRoot() != null)
{
groupJson.put("isRoot", getIsRoot());
}
if (getHasSubgroups() != null)
{
groupJson.put("hasSubgroups", getHasSubgroups());
}
if (getParentIds() != null)
{
groupJson.put("parentIds", new ArrayList(getParentIds()));
@@ -97,6 +109,7 @@ public class Group extends org.alfresco.rest.api.model.Group implements Serializ
String displayName = (String) jsonObject.get("displayName");
String description = (String) jsonObject.get("description");
Boolean isRoot = (Boolean) jsonObject.get("isRoot");
Boolean hasSubgroups = (Boolean) jsonObject.get("hasSubgroups");
List<String> parentIds = (List<String>) jsonObject.get("parentIds");
List<String> zones = (List<String>) jsonObject.get("zones");
@@ -105,6 +118,7 @@ public class Group extends org.alfresco.rest.api.model.Group implements Serializ
group.setDisplayName(displayName);
group.setDescription(description);
group.setIsRoot(isRoot);
group.setHasSubgroups(hasSubgroups);
group.setParentIds(parentIds != null ? new HashSet<>(parentIds) : null);
group.setZones(zones != null ? new HashSet<>(zones) : null);