public BpmnNode convertSubProcess(SubProcess subProcess) { BpmnNode subProcessRoot; if (subProcess instanceof org.eclipse.bpmn2.AdHocSubProcess) { subProcessRoot = convertAdHocSubProcess((org.eclipse.bpmn2.AdHocSubProcess) subProcess); } else if (subProcess.getLoopCharacteristics() != null) { subProcessRoot = convertMultInstanceSubprocessNode(subProcess); } else if (subProcess.isTriggeredByEvent()) { subProcessRoot = convertEventSubprocessNode(subProcess); } else { subProcessRoot = convertEmbeddedSubprocessNode(subProcess); } Map<String, BpmnNode> nodes = delegate.convertChildNodes(subProcessRoot, subProcess.getFlowElements(), subProcess.getLaneSets()); delegate.convertEdges(subProcessRoot, Stream.concat(subProcess.getFlowElements().stream(), subProcess.getArtifacts().stream()).collect(Collectors.toList()), nodes); return subProcessRoot; }
@Override public void process(ProcessPropertyWriter processWriter, BasePropertyWriter nodeWriter, Node<View<? extends BPMNViewDefinition>, ?> node) { boolean isForCompensation = GraphUtils.getChildNodes(node).stream() .filter(currentNode -> currentNode.getContent() instanceof View && ((View) currentNode.getContent()).getDefinition() instanceof StartCompensationEvent) .findFirst() .isPresent(); if (isForCompensation) { ((SubProcess) nodeWriter.getElement()).setIsForCompensation(true); } } }
BpmnDiFactory factory) { SubProcess sp = (SubProcess) flowElement; for (FlowElement subProcessFlowElement : sp.getFlowElements()) { if (subProcessFlowElement instanceof SubProcess) { createBpmnShapeForElement(factory, if (sp.getArtifacts() != null) { List<Association> incompleteAssociations = new ArrayList<Association>(); for (Artifact artifact : sp.getArtifacts()) { sp.getArtifacts().remove(incompleteAssociation);
Map<String, Object> flowElementProperties) throws JsonGenerationException, IOException { Map<String, Object> properties = new LinkedHashMap<String, Object>(flowElementProperties); if (subProcess.getName() != null) { properties.put(NAME, StringEscapeUtils.unescapeXml(subProcess.getName())); } else { properties.put(NAME, String elementName = Utils.getMetaDataValue(subProcess.getExtensionValues(), "elementname"); if (elementName != null) { String customAsyncMetaData = Utils.getMetaDataValue(subProcess.getExtensionValues(), "customAsync"); String customAsync = (customAsyncMetaData != null && customAsyncMetaData.length() > 0) ? customAsyncMetaData : "false"; List<DataInputAssociation> inputAssociations = subProcess.getDataInputAssociations(); List<DataOutputAssociation> outputAssociations = subProcess.getDataOutputAssociations(); marshallDataInputAssociations(associationBuff, inputAssociations); ScriptTypeListValue onEntryActions = getOnEntryActions(subProcess.getExtensionValues()); ScriptTypeListValue onExitActions = getOnExitActions(subProcess.getExtensionValues()); if (!onEntryActions.isEmpty()) { properties.put(ONENTRYACTIONS, if (subProcess.getLoopCharacteristics() != null && subProcess.getLoopCharacteristics() instanceof MultiInstanceLoopCharacteristics) { haveValidLoopCharacteristics = true; properties.put(MITRIGGER,
(FlowNode) flowElement); if (flowElement instanceof SubProcess) { linkSequenceFlows(((SubProcess) flowElement).getFlowElements());
protected List<SequenceFlow> getOutgoing(FlowElement element) { List<SequenceFlow> outgoing = null; if (element instanceof StartEvent) { outgoing = ((StartEvent) element).getOutgoing(); } else if (element instanceof SubProcess) { SubProcess subProcess = ((SubProcess) element); outgoing = subProcess.getOutgoing(); } else if (element instanceof Event) { outgoing = ((Event) element).getOutgoing(); } else if (element instanceof Activity) { outgoing = ((Activity) element).getOutgoing(); } else if (element instanceof EndEvent) { outgoing = ((EndEvent) element).getOutgoing(); } else if (element instanceof Gateway) { Gateway gateway = ((Gateway) element); outgoing = gateway.getOutgoing(); } return outgoing; }
private boolean isParentEventSubprocess(FlowElement fe) { if (fe.eContainer() instanceof SubProcess && ((SubProcess) fe.eContainer()).isTriggeredByEvent()){ return true; } return false; }
private Optional<MultiInstanceLoopCharacteristics> getMultiInstanceLoopCharacteristics() { return Optional.ofNullable((MultiInstanceLoopCharacteristics) process.getLoopCharacteristics()); }
((Process)process).getArtifacts().add((Artifact)p.getElement()); } else if (process instanceof SubProcess) { ((SubProcess)process).getArtifacts().add((Artifact)p.getElement());
@Test public void addChildElement() { SubProcess process = (SubProcess) p.getElement(); BoundaryEventPropertyWriter boundaryEventPropertyWriter = new BoundaryEventPropertyWriter(bpmn2.createBoundaryEvent(), variableScope); UserTaskPropertyWriter userTaskPropertyWriter = new UserTaskPropertyWriter(bpmn2.createUserTask(), variableScope); p.addChildElement(boundaryEventPropertyWriter); p.addChildElement(userTaskPropertyWriter); // boundary event should always occur after other nodes (compat with old marshallers) assertThat(process.getFlowElements().get(0)).isEqualTo(userTaskPropertyWriter.getFlowElement()); assertThat(process.getFlowElements().get(1)).isEqualTo(boundaryEventPropertyWriter.getFlowElement()); }
@Before public void setUp() { when(propertyWriter.getRootElements()).thenReturn(propertyWriterRootElements); when(propertyWriter.getSimulationParameters()).thenReturn(propertyWriterElementParameters); when(propertyWriter.getItemDefinitions()).thenReturn(propertyWriterItemDefinitions); when(boundaryEventPropertyWriter.getRootElements()).thenReturn(propertyWriterRootElements); when(boundaryEventPropertyWriter.getSimulationParameters()).thenReturn(propertyWriterElementParameters); when(boundaryEventPropertyWriter.getItemDefinitions()).thenReturn(propertyWriterItemDefinitions); flowElement = new FlowElementImpl() {}; flowElement.setId(ELEMENT_ID); artifact = new ArtifactImpl() {}; artifact.setId(ELEMENT_ID); when(process.getFlowElements()).thenReturn(flowElements); when(process.getArtifacts()).thenReturn(artifacts); when(subProcess.getFlowElements()).thenReturn(flowElements); when(subProcess.getArtifacts()).thenReturn(artifacts); }
protected List<SequenceFlow> getOutgoing(FlowElement element) { List<SequenceFlow> outgoing = null; if (element instanceof StartEvent) { outgoing = ((StartEvent) element).getOutgoing(); } else if (element instanceof SubProcess) { SubProcess subProcess = ((SubProcess) element); outgoing = subProcess.getOutgoing(); } else if (element instanceof Event) { outgoing = ((Event) element).getOutgoing(); } else if (element instanceof Activity) { outgoing = ((Activity) element).getOutgoing(); } else if (element instanceof EndEvent) { outgoing = ((EndEvent) element).getOutgoing(); } else if (element instanceof Gateway) { Gateway gateway = ((Gateway) element); outgoing = gateway.getOutgoing(); } return outgoing; }
private boolean isParentEventSubprocess(FlowElement fe) { if (fe.eContainer() instanceof SubProcess && ((SubProcess) fe.eContainer()).isTriggeredByEvent()){ return true; } return false; }
@Test public void completionConditionMustBeWrappedInCdata() { String expression = "x<1"; String expected = "<![CDATA[" + expression + "]]>"; SubProcess subProcess = bpmn2.createSubProcess(); MultipleInstanceSubProcessPropertyWriter p = new MultipleInstanceSubProcessPropertyWriter( subProcess, new FlatVariableScope()); p.setCompletionCondition(expression); MultiInstanceLoopCharacteristics loopCharacteristics = (MultiInstanceLoopCharacteristics) subProcess.getLoopCharacteristics(); FormalExpression completionCondition = (FormalExpression) loopCharacteristics.getCompletionCondition(); assertThat(expected).isEqualTo(completionCondition.getBody()); } }
float parentY) { boolean foundInSubprocess = false; for (FlowElement subEle : sub.getFlowElements()) { if (subEle.getId().equals(ele.getId())) { foundInSubprocess = true; for (FlowElement subEle : sub.getFlowElements()) { if (subEle instanceof SubProcess) { Bounds subEleBounds = getBoundsForElement(subEle,
for (BaseElement child : childElements) { if (child instanceof FlowElement) { ((SubProcess) baseElt).getFlowElements().add((FlowElement) child); } else if (child instanceof Artifact) { ((SubProcess) baseElt).getArtifacts().add((Artifact) child); } else { _logger.error("Subprocess - don't know what to do of " + child);
protected List<SequenceFlow> getOutgoing(FlowElement element) { List<SequenceFlow> outgoing = null; if (element instanceof StartEvent) { outgoing = ((StartEvent) element).getOutgoing(); } else if (element instanceof SubProcess) { SubProcess subProcess = ((SubProcess) element); outgoing = subProcess.getOutgoing(); } else if (element instanceof Event) { outgoing = ((Event) element).getOutgoing(); } else if (element instanceof Activity) { outgoing = ((Activity) element).getOutgoing(); } else if (element instanceof EndEvent) { outgoing = ((EndEvent) element).getOutgoing(); } else if (element instanceof Gateway) { Gateway gateway = ((Gateway) element); outgoing = gateway.getOutgoing(); } return outgoing; }
} else if (fElement instanceof EventSubprocess || ((fElement instanceof SubProcess) && ((SubProcess) fElement).isTriggeredByEvent())) { readFlowElements((FlowElementsContainer)fElement, catchingEvents);
@Test @SuppressWarnings("unchecked") public void testProcessWhenIsNotForCompensation() { converter.process(processWriter, nodeWriter, eventSubprocessNode); verify(subProcess, never()).setIsForCompensation(true); }
public void updateShapeBoundsInSubprocessInLanes(BPMNPlane plane, BaseElement ele, SubProcess sub, float parentX, float parentY) { for (FlowElement subEle : sub.getFlowElements()) { Bounds subEleBounds = getBoundsForElement(subEle, plane); if (subEleBounds != null) { subEleBounds.setX(subEleBounds.getX() + parentX); subEleBounds.setY(subEleBounds.getY() + parentY); } if (subEle instanceof SubProcess) { updateShapeBoundsInSubprocessInLanes(plane, ele, (SubProcess) subEle, subEleBounds.getX(), subEleBounds.getY()); } } }