Search in sources :

Example 6 with ObjectReference

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

the class TaskServiceImplIntAutocommitTest method testWithPrimaryObjectRef.

@Test
public void testWithPrimaryObjectRef() throws FileNotFoundException, SQLException, TaskNotFoundException, WorkbasketNotFoundException, NotAuthorizedException, ClassificationNotFoundException, ClassificationAlreadyExistException, TaskAlreadyExistException, InvalidWorkbasketException, InvalidArgumentException, WorkbasketAlreadyExistException, DomainNotFoundException {
    Workbasket wb = workbasketService.newWorkbasket("workbasket", "DOMAIN_A");
    wb.setName("workbasket");
    wb.setType(WorkbasketType.GROUP);
    taskanaEngine.getWorkbasketService().createWorkbasket(wb);
    Classification classification = classificationService.newClassification("TEST", "DOMAIN_A", "TASK");
    taskanaEngine.getClassificationService().createClassification(classification);
    Task task = taskServiceImpl.newTask(wb.getId());
    task.setName("Unit Test Task");
    task.setClassificationKey(classification.getKey());
    ObjectReference objRef = new ObjectReference();
    objRef.setCompany("novatec");
    objRef.setSystem("linux");
    objRef.setSystemInstance("inst1");
    objRef.setType("fast");
    objRef.setValue("4711");
    task.setPrimaryObjRef(objRef);
    task = taskServiceImpl.createTask(task);
    Task task2 = taskServiceImpl.getTask(task.getId());
    // skanaEngineImpl.getSqlSession().commit(); // needed so that the change is visible in the other session
    Assert.assertNotNull(task2);
}
Also used : Task(pro.taskana.Task) ObjectReference(pro.taskana.impl.ObjectReference) Classification(pro.taskana.Classification) Workbasket(pro.taskana.Workbasket) TaskanaEngineConfigurationTest(pro.taskana.impl.configuration.TaskanaEngineConfigurationTest) Test(org.junit.Test)

Example 7 with ObjectReference

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

the class TaskanaComponent method triggerRollback.

public void triggerRollback() throws NotAuthorizedException, WorkbasketNotFoundException, ClassificationNotFoundException, InvalidWorkbasketException, TaskAlreadyExistException, InvalidArgumentException {
    Task task = taskService.newTask("1");
    task.setName("Unit Test Task");
    ObjectReference objRef = new ObjectReference();
    objRef.setCompany("aCompany");
    objRef.setSystem("aSystem");
    objRef.setSystemInstance("anInstance");
    objRef.setType("aType");
    objRef.setValue("aValue");
    task.setPrimaryObjRef(objRef);
    task = taskService.createTask(task);
    throw new RuntimeException();
}
Also used : ObjectReference(pro.taskana.impl.ObjectReference)

Example 8 with ObjectReference

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

the class ExampleBootstrap method init.

@PostConstruct
public void init(@Observes @Initialized(ApplicationScoped.class) Object init) throws TaskNotFoundException, NotAuthorizedException, WorkbasketNotFoundException, ClassificationNotFoundException, InvalidStateException, InvalidOwnerException, InvalidWorkbasketException, TaskAlreadyExistException, InvalidArgumentException {
    System.out.println("---------------------------> Start App");
    Task task = taskanaEjb.getTaskService().newTask(null);
    ObjectReference objRef = new ObjectReference();
    objRef.setCompany("aCompany");
    objRef.setSystem("aSystem");
    objRef.setSystemInstance("anInstance");
    objRef.setType("aType");
    objRef.setValue("aValue");
    task.setPrimaryObjRef(objRef);
    task = taskanaEjb.getTaskService().createTask(task);
    System.out.println("---------------------------> Task started: " + task.getId());
    taskanaEjb.getTaskService().claim(task.getId());
    System.out.println("---------------------------> Task claimed: " + taskanaEjb.getTaskService().getTask(task.getId()).getOwner());
    taskanaEjb.getTaskService().completeTask(task.getId());
    System.out.println("---------------------------> Task completed");
}
Also used : ObjectReference(pro.taskana.impl.ObjectReference) PostConstruct(javax.annotation.PostConstruct)

Example 9 with ObjectReference

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

the class TaskanaEjb method triggerRollback.

public void triggerRollback() throws NotAuthorizedException, WorkbasketNotFoundException, ClassificationNotFoundException, TaskAlreadyExistException, InvalidWorkbasketException, InvalidArgumentException {
    Task task = taskService.newTask(null);
    ObjectReference objRef = new ObjectReference();
    objRef.setCompany("aCompany");
    objRef.setSystem("aSystem");
    objRef.setSystemInstance("anInstance");
    objRef.setType("aType");
    objRef.setValue("aValue");
    task.setPrimaryObjRef(objRef);
    taskService.createTask(task);
    System.out.println("---------------->" + task.getId());
    throw new RuntimeException();
}
Also used : ObjectReference(pro.taskana.impl.ObjectReference)

Example 10 with ObjectReference

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

the class TaskanaRestTest method startTask.

@GET
public Response startTask() throws NotAuthorizedException, WorkbasketNotFoundException, ClassificationNotFoundException, ClassificationAlreadyExistException, InvalidWorkbasketException, TaskAlreadyExistException, InvalidArgumentException, WorkbasketAlreadyExistException, DomainNotFoundException {
    Workbasket workbasket = taskanaEjb.getWorkbasketService().newWorkbasket("key", "cdiDomain");
    workbasket.setName("wb");
    workbasket.setType(WorkbasketType.PERSONAL);
    taskanaEjb.getWorkbasketService().createWorkbasket(workbasket);
    Classification classification = classificationService.newClassification("TEST", "cdiDomain", "t1");
    taskanaEjb.getClassificationService().createClassification(classification);
    Task task = taskanaEjb.getTaskService().newTask(workbasket.getKey());
    task.setClassificationKey(classification.getKey());
    ObjectReference objRef = new ObjectReference();
    objRef.setCompany("aCompany");
    objRef.setSystem("aSystem");
    objRef.setSystemInstance("anInstance");
    objRef.setType("aType");
    objRef.setValue("aValue");
    task.setPrimaryObjRef(objRef);
    Task result = taskanaEjb.getTaskService().createTask(task);
    logger.info(result.getId() + ":" + result.getOwner());
    return Response.status(200).entity(result.getId()).build();
}
Also used : ObjectReference(pro.taskana.impl.ObjectReference) GET(javax.ws.rs.GET)

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