use of pro.taskana.TaskService in project taskana by Taskana.
the class CreateTaskAccTest method testUseClassificationMetadataFromCorrectDomainForNewTask.
@WithAccessId(userName = "user_1_1", groupNames = { "group_1" })
@Test
public void testUseClassificationMetadataFromCorrectDomainForNewTask() throws SQLException, NotAuthorizedException, InvalidArgumentException, ClassificationNotFoundException, WorkbasketNotFoundException, TaskAlreadyExistException, InvalidWorkbasketException {
TaskService taskService = taskanaEngine.getTaskService();
Task newTask = taskService.newTask("USER_1_1", "DOMAIN_A");
newTask.setClassificationKey("T2100");
newTask.setPrimaryObjRef(createObjectReference("COMPANY_A", "SYSTEM_A", "INSTANCE_A", "VNR", "1234567"));
newTask.setName("Test Name");
Task createdTask = taskService.createTask(newTask);
assertNotNull(createdTask);
assertThat(createdTask.getCreator(), equalTo(CurrentUserContext.getUserid()));
// priority is 22 in DOMAIN_B, task is created in DOMAIN_A
assertEquals(2, createdTask.getPriority());
}
use of pro.taskana.TaskService 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));
}
use of pro.taskana.TaskService 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));
}
use of pro.taskana.TaskService 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));
}
use of pro.taskana.TaskService 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));
}
Aggregations