Skip to content

Commit

Permalink
Fix issue with condition extension elements
Browse files Browse the repository at this point in the history
  • Loading branch information
tijsrademakers committed Nov 20, 2023
1 parent ac508d9 commit f2656ac
Show file tree
Hide file tree
Showing 3 changed files with 32 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -36,4 +36,9 @@ public void parseChildElement(XMLStreamReader xtr, BaseElement parentElement, Bp

((ConditionalEventDefinition) parentElement).setConditionExpression(xtr.getElementText().trim());
}

@Override
public boolean accepts(BaseElement element) {
return element instanceof ConditionalEventDefinition;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
import org.flowable.bpmn.model.BpmnModel;
import org.flowable.bpmn.model.ExtensionElement;
import org.flowable.bpmn.model.FlowElement;
import org.flowable.bpmn.model.SequenceFlow;
import org.flowable.editor.language.xml.util.BpmnXmlConverterTest;
import org.flowable.editor.language.xml.util.ConversionDirection;

Expand All @@ -32,6 +33,18 @@ void validateModel(BpmnModel bpmnModel) {
FlowElement flowElement = bpmnModel.getMainProcess().getFlowElement("theTask");
List<ExtensionElement> extensionElements = flowElement.getExtensionElements().get("test");
assertThat(extensionElements).hasSize(1);

SequenceFlow sequenceFlow = (SequenceFlow) bpmnModel.getMainProcess().getFlowElement("flow1");
assertThat(sequenceFlow.getExtensionElements()).hasSize(2);

List<ExtensionElement> myElements = sequenceFlow.getExtensionElements().get("condition");
assertThat(myElements).hasSize(1);
ExtensionElement myElement = myElements.get(0);
assertThat(myElement.getAttributeValue(null, "name")).isEqualTo("test");
myElements = myElement.getChildElements().get("condition");
assertThat(myElements).hasSize(1);
myElement = myElements.get(0);
assertThat(myElement.getAttributeValue(null, "ref")).isEqualTo("test");
}

// We are only converting one direction since the XML location changes when we do it both ways
Expand Down
Original file line number Diff line number Diff line change
@@ -1,14 +1,26 @@
<?xml version="1.0" encoding="UTF-8"?>
<definitions xmlns="http://www.omg.org/spec/BPMN/20100524/MODEL"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:flowable="http://flowable.org/bpmn"
xmlns:custom="http://custom.org/bpmn"
targetNamespace="ExamplesCategory">
<process id="oneTaskProcess">
<extensionElements>
<custom:test name="test">test</custom:test>
</extensionElements>
<startEvent id="theStart" />
<sequenceFlow id="flow1" sourceRef="theStart" targetRef="theTask" />
<sequenceFlow id="flow1" sourceRef="theStart" targetRef="theTask">
<extensionElements>
<flowable:condition name="test">
<flowable:condition ref="test"></flowable:condition>
</flowable:condition>
<custom:test name="test"><![CDATA[test]]></custom:test>
</extensionElements>
<conditionExpression xsi:type="tFormalExpression"><![CDATA[${test}]]></conditionExpression>
</sequenceFlow>
<userTask id="theTask" name="my task">
<extensionElements>
<custom:test name="test" />
<custom:test name="test"></custom:test>
</extensionElements>
</userTask>
<sequenceFlow id="flow2" sourceRef="theTask" targetRef="theEnd" />
Expand Down

0 comments on commit f2656ac

Please sign in to comment.