protected List<String> gatherCompletedFlows(Set<String> completedActivityInstances, Set<String> currentActivityinstances, BpmnModel pojoModel) { List<String> completedFlows = new ArrayList<>(); List<String> activities = new ArrayList<>(completedActivityInstances); activities.addAll(currentActivityinstances); // TODO: not a robust way of checking when parallel paths are active, should be revisited // Go over all activities and check if it's possible to match any outgoing paths against the activities for (FlowElement activity : pojoModel.getMainProcess().getFlowElements()) { if (activity instanceof FlowNode) { int index = activities.indexOf(activity.getId()); if (index >= 0 && index + 1 < activities.size()) { List<SequenceFlow> outgoingFlows = ((FlowNode) activity).getOutgoingFlows(); for (SequenceFlow flow : outgoingFlows) { String destinationFlowId = flow.getTargetRef(); if (destinationFlowId.equals(activities.get(index + 1))) { completedFlows.add(flow.getId()); } } } } } return completedFlows; } }
protected List<String> gatherCompletedFlows(List<String> completedActivityInstances, List<String> currentActivityinstances, BpmnModel pojoModel) { List<String> completedFlows = new ArrayList<>(); List<String> activities = new ArrayList<>(completedActivityInstances); if (currentActivityinstances != null) { activities.addAll(currentActivityinstances); } // TODO: not a robust way of checking when parallel paths are active, should be revisited // Go over all activities and check if it's possible to match any outgoing paths against the activities for (FlowElement activity : pojoModel.getMainProcess().getFlowElements()) { if (activity instanceof FlowNode) { int index = activities.indexOf(activity.getId()); if (index >= 0 && index + 1 < activities.size()) { List<SequenceFlow> outgoingFlows = ((FlowNode) activity).getOutgoingFlows(); for (SequenceFlow flow : outgoingFlows) { String destinationFlowId = flow.getTargetRef(); if (destinationFlowId.equals(activities.get(index + 1))) { completedFlows.add(flow.getId()); } } } } } return completedFlows; }
if (sourceElement.getOutgoingFlows().size() == 0) { visitedElements.add(sourceElement.getId()); List<SequenceFlow> sequenceFlows = sourceElement.getOutgoingFlows(); if (sequenceFlows != null && sequenceFlows.size() > 0) { for (SequenceFlow sequenceFlow : sequenceFlows) {
protected void leaveFlowNode(FlowNode flowNode) { flowNode.getClass(), flowNode.getId(), flowNode.getOutgoingFlows().size()); for (SequenceFlow sequenceFlow : flowNode.getOutgoingFlows()) { } else if (flowNode.getOutgoingFlows().size() == 1 || SkipExpressionUtil.shouldSkipFlowElement(commandContext, execution, skipExpressionString)) { for (SequenceFlow sequenceFlow : flowNode.getOutgoingFlows()) { if (defaultSequenceFlowId.equals(sequenceFlow.getId())) { outgoingSequenceFlows.add(sequenceFlow); if (flowNode.getOutgoingFlows() == null || flowNode.getOutgoingFlows().size() == 0) { LOGGER.debug("No outgoing sequence flow found for flow node '{}'.", flowNode.getId()); agenda.planEndExecutionOperation(execution); List<ExecutionEntity> outgoingExecutions = new ArrayList<>(flowNode.getOutgoingFlows().size());
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) sourceFlowElement).getOutgoingFlows().add(sequenceFlow); JsonNode edgeNode = edgeMap.get(sequenceFlow.getId()); if (edgeNode != null) {
for (SequenceFlow sequenceFlow : flowNode.getOutgoingFlows()) { outgoingArrayNode.add(BpmnJsonConverterUtil.createResourceNode(sequenceFlow.getId()));
if (flowNode.getOutgoingFlows().size() > 0) { leaveFlowNode(flowNode); } else {
&& ((FlowNode) executionEntity.getCurrentFlowElement()).getOutgoingFlows().isEmpty()) { CommandContextUtil.getActivityInstanceEntityManager(commandContext).recordActivityEnd(executionEntity, null);
protected void handleActivityEnd(FlowNode flowNode) { // a process instance execution can never leave a flow node, but it can pass here whilst cleaning up // hence the check for NOT being a process instance if (!execution.isProcessInstanceType()) { if (CollectionUtil.isNotEmpty(flowNode.getExecutionListeners())) { executeExecutionListeners(flowNode, ExecutionListener.EVENTNAME_END); } if (execution.isActive() && !flowNode.getOutgoingFlows().isEmpty() && !(flowNode instanceof ParallelGateway) // Parallel gw takes care of its own history && !(flowNode instanceof InclusiveGateway) // Inclusive gw takes care of its own history && !(flowNode instanceof SubProcess) // Subprocess handling creates and destroys scoped execution. The execution taking the seq flow is different from the one entering && (!(flowNode instanceof Activity) || ((Activity) flowNode).getLoopCharacteristics() == null) // Multi instance root execution leaving the node isn't stored in history ) { // If no sequence flow: will be handled by the deletion of executions CommandContextUtil.getActivityInstanceEntityManager(commandContext).recordActivityEnd(execution, null); } if (!(execution.getCurrentFlowElement() instanceof SubProcess) && !(flowNode instanceof Activity && ((Activity) flowNode).hasMultiInstanceLoopCharacteristics())) { CommandContextUtil.getEventDispatcher(commandContext).dispatchEvent( FlowableEventBuilder.createActivityEvent(FlowableEngineEventType.ACTIVITY_COMPLETED, flowNode.getId(), flowNode.getName(), execution.getId(), execution.getProcessInstanceId(), execution.getProcessDefinitionId(), flowNode)); } } }