Search in sources :

Example 6 with SequenceFlow

use of org.eclipse.bpmn2.SequenceFlow in project kie-wb-common by kiegroup.

the class Bpmn2JsonUnmarshaller method createBpmnEdgeForSequenceFlow.

private void createBpmnEdgeForSequenceFlow(BpmnDiFactory factory, BPMNPlane plane, SequenceFlow sequenceFlow) {
    BPMNEdge edge = factory.createBPMNEdge();
    edge.setBpmnElement(sequenceFlow);
    DcFactory dcFactory = DcFactory.eINSTANCE;
    Point point = dcFactory.createPoint();
    List<Point> dockers = _dockers.get(sequenceFlow.getId());
    if (sequenceFlow.getSourceRef() != null) {
        Bounds sourceBounds = _bounds.get(sequenceFlow.getSourceRef().getId());
        // Test for valid docker with X and Y  > -1, created by EdgeParser
        if (dockers != null && dockers.size() > 0 && dockers.get(0).getX() > -1 && dockers.get(0).getY() > -1) {
            // First docker is connection to Source
            point.setX(sourceBounds.getX() + dockers.get(0).getX());
            point.setY(sourceBounds.getY() + dockers.get(0).getY());
        } else {
            // Default is right middle of Source
            point.setX(sourceBounds.getX() + sourceBounds.getWidth());
            point.setY(sourceBounds.getY() + (sourceBounds.getHeight() / 2));
        }
    }
    edge.getWaypoint().add(point);
    for (int i = 1; i < dockers.size() - 1; i++) {
        edge.getWaypoint().add(dockers.get(i));
    }
    point = dcFactory.createPoint();
    if (sequenceFlow.getTargetRef() != null) {
        Bounds targetBounds = _bounds.get(sequenceFlow.getTargetRef().getId());
        // Test for valid docker with X and Y  > -1, created by EdgeParser
        if (dockers != null && dockers.size() > 1 && dockers.get(dockers.size() - 1).getX() > -1 && dockers.get(dockers.size() - 1).getY() > -1) {
            // Last docker is connection to Target
            point.setX(targetBounds.getX() + dockers.get(dockers.size() - 1).getX());
            point.setY(targetBounds.getY() + dockers.get(dockers.size() - 1).getY());
        } else {
            // Default is left middle of Target
            point.setX(targetBounds.getX());
            point.setY(targetBounds.getY() + (targetBounds.getHeight() / 2));
        }
    }
    edge.getWaypoint().add(point);
    plane.getPlaneElement().add(edge);
}
Also used : Bounds(org.eclipse.dd.dc.Bounds) Point(org.eclipse.dd.dc.Point) BPMNEdge(org.eclipse.bpmn2.di.BPMNEdge) DcFactory(org.eclipse.dd.dc.DcFactory) Point(org.eclipse.dd.dc.Point)

Example 7 with SequenceFlow

use of org.eclipse.bpmn2.SequenceFlow in project kie-wb-common by kiegroup.

the class Bpmn2JsonUnmarshaller method applySequenceFlowCondition.

protected void applySequenceFlowCondition(SequenceFlow sequenceFlow, Map<String, String> properties) {
    String conditionExpression = properties.get("conditionexpression");
    if (conditionExpression != null && !conditionExpression.isEmpty()) {
        ScriptTypeValue value = new ScriptTypeTypeSerializer().parse(conditionExpression);
        if (value.getScript() != null && !value.getScript().isEmpty()) {
            FormalExpression expr = Bpmn2Factory.eINSTANCE.createFormalExpression();
            expr.setBody(wrapInCDATABlock(value.getScript()));
            if (value.getLanguage() != null && !value.getLanguage().isEmpty()) {
                String languageFormat = Utils.getScriptLanguageFormat(value.getLanguage());
                if (languageFormat == null) {
                    // default to mvel
                    languageFormat = "http://www.mvel.org/2.0";
                }
                expr.setLanguage(languageFormat);
            }
            sequenceFlow.setConditionExpression(expr);
        }
    }
}
Also used : ScriptTypeTypeSerializer(org.kie.workbench.common.stunner.bpmn.backend.marshall.json.oryx.property.ScriptTypeTypeSerializer) FormalExpression(org.eclipse.bpmn2.FormalExpression) ScriptTypeValue(org.kie.workbench.common.stunner.bpmn.definition.property.task.ScriptTypeValue)

Example 8 with SequenceFlow

use of org.eclipse.bpmn2.SequenceFlow in project kie-wb-common by kiegroup.

the class Bpmn2JsonUnmarshaller method setDefaultGateway.

private void setDefaultGateway(FlowElement fe, List<SequenceFlow> sqList) {
    Iterator<FeatureMap.Entry> iter = fe.getAnyAttribute().iterator();
    while (iter.hasNext()) {
        FeatureMap.Entry entry = iter.next();
        if (entry.getEStructuralFeature().getName().equals("dg")) {
            for (SequenceFlow newFlow : sqList) {
                String entryValue = (String) entry.getValue();
                String entryValueId = "";
                String[] entryValueParts = entryValue.split(" : ");
                if (entryValueParts.length == 1) {
                    entryValueId = entryValueParts[0];
                } else if (entryValueParts.length > 1) {
                    entryValueId = entryValueParts[1];
                }
                if (newFlow.getId().equals(entryValueId)) {
                    if (fe instanceof ExclusiveGateway) {
                        ((ExclusiveGateway) fe).setDefault(newFlow);
                    } else if (fe instanceof InclusiveGateway) {
                        ((InclusiveGateway) fe).setDefault(newFlow);
                    }
                    if (newFlow.getConditionExpression() == null) {
                        FormalExpression expr = Bpmn2Factory.eINSTANCE.createFormalExpression();
                        expr.setBody("");
                        newFlow.setConditionExpression(expr);
                    }
                }
            }
        }
    }
}
Also used : FeatureMap(org.eclipse.emf.ecore.util.FeatureMap) ExclusiveGateway(org.eclipse.bpmn2.ExclusiveGateway) Entry(java.util.Map.Entry) SimpleFeatureMapEntry(org.eclipse.emf.ecore.impl.EStructuralFeatureImpl.SimpleFeatureMapEntry) InclusiveGateway(org.eclipse.bpmn2.InclusiveGateway) SequenceFlow(org.eclipse.bpmn2.SequenceFlow) FormalExpression(org.eclipse.bpmn2.FormalExpression)

Example 9 with SequenceFlow

use of org.eclipse.bpmn2.SequenceFlow in project kie-wb-common by kiegroup.

the class BPMNDiagramMarshallerTest method assertConditionLanguage.

private void assertConditionLanguage(Diagram<Graph, Metadata> diagram, String id, String value) {
    List<Node> nodes = getNodes(diagram);
    Optional<SequenceFlow> sequenceFlow = Stream.concat(nodes.stream().flatMap(node -> {
        List<Edge> d = node.getInEdges();
        return d.stream();
    }), nodes.stream().flatMap(node -> {
        List<Edge> d = node.getOutEdges();
        return d.stream();
    })).filter(edge -> edge.getUUID().equals(id)).map(node -> (View) node.getContent()).filter(view -> view.getDefinition() instanceof SequenceFlow).map(view -> ((SequenceFlow) view.getDefinition())).findFirst();
    String conditionLanguage = (sequenceFlow.isPresent() ? sequenceFlow.get().getExecutionSet().getConditionExpression().getValue().getLanguage() : null);
    assertEquals(value, conditionLanguage);
}
Also used : Arrays(java.util.Arrays) BPMNGraphObjectBuilderFactory(org.kie.workbench.common.stunner.bpmn.backend.marshall.json.builder.BPMNGraphObjectBuilderFactory) SequenceFlow(org.kie.workbench.common.stunner.bpmn.definition.SequenceFlow) AssignmentsTypeSerializer(org.kie.workbench.common.stunner.bpmn.backend.marshall.json.oryx.property.AssignmentsTypeSerializer) ReusableSubprocessTaskExecutionSet(org.kie.workbench.common.stunner.bpmn.definition.property.task.ReusableSubprocessTaskExecutionSet) EndErrorEvent(org.kie.workbench.common.stunner.bpmn.definition.EndErrorEvent) Edge(org.kie.workbench.common.stunner.core.graph.Edge) SimulationSet(org.kie.workbench.common.stunner.bpmn.definition.property.simulation.SimulationSet) StartTimerEvent(org.kie.workbench.common.stunner.bpmn.definition.StartTimerEvent) UserTask(org.kie.workbench.common.stunner.bpmn.definition.UserTask) BackendDefinitionSetAdapter(org.kie.workbench.common.stunner.core.backend.definition.adapter.reflect.BackendDefinitionSetAdapter) Bpmn2OryxPropertySerializer(org.kie.workbench.common.stunner.bpmn.backend.marshall.json.oryx.property.Bpmn2OryxPropertySerializer) EdgeFactoryImpl(org.kie.workbench.common.stunner.core.factory.impl.EdgeFactoryImpl) DataOutputAssociation(org.eclipse.bpmn2.DataOutputAssociation) BPMNDiagramMarshaller(org.kie.workbench.common.stunner.bpmn.backend.BPMNDiagramMarshaller) Mockito.doAnswer(org.mockito.Mockito.doAnswer) GraphFactory(org.kie.workbench.common.stunner.core.factory.graph.GraphFactory) DefinitionManager(org.kie.workbench.common.stunner.core.api.DefinitionManager) EndTerminateEvent(org.kie.workbench.common.stunner.bpmn.definition.EndTerminateEvent) Diagram(org.kie.workbench.common.stunner.core.diagram.Diagram) NodeFactory(org.kie.workbench.common.stunner.core.factory.graph.NodeFactory) RuleEvaluationContext(org.kie.workbench.common.stunner.core.rule.RuleEvaluationContext) ColorTypeSerializer(org.kie.workbench.common.stunner.bpmn.backend.marshall.json.oryx.property.ColorTypeSerializer) ScriptTask(org.kie.workbench.common.stunner.bpmn.definition.ScriptTask) IntegerTypeSerializer(org.kie.workbench.common.stunner.bpmn.backend.marshall.json.oryx.property.IntegerTypeSerializer) StandardCharsets(java.nio.charset.StandardCharsets) Bpmn2OryxPropertyManager(org.kie.workbench.common.stunner.bpmn.backend.marshall.json.oryx.property.Bpmn2OryxPropertyManager) MorphDefinition(org.kie.workbench.common.stunner.core.definition.morph.MorphDefinition) Matchers.any(org.mockito.Matchers.any) Stream(java.util.stream.Stream) EmbeddedSubprocess(org.kie.workbench.common.stunner.bpmn.definition.EmbeddedSubprocess) JBPMBpmn2ResourceImpl(org.kie.workbench.common.stunner.bpmn.backend.legacy.resource.JBPMBpmn2ResourceImpl) Assert.assertFalse(org.junit.Assert.assertFalse) Dock(org.kie.workbench.common.stunner.core.graph.content.relationship.Dock) NoneTask(org.kie.workbench.common.stunner.bpmn.definition.NoneTask) ViewConnectorImpl(org.kie.workbench.common.stunner.core.graph.content.view.ViewConnectorImpl) InputOutputSpecification(org.eclipse.bpmn2.InputOutputSpecification) Mockito.mock(org.mockito.Mockito.mock) Bpmn2OryxIdMappings(org.kie.workbench.common.stunner.bpmn.backend.marshall.json.oryx.Bpmn2OryxIdMappings) StartNoneEvent(org.kie.workbench.common.stunner.bpmn.definition.StartNoneEvent) BPMNGeneralSet(org.kie.workbench.common.stunner.bpmn.definition.property.general.BPMNGeneralSet) ItemAwareElement(org.eclipse.bpmn2.ItemAwareElement) ItemDefinition(org.eclipse.bpmn2.ItemDefinition) ScriptTypeTypeSerializer(org.kie.workbench.common.stunner.bpmn.backend.marshall.json.oryx.property.ScriptTypeTypeSerializer) Connection(org.kie.workbench.common.stunner.core.graph.content.view.Connection) Mock(org.mockito.Mock) BusinessRuleTask(org.kie.workbench.common.stunner.bpmn.definition.BusinessRuleTask) GraphCommandManager(org.kie.workbench.common.stunner.core.graph.command.GraphCommandManager) RunWith(org.junit.runner.RunWith) MessageRef(org.kie.workbench.common.stunner.bpmn.definition.property.event.message.MessageRef) GraphCommandManagerImpl(org.kie.workbench.common.stunner.core.graph.command.GraphCommandManagerImpl) ExtensionAttributeValue(org.eclipse.bpmn2.ExtensionAttributeValue) AdHocSubprocess(org.kie.workbench.common.stunner.bpmn.definition.AdHocSubprocess) CloneManager(org.kie.workbench.common.stunner.core.definition.clone.CloneManager) Matchers.anyString(org.mockito.Matchers.anyString) ArrayList(java.util.ArrayList) DataInput(org.eclipse.bpmn2.DataInput) Property(org.eclipse.bpmn2.Property) ProcessData(org.kie.workbench.common.stunner.bpmn.definition.property.variables.ProcessData) BackendDefinitionAdapter(org.kie.workbench.common.stunner.core.backend.definition.adapter.reflect.BackendDefinitionAdapter) MapIndexBuilder(org.kie.workbench.common.stunner.core.graph.processing.index.map.MapIndexBuilder) InterruptingSignalEventExecutionSet(org.kie.workbench.common.stunner.bpmn.definition.property.event.signal.InterruptingSignalEventExecutionSet) IntermediateSignalEventCatching(org.kie.workbench.common.stunner.bpmn.definition.IntermediateSignalEventCatching) AdapterManager(org.kie.workbench.common.stunner.core.definition.adapter.AdapterManager) Before(org.junit.Before) BindableAdapterUtils(org.kie.workbench.common.stunner.core.definition.adapter.binding.BindableAdapterUtils) NodeFactoryImpl(org.kie.workbench.common.stunner.core.factory.impl.NodeFactoryImpl) MetaDataType(org.jboss.drools.MetaDataType) AssignmentsInfo(org.kie.workbench.common.stunner.bpmn.definition.property.dataio.AssignmentsInfo) DataInputAssociation(org.eclipse.bpmn2.DataInputAssociation) EndMessageEvent(org.kie.workbench.common.stunner.bpmn.definition.EndMessageEvent) BPMNDefinition(org.kie.workbench.common.stunner.bpmn.definition.BPMNDefinition) EndSignalEvent(org.kie.workbench.common.stunner.bpmn.definition.EndSignalEvent) BPMNDiagramImpl(org.kie.workbench.common.stunner.bpmn.definition.BPMNDiagramImpl) RuleSet(org.kie.workbench.common.stunner.core.rule.RuleSet) Assert.assertTrue(org.junit.Assert.assertTrue) FeatureMap(org.eclipse.emf.ecore.util.FeatureMap) Test(org.junit.Test) AdapterRegistry(org.kie.workbench.common.stunner.core.registry.definition.AdapterRegistry) InterruptingErrorEventExecutionSet(org.kie.workbench.common.stunner.bpmn.definition.property.event.error.InterruptingErrorEventExecutionSet) GraphCommandFactory(org.kie.workbench.common.stunner.core.graph.command.impl.GraphCommandFactory) TimerSettingsTypeSerializer(org.kie.workbench.common.stunner.bpmn.backend.marshall.json.oryx.property.TimerSettingsTypeSerializer) Graph(org.kie.workbench.common.stunner.core.graph.Graph) IntermediateMessageEventThrowing(org.kie.workbench.common.stunner.bpmn.definition.IntermediateMessageEventThrowing) MockitoJUnitRunner(org.mockito.runners.MockitoJUnitRunner) Assert.assertNull(org.junit.Assert.assertNull) SignalRef(org.kie.workbench.common.stunner.bpmn.definition.property.event.signal.SignalRef) WorkItemDefinitionRegistry(org.kie.workbench.common.stunner.bpmn.workitem.WorkItemDefinitionRegistry) IsInterrupting(org.kie.workbench.common.stunner.bpmn.definition.property.event.IsInterrupting) BackendPropertyAdapter(org.kie.workbench.common.stunner.core.backend.definition.adapter.reflect.BackendPropertyAdapter) MultipleInstanceSubprocess(org.kie.workbench.common.stunner.bpmn.definition.MultipleInstanceSubprocess) BackendBindableMorphAdapter(org.kie.workbench.common.stunner.core.backend.definition.adapter.bind.BackendBindableMorphAdapter) BeanManager(javax.enterprise.inject.spi.BeanManager) FlowElement(org.eclipse.bpmn2.FlowElement) Assert.assertEquals(org.junit.Assert.assertEquals) RootElement(org.eclipse.bpmn2.RootElement) DefinitionUtils(org.kie.workbench.common.stunner.core.util.DefinitionUtils) IntermediateErrorEventCatching(org.kie.workbench.common.stunner.bpmn.definition.IntermediateErrorEventCatching) StartSignalEvent(org.kie.workbench.common.stunner.bpmn.definition.StartSignalEvent) UserTaskExecutionSet(org.kie.workbench.common.stunner.bpmn.definition.property.task.UserTaskExecutionSet) Activity(org.eclipse.bpmn2.Activity) GraphIndexBuilder(org.kie.workbench.common.stunner.core.graph.processing.index.GraphIndexBuilder) DefaultRuleViolations(org.kie.workbench.common.stunner.core.rule.violations.DefaultRuleViolations) BooleanTypeSerializer(org.kie.workbench.common.stunner.bpmn.backend.marshall.json.oryx.property.BooleanTypeSerializer) EdgeImpl(org.kie.workbench.common.stunner.core.graph.impl.EdgeImpl) ByteArrayInputStream(java.io.ByteArrayInputStream) Matchers.eq(org.mockito.Matchers.eq) DataOutput(org.eclipse.bpmn2.DataOutput) EStructuralFeatureImpl(org.eclipse.emf.ecore.impl.EStructuralFeatureImpl) NodeImpl(org.kie.workbench.common.stunner.core.graph.impl.NodeImpl) DoubleTypeSerializer(org.kie.workbench.common.stunner.bpmn.backend.marshall.json.oryx.property.DoubleTypeSerializer) Collection(java.util.Collection) BPMNDiagram(org.kie.workbench.common.stunner.bpmn.definition.BPMNDiagram) ServiceTask(org.kie.workbench.common.stunner.bpmn.workitem.ServiceTask) ScriptTypeListTypeSerializer(org.kie.workbench.common.stunner.bpmn.backend.marshall.json.oryx.property.ScriptTypeListTypeSerializer) StartErrorEvent(org.kie.workbench.common.stunner.bpmn.definition.StartErrorEvent) BackendPropertySetAdapter(org.kie.workbench.common.stunner.core.backend.definition.adapter.reflect.BackendPropertySetAdapter) TaskTypeSerializer(org.kie.workbench.common.stunner.bpmn.backend.marshall.json.oryx.property.TaskTypeSerializer) ExclusiveGateway(org.kie.workbench.common.stunner.bpmn.definition.ExclusiveGateway) EdgeFactory(org.kie.workbench.common.stunner.core.factory.graph.EdgeFactory) InterruptingTimerEventExecutionSet(org.kie.workbench.common.stunner.bpmn.definition.property.event.timer.InterruptingTimerEventExecutionSet) TaskTypes(org.kie.workbench.common.stunner.bpmn.definition.property.task.TaskTypes) Metadata(org.kie.workbench.common.stunner.core.diagram.Metadata) List(java.util.List) DiagramSet(org.kie.workbench.common.stunner.bpmn.definition.property.diagram.DiagramSet) BPMNDefinitionSet(org.kie.workbench.common.stunner.bpmn.BPMNDefinitionSet) MetadataImpl(org.kie.workbench.common.stunner.core.diagram.MetadataImpl) Optional(java.util.Optional) IntermediateTimerEvent(org.kie.workbench.common.stunner.bpmn.definition.IntermediateTimerEvent) StartMessageEvent(org.kie.workbench.common.stunner.bpmn.definition.StartMessageEvent) Bounds(org.kie.workbench.common.stunner.core.graph.content.Bounds) Node(org.kie.workbench.common.stunner.core.graph.Node) DataIOSet(org.kie.workbench.common.stunner.bpmn.definition.property.dataio.DataIOSet) StringTypeSerializer(org.kie.workbench.common.stunner.bpmn.backend.marshall.json.oryx.property.StringTypeSerializer) View(org.kie.workbench.common.stunner.core.graph.content.view.View) DiagramImpl(org.kie.workbench.common.stunner.core.diagram.DiagramImpl) Element(org.kie.workbench.common.stunner.core.graph.Element) IntermediateSignalEventThrowing(org.kie.workbench.common.stunner.bpmn.definition.IntermediateSignalEventThrowing) ReusableSubprocess(org.kie.workbench.common.stunner.bpmn.definition.ReusableSubprocess) LinkedList(java.util.LinkedList) EnumTypeSerializer(org.kie.workbench.common.stunner.bpmn.backend.marshall.json.oryx.property.EnumTypeSerializer) GraphFactoryImpl(org.kie.workbench.common.stunner.core.factory.impl.GraphFactoryImpl) Definitions(org.eclipse.bpmn2.Definitions) Process(org.eclipse.bpmn2.Process) Iterator(java.util.Iterator) XMLEncoderDiagramMetadataMarshaller(org.kie.workbench.common.stunner.core.backend.service.XMLEncoderDiagramMetadataMarshaller) Assert.assertNotNull(org.junit.Assert.assertNotNull) InclusiveGateway(org.kie.workbench.common.stunner.bpmn.definition.InclusiveGateway) Mockito.when(org.mockito.Mockito.when) AdHocSubprocessTaskExecutionSet(org.kie.workbench.common.stunner.bpmn.definition.property.task.AdHocSubprocessTaskExecutionSet) Definition(org.kie.workbench.common.stunner.core.graph.content.definition.Definition) TestScopeModelFactory(org.kie.workbench.common.stunner.backend.definition.factory.TestScopeModelFactory) ViewConnector(org.kie.workbench.common.stunner.core.graph.content.view.ViewConnector) EventSubprocess(org.kie.workbench.common.stunner.bpmn.definition.EventSubprocess) BackendFactoryManager(org.kie.workbench.common.stunner.core.backend.BackendFactoryManager) Bpmn2OryxManager(org.kie.workbench.common.stunner.bpmn.backend.marshall.json.oryx.Bpmn2OryxManager) WorkItemDefinitionBackendRegistry(org.kie.workbench.common.stunner.bpmn.backend.workitem.WorkItemDefinitionBackendRegistry) ElementFactory(org.kie.workbench.common.stunner.core.factory.graph.ElementFactory) ProcessVariables(org.kie.workbench.common.stunner.bpmn.definition.property.variables.ProcessVariables) RuleManager(org.kie.workbench.common.stunner.core.rule.RuleManager) IntermediateMessageEventCatching(org.kie.workbench.common.stunner.bpmn.definition.IntermediateMessageEventCatching) VariablesTypeSerializer(org.kie.workbench.common.stunner.bpmn.backend.marshall.json.oryx.property.VariablesTypeSerializer) DiscreteConnection(org.kie.workbench.common.stunner.core.graph.content.view.DiscreteConnection) InputStream(java.io.InputStream) EndNoneEvent(org.kie.workbench.common.stunner.bpmn.definition.EndNoneEvent) InterruptingMessageEventExecutionSet(org.kie.workbench.common.stunner.bpmn.definition.property.event.message.InterruptingMessageEventExecutionSet) SequenceFlow(org.kie.workbench.common.stunner.bpmn.definition.SequenceFlow) Node(org.kie.workbench.common.stunner.core.graph.Node) Matchers.anyString(org.mockito.Matchers.anyString) Edge(org.kie.workbench.common.stunner.core.graph.Edge) View(org.kie.workbench.common.stunner.core.graph.content.view.View)

Example 10 with SequenceFlow

use of org.eclipse.bpmn2.SequenceFlow in project kie-wb-common by kiegroup.

the class BPMNDiagramMarshallerTest method testUnmarshallSequenceFlow.

@Test
public void testUnmarshallSequenceFlow() throws Exception {
    Diagram<Graph, Metadata> diagram = unmarshall(BPMN_SEQUENCEFLOW);
    SequenceFlow sequenceFlow1 = null;
    SequenceFlow sequenceFlow2 = null;
    Iterator<Element> it = nodesIterator(diagram);
    while (it.hasNext()) {
        Element element = it.next();
        if (element.getContent() instanceof View) {
            Object oDefinition = ((View) element.getContent()).getDefinition();
            if (oDefinition instanceof ExclusiveGateway) {
                List<Edge> outEdges = ((NodeImpl) element).getOutEdges();
                for (Edge edge : outEdges) {
                    SequenceFlow flow = (SequenceFlow) ((ViewConnectorImpl) ((EdgeImpl) edge).getContent()).getDefinition();
                    if ("route1".equals(flow.getGeneral().getName().getValue())) {
                        sequenceFlow1 = flow;
                    }
                    if ("route2".equals(flow.getGeneral().getName().getValue())) {
                        sequenceFlow2 = flow;
                    }
                }
            }
        }
    }
    assertNotNull(sequenceFlow1);
    assertNotNull(sequenceFlow1.getExecutionSet());
    assertNotNull(sequenceFlow1.getExecutionSet().getConditionExpression());
    assertNotNull(sequenceFlow1.getExecutionSet().getPriority());
    assertNotNull(sequenceFlow1.getGeneral());
    assertNotNull(sequenceFlow1.getGeneral().getName());
    assertEquals("route1", sequenceFlow1.getGeneral().getName().getValue());
    assertEquals("age >= 10;", sequenceFlow1.getExecutionSet().getConditionExpression().getValue().getScript());
    assertEquals("javascript", sequenceFlow1.getExecutionSet().getConditionExpression().getValue().getLanguage());
    assertEquals("2", sequenceFlow1.getExecutionSet().getPriority().getValue());
    assertNotNull(sequenceFlow2);
    assertNotNull(sequenceFlow2.getExecutionSet());
    assertNotNull(sequenceFlow2.getExecutionSet().getConditionExpression());
    assertNotNull(sequenceFlow2.getExecutionSet().getPriority());
    assertNotNull(sequenceFlow2.getGeneral());
    assertNotNull(sequenceFlow2.getGeneral().getName());
    assertEquals("route2", sequenceFlow2.getGeneral().getName().getValue());
    assertEquals("age\n" + "<\n" + "10;", sequenceFlow2.getExecutionSet().getConditionExpression().getValue().getScript());
    assertEquals("java", sequenceFlow2.getExecutionSet().getConditionExpression().getValue().getLanguage());
    assertEquals("1", sequenceFlow2.getExecutionSet().getPriority().getValue());
}
Also used : NodeImpl(org.kie.workbench.common.stunner.core.graph.impl.NodeImpl) SequenceFlow(org.kie.workbench.common.stunner.bpmn.definition.SequenceFlow) ItemAwareElement(org.eclipse.bpmn2.ItemAwareElement) FlowElement(org.eclipse.bpmn2.FlowElement) RootElement(org.eclipse.bpmn2.RootElement) Element(org.kie.workbench.common.stunner.core.graph.Element) Metadata(org.kie.workbench.common.stunner.core.diagram.Metadata) EdgeImpl(org.kie.workbench.common.stunner.core.graph.impl.EdgeImpl) View(org.kie.workbench.common.stunner.core.graph.content.view.View) ExclusiveGateway(org.kie.workbench.common.stunner.bpmn.definition.ExclusiveGateway) Graph(org.kie.workbench.common.stunner.core.graph.Graph) Edge(org.kie.workbench.common.stunner.core.graph.Edge) Test(org.junit.Test)

Aggregations

SequenceFlow (org.eclipse.bpmn2.SequenceFlow)13 ArrayList (java.util.ArrayList)11 FlowElement (org.eclipse.bpmn2.FlowElement)11 AdHocSubProcess (org.eclipse.bpmn2.AdHocSubProcess)10 SubProcess (org.eclipse.bpmn2.SubProcess)10 Process (org.eclipse.bpmn2.Process)9 RootElement (org.eclipse.bpmn2.RootElement)8 Point (org.eclipse.dd.dc.Point)8 Bounds (org.eclipse.dd.dc.Bounds)7 DataObject (org.eclipse.bpmn2.DataObject)6 List (java.util.List)5 DataInputAssociation (org.eclipse.bpmn2.DataInputAssociation)5 DataOutputAssociation (org.eclipse.bpmn2.DataOutputAssociation)5 FlowNode (org.eclipse.bpmn2.FlowNode)5 FormalExpression (org.eclipse.bpmn2.FormalExpression)5 FeatureMap (org.eclipse.emf.ecore.util.FeatureMap)5 Artifact (org.eclipse.bpmn2.Artifact)4 BoundaryEvent (org.eclipse.bpmn2.BoundaryEvent)4 ItemAwareElement (org.eclipse.bpmn2.ItemAwareElement)4 BPMNEdge (org.eclipse.bpmn2.di.BPMNEdge)4