diff --git a/packaging/tests/tas-restapi/src/test/java/org/alfresco/rest/groups/GroupsTests.java b/packaging/tests/tas-restapi/src/test/java/org/alfresco/rest/groups/GroupsTests.java index 75cecb45ff..f01f4d622d 100644 --- a/packaging/tests/tas-restapi/src/test/java/org/alfresco/rest/groups/GroupsTests.java +++ b/packaging/tests/tas-restapi/src/test/java/org/alfresco/rest/groups/GroupsTests.java @@ -31,7 +31,8 @@ public class GroupsTests extends RestTest @Test(groups = { TestGroup.REST_API, TestGroup.GROUPS, TestGroup.SANITY }) @TestRail(section = { TestGroup.REST_API, TestGroup.NODES }, executionType = ExecutionType.SANITY, description = "Verify creation, listing, updating and deletion of groups.") - public void createListUpdateAndDeleteGroup() { + public void createListUpdateAndDeleteGroup() + { String groupName = "ZtestGroup" + UUID.randomUUID(); String subGroupName = "ZtestSubgroup" + UUID.randomUUID(); String groupDescription = "ZtestGroup description" + UUID.randomUUID(); @@ -111,7 +112,8 @@ public class GroupsTests extends RestTest @Test(groups = { TestGroup.REST_API, TestGroup.GROUPS, TestGroup.SANITY }) @TestRail(section = { TestGroup.REST_API, TestGroup.NODES }, executionType = ExecutionType.SANITY, description = "Verify creation, listing(only for person) and deletion of group memberships. ") - public void createListDeleteGroupMembership() { + public void createListDeleteGroupMembership() + { String groupName = "ZtestGroup" + UUID.randomUUID(); JsonObject groupBody = Json.createObjectBuilder().add("id", groupName).add("displayName", groupName).build(); String groupBodyCreate = groupBody.toString(); diff --git a/remote-api/src/main/java/org/alfresco/rest/api/impl/GroupsImpl.java b/remote-api/src/main/java/org/alfresco/rest/api/impl/GroupsImpl.java index 464d4ff525..6cc4631df0 100644 --- a/remote-api/src/main/java/org/alfresco/rest/api/impl/GroupsImpl.java +++ b/remote-api/src/main/java/org/alfresco/rest/api/impl/GroupsImpl.java @@ -379,11 +379,13 @@ public class GroupsImpl implements Groups String displayNameFilter = groupsFilter.getDisplayNameFilter(); PagingResults pagingResult; - if (isRootParam != null || displayNameFilter != null) + // Don't use canned queries when fetching authorities with description + // if better performance is requested for loading descriptions we can add canned queries in the future + if (isRootParam != null || displayNameFilter != null || includeDescription) { List groupList; - if (isRootParam != null && isRootParam) + if ((isRootParam != null && isRootParam) || includeDescription) { // Limit the post processing work by using the already loaded // list of root authorities. diff --git a/repository/src/main/java/org/alfresco/repo/security/authority/AuthorityDAOImpl.java b/repository/src/main/java/org/alfresco/repo/security/authority/AuthorityDAOImpl.java index 6db71ea26b..14b69a50d0 100644 --- a/repository/src/main/java/org/alfresco/repo/security/authority/AuthorityDAOImpl.java +++ b/repository/src/main/java/org/alfresco/repo/security/authority/AuthorityDAOImpl.java @@ -392,7 +392,7 @@ public class AuthorityDAOImpl implements AuthorityDAO, NodeServicePolicies.Befor props.put(ContentModel.PROP_NAME, DigestUtils.md5Hex(name)); props.put(ContentModel.PROP_AUTHORITY_NAME, name); props.put(ContentModel.PROP_AUTHORITY_DISPLAY_NAME, authorityDisplayName); - if (MapUtils.isNotEmpty(properties)) + if (properties != null) { props.putAll(properties); } @@ -1452,9 +1452,9 @@ public class AuthorityDAOImpl implements AuthorityDAO, NodeServicePolicies.Befor { return Pair.nullPair(); } - Serializable displayName = nodeService.getProperty(ref, ContentModel.PROP_AUTHORITY_DISPLAY_NAME); + String displayName = getAuthorityDisplayName(authorityName); Serializable description = nodeService.getProperty(ref, ContentModel.PROP_DESCRIPTION); - return new Pair<>(DefaultTypeConverter.INSTANCE.convert(String.class, displayName), DefaultTypeConverter.INSTANCE.convert(String.class, description)); + return new Pair<>(displayName, DefaultTypeConverter.INSTANCE.convert(String.class, description)); } @Override @@ -1465,8 +1465,10 @@ public class AuthorityDAOImpl implements AuthorityDAO, NodeServicePolicies.Befor { return; } - nodeService.setProperty(ref, ContentModel.PROP_AUTHORITY_DISPLAY_NAME, authorityDisplayName); - nodeService.setProperty(ref, ContentModel.PROP_DESCRIPTION, description); + Map properties = new HashMap<>(); + properties.put(ContentModel.PROP_AUTHORITY_DISPLAY_NAME, authorityDisplayName); + properties.put(ContentModel.PROP_DESCRIPTION, description); + nodeService.setProperties(ref, properties); } public NodeRef getOrCreateZone(String zoneName)