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));
}
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));
}
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);
}
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());
}
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());
}
Aggregations