Search in sources :

Example 56 with TaskService

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

the class QueryTasksByObjectReferenceAccTest method testQueryTasksByExcactValueOfObjectReference.

@WithAccessId(userName = "teamlead_1", groupNames = { "group_1", "group_2" })
@Test
public void testQueryTasksByExcactValueOfObjectReference() throws SQLException, NotAuthorizedException, InvalidArgumentException, SystemException {
    TaskService taskService = taskanaEngine.getTaskService();
    List<TaskSummary> results = taskService.createTaskQuery().primaryObjectReferenceValueIn("11223344", "22334455").list();
    Assert.assertEquals(32L, results.size());
}
Also used : TaskService(pro.taskana.TaskService) TaskSummary(pro.taskana.TaskSummary) AbstractAccTest(acceptance.AbstractAccTest) Test(org.junit.Test) WithAccessId(pro.taskana.security.WithAccessId)

Example 57 with TaskService

use of pro.taskana.TaskService 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 58 with TaskService

use of pro.taskana.TaskService 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 59 with TaskService

use of pro.taskana.TaskService 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 60 with TaskService

use of pro.taskana.TaskService 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)

Aggregations

TaskService (pro.taskana.TaskService)102 Test (org.junit.Test)101 AbstractAccTest (acceptance.AbstractAccTest)99 WithAccessId (pro.taskana.security.WithAccessId)98 Task (pro.taskana.Task)48 TaskSummary (pro.taskana.TaskSummary)45 TaskanaEngineProxyForTest (pro.taskana.impl.TaskanaEngineProxyForTest)32 KeyDomain (pro.taskana.KeyDomain)16 InvalidArgumentException (pro.taskana.exceptions.InvalidArgumentException)16 Instant (java.time.Instant)13 TimeInterval (pro.taskana.TimeInterval)8 ArrayList (java.util.ArrayList)7 TaskanaException (pro.taskana.exceptions.TaskanaException)6 InvalidStateException (pro.taskana.exceptions.InvalidStateException)5 TaskNotFoundException (pro.taskana.exceptions.TaskNotFoundException)4 SqlSession (org.apache.ibatis.session.SqlSession)3 Ignore (org.junit.Ignore)3 Workbasket (pro.taskana.Workbasket)3 ConcurrencyException (pro.taskana.exceptions.ConcurrencyException)3 NotAuthorizedException (pro.taskana.exceptions.NotAuthorizedException)3