Search in sources :

Example 41 with TaskSummary

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

the class QueryTasksWithSortingAccTest method testSortByPorSystemNoteDueAndOwner.

@WithAccessId(userName = "teamlead_1", groupNames = { "group_1", "group_2" })
@Test
public void testSortByPorSystemNoteDueAndOwner() throws SQLException, NotAuthorizedException, InvalidArgumentException {
    TaskService taskService = taskanaEngine.getTaskService();
    List<TaskSummary> results = taskService.createTaskQuery().workbasketKeyDomainIn(new KeyDomain("USER_3_2", "DOMAIN_B")).orderByPrimaryObjectReferenceSystem(SortDirection.DESCENDING).orderByNote(null).orderByDue(null).orderByOwner(asc).list();
    assertThat(results.size(), equalTo(25));
    TaskSummary previousSummary = null;
    for (TaskSummary taskSummary : results) {
        if (previousSummary != null) {
            Assert.assertTrue(taskSummary.getPrimaryObjRef().getSystem().compareToIgnoreCase(previousSummary.getPrimaryObjRef().getSystem()) <= 0);
        }
        previousSummary = taskSummary;
    }
}
Also used : TaskService(pro.taskana.TaskService) TaskSummary(pro.taskana.TaskSummary) KeyDomain(pro.taskana.KeyDomain) AbstractAccTest(acceptance.AbstractAccTest) Test(org.junit.Test) WithAccessId(pro.taskana.security.WithAccessId)

Example 42 with TaskSummary

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

the class QueryTasksWithSortingAccTest method testSortByPorSystemInstanceParentProcPlannedAndState.

@WithAccessId(userName = "teamlead_1", groupNames = { "group_1", "group_2" })
@Test
public void testSortByPorSystemInstanceParentProcPlannedAndState() throws SQLException, NotAuthorizedException, InvalidArgumentException {
    TaskService taskService = taskanaEngine.getTaskService();
    List<TaskSummary> results = taskService.createTaskQuery().workbasketKeyDomainIn(new KeyDomain("USER_3_2", "DOMAIN_B")).orderByPrimaryObjectReferenceSystemInstance(desc).orderByParentBusinessProcessId(asc).orderByPlanned(asc).orderByState(asc).list();
    assertThat(results.size(), equalTo(25));
    TaskSummary previousSummary = null;
    for (TaskSummary taskSummary : results) {
        if (previousSummary != null) {
            Assert.assertTrue(taskSummary.getPrimaryObjRef().getSystemInstance().compareToIgnoreCase(previousSummary.getPrimaryObjRef().getSystemInstance()) <= 0);
        }
        previousSummary = taskSummary;
    }
}
Also used : TaskService(pro.taskana.TaskService) TaskSummary(pro.taskana.TaskSummary) KeyDomain(pro.taskana.KeyDomain) AbstractAccTest(acceptance.AbstractAccTest) Test(org.junit.Test) WithAccessId(pro.taskana.security.WithAccessId)

Example 43 with TaskSummary

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

the class QueryTasksWithSortingAccTest method testSortBpIdClassificationIdDescriptionAndPorType.

@WithAccessId(userName = "teamlead_1", groupNames = { "group_1", "group_2" })
@Test
public void testSortBpIdClassificationIdDescriptionAndPorType() throws SQLException, NotAuthorizedException, InvalidArgumentException {
    TaskService taskService = taskanaEngine.getTaskService();
    List<TaskSummary> results = taskService.createTaskQuery().stateIn(TaskState.READY).workbasketIdIn("WBI:100000000000000000000000000000000015").orderByBusinessProcessId(asc).orderByClassificationKey(null).orderByPrimaryObjectReferenceType(SortDirection.DESCENDING).list();
    assertThat(results.size(), equalTo(22));
    TaskSummary previousSummary = null;
    for (TaskSummary taskSummary : results) {
        if (previousSummary != null) {
            Assert.assertTrue(taskSummary.getBusinessProcessId().compareToIgnoreCase(previousSummary.getBusinessProcessId()) >= 0);
        }
        previousSummary = taskSummary;
    }
}
Also used : TaskService(pro.taskana.TaskService) TaskSummary(pro.taskana.TaskSummary) AbstractAccTest(acceptance.AbstractAccTest) Test(org.junit.Test) WithAccessId(pro.taskana.security.WithAccessId)

Example 44 with TaskSummary

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

the class QueryTasksWithSortingAccTest method testSortByWbKeyPrioPorValueAndCompleted.

@WithAccessId(userName = "teamlead_1", groupNames = { "group_1", "group_2" })
@Test
public void testSortByWbKeyPrioPorValueAndCompleted() throws SQLException, NotAuthorizedException, InvalidArgumentException {
    TaskService taskService = taskanaEngine.getTaskService();
    List<TaskSummary> results = taskService.createTaskQuery().stateIn(TaskState.READY).orderByWorkbasketKey(null).workbasketIdIn("WBI:100000000000000000000000000000000015").orderByPriority(desc).orderByPrimaryObjectReferenceValue(asc).orderByCompleted(desc).list();
    assertThat(results.size(), equalTo(22));
    TaskSummary previousSummary = null;
    for (TaskSummary taskSummary : results) {
        if (previousSummary != null) {
            Assert.assertTrue(taskSummary.getWorkbasketSummary().getKey().compareToIgnoreCase(previousSummary.getWorkbasketSummary().getKey()) >= 0);
        }
        previousSummary = taskSummary;
    }
}
Also used : TaskService(pro.taskana.TaskService) TaskSummary(pro.taskana.TaskSummary) AbstractAccTest(acceptance.AbstractAccTest) Test(org.junit.Test) WithAccessId(pro.taskana.security.WithAccessId)

Example 45 with TaskSummary

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

the class TaskQueryAccTest method testTaskQueryUnauthenticated.

public void testTaskQueryUnauthenticated() {
    TaskService taskService = taskanaEngine.getTaskService();
    List<TaskSummary> results = taskService.createTaskQuery().ownerLike("%a%", "%u%").list();
    assertThat(results.size(), equalTo(0));
}
Also used : TaskService(pro.taskana.TaskService) TaskSummary(pro.taskana.TaskSummary)

Aggregations

TaskSummary (pro.taskana.TaskSummary)58 Test (org.junit.Test)48 TaskService (pro.taskana.TaskService)47 WithAccessId (pro.taskana.security.WithAccessId)45 AbstractAccTest (acceptance.AbstractAccTest)44 TaskanaEngineProxyForTest (pro.taskana.impl.TaskanaEngineProxyForTest)17 KeyDomain (pro.taskana.KeyDomain)14 InvalidArgumentException (pro.taskana.exceptions.InvalidArgumentException)14 Instant (java.time.Instant)9 ArrayList (java.util.ArrayList)8 TimeInterval (pro.taskana.TimeInterval)8 Classification (pro.taskana.Classification)5 Task (pro.taskana.Task)5 NotAuthorizedException (pro.taskana.exceptions.NotAuthorizedException)5 NotAuthorizedToQueryWorkbasketException (pro.taskana.exceptions.NotAuthorizedToQueryWorkbasketException)5 TaskQuery (pro.taskana.TaskQuery)4 Workbasket (pro.taskana.Workbasket)3 Arrays (java.util.Arrays)2 HashSet (java.util.HashSet)2 List (java.util.List)2