use of org.camunda.bpm.engine.identity.GroupQuery in project camunda-bpm-platform by camunda.
the class FetchAndLockRestServiceInteractionTest method setupGroupQueryMock.
private List<String> setupGroupQueryMock(List<Group> groups) {
GroupQuery mockGroupQuery = mock(GroupQuery.class);
when(identityServiceMock.createGroupQuery()).thenReturn(mockGroupQuery);
when(mockGroupQuery.groupMember(anyString())).thenReturn(mockGroupQuery);
when(mockGroupQuery.list()).thenReturn(groups);
List<String> groupIds = new ArrayList<String>();
for (Group groupMock : groups) {
groupIds.add(groupMock.getId());
}
return groupIds;
}
use of org.camunda.bpm.engine.identity.GroupQuery in project camunda-bpm-platform by camunda.
the class AbstractAuthenticationFilterTest method setupGroupQueryMock.
protected List<String> setupGroupQueryMock(List<Group> groups) {
GroupQuery mockGroupQuery = mock(GroupQuery.class);
when(identityServiceMock.createGroupQuery()).thenReturn(mockGroupQuery);
when(mockGroupQuery.groupMember(anyString())).thenReturn(mockGroupQuery);
when(mockGroupQuery.list()).thenReturn(groups);
List<String> groupIds = new ArrayList<String>();
for (Group groupMock : groups) {
groupIds.add(groupMock.getId());
}
return groupIds;
}
use of org.camunda.bpm.engine.identity.GroupQuery in project camunda-bpm-platform by camunda.
the class GroupRestServiceImpl method queryGroups.
public List<GroupDto> queryGroups(GroupQueryDto queryDto, Integer firstResult, Integer maxResults) {
queryDto.setObjectMapper(getObjectMapper());
GroupQuery query = queryDto.toQuery(getProcessEngine());
List<Group> resultList;
if (firstResult != null || maxResults != null) {
resultList = executePaginatedQuery(query, firstResult, maxResults);
} else {
resultList = query.list();
}
return GroupDto.fromGroupList(resultList);
}
use of org.camunda.bpm.engine.identity.GroupQuery in project camunda-bpm-platform by camunda.
the class IdentityRestServiceImpl method getGroupInfo.
@Override
public GroupInfoDto getGroupInfo(String userId) {
if (userId == null) {
throw new InvalidRequestException(Status.BAD_REQUEST, "No user id was supplied");
}
IdentityService identityService = getProcessEngine().getIdentityService();
GroupQuery query = identityService.createGroupQuery();
List<Group> userGroups = query.groupMember(userId).orderByGroupName().asc().list();
Set<UserDto> allGroupUsers = new HashSet<UserDto>();
List<GroupDto> allGroups = new ArrayList<GroupDto>();
for (Group group : userGroups) {
List<User> groupUsers = identityService.createUserQuery().memberOfGroup(group.getId()).list();
for (User user : groupUsers) {
if (!user.getId().equals(userId)) {
allGroupUsers.add(new UserDto(user.getId(), user.getFirstName(), user.getLastName()));
}
}
allGroups.add(new GroupDto(group.getId(), group.getName()));
}
return new GroupInfoDto(allGroups, allGroupUsers);
}
use of org.camunda.bpm.engine.identity.GroupQuery in project camunda-bpm-platform by camunda.
the class GroupQueryTest method testQueryByInvalidNameLike.
public void testQueryByInvalidNameLike() {
GroupQuery query = identityService.createGroupQuery().groupNameLike("%invalid%");
verifyQueryResults(query, 0);
try {
identityService.createGroupQuery().groupNameLike(null).list();
fail();
} catch (ProcessEngineException e) {
}
}
Aggregations