protected void continueThroughFlowNode(FlowNode flowNode) { execution.setActive(true); // Check if it's the initial flow element. If so, we must fire the execution listeners for the process too if (flowNode.getIncomingFlows() != null && flowNode.getIncomingFlows().size() == 0 && flowNode.getSubProcess() == null) { executeProcessStartExecutionListeners(); } // For a subprocess, a new child execution is created that will visit the steps of the subprocess // The original execution that arrived here will wait until the subprocess is finished // and will then be used to continue the process instance. if (flowNode instanceof SubProcess) { createChildExecutionForSubProcess((SubProcess) flowNode); } if (flowNode instanceof Activity && ((Activity) flowNode).hasMultiInstanceLoopCharacteristics()) { // the multi instance execution will look at async executeMultiInstanceSynchronous(flowNode); } else if (forceSynchronousOperation || !flowNode.isAsynchronous()) { executeSynchronous(flowNode); } else { executeAsynchronous(flowNode); } }
@Override public List<FlowNode> execute(CommandContext commandContext) { ExecutionEntity execution = CommandContextUtil.getExecutionEntityManager(commandContext).findById(executionId); if (execution == null) { throw new FlowableObjectNotFoundException("No execution found for id '" + executionId + "'", ExecutionEntity.class); } if (!(execution.getCurrentFlowElement() instanceof AdhocSubProcess)) { throw new FlowableException("The current flow element of the requested execution is not an ad-hoc sub process"); } List<FlowNode> enabledFlowNodes = new ArrayList<>(); AdhocSubProcess adhocSubProcess = (AdhocSubProcess) execution.getCurrentFlowElement(); // if sequential ordering, only one child execution can be active, so no enabled activities if (adhocSubProcess.hasSequentialOrdering()) { if (execution.getExecutions().size() > 0) { return enabledFlowNodes; } } for (FlowElement flowElement : adhocSubProcess.getFlowElements()) { if (flowElement instanceof FlowNode) { FlowNode flowNode = (FlowNode) flowElement; if (flowNode.getIncomingFlows().size() == 0) { enabledFlowNodes.add(flowNode); } } } return enabledFlowNodes; }
FlowNode flowNode = (FlowNode) element; ArrayNode incomingFlows = objectMapper.createArrayNode(); for (SequenceFlow flow : flowNode.getIncomingFlows()) { incomingFlows.add(flow.getId());
protected void processFlowElements(Collection<FlowElement> flowElementList, BaseElement parentScope) { for (FlowElement flowElement : flowElementList) { if (flowElement instanceof SequenceFlow) { SequenceFlow sequenceFlow = (SequenceFlow) flowElement; FlowNode sourceNode = getFlowNodeFromScope(sequenceFlow.getSourceRef(), parentScope); if (sourceNode != null) { sourceNode.getOutgoingFlows().add(sequenceFlow); sequenceFlow.setSourceFlowElement(sourceNode); } FlowNode targetNode = getFlowNodeFromScope(sequenceFlow.getTargetRef(), parentScope); if (targetNode != null) { targetNode.getIncomingFlows().add(sequenceFlow); sequenceFlow.setTargetFlowElement(targetNode); } } else if (flowElement instanceof BoundaryEvent) { BoundaryEvent boundaryEvent = (BoundaryEvent) flowElement; FlowElement attachedToElement = getFlowNodeFromScope(boundaryEvent.getAttachedToRefId(), parentScope); if (attachedToElement instanceof Activity) { Activity attachedActivity = (Activity) attachedToElement; boundaryEvent.setAttachedToRef(attachedActivity); attachedActivity.getBoundaryEvents().add(boundaryEvent); } } else if (flowElement instanceof SubProcess) { SubProcess subProcess = (SubProcess) flowElement; processFlowElements(subProcess.getFlowElements(), subProcess); } } }
((FlowNode) targetFlowElement).getIncomingFlows().add(sequenceFlow);
if (activityId.equals(flowElement.getId()) && flowElement instanceof FlowNode) { FlowNode flowNode = (FlowNode) flowElement; if (flowNode.getIncomingFlows().size() == 0) { foundNode = flowNode;