use of org.camunda.bpm.engine.TaskService in project camunda-bpm-platform by camunda.
the class TaskResourceImpl method updateTask.
public void updateTask(TaskDto taskDto) {
TaskService taskService = engine.getTaskService();
Task task = getTaskById(taskId);
if (task == null) {
throw new InvalidRequestException(Status.NOT_FOUND, "No matching task with id " + taskId);
}
taskDto.updateTask(task);
taskService.saveTask(task);
}
use of org.camunda.bpm.engine.TaskService in project camunda-bpm-platform by camunda.
the class TaskResourceImpl method addIdentityLink.
@Override
public void addIdentityLink(IdentityLinkDto identityLink) {
TaskService taskService = engine.getTaskService();
identityLink.validate();
if (identityLink.getUserId() != null) {
taskService.addUserIdentityLink(taskId, identityLink.getUserId(), identityLink.getType());
} else if (identityLink.getGroupId() != null) {
taskService.addGroupIdentityLink(taskId, identityLink.getGroupId(), identityLink.getType());
}
}
use of org.camunda.bpm.engine.TaskService in project camunda-bpm-platform by camunda.
the class TaskResourceImpl method complete.
@Override
public void complete(CompleteTaskDto dto) {
TaskService taskService = engine.getTaskService();
try {
VariableMap variables = VariableValueDto.toMap(dto.getVariables(), engine, objectMapper);
taskService.complete(taskId, variables);
} catch (RestException e) {
String errorMessage = String.format("Cannot complete task %s: %s", taskId, e.getMessage());
throw new InvalidRequestException(e.getStatus(), e, errorMessage);
} catch (AuthorizationException e) {
throw e;
} catch (ProcessEngineException e) {
String errorMessage = String.format("Cannot complete task %s: %s", taskId, e.getMessage());
throw new RestException(Status.INTERNAL_SERVER_ERROR, e, errorMessage);
}
}
use of org.camunda.bpm.engine.TaskService in project camunda-bpm-platform by camunda.
the class TaskResourceImpl method deleteIdentityLink.
@Override
public void deleteIdentityLink(IdentityLinkDto identityLink) {
TaskService taskService = engine.getTaskService();
identityLink.validate();
if (identityLink.getUserId() != null) {
taskService.deleteUserIdentityLink(taskId, identityLink.getUserId(), identityLink.getType());
} else if (identityLink.getGroupId() != null) {
taskService.deleteGroupIdentityLink(taskId, identityLink.getGroupId(), identityLink.getType());
}
}
use of org.camunda.bpm.engine.TaskService in project camunda-bpm-platform by camunda.
the class ProcessEngineRuleJunit4Test method ruleUsageExample.
@Test
@Deployment
public void ruleUsageExample() {
RuntimeService runtimeService = engineRule.getRuntimeService();
runtimeService.startProcessInstanceByKey("ruleUsage");
TaskService taskService = engineRule.getTaskService();
Task task = taskService.createTaskQuery().singleResult();
assertEquals("My Task", task.getName());
taskService.complete(task.getId());
assertEquals(0, runtimeService.createProcessInstanceQuery().count());
}
Aggregations