Search in sources :

Example 11 with ObjectReference

use of pro.taskana.impl.ObjectReference in project taskana by Taskana.

the class UpdateTaskAccTest method testUpdateTasksByPorForUser1.

@WithAccessId(userName = "user_1_1", groupNames = { "group_1" })
@Test
public void testUpdateTasksByPorForUser1() throws InvalidArgumentException {
    ObjectReference por = new ObjectReference();
    por.setCompany("00");
    por.setSystem("PASystem");
    por.setSystemInstance("00");
    por.setType("VNR");
    por.setValue("22334455");
    Map<String, String> customProperties = new HashMap<>();
    customProperties.put("7", "This is modifiedValue 7");
    customProperties.put("14", null);
    customProperties.put("3", "This is modifiedValue 3");
    customProperties.put("16", "This is modifiedValue 16");
    TaskService taskService = taskanaEngine.getTaskService();
    List<String> taskIds = taskService.updateTasks(por, customProperties);
    assertEquals(0, taskIds.size());
}
Also used : ObjectReference(pro.taskana.impl.ObjectReference) HashMap(java.util.HashMap) TaskService(pro.taskana.TaskService) AbstractAccTest(acceptance.AbstractAccTest) Test(org.junit.Test) WithAccessId(pro.taskana.security.WithAccessId)

Example 12 with ObjectReference

use of pro.taskana.impl.ObjectReference in project taskana by Taskana.

the class UpdateTaskAccTest method testUpdateTasksByPor.

@WithAccessId(userName = "teamlead_1", groupNames = { "group_1" })
@Test
public void testUpdateTasksByPor() throws InvalidArgumentException, TaskNotFoundException, NotAuthorizedException {
    ObjectReference por = new ObjectReference();
    por.setCompany("00");
    por.setSystem("PASystem");
    por.setSystemInstance("00");
    por.setType("VNR");
    por.setValue("22334455");
    Map<String, String> customProperties = new HashMap<>();
    customProperties.put("7", "This is modifiedValue 7");
    customProperties.put("14", null);
    customProperties.put("3", "This is modifiedValue 3");
    customProperties.put("16", "This is modifiedValue 16");
    TaskService taskService = taskanaEngine.getTaskService();
    List<String> taskIds = taskService.updateTasks(por, customProperties);
    assertEquals(6, taskIds.size());
    for (String taskId : taskIds) {
        Task task = taskService.getTask(taskId);
        assertEquals("This is modifiedValue 3", task.getCustomAttribute("3"));
        assertEquals("This is modifiedValue 7", task.getCustomAttribute("7"));
        assertEquals("This is modifiedValue 16", task.getCustomAttribute("16"));
        assertNull(task.getCustomAttribute("14"));
    }
}
Also used : Task(pro.taskana.Task) ObjectReference(pro.taskana.impl.ObjectReference) HashMap(java.util.HashMap) TaskService(pro.taskana.TaskService) AbstractAccTest(acceptance.AbstractAccTest) Test(org.junit.Test) WithAccessId(pro.taskana.security.WithAccessId)

Example 13 with ObjectReference

use of pro.taskana.impl.ObjectReference in project taskana by Taskana.

the class QueryObjectReferenceAccTest method testFindObjectReferenceBySystemInstance.

@Test
public void testFindObjectReferenceBySystemInstance() throws SQLException, ClassificationNotFoundException, NotAuthorizedException, InvalidArgumentException {
    TaskQuery taskQuery = taskanaEngine.getTaskService().createTaskQuery();
    List<ObjectReference> objectReferenceList = taskQuery.createObjectReferenceQuery().companyIn("Company1", "Company2").systemInstanceIn("Instance1").list();
    assertNotNull(objectReferenceList);
    assertEquals(1, objectReferenceList.size());
}
Also used : ObjectReference(pro.taskana.impl.ObjectReference) TaskQuery(pro.taskana.TaskQuery) AbstractAccTest(acceptance.AbstractAccTest) Test(org.junit.Test)

Example 14 with ObjectReference

use of pro.taskana.impl.ObjectReference in project taskana by Taskana.

the class QueryObjectReferenceAccTest method testFindObjectReferenceBySystem.

@Test
public void testFindObjectReferenceBySystem() throws SQLException, ClassificationNotFoundException, NotAuthorizedException, InvalidArgumentException {
    TaskQuery taskQuery = taskanaEngine.getTaskService().createTaskQuery();
    List<ObjectReference> objectReferenceList = taskQuery.createObjectReferenceQuery().companyIn("Company1", "Company2").systemIn("System2").list();
    assertNotNull(objectReferenceList);
    assertEquals(1, objectReferenceList.size());
}
Also used : ObjectReference(pro.taskana.impl.ObjectReference) TaskQuery(pro.taskana.TaskQuery) AbstractAccTest(acceptance.AbstractAccTest) Test(org.junit.Test)

Aggregations

ObjectReference (pro.taskana.impl.ObjectReference)14 Test (org.junit.Test)8 AbstractAccTest (acceptance.AbstractAccTest)7 TaskQuery (pro.taskana.TaskQuery)5 HashMap (java.util.HashMap)2 PostConstruct (javax.annotation.PostConstruct)2 Task (pro.taskana.Task)2 TaskService (pro.taskana.TaskService)2 WithAccessId (pro.taskana.security.WithAccessId)2 GET (javax.ws.rs.GET)1 Classification (pro.taskana.Classification)1 Workbasket (pro.taskana.Workbasket)1 TaskanaEngineConfigurationTest (pro.taskana.impl.configuration.TaskanaEngineConfigurationTest)1