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

The following examples show how to use org.camunda.bpm.engine.task.Task#getCreateTime() . 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: ProcessInstanceSuspensionTest.java    From camunda-bpm-platform with Apache License 2.0 6 votes vote down vote up
/**
 * See https://app.camunda.com/jira/browse/CAM-9505
 */
@Deployment(resources={"org/camunda/bpm/engine/test/api/runtime/oneTaskProcess.bpmn20.xml"})
public void testPreserveCreateTimeOnUpdatedTask() {
  // given
  ProcessDefinition processDefinition = repositoryService.createProcessDefinitionQuery().singleResult();
  runtimeService.startProcessInstanceByKey(processDefinition.getKey());
  ProcessInstance processInstance = runtimeService.createProcessInstanceQuery().singleResult();

  Task taskBeforeSuspension = taskService.createTaskQuery().processInstanceId(processInstance.getId()).singleResult();
  Date createTime = taskBeforeSuspension.getCreateTime();

  // when
  runtimeService.suspendProcessInstanceById(processInstance.getId());

  Task task = taskService.createTaskQuery().processInstanceId(processInstance.getId()).singleResult();

  // assume
  assertTrue(task.isSuspended());

  // then
  assertEquals(createTime, task.getCreateTime());
}
 
Example 2
Source File: ShipmentTaskBoundaryServiceImpl.java    From Showcase with Apache License 2.0 5 votes vote down vote up
private  List<ShipmentTaskDS> shipmentTaskFromTask(Collection<Task> tasks) {
    List<ShipmentTaskDS> shipmentTasks = new ArrayList<ShipmentTaskDS>();
    for (Task task : tasks) {
        CaseInstance caseInstance = caseService.createCaseInstanceQuery().caseInstanceId(task.getCaseInstanceId()).active().singleResult();
        Shipment shipment = shipmentRepository.findOneBytrackingId(caseInstance.getBusinessKey());
        ShipmentTaskDS shipmentTaskDS = new ShipmentTaskDS(task.getCreateTime(), shipment.trackingId, task.getId(),
                task.getName(), task.getDescription(), task.getAssignee(), shipment.sender, shipment.receiver,
                task.getDueDate());
        shipmentTasks.add(shipmentTaskDS);
    }
    return shipmentTasks;
}
 
Example 3
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 4
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;
}