if (execution.getProcessInstance() != null) processId = execution.getProcessInstance().getId();
if (execution.getProcessInstance() != null) processId = execution.getProcessInstance().getId();
if (execution.getProcessInstance() != null) processId = execution.getProcessInstance().getId();
if (execution.getProcessInstance() != null) processId = execution.getProcessInstance().getId();
String procInstId = execution.getProcessInstance().getId(); ProcessDefinition procDef = repoService.createProcessDefinitionQuery() .processDefinitionId(execution.getProcessDefinitionId())
Execution execution = executionService.findExecutionById(executionId); if (execution != null) { Execution pi = execution.getProcessInstance(); task.setProcessInstanceId(pi.getId()); task.setProcessId(pi.getProcessDefinitionId());
public static ProcessInstanceRef adoptExecution(Execution execution) { ProcessInstanceRef ref = new ProcessInstanceRef(); ref.setId(execution.getId()); ref.setKey(execution.getKey()); ref.setDefinitionId(execution.getProcessDefinitionId()); // Start date is only available through historyService HistoryService historyService = ProcessEngineUtil.retrieveProcessEngine().getHistoryService(); Date startDate = historyService.createHistoryProcessInstanceQuery() .processInstanceId(execution.getId()) .uniqueResult().getStartTime(); ref.setStartDate(startDate); ExecutionImpl processInstance = (ExecutionImpl) execution.getProcessInstance(); ProcessDefinitionImpl processDefinition = processInstance.getProcessDefinition(); TokenReference tok = execution2TokenReference(processInstance); Collection<? extends Execution> childExecutions = processInstance.getExecutions(); if (childExecutions != null) { for (Execution child : childExecutions) { ExecutionImpl childExecution = (ExecutionImpl) child; // set process definition on child execution from process instance childExecution.setProcessDefinition(processDefinition); TokenReference childTok = execution2TokenReference(childExecution); tok.getChildren().add(childTok); } } ref.setRootToken(tok); return ref; }