Java Code Examples for org.camunda.bpm.engine.task.Task#setCaseInstanceId()

The following examples show how to use org.camunda.bpm.engine.task.Task#setCaseInstanceId() . 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: TaskServiceTest.java    From camunda-bpm-platform with Apache License 2.0 6 votes vote down vote up
@Test
public void testTaskCaseInstanceId() {
  Task task = taskService.newTask();
  task.setCaseInstanceId("aCaseInstanceId");
  taskService.saveTask(task);

  // Fetch the task again and update
  task = taskService.createTaskQuery().taskId(task.getId()).singleResult();
  assertEquals("aCaseInstanceId", task.getCaseInstanceId());

  task.setCaseInstanceId("anotherCaseInstanceId");
  taskService.saveTask(task);

  task = taskService.createTaskQuery().taskId(task.getId()).singleResult();
  assertEquals("anotherCaseInstanceId", task.getCaseInstanceId());

  // Finally, delete task
  taskService.deleteTask(task.getId(), true);

}
 
Example 2
Source File: HistoricTaskInstanceTest.java    From camunda-bpm-platform with Apache License 2.0 6 votes vote down vote up
public void testHistoricTaskInstanceCaseInstanceId() {
  Task task = taskService.newTask();
  task.setCaseInstanceId("aCaseInstanceId");
  taskService.saveTask(task);

  HistoricTaskInstance hti = historyService
      .createHistoricTaskInstanceQuery()
      .taskId(task.getId())
      .singleResult();

  assertEquals("aCaseInstanceId", hti.getCaseInstanceId());

  task.setCaseInstanceId("anotherCaseInstanceId");
  taskService.saveTask(task);

  hti = historyService
      .createHistoricTaskInstanceQuery()
      .taskId(task.getId())
      .singleResult();

  assertEquals("anotherCaseInstanceId", hti.getCaseInstanceId());

  // Finally, delete task
  taskService.deleteTask(task.getId(), true);

}
 
Example 3
Source File: TaskDto.java    From camunda-bpm-platform with Apache License 2.0 6 votes vote down vote up
public void updateTask(Task task) {
  task.setName(getName());
  task.setDescription(getDescription());
  task.setPriority(getPriority());
  task.setAssignee(getAssignee());
  task.setOwner(getOwner());

  DelegationState state = null;
  if (getDelegationState() != null) {
    DelegationStateConverter converter = new DelegationStateConverter();
    state = converter.convertQueryParameterToType(getDelegationState());
  }
  task.setDelegationState(state);

  task.setDueDate(getDue());
  task.setFollowUpDate(getFollowUp());
  task.setParentTaskId(getParentTaskId());
  task.setCaseInstanceId(getCaseInstanceId());
  task.setTenantId(getTenantId());
}
 
Example 4
Source File: UserOperationLogWithoutUserTest.java    From camunda-bpm-platform with Apache License 2.0 5 votes vote down vote up
@Deployment(resources = PROCESS_PATH)
public void testUpdateTask() {
  // given
  runtimeService.startProcessInstanceByKey(PROCESS_KEY);
  Task task = taskService.createTaskQuery().singleResult();
  task.setCaseInstanceId("a-case-instance-id");

  // when
  taskService.saveTask(task);

  // then
  verifyNoUserOperationLogged();
}