use of pro.taskana.WorkbasketSummary in project taskana by Taskana.
the class QueryWorkbasketByPermissionAccTest method testQueryAllTransferTargetsForUserAndGroupSortedByNameAscending.
@WithAccessId(userName = "dummy", groupNames = { "businessadmin" })
@Test
public void testQueryAllTransferTargetsForUserAndGroupSortedByNameAscending() throws SQLException, NotAuthorizedException, InvalidArgumentException, SystemException {
WorkbasketService workbasketService = taskanaEngine.getWorkbasketService();
List<WorkbasketSummary> results = workbasketService.createWorkbasketQuery().accessIdsHavePermission(WorkbasketPermission.APPEND, "user_1_1", "group_1").orderByName(asc).list();
Assert.assertEquals(6, results.size());
Assert.assertEquals("GPK_KSC_1", results.get(0).getKey());
}
use of pro.taskana.WorkbasketSummary in project taskana by Taskana.
the class QueryWorkbasketByPermissionAccTest method testQueryAllTransferTargetsForUserAndGroup.
@WithAccessId(userName = "dummy", groupNames = { "businessadmin" })
@Test
public void testQueryAllTransferTargetsForUserAndGroup() throws SQLException, NotAuthorizedException, InvalidArgumentException, SystemException {
WorkbasketService workbasketService = taskanaEngine.getWorkbasketService();
List<WorkbasketSummary> results = workbasketService.createWorkbasketQuery().accessIdsHavePermission(WorkbasketPermission.APPEND, "user_1_1", "group_1").list();
Assert.assertEquals(6, results.size());
}
use of pro.taskana.WorkbasketSummary in project taskana by Taskana.
the class QueryWorkbasketByPermissionAccTest method testQueryAllTransferTargetsForUserAndGroupFromSubject.
@WithAccessId(userName = "user_1_1", groupNames = { "group_1" })
@Test
public void testQueryAllTransferTargetsForUserAndGroupFromSubject() throws SQLException, NotAuthorizedException, SystemException {
WorkbasketService workbasketService = taskanaEngine.getWorkbasketService();
List<WorkbasketSummary> results = workbasketService.createWorkbasketQuery().callerHasPermission(WorkbasketPermission.APPEND).list();
Assert.assertEquals(6, results.size());
}
use of pro.taskana.WorkbasketSummary in project taskana by Taskana.
the class QueryWorkbasketByPermissionAccTest method testQueryAllTransferTargetsForUser.
@WithAccessId(userName = "dummy", groupNames = { "businessadmin" })
@Test
public void testQueryAllTransferTargetsForUser() throws SQLException, NotAuthorizedException, InvalidArgumentException {
WorkbasketService workbasketService = taskanaEngine.getWorkbasketService();
List<WorkbasketSummary> results = workbasketService.createWorkbasketQuery().accessIdsHavePermission(WorkbasketPermission.APPEND, "user_1_1").list();
Assert.assertEquals(1, results.size());
Assert.assertEquals("USER_1_1", results.get(0).getKey());
}
use of pro.taskana.WorkbasketSummary in project taskana by Taskana.
the class TaskServiceImpl method addWorkbasketSummariesToTaskSummaries.
private void addWorkbasketSummariesToTaskSummaries(List<TaskSummaryImpl> taskSummaries) throws NotAuthorizedException {
LOGGER.debug("entry to addWorkbasketSummariesToTaskSummaries()");
if (taskSummaries == null || taskSummaries.isEmpty()) {
return;
}
// calculate parameters for workbasket query: workbasket keys
Set<String> workbasketIdSet = taskSummaries.stream().map(t -> t.getWorkbasketSummary().getId()).collect(Collectors.toSet());
String[] workbasketIdArray = workbasketIdSet.toArray(new String[0]);
// perform workbasket query
LOGGER.debug("addWorkbasketSummariesToTaskSummaries() about to query workbaskets");
WorkbasketQueryImpl query = (WorkbasketQueryImpl) workbasketService.createWorkbasketQuery();
query.setUsedToAugmentTasks(true);
List<WorkbasketSummary> workbaskets = query.idIn(workbasketIdArray).list();
// assign query results to appropriate tasks.
Iterator<TaskSummaryImpl> taskIterator = taskSummaries.iterator();
while (taskIterator.hasNext()) {
TaskSummaryImpl task = taskIterator.next();
String workbasketId = task.getWorkbasketSummaryImpl().getId();
// find the appropriate workbasket from the query result
WorkbasketSummary aWorkbasket = workbaskets.stream().filter(x -> workbasketId != null && workbasketId.equals(x.getId())).findFirst().orElse(null);
if (aWorkbasket == null) {
LOGGER.warn("Could not find a Workbasket for task {}.", task.getTaskId());
taskIterator.remove();
continue;
}
// set the classification on the task object
task.setWorkbasketSummary(aWorkbasket);
}
LOGGER.debug("exit from addWorkbasketSummariesToTaskSummaries()");
}
Aggregations