protected void continueThroughSequenceFlow(SequenceFlow sequenceFlow) {
if (CollectionUtil.isNotEmpty(sequenceFlow.getExecutionListeners())) {
executeExecutionListeners(sequenceFlow, ExecutionListener.EVENTNAME_START);
executeExecutionListeners(sequenceFlow, ExecutionListener.EVENTNAME_TAKE);
executeExecutionListeners(sequenceFlow, ExecutionListener.EVENTNAME_END);
}
if(Context.getProcessEngineConfiguration() != null && Context.getProcessEngineConfiguration().getEventDispatcher().isEnabled()) {
FlowElement sourceFlowElement = sequenceFlow.getSourceFlowElement();
FlowElement targetFlowElement = sequenceFlow.getTargetFlowElement();
Context.getProcessEngineConfiguration().getEventDispatcher().dispatchEvent(
ActivitiEventBuilder.createSequenceFlowTakenEvent(
(ExecutionEntity) execution,
ActivitiEventType.SEQUENCEFLOW_TAKEN,
sequenceFlow.getId(),
sourceFlowElement != null ? sourceFlowElement.getId() : null,
sourceFlowElement != null ? (String) sourceFlowElement.getName() : null,
sourceFlowElement != null ? sourceFlowElement.getClass().getName() : null,
sourceFlowElement != null ? ((FlowNode) sourceFlowElement).getBehavior(): null,
targetFlowElement != null ? targetFlowElement.getId() : null,
targetFlowElement != null ? targetFlowElement.getName() : null,
targetFlowElement != null ? targetFlowElement.getClass().getName() : null,
targetFlowElement != null ? ((FlowNode) targetFlowElement).getBehavior(): null));
}
FlowElement targetFlowElement = sequenceFlow.getTargetFlowElement();
execution.setCurrentFlowElement(targetFlowElement);
logger.debug("Sequence flow '{}' encountered. Continuing process by following it using execution {}", sequenceFlow.getId(), execution.getId());
Context.getAgenda().planContinueProcessOperation(execution);
}