private String findEndActivityName(ProcessInstance pi, ProcessToolContext ctx) { List<HistoricProcessInstance> history = getProcessEngine().getHistoryService().createHistoricProcessInstanceQuery() .processInstanceId(pi.getInternalId()) .list(); if (history != null && !history.isEmpty()) { String endActivityName = history.get(0).getEndActivityId(); if (Strings.hasText(endActivityName)) { return endActivityName; } } return null; }
protected void printProcessInstanceInfo(HistoricProcessInstance hpi) { LinkedHashMap<String, String> nvMap = new LinkedHashMap<String, String>(); nvMap.put("Instance ID", hpi.getId()); nvMap.put("Start Activity", hpi.getStartActivityId()); nvMap.put("End Activity", hpi.getEndActivityId()); nvMap.put("Start Time", Commands.UTIL.formatDate(hpi.getStartTime())); nvMap.put("End Time", Commands.UTIL.formatDate(hpi.getEndTime())); if (!this.isQuiet()) { nvMap.put("Duration", Commands.UTIL.formatDuration(hpi.getDurationInMillis())); } PrintWriter out = new PrintWriter(out(), true); Commands.UTIL.printNameValues(out, nvMap); // print instance data this.getPrintHandler().printInstanceData(out, this.isVerbose(), this.isQuiet(), hpi); }
@SuppressWarnings("deprecation") @Override public SlpTaskState getCurrentState() { if (processInstance.getEndActivityId() == null) { if (processInstance.getDeleteReason() != null && !processInstance.getDeleteReason().isEmpty()) { try { SlpTaskState slpTaskState = SlpTaskState.fromValue(processInstance.getDeleteReason()); if (slpTaskState == SlpTaskState.SLP_TASK_STATE_FINISHED || slpTaskState == SlpTaskState.SLP_TASK_STATE_ERROR || slpTaskState == SlpTaskState.SLP_TASK_STATE_ABORTED) { return slpTaskState; } } catch (IllegalArgumentException e) { return SlpTaskState.SLP_TASK_STATE_ABORTED; } } return SlpTaskState.SLP_TASK_STATE_ABORTED; } else { return SlpTaskState.SLP_TASK_STATE_FINISHED; } }
protected void printProcessInstanceInfo(HistoricProcessInstance hpi) { LinkedHashMap<String, String> nvMap = new LinkedHashMap<String, String>(); nvMap.put("Instance ID", hpi.getId()); nvMap.put("Start Activity", hpi.getStartActivityId()); nvMap.put("End Activity", hpi.getEndActivityId()); nvMap.put("Start Time", Commands.UTIL.formatDate(hpi.getStartTime())); nvMap.put("End Time", Commands.UTIL.formatDate(hpi.getEndTime())); if (!this.isQuiet()) { nvMap.put("Duration", Commands.UTIL.formatDuration(hpi.getDurationInMillis())); } PrintWriter out = new PrintWriter(out(), true); Commands.UTIL.printNameValues(out, nvMap); // print instance data this.getPrintHandler().printInstanceData(out, this.isVerbose(), this.isQuiet(), hpi); }
.createHistoricProcessInstanceQuery().processInstanceId(pi.getInternalId()); HistoricProcessInstance historyProcessInstance = historyProcessInstanceQuery.singleResult(); if (historyProcessInstance != null && historyProcessInstance.getEndActivityId() != null) { StateNode sn = (StateNode) processGraphElements.get(historyProcessInstance.getEndActivityId()); if (sn != null) { if (prev != null) {
@SuppressWarnings("deprecation") public HistoricProcessInstanceResponse createHistoricProcessInstanceResponse(HistoricProcessInstance processInstance, RestUrlBuilder urlBuilder) { HistoricProcessInstanceResponse result = new HistoricProcessInstanceResponse(); result.setBusinessKey(processInstance.getBusinessKey()); result.setDeleteReason(processInstance.getDeleteReason()); result.setDurationInMillis(processInstance.getDurationInMillis()); result.setEndActivityId(processInstance.getEndActivityId()); result.setEndTime(processInstance.getEndTime()); result.setId(processInstance.getId()); result.setName(processInstance.getName()); result.setProcessDefinitionId(processInstance.getProcessDefinitionId()); result.setProcessDefinitionUrl(urlBuilder.buildUrl(RestUrls.URL_PROCESS_DEFINITION, processInstance.getProcessDefinitionId())); result.setStartActivityId(processInstance.getStartActivityId()); result.setStartTime(processInstance.getStartTime()); result.setStartUserId(processInstance.getStartUserId()); result.setSuperProcessInstanceId(processInstance.getSuperProcessInstanceId()); result.setUrl(urlBuilder.buildUrl(RestUrls.URL_HISTORIC_PROCESS_INSTANCE, processInstance.getId())); if (processInstance.getProcessVariables() != null) { Map<String, Object> variableMap = processInstance.getProcessVariables(); for (String name : variableMap.keySet()) { result.addVariable(createRestVariable(name, variableMap.get(name), RestVariableScope.LOCAL, processInstance.getId(), VARIABLE_HISTORY_PROCESS, false, urlBuilder)); } } result.setTenantId(processInstance.getTenantId()); return result; }