Search in sources :

Example 26 with UserTaskInstanceDesc

use of org.jbpm.services.api.model.UserTaskInstanceDesc in project jbpm by kiegroup.

the class UserTaskAdminServiceImpl method cancelReassignment.

@Override
public void cancelReassignment(String deploymentId, long taskId, long reassignmentId) throws TaskNotFoundException {
    UserTaskInstanceDesc task = runtimeDataService.getTaskById(taskId);
    validateTask(deploymentId, taskId, task);
    userTaskService.execute(task.getDeploymentId(), ProcessInstanceIdContext.get(task.getProcessInstanceId()), new CancelTaskDeadlineCommand(identityProvider.getName(), taskId, reassignmentId));
}
Also used : CancelTaskDeadlineCommand(org.jbpm.kie.services.impl.admin.commands.CancelTaskDeadlineCommand) UserTaskInstanceDesc(org.jbpm.services.api.model.UserTaskInstanceDesc)

Example 27 with UserTaskInstanceDesc

use of org.jbpm.services.api.model.UserTaskInstanceDesc in project jbpm by kiegroup.

the class UserTaskAdminServiceImpl method removePeopleAssignment.

protected void removePeopleAssignment(String deploymentId, long taskId, int type, OrganizationalEntity... orgEntities) throws TaskNotFoundException {
    UserTaskInstanceDesc task = runtimeDataService.getTaskById(taskId);
    validateTask(deploymentId, taskId, task);
    userTaskService.execute(task.getDeploymentId(), ProcessInstanceIdContext.get(task.getProcessInstanceId()), new RemovePeopleAssignmentsCommand(identityProvider.getName(), taskId, type, orgEntities));
}
Also used : UserTaskInstanceDesc(org.jbpm.services.api.model.UserTaskInstanceDesc) RemovePeopleAssignmentsCommand(org.jbpm.kie.services.impl.admin.commands.RemovePeopleAssignmentsCommand)

Example 28 with UserTaskInstanceDesc

use of org.jbpm.services.api.model.UserTaskInstanceDesc in project jbpm by kiegroup.

the class ETaskOperationTest method testStartAndComplete.

@Test
public void testStartAndComplete() {
    Long processInstanceId = archive.startProcess(kieJar, HUMAN_TASK_PROCESS_ID);
    Assertions.assertThat(processInstanceId).isNotNull();
    List<Long> taskIds = runtimeDataService.getTasksByProcessInstanceId(processInstanceId);
    Assertions.assertThat(taskIds).isNotNull();
    Assertions.assertThat(taskIds).hasSize(1);
    Long taskId = taskIds.get(0);
    userTaskService.start(taskId, userId);
    UserTaskInstanceDesc task = runtimeDataService.getTaskById(taskId);
    Assertions.assertThat(task).isNotNull();
    Assertions.assertThat(task.getStatus()).isEqualTo(Status.InProgress.toString());
    Map<String, Object> results = new HashMap<String, Object>();
    userTaskService.complete(taskId, userId, results);
    task = runtimeDataService.getTaskById(taskId);
    Assertions.assertThat(task).isNotNull();
    Assertions.assertThat(task.getStatus()).isEqualTo(Status.Completed.toString());
    ProcessInstanceDesc log = runtimeDataService.getProcessInstanceById(processInstanceId);
    Assertions.assertThat(log).isNotNull();
    Assertions.assertThat(log.getState()).isEqualTo(ProcessInstance.STATE_COMPLETED);
}
Also used : HashMap(java.util.HashMap) ProcessInstanceDesc(org.jbpm.services.api.model.ProcessInstanceDesc) UserTaskInstanceDesc(org.jbpm.services.api.model.UserTaskInstanceDesc) Test(org.junit.Test) AbstractRuntimeEJBServicesTest(org.jbpm.test.container.AbstractRuntimeEJBServicesTest)

Example 29 with UserTaskInstanceDesc

use of org.jbpm.services.api.model.UserTaskInstanceDesc in project jbpm by kiegroup.

the class RuntimeDataServiceImplTest method testGetTaskByWorkItemId.

@Test
public void testGetTaskByWorkItemId() {
    processInstanceId = processService.startProcess(deploymentUnit.getIdentifier(), "org.jbpm.writedocument");
    assertNotNull(processInstanceId);
    ProcessInstance instance = processService.getProcessInstance(processInstanceId);
    assertNotNull(instance);
    Collection<NodeInstance> activeNodes = ((WorkflowProcessInstanceImpl) instance).getNodeInstances();
    assertNotNull(activeNodes);
    assertEquals(1, activeNodes.size());
    NodeInstance node = activeNodes.iterator().next();
    assertNotNull(node);
    assertTrue(node instanceof WorkItemNodeInstance);
    Long workItemId = ((WorkItemNodeInstance) node).getWorkItemId();
    assertNotNull(workItemId);
    UserTaskInstanceDesc userTask = runtimeDataService.getTaskByWorkItemId(workItemId);
    assertNotNull(userTask);
    assertEquals(processInstanceId, userTask.getProcessInstanceId());
    assertEquals("Write a Document", userTask.getName());
}
Also used : WorkflowProcessInstanceImpl(org.jbpm.workflow.instance.impl.WorkflowProcessInstanceImpl) ProcessInstance(org.kie.api.runtime.process.ProcessInstance) WorkItemNodeInstance(org.jbpm.workflow.instance.node.WorkItemNodeInstance) UserTaskInstanceDesc(org.jbpm.services.api.model.UserTaskInstanceDesc) NodeInstance(org.kie.api.runtime.process.NodeInstance) WorkItemNodeInstance(org.jbpm.workflow.instance.node.WorkItemNodeInstance) AbstractKieServicesBaseTest(org.jbpm.kie.test.util.AbstractKieServicesBaseTest) Test(org.junit.Test)

Example 30 with UserTaskInstanceDesc

use of org.jbpm.services.api.model.UserTaskInstanceDesc in project jbpm by kiegroup.

the class UserTaskServiceImplTest method testExit.

@Test
public void testExit() {
    processInstanceId = processService.startProcess(deploymentUnit.getIdentifier(), "org.jbpm.writedocument");
    assertNotNull(processInstanceId);
    List<Long> taskIds = runtimeDataService.getTasksByProcessInstanceId(processInstanceId);
    assertNotNull(taskIds);
    assertEquals(1, taskIds.size());
    Long taskId = taskIds.get(0);
    userTaskService.exit(taskId, "Administrator");
    UserTaskInstanceDesc task = runtimeDataService.getTaskById(taskId);
    assertNotNull(task);
    assertEquals(Status.Exited.toString(), task.getStatus());
}
Also used : UserTaskInstanceDesc(org.jbpm.services.api.model.UserTaskInstanceDesc) AbstractKieServicesBaseTest(org.jbpm.kie.test.util.AbstractKieServicesBaseTest) Test(org.junit.Test)

Aggregations

UserTaskInstanceDesc (org.jbpm.services.api.model.UserTaskInstanceDesc)118 Test (org.junit.Test)67 AbstractKieServicesBaseTest (org.jbpm.kie.test.util.AbstractKieServicesBaseTest)36 RuntimeManager (org.kie.api.runtime.manager.RuntimeManager)35 InternalRuntimeManager (org.kie.internal.runtime.manager.InternalRuntimeManager)35 InternalTaskService (org.kie.internal.task.api.InternalTaskService)35 UserTaskService (org.jbpm.services.api.UserTaskService)34 RuntimeEngine (org.kie.api.runtime.manager.RuntimeEngine)34 TaskService (org.kie.api.task.TaskService)34 HashMap (java.util.HashMap)23 QueryContext (org.kie.api.runtime.query.QueryContext)22 ArrayList (java.util.ArrayList)18 TaskNotFoundException (org.jbpm.services.api.TaskNotFoundException)16 PermissionDeniedException (org.jbpm.services.task.exception.PermissionDeniedException)16 ProcessInstanceDesc (org.jbpm.services.api.model.ProcessInstanceDesc)15 SqlQueryDefinition (org.jbpm.kie.services.impl.query.SqlQueryDefinition)11 QueryDefinition (org.jbpm.services.api.query.model.QueryDefinition)9 ProcessInstance (org.kie.api.runtime.process.ProcessInstance)7 CorrelationKey (org.kie.internal.process.CorrelationKey)7 AdvancedQueryContext (org.kie.api.runtime.query.AdvancedQueryContext)6