protected void cleanupExecutions(FlowElement currentFlowElement) { if (execution.getParentId() != null && execution.isScope()) { // If the execution is a scope (and not a process instance), the scope must first be // destroyed before we can continue and follow the sequence flow Context.getAgenda().planDestroyScopeOperation(execution); } else if (currentFlowElement instanceof Activity) { // If the current activity is an activity, we need to remove any currently active boundary events Activity activity = (Activity) currentFlowElement; if (CollectionUtil.isNotEmpty(activity.getBoundaryEvents())) { // Cancel events are not removed List<String> notToDeleteEvents = new ArrayList<String>(); for (BoundaryEvent event : activity.getBoundaryEvents()) { if (CollectionUtil.isNotEmpty(event.getEventDefinitions()) && event.getEventDefinitions().get(0) instanceof CancelEventDefinition) { notToDeleteEvents.add(event.getId()); } } // Delete all child executions Collection<ExecutionEntity> childExecutions = commandContext.getExecutionEntityManager().findChildExecutionsByParentExecutionId(execution.getId()); for (ExecutionEntity childExecution : childExecutions) { if (childExecution.getCurrentFlowElement() == null || !notToDeleteEvents.contains(childExecution.getCurrentFlowElement().getId())) { commandContext.getExecutionEntityManager().deleteExecutionAndRelatedData(childExecution, null, false); } } } } }
Activity attachedActivity = (Activity) attachedToElement; boundaryEvent.setAttachedToRef(attachedActivity); attachedActivity.getBoundaryEvents().add(boundaryEvent);
} else { boundaryEvent.setAttachedToRef(activity); activity.getBoundaryEvents().add(boundaryEvent);
for (BoundaryEvent boundaryEvent : activity.getBoundaryEvents()) { outgoingArrayNode.add(BpmnJsonConverterUtil.createResourceNode(boundaryEvent.getId()));
protected void executeMultiInstanceSynchronous(FlowNode flowNode) { // Execution listener: event 'start' if (CollectionUtil.isNotEmpty(flowNode.getExecutionListeners())) { executeExecutionListeners(flowNode, ExecutionListener.EVENTNAME_START); } // Execute any boundary events, sub process boundary events will be executed from the activity behavior if (!inCompensation && flowNode instanceof Activity) { // Only activities can have boundary events List<BoundaryEvent> boundaryEvents = ((Activity) flowNode).getBoundaryEvents(); if (CollectionUtil.isNotEmpty(boundaryEvents)) { executeBoundaryEvents(boundaryEvents, execution); } } // Execute the multi instance behavior ActivityBehavior activityBehavior = (ActivityBehavior) flowNode.getBehavior(); if (activityBehavior != null) { executeActivityBehavior(activityBehavior, flowNode); } else { throw new ActivitiException("Expected an activity behavior in flow node " + flowNode.getId()); } }
protected void executeSynchronous(FlowNode flowNode) { commandContext.getHistoryManager().recordActivityStart(execution); // Execution listener: event 'start' if (CollectionUtil.isNotEmpty(flowNode.getExecutionListeners())) { executeExecutionListeners(flowNode, ExecutionListener.EVENTNAME_START); } // Execute any boundary events, sub process boundary events will be executed from the activity behavior if (!inCompensation && flowNode instanceof Activity) { // Only activities can have boundary events List<BoundaryEvent> boundaryEvents = ((Activity) flowNode).getBoundaryEvents(); if (CollectionUtil.isNotEmpty(boundaryEvents)) { executeBoundaryEvents(boundaryEvents, execution); } } // Execute actual behavior ActivityBehavior activityBehavior = (ActivityBehavior) flowNode.getBehavior(); if (activityBehavior != null) { executeActivityBehavior(activityBehavior, flowNode); } else { logger.debug("No activityBehavior on activity '{}' with execution {}", flowNode.getId(), execution.getId()); Context.getAgenda().planTakeOutgoingSequenceFlowsOperation(execution, true); } }
if (subElement instanceof Activity) { Activity subActivity = (Activity) subElement; if (CollectionUtil.isNotEmpty(subActivity.getBoundaryEvents())) { for (BoundaryEvent boundaryEvent : subActivity.getBoundaryEvents()) { if (CollectionUtil.isNotEmpty(boundaryEvent.getEventDefinitions()) && boundaryEvent.getEventDefinitions().get(0) instanceof CompensateEventDefinition) {
if (subElement instanceof Activity) { Activity subActivity = (Activity) subElement; if (CollectionUtil.isNotEmpty(subActivity.getBoundaryEvents())) { for (BoundaryEvent boundaryEvent : subActivity.getBoundaryEvents()) { if (CollectionUtil.isNotEmpty(boundaryEvent.getEventDefinitions()) && boundaryEvent.getEventDefinitions().get(0) instanceof CompensateEventDefinition) {
protected void cleanupExecutions(FlowElement currentFlowElement) { if (execution.getParentId() != null && execution.isScope()) { // If the execution is a scope (and not a process instance), the scope must first be // destroyed before we can continue and follow the sequence flow Context.getAgenda().planDestroyScopeOperation(execution); } else if (currentFlowElement instanceof Activity) { // If the current activity is an activity, we need to remove any currently active boundary events Activity activity = (Activity) currentFlowElement; if (CollectionUtil.isNotEmpty(activity.getBoundaryEvents())) { // Cancel events are not removed List<String> notToDeleteEvents = new ArrayList<String>(); for (BoundaryEvent event : activity.getBoundaryEvents()) { if (CollectionUtil.isNotEmpty(event.getEventDefinitions()) && event.getEventDefinitions().get(0) instanceof CancelEventDefinition) { notToDeleteEvents.add(event.getId()); } } // Delete all child executions Collection<ExecutionEntity> childExecutions = commandContext.getExecutionEntityManager().findChildExecutionsByParentExecutionId(execution.getId()); for (ExecutionEntity childExecution : childExecutions) { if (childExecution.getCurrentFlowElement() == null || !notToDeleteEvents.contains(childExecution.getCurrentFlowElement().getId())) { commandContext.getExecutionEntityManager().deleteExecutionAndRelatedData(childExecution, null, false); } } } } }
private 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); } FlowNode targetNode = getFlowNodeFromScope(sequenceFlow.getTargetRef(), parentScope); if (targetNode != null) { targetNode.getIncomingFlows().add(sequenceFlow); } } else if (flowElement instanceof BoundaryEvent) { BoundaryEvent boundaryEvent = (BoundaryEvent) flowElement; FlowElement attachedToElement = getFlowNodeFromScope(boundaryEvent.getAttachedToRefId(), parentScope); if(attachedToElement != null) { boundaryEvent.setAttachedToRef((Activity) attachedToElement); ((Activity) attachedToElement).getBoundaryEvents().add(boundaryEvent); } } else if(flowElement instanceof SubProcess) { SubProcess subProcess = (SubProcess) flowElement; processFlowElements(subProcess.getFlowElements(), subProcess); } } }
Activity attachedActivity = (Activity) attachedToElement; boundaryEvent.setAttachedToRef(attachedActivity); attachedActivity.getBoundaryEvents().add(boundaryEvent);
} else { boundaryEvent.setAttachedToRef(activity); activity.getBoundaryEvents().add(boundaryEvent);
protected void executeMultiInstanceSynchronous(FlowNode flowNode) { // Execution listener: event 'start' if (CollectionUtil.isNotEmpty(flowNode.getExecutionListeners())) { executeExecutionListeners(flowNode, ExecutionListener.EVENTNAME_START); } // Execute any boundary events, sub process boundary events will be executed from the activity behavior if (!inCompensation && flowNode instanceof Activity) { // Only activities can have boundary events List<BoundaryEvent> boundaryEvents = ((Activity) flowNode).getBoundaryEvents(); if (CollectionUtil.isNotEmpty(boundaryEvents)) { executeBoundaryEvents(boundaryEvents, execution); } } // Execute the multi instance behavior ActivityBehavior activityBehavior = (ActivityBehavior) flowNode.getBehavior(); if (activityBehavior != null) { executeActivityBehavior(activityBehavior, flowNode); } else { throw new ActivitiException("Expected an activity behavior in flow node " + flowNode.getId()); } }
for (BoundaryEvent boundaryEvent : activity.getBoundaryEvents()) { outgoingArrayNode.add(BpmnJsonConverterUtil.createResourceNode(boundaryEvent.getId()));
protected void executeSynchronous(FlowNode flowNode) { commandContext.getHistoryManager().recordActivityStart(execution); // Execution listener: event 'start' if (CollectionUtil.isNotEmpty(flowNode.getExecutionListeners())) { executeExecutionListeners(flowNode, ExecutionListener.EVENTNAME_START); } // Execute any boundary events, sub process boundary events will be executed from the activity behavior if (!inCompensation && flowNode instanceof Activity) { // Only activities can have boundary events List<BoundaryEvent> boundaryEvents = ((Activity) flowNode).getBoundaryEvents(); if (CollectionUtil.isNotEmpty(boundaryEvents)) { executeBoundaryEvents(boundaryEvents, execution); } } // Execute actual behavior ActivityBehavior activityBehavior = (ActivityBehavior) flowNode.getBehavior(); if (activityBehavior != null) { executeActivityBehavior(activityBehavior, flowNode); } else { logger.debug("No activityBehavior on activity '{}' with execution {}", flowNode.getId(), execution.getId()); Context.getAgenda().planTakeOutgoingSequenceFlowsOperation(execution, true); } }
if (subElement instanceof Activity) { Activity subActivity = (Activity) subElement; if (CollectionUtil.isNotEmpty(subActivity.getBoundaryEvents())) { for (BoundaryEvent boundaryEvent : subActivity.getBoundaryEvents()) { if (CollectionUtil.isNotEmpty(boundaryEvent.getEventDefinitions()) && boundaryEvent.getEventDefinitions().get(0) instanceof CompensateEventDefinition) {
if (subElement instanceof Activity) { Activity subActivity = (Activity) subElement; if (CollectionUtil.isNotEmpty(subActivity.getBoundaryEvents())) { for (BoundaryEvent boundaryEvent : subActivity.getBoundaryEvents()) { if (CollectionUtil.isNotEmpty(boundaryEvent.getEventDefinitions()) && boundaryEvent.getEventDefinitions().get(0) instanceof CompensateEventDefinition) {