Search in sources :

Example 46 with TaskSummary

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

the class QueryTasksAccTest method testQueryForCustom7.

@WithAccessId(userName = "teamlead_1", groupNames = { "group_1" })
@Test
public void testQueryForCustom7() throws SQLException, NotAuthorizedException, InvalidArgumentException {
    TaskService taskService = taskanaEngine.getTaskService();
    List<TaskSummary> results = taskService.createTaskQuery().customAttributeLike("7", "%a%", "%b%", "%c%", "%d%", "%e%", "%f%", "%g%", "%h%", "%i%", "%j%", "%k%", "%l%", "%m%", "%n%", "%o%", "%p%", "%q%", "%r%", "%s%", "%w%").list();
    assertThat(results.size(), equalTo(1));
    String[] ids = results.stream().map(t -> {
        try {
            return t.getCustomAttribute("7");
        } catch (InvalidArgumentException e) {
            e.printStackTrace();
            return "";
        }
    }).collect(Collectors.toList()).toArray(new String[0]);
    List<TaskSummary> result2 = taskService.createTaskQuery().customAttributeIn("7", ids).list();
    assertThat(result2.size(), equalTo(1));
}
Also used : InvalidArgumentException(pro.taskana.exceptions.InvalidArgumentException) TaskService(pro.taskana.TaskService) TaskSummary(pro.taskana.TaskSummary) TaskanaEngineProxyForTest(pro.taskana.impl.TaskanaEngineProxyForTest) AbstractAccTest(acceptance.AbstractAccTest) Test(org.junit.Test) WithAccessId(pro.taskana.security.WithAccessId)

Example 47 with TaskSummary

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

the class QueryTasksAccTest method testQueryForCustom10.

@WithAccessId(userName = "teamlead_1", groupNames = { "group_1" })
@Test
public void testQueryForCustom10() throws SQLException, NotAuthorizedException, InvalidArgumentException {
    TaskService taskService = taskanaEngine.getTaskService();
    List<TaskSummary> results = taskService.createTaskQuery().customAttributeLike("10", "%a%", "%b%", "%c%", "%d%", "%e%", "%f%", "%g%", "%h%", "%i%", "%j%", "%k%", "%l%", "%m%", "%n%", "%o%", "%p%", "%q%", "%r%", "%s%", "%w%").list();
    assertThat(results.size(), equalTo(2));
    String[] ids = results.stream().map(t -> {
        try {
            return t.getCustomAttribute("10");
        } catch (InvalidArgumentException e) {
            e.printStackTrace();
            return "";
        }
    }).collect(Collectors.toList()).toArray(new String[0]);
    List<TaskSummary> result2 = taskService.createTaskQuery().customAttributeIn("10", ids).list();
    assertThat(result2.size(), equalTo(2));
}
Also used : InvalidArgumentException(pro.taskana.exceptions.InvalidArgumentException) TaskService(pro.taskana.TaskService) TaskSummary(pro.taskana.TaskSummary) TaskanaEngineProxyForTest(pro.taskana.impl.TaskanaEngineProxyForTest) AbstractAccTest(acceptance.AbstractAccTest) Test(org.junit.Test) WithAccessId(pro.taskana.security.WithAccessId)

Example 48 with TaskSummary

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

the class QueryTasksAccTest method testQueryForCustom1.

@WithAccessId(userName = "teamlead_1", groupNames = { "group_1" })
@Test
public void testQueryForCustom1() throws SQLException, NotAuthorizedException, InvalidArgumentException {
    TaskService taskService = taskanaEngine.getTaskService();
    List<TaskSummary> results = taskService.createTaskQuery().customAttributeLike("1", "%a%", "%b%", "%c%", "%d%", "%e%", "%f%", "%g%", "%h%", "%i%", "%j%", "%k%", "%l%", "%m%", "%n%", "%o%", "%p%", "%q%", "%r%", "%s%", "%w%").list();
    assertThat(results.size(), equalTo(2));
    String[] ids = results.stream().map(t -> {
        try {
            return t.getCustomAttribute("1");
        } catch (InvalidArgumentException e) {
            e.printStackTrace();
            return "";
        }
    }).collect(Collectors.toList()).toArray(new String[0]);
    List<TaskSummary> result2 = taskService.createTaskQuery().customAttributeIn("1", ids).list();
    assertThat(result2.size(), equalTo(2));
}
Also used : InvalidArgumentException(pro.taskana.exceptions.InvalidArgumentException) TaskService(pro.taskana.TaskService) TaskSummary(pro.taskana.TaskSummary) TaskanaEngineProxyForTest(pro.taskana.impl.TaskanaEngineProxyForTest) AbstractAccTest(acceptance.AbstractAccTest) Test(org.junit.Test) WithAccessId(pro.taskana.security.WithAccessId)

Example 49 with TaskSummary

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

the class QueryTasksAccTest method testQueryForCustom3.

@WithAccessId(userName = "teamlead_1", groupNames = { "group_1" })
@Test
public void testQueryForCustom3() throws SQLException, NotAuthorizedException, InvalidArgumentException {
    TaskService taskService = taskanaEngine.getTaskService();
    List<TaskSummary> results = taskService.createTaskQuery().customAttributeLike("3", "%a%", "%b%", "%c%", "%d%", "%e%", "%f%", "%g%", "%h%", "%i%", "%j%", "%k%", "%l%", "%m%", "%n%", "%o%", "%p%", "%q%", "%r%", "%s%", "%w%").list();
    assertThat(results.size(), equalTo(1));
    String[] ids = results.stream().map(t -> {
        try {
            return t.getCustomAttribute("3");
        } catch (InvalidArgumentException e) {
            e.printStackTrace();
            return "";
        }
    }).collect(Collectors.toList()).toArray(new String[0]);
    List<TaskSummary> result2 = taskService.createTaskQuery().customAttributeIn("3", ids).list();
    assertThat(result2.size(), equalTo(1));
}
Also used : InvalidArgumentException(pro.taskana.exceptions.InvalidArgumentException) TaskService(pro.taskana.TaskService) TaskSummary(pro.taskana.TaskSummary) TaskanaEngineProxyForTest(pro.taskana.impl.TaskanaEngineProxyForTest) AbstractAccTest(acceptance.AbstractAccTest) Test(org.junit.Test) WithAccessId(pro.taskana.security.WithAccessId)

Example 50 with TaskSummary

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

the class QueryTasksAccTest method testQueryForAttachmentInSummary.

@WithAccessId(userName = "teamlead_1", groupNames = { "group_1" })
@Test
public void testQueryForAttachmentInSummary() throws SQLException, NotAuthorizedException, InvalidArgumentException, ClassificationNotFoundException, TaskNotFoundException, WorkbasketNotFoundException, ConcurrencyException, InvalidWorkbasketException, AttachmentPersistenceException {
    TaskService taskService = taskanaEngine.getTaskService();
    Attachment attachment = createAttachment(// prio 99, SL P2000D
    "DOCTYPE_DEFAULT", createObjectReference("COMPANY_A", "SYSTEM_B", "INSTANCE_B", "ArchiveId", "12345678901234567890123456789012345678901234567890"), "E-MAIL", "2018-01-15", createSimpleCustomProperties(3));
    Task task = taskService.getTask("TKI:000000000000000000000000000000000000");
    task.addAttachment(attachment);
    taskService.updateTask(task);
    List<TaskSummary> results = taskService.createTaskQuery().idIn("TKI:000000000000000000000000000000000000").list();
    assertThat(results.size(), equalTo(1));
    assertThat(results.get(0).getAttachmentSummaries().size(), equalTo(3));
    AttachmentSummary att = results.get(0).getAttachmentSummaries().get(0);
}
Also used : Task(pro.taskana.Task) TaskService(pro.taskana.TaskService) TaskSummary(pro.taskana.TaskSummary) Attachment(pro.taskana.Attachment) AttachmentSummary(pro.taskana.AttachmentSummary) TaskanaEngineProxyForTest(pro.taskana.impl.TaskanaEngineProxyForTest) AbstractAccTest(acceptance.AbstractAccTest) Test(org.junit.Test) WithAccessId(pro.taskana.security.WithAccessId)

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