use of org.flowable.engine.delegate.event.impl.FlowableProcessCancelledEventImpl in project petals-se-flowable by petalslink.
the class ProcessInstanceCanceledEventListener method createLogData.
@Override
protected AbstractFlowLogData createLogData(final FlowableEvent event) {
if (event instanceof FlowableProcessCancelledEventImpl) {
final FlowableProcessCancelledEventImpl eventImpl = (FlowableProcessCancelledEventImpl) event;
final String processInstanceId = eventImpl.getProcessInstanceId();
this.log.fine("The process instance '" + processInstanceId + "' is canceled.");
final HistoricProcessInstanceQuery processQuery = this.historyService.createHistoricProcessInstanceQuery().processInstanceId(processInstanceId).includeProcessVariables();
final HistoricProcessInstance processResult = processQuery.singleResult();
final Map<String, Object> processVariables = processResult.getProcessVariables();
final String flowInstanceId = (String) processVariables.get(VAR_PETALS_FLOW_INSTANCE_ID);
final String flowStepId = (String) processVariables.get(VAR_PETALS_FLOW_STEP_ID);
if (this.isFlowTracingEnabled(processVariables)) {
return new ProcessInstanceFlowStepFailureLogData(flowInstanceId, flowStepId, eventImpl.getCause().toString());
} else {
return null;
}
} else {
this.log.warning("Unexpected event implementation: " + event.getClass().getName());
return null;
}
}
Aggregations