Search in sources :

Example 66 with WorkbasketSummary

use of pro.taskana.WorkbasketSummary in project taskana by Taskana.

the class WorkbasketServiceImpl method getDistributionTargets.

@Override
public List<WorkbasketSummary> getDistributionTargets(String workbasketKey, String domain) throws NotAuthorizedException, WorkbasketNotFoundException {
    LOGGER.debug("entry to getDistributionTargets(workbasketKey = {}, domain = {})", workbasketKey, domain);
    List<WorkbasketSummary> result = new ArrayList<>();
    try {
        taskanaEngine.openConnection();
        // check that source workbasket exists
        Workbasket workbasket = getWorkbasket(workbasketKey, domain);
        if (!taskanaEngine.isUserInRole(TaskanaRole.ADMIN, TaskanaRole.BUSINESS_ADMIN)) {
            checkAuthorization(workbasket.getId(), WorkbasketPermission.READ);
        }
        List<WorkbasketSummaryImpl> distributionTargets = workbasketMapper.findByDistributionTargets(workbasket.getId());
        result.addAll(distributionTargets);
        return result;
    } finally {
        taskanaEngine.returnConnection();
        if (LOGGER.isDebugEnabled()) {
            int numberOfResultObjects = result.size();
            LOGGER.debug("exit from getDistributionTargets(workbasketId). Returning {} resulting Objects: {} ", numberOfResultObjects, LoggerUtils.listToString(result));
        }
    }
}
Also used : ArrayList(java.util.ArrayList) Workbasket(pro.taskana.Workbasket) WorkbasketSummary(pro.taskana.WorkbasketSummary)

Aggregations

WorkbasketSummary (pro.taskana.WorkbasketSummary)66 Test (org.junit.Test)56 WorkbasketService (pro.taskana.WorkbasketService)53 AbstractAccTest (acceptance.AbstractAccTest)52 WithAccessId (pro.taskana.security.WithAccessId)51 ArrayList (java.util.ArrayList)15 Workbasket (pro.taskana.Workbasket)9 NotAuthorizedException (pro.taskana.exceptions.NotAuthorizedException)7 WorkbasketQuery (pro.taskana.WorkbasketQuery)5 Classification (pro.taskana.Classification)3 Task (pro.taskana.Task)3 InvalidArgumentException (pro.taskana.exceptions.InvalidArgumentException)3 WorkbasketNotFoundException (pro.taskana.exceptions.WorkbasketNotFoundException)3 Instant (java.time.Instant)2 Arrays (java.util.Arrays)2 HashSet (java.util.HashSet)2 List (java.util.List)2 Collectors (java.util.stream.Collectors)2 PersistenceException (org.apache.ibatis.exceptions.PersistenceException)2 Ignore (org.junit.Ignore)2