Java Code Examples for org.camunda.bpm.engine.TaskService#saveTask()

The following examples show how to use org.camunda.bpm.engine.TaskService#saveTask() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: CreateStandaloneTaskScenario.java    From camunda-bpm-platform with Apache License 2.0 6 votes vote down vote up
@DescribesScenario("createUserOperationLogEntries")
public static ScenarioSetup createUserOperationLogEntries() {
  return new ScenarioSetup() {
    public void execute(ProcessEngine engine, String scenarioName) {
      IdentityService identityService = engine.getIdentityService();
      identityService.setAuthentication("jane02", null);

      TaskService taskService = engine.getTaskService();

      String taskId = "myTaskForUserOperationLog";
      Task task = taskService.newTask(taskId);
      taskService.saveTask(task);

      identityService.clearAuthentication();
    }
  };
}
 
Example 2
Source File: CreateStandaloneTaskDeleteScenario.java    From camunda-bpm-platform with Apache License 2.0 6 votes vote down vote up
@DescribesScenario("createUserOperationLogEntriesForDelete")
public static ScenarioSetup createUserOperationLogEntries() {
  return new ScenarioSetup() {
    public void execute(ProcessEngine engine, String scenarioName) {
      IdentityService identityService = engine.getIdentityService();
      identityService.setAuthentication("mary01", null);

      TaskService taskService = engine.getTaskService();

      String taskId = "myTaskForUserOperationLogDel";
      Task task = taskService.newTask(taskId);
      taskService.saveTask(task);

      identityService.clearAuthentication();
    }
  };
}
 
Example 3
Source File: TaskResourceImpl.java    From camunda-bpm-platform with Apache License 2.0 5 votes vote down vote up
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);
}
 
Example 4
Source File: TaskRestServiceImpl.java    From camunda-bpm-platform with Apache License 2.0 5 votes vote down vote up
public void createTask(TaskDto taskDto) {
  ProcessEngine engine = getProcessEngine();
  TaskService taskService = engine.getTaskService();

  Task newTask = taskService.newTask(taskDto.getId());
  taskDto.updateTask(newTask);

  try {
    taskService.saveTask(newTask);

  } catch (NotValidException e) {
    throw new InvalidRequestException(Status.BAD_REQUEST, e, "Could not save task: " + e.getMessage());
  }

}