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

The following examples show how to use org.camunda.bpm.engine.task.Task#getExecutionId() . 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: HistoricDetailQueryTest.java    From camunda-bpm-platform with Apache License 2.0 6 votes vote down vote up
@Test
@Deployment(resources={"org/camunda/bpm/engine/test/api/oneTaskProcess.bpmn20.xml"})
public void testQueryByExecutionIdAndProcessInstanceId() {
  // given
  startProcessInstance(PROCESS_KEY);

  Task task = taskService.createTaskQuery().singleResult();

  String processInstanceId = task.getProcessInstanceId();
  String executionId = task.getExecutionId();
  String taskId = task.getId();

  taskService.resolveTask(taskId, getVariables());

  // when
  HistoricDetail detail = historyService.createHistoricDetailQuery()
      .processInstanceId(processInstanceId)
      .executionId(executionId).singleResult();

  //then
  assertThat(detail.getProcessInstanceId(), is(processInstanceId));
  assertThat(detail.getExecutionId(), is(executionId));
}
 
Example 2
Source File: TaskDto.java    From camunda-bpm-platform with Apache License 2.0 5 votes vote down vote up
public static TaskDto fromEntity(Task task) {
  TaskDto dto = new TaskDto();
  dto.id = task.getId();
  dto.name = task.getName();
  dto.assignee = task.getAssignee();
  dto.created = task.getCreateTime();
  dto.due = task.getDueDate();
  dto.followUp = task.getFollowUpDate();

  if (task.getDelegationState() != null) {
    dto.delegationState = task.getDelegationState().toString();
  }

  dto.description = task.getDescription();
  dto.executionId = task.getExecutionId();
  dto.owner = task.getOwner();
  dto.parentTaskId = task.getParentTaskId();
  dto.priority = task.getPriority();
  dto.processDefinitionId = task.getProcessDefinitionId();
  dto.processInstanceId = task.getProcessInstanceId();
  dto.taskDefinitionKey = task.getTaskDefinitionKey();
  dto.caseDefinitionId = task.getCaseDefinitionId();
  dto.caseExecutionId = task.getCaseExecutionId();
  dto.caseInstanceId = task.getCaseInstanceId();
  dto.suspended = task.isSuspended();
  dto.tenantId = task.getTenantId();

  try {
    dto.formKey = task.getFormKey();
  }
  catch (BadUserRequestException e) {
    // ignore (initializeFormKeys was not called)
  }
  return dto;
}
 
Example 3
Source File: HalTask.java    From camunda-bpm-platform with Apache License 2.0 4 votes vote down vote up
public static HalTask fromTask(Task task) {
  HalTask dto = new HalTask();

  // task state
  dto.id = task.getId();
  dto.name = task.getName();
  dto.assignee = task.getAssignee();
  dto.created = task.getCreateTime();
  dto.due = task.getDueDate();
  dto.followUp = task.getFollowUpDate();
  dto.delegationState = task.getDelegationState();
  dto.description = task.getDescription();
  dto.executionId = task.getExecutionId();
  dto.owner = task.getOwner();
  dto.parentTaskId = task.getParentTaskId();
  dto.priority = task.getPriority();
  dto.processDefinitionId = task.getProcessDefinitionId();
  dto.processInstanceId = task.getProcessInstanceId();
  dto.taskDefinitionKey = task.getTaskDefinitionKey();
  dto.caseDefinitionId = task.getCaseDefinitionId();
  dto.caseExecutionId = task.getCaseExecutionId();
  dto.caseInstanceId = task.getCaseInstanceId();
  dto.suspended = task.isSuspended();
  dto.tenantId = task.getTenantId();
  try {
    dto.formKey = task.getFormKey();
  }
  catch (BadUserRequestException e) {
    // ignore (initializeFormKeys was not called)
  }

  // links
  dto.linker.createLink(REL_SELF, task.getId());
  dto.linker.createLink(REL_ASSIGNEE, task.getAssignee());
  dto.linker.createLink(REL_OWNER, task.getOwner());
  dto.linker.createLink(REL_EXECUTION,task.getExecutionId());
  dto.linker.createLink(REL_PARENT_TASK, task.getParentTaskId());
  dto.linker.createLink(REL_PROCESS_DEFINITION, task.getProcessDefinitionId());
  dto.linker.createLink(REL_PROCESS_INSTANCE, task.getProcessInstanceId());
  dto.linker.createLink(REL_CASE_INSTANCE, task.getCaseInstanceId());
  dto.linker.createLink(REL_CASE_EXECUTION, task.getCaseExecutionId());
  dto.linker.createLink(REL_CASE_DEFINITION, task.getCaseDefinitionId());
  dto.linker.createLink(REL_IDENTITY_LINKS, task.getId());

  return dto;
}