protected EventGateway getPrecedingEventBasedGateway(DelegateExecution execution) { FlowElement currentFlowElement = execution.getCurrentFlowElement(); if (currentFlowElement instanceof IntermediateCatchEvent) { IntermediateCatchEvent intermediateCatchEvent = (IntermediateCatchEvent) currentFlowElement; List<SequenceFlow> incomingSequenceFlow = intermediateCatchEvent.getIncomingFlows(); // If behind an event based gateway, there is only one incoming sequence flow that originates from said gateway if (incomingSequenceFlow != null && incomingSequenceFlow.size() == 1) { SequenceFlow sequenceFlow = incomingSequenceFlow.get(0); FlowElement sourceFlowElement = sequenceFlow.getSourceFlowElement(); if (sourceFlowElement instanceof EventGateway) { return (EventGateway) sourceFlowElement; } } } return null; }
@Override public HistoricActivityInstanceEntity findActivityInstance(ExecutionEntity execution, boolean createOnNotFound, boolean endTimeMustBeNull) { String activityId = null; if (execution.getCurrentFlowElement() instanceof FlowNode) { activityId = execution.getCurrentFlowElement().getId(); } else if (execution.getCurrentFlowElement() instanceof SequenceFlow && execution.getCurrentActivitiListener() == null) { // while executing sequence flow listeners, we don't want historic activities activityId = ( (SequenceFlow) (execution.getCurrentFlowElement())).getSourceFlowElement().getId(); } if (activityId != null) { return findActivityInstance(execution, activityId, createOnNotFound, endTimeMustBeNull); } return null; }
FlowElement sourceFlowElement = sequenceFlow.getSourceFlowElement(); FlowElement targetFlowElement = sequenceFlow.getTargetFlowElement(); Context.getProcessEngineConfiguration().getEventDispatcher().dispatchEvent(
protected EventGateway getPrecedingEventBasedGateway(DelegateExecution execution) { FlowElement currentFlowElement = execution.getCurrentFlowElement(); if (currentFlowElement instanceof IntermediateCatchEvent) { IntermediateCatchEvent intermediateCatchEvent = (IntermediateCatchEvent) currentFlowElement; List<SequenceFlow> incomingSequenceFlow = intermediateCatchEvent.getIncomingFlows(); // If behind an event based gateway, there is only one incoming sequence flow that originates from said gateway if (incomingSequenceFlow != null && incomingSequenceFlow.size() == 1) { SequenceFlow sequenceFlow = incomingSequenceFlow.get(0); FlowElement sourceFlowElement = sequenceFlow.getSourceFlowElement(); if (sourceFlowElement instanceof EventGateway) { return (EventGateway) sourceFlowElement; } } } return null; }
@Override public HistoricActivityInstanceEntity findActivityInstance(ExecutionEntity execution, boolean createOnNotFound, boolean endTimeMustBeNull) { String activityId = null; if (execution.getCurrentFlowElement() instanceof FlowNode) { activityId = execution.getCurrentFlowElement().getId(); } else if (execution.getCurrentFlowElement() instanceof SequenceFlow && execution.getCurrentActivitiListener() == null) { // while executing sequence flow listeners, we don't want historic activities activityId = ( (SequenceFlow) (execution.getCurrentFlowElement())).getSourceFlowElement().getId(); } if (activityId != null) { return findActivityInstance(execution, activityId, createOnNotFound, endTimeMustBeNull); } return null; }
protected void continueThroughSequenceFlow(SequenceFlow sequenceFlow) { // Execution listener. Sequenceflow only 'take' makes sense ... but we've supported all three since the beginning if (CollectionUtil.isNotEmpty(sequenceFlow.getExecutionListeners())) { executeExecutionListeners(sequenceFlow, ExecutionListener.EVENTNAME_START); executeExecutionListeners(sequenceFlow, ExecutionListener.EVENTNAME_TAKE); executeExecutionListeners(sequenceFlow, ExecutionListener.EVENTNAME_END); } // Firing event that transition is being taken 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); }