mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-07-24 17:32:48 +00:00
ACS-5506 PMD fixes
This commit is contained in:
@@ -107,9 +107,9 @@ public class GroupsImpl implements Groups
|
||||
}
|
||||
|
||||
// List groups filtering (via where clause)
|
||||
private final static Set<String> LIST_GROUPS_EQUALS_QUERY_PROPERTIES = new HashSet<>(Arrays.asList(new String[] { PARAM_IS_ROOT }));
|
||||
private final static Set<String> LIST_GROUPS_EQUALS_QUERY_PROPERTIES = new HashSet<>(List.of(PARAM_IS_ROOT));
|
||||
|
||||
private final static Set<String> LIST_GROUP_MEMBERS_QUERY_PROPERTIES = new HashSet<>(Arrays.asList(new String[] { PARAM_MEMBER_TYPE }));
|
||||
private final static Set<String> LIST_GROUP_MEMBERS_QUERY_PROPERTIES = new HashSet<>(List.of(PARAM_MEMBER_TYPE));
|
||||
|
||||
protected AuthorityService authorityService;
|
||||
protected NodeService nodeService;
|
||||
@@ -241,7 +241,7 @@ public class GroupsImpl implements Groups
|
||||
|
||||
private List<Group> createGroupsResponse(final List<AuthorityInfo> page, final List<String> includeParam, final Set<String> rootAuthorities)
|
||||
{
|
||||
List<Group> groups = new AbstractList<Group>()
|
||||
List<Group> groups = new AbstractList<>()
|
||||
{
|
||||
@Override
|
||||
public Group get(int index)
|
||||
@@ -656,7 +656,7 @@ public class GroupsImpl implements Groups
|
||||
Pair<String, Boolean> sortProp;
|
||||
List<SortColumn> sortCols = parameters.getSorting();
|
||||
|
||||
if ((sortCols != null) && (sortCols.size() > 0))
|
||||
if (sortCols != null && !sortCols.isEmpty())
|
||||
{
|
||||
if (sortCols.size() > 1)
|
||||
{
|
||||
@@ -671,7 +671,7 @@ public class GroupsImpl implements Groups
|
||||
throw new InvalidArgumentException("Invalid sort field: " + sortCol.column);
|
||||
}
|
||||
|
||||
sortProp = new Pair<>(sortPropName, (sortCol.asc ? Boolean.TRUE : Boolean.FALSE));
|
||||
sortProp = new Pair<>(sortPropName, sortCol.asc ? Boolean.TRUE : Boolean.FALSE);
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -887,7 +887,7 @@ public class GroupsImpl implements Groups
|
||||
|
||||
// Verify if groupMemberId is member of groupId
|
||||
AuthorityType authorityType = AuthorityType.getAuthorityType(groupMemberId);
|
||||
Set<String> parents = authorityService.getContainingAuthorities(AuthorityType.GROUP, groupMemberId, true);
|
||||
Set<String> parents = authorityService.getContainingAuthorities(authorityType, groupMemberId, true);
|
||||
if (!parents.contains(groupId))
|
||||
{
|
||||
throw new NotFoundException(groupMemberId + " is not member of " + groupId);
|
||||
@@ -1093,7 +1093,7 @@ public class GroupsImpl implements Groups
|
||||
{
|
||||
String name = inferPrefix ? authorityService.getName(authorityType, authorityName) : authorityName;
|
||||
|
||||
return (name != null && authorityService.authorityExists(name));
|
||||
return name != null && authorityService.authorityExists(name);
|
||||
}
|
||||
|
||||
private boolean isGroupAuthority(String authorityName)
|
||||
|
@@ -181,6 +181,6 @@ public class Group implements Comparable<Group>
|
||||
public boolean wasSet(String fieldName)
|
||||
{
|
||||
Boolean b = setFields.get(fieldName);
|
||||
return (b != null ? b : false);
|
||||
return b != null ? b : false;
|
||||
}
|
||||
}
|
File diff suppressed because it is too large
Load Diff
@@ -51,7 +51,11 @@ import org.mockito.Mock;
|
||||
import jakarta.servlet.http.HttpServletResponse;
|
||||
import java.util.*;
|
||||
|
||||
import static org.junit.Assert.*;
|
||||
import static org.junit.Assert.assertEquals;
|
||||
import static org.junit.Assert.assertFalse;
|
||||
import static org.junit.Assert.assertNotNull;
|
||||
import static org.junit.Assert.assertNull;
|
||||
import static org.junit.Assert.assertTrue;
|
||||
import static org.mockito.Mockito.when;
|
||||
|
||||
/**
|
||||
@@ -67,13 +71,13 @@ public class GroupsTest extends AbstractSingleNetworkSiteTest
|
||||
|
||||
protected AuthorityService authorityService;
|
||||
|
||||
private String rootGroupName = null;
|
||||
private Group rootGroup = null;
|
||||
private Group groupA = null;
|
||||
private Group groupB = null;
|
||||
private GroupMember groupMemberA = null;
|
||||
private GroupMember groupMemberB = null;
|
||||
private GroupMember personMember = null;
|
||||
private String rootGroupName;
|
||||
private Group rootGroup;
|
||||
private Group groupA;
|
||||
private Group groupB;
|
||||
private GroupMember groupMemberA;
|
||||
private GroupMember groupMemberB;
|
||||
private GroupMember personMember;
|
||||
@Mock
|
||||
private ResultSetRow groupAResultSetRow;
|
||||
@Mock
|
||||
@@ -955,7 +959,7 @@ public class GroupsTest extends AbstractSingleNetworkSiteTest
|
||||
expected.retainAll(respPostProcess.getList());
|
||||
|
||||
// If this assertion fails, then the tests aren't providing any value - change them!
|
||||
assertTrue("List doesn't contain enough items for test to be conclusive.", expected.size() > 0);
|
||||
assertTrue("List doesn't contain enough items for test to be conclusive.", !expected.isEmpty());
|
||||
checkList(expected, respPostProcess.getPaging(), respPostProcess);
|
||||
}
|
||||
|
||||
@@ -976,7 +980,7 @@ public class GroupsTest extends AbstractSingleNetworkSiteTest
|
||||
expected.retainAll(respPostProcess.getList());
|
||||
|
||||
// If this assertion fails, then the tests aren't providing any value - change them!
|
||||
assertTrue("List doesn't contain enough items for test to be conclusive.", expected.size() > 0);
|
||||
assertTrue("List doesn't contain enough items for test to be conclusive.", !expected.isEmpty());
|
||||
checkList(expected, respPostProcess.getPaging(), respPostProcess);
|
||||
}
|
||||
|
||||
@@ -1153,7 +1157,6 @@ public class GroupsTest extends AbstractSingleNetworkSiteTest
|
||||
|
||||
// -ve test: invalid zones clause
|
||||
{
|
||||
Paging paging = getPaging(0, Integer.MAX_VALUE);
|
||||
Map<String, String> otherParams = new HashMap<>();
|
||||
otherParams.put("include", org.alfresco.rest.api.Groups.PARAM_INCLUDE_ZONES);
|
||||
|
||||
|
Reference in New Issue
Block a user