Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix issue where call activities within sub processes were not returned #342

Merged
merged 1 commit into from
Jul 10, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion SpiffWorkflow/bpmn/parser/ProcessParser.py
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ def called_element_ids(self):
"""
Returns a list of ids referenced by `bpmn:callActivity` nodes.
"""
return self.xpath("./bpmn:callActivity/@calledElement")
return self.xpath(".//bpmn:callActivity/@calledElement")

def parse_node(self, node):
"""
Expand Down
4 changes: 4 additions & 0 deletions tests/SpiffWorkflow/bpmn/ProcessParserTest.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,10 @@ def testHandlesMultipleCallActivities(self):
parser = _process_parser("multiple_call_activities.bpmn", "Process_90mmqlw")
assert parser.called_element_ids() == ["Process_sypm122", "Process_diu8ta2", "Process_l14lar1"]

def testHandlesNestedCallActivity(self):
parser = _process_parser("nested_call_activity.bpmn", "Process_expand_call_activity")
assert parser.called_element_ids() == ["is_this_missing", "set_permissions_process"]

def testCanAddDmnFromString(self):
parser = BpmnDmnParser()
parser.add_dmn_str(EMPTY_DMN)
Expand Down
115 changes: 115 additions & 0 deletions tests/SpiffWorkflow/bpmn/data/nested_call_activity.bpmn
Original file line number Diff line number Diff line change
@@ -0,0 +1,115 @@
<?xml version="1.0" encoding="UTF-8"?>
<bpmn:definitions xmlns:bpmn="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" xmlns:dc="http://www.omg.org/spec/DD/20100524/DC" xmlns:di="http://www.omg.org/spec/DD/20100524/DI" id="Definitions_96f6665" targetNamespace="http://bpmn.io/schema/bpmn" exporter="Camunda Modeler" exporterVersion="3.0.0-dev">
<bpmn:process id="Process_expand_call_activity" isExecutable="true">
<bpmn:subProcess id="Activity_0jqrbg8">
<bpmn:incoming>Flow_0rrlqcy</bpmn:incoming>
<bpmn:outgoing>Flow_1x7ckx0</bpmn:outgoing>
<bpmn:startEvent id="Event_1gj4k6s">
<bpmn:outgoing>Flow_09wo95v</bpmn:outgoing>
</bpmn:startEvent>
<bpmn:sequenceFlow id="Flow_09wo95v" sourceRef="Event_1gj4k6s" targetRef="Activity_0f25k4g" />
<bpmn:endEvent id="Event_12ep3rp">
<bpmn:incoming>Flow_0fbenj5</bpmn:incoming>
</bpmn:endEvent>
<bpmn:sequenceFlow id="Flow_0fbenj5" sourceRef="Activity_0f25k4g" targetRef="Event_12ep3rp" />
<bpmn:callActivity id="Activity_0f25k4g" name="missing?" calledElement="is_this_missing">
<bpmn:incoming>Flow_09wo95v</bpmn:incoming>
<bpmn:outgoing>Flow_0fbenj5</bpmn:outgoing>
</bpmn:callActivity>
</bpmn:subProcess>
<bpmn:endEvent id="Event_0woz4y5">
<bpmn:incoming>Flow_0q4zwqq</bpmn:incoming>
</bpmn:endEvent>
<bpmn:sequenceFlow id="Flow_1x7ckx0" sourceRef="Activity_0jqrbg8" targetRef="Activity_1tglo3a" />
<bpmn:startEvent id="Event_0l2o0kx">
<bpmn:outgoing>Flow_0rrlqcy</bpmn:outgoing>
</bpmn:startEvent>
<bpmn:sequenceFlow id="Flow_0rrlqcy" sourceRef="Event_0l2o0kx" targetRef="Activity_0jqrbg8" />
<bpmn:sequenceFlow id="Flow_0q4zwqq" sourceRef="Activity_1tglo3a" targetRef="Event_0woz4y5" />
<bpmn:subProcess id="Activity_1tglo3a" name="missing?">
<bpmn:incoming>Flow_1x7ckx0</bpmn:incoming>
<bpmn:outgoing>Flow_0q4zwqq</bpmn:outgoing>
<bpmn:startEvent id="Event_003dbci">
<bpmn:outgoing>Flow_1gg1sal</bpmn:outgoing>
</bpmn:startEvent>
<bpmn:sequenceFlow id="Flow_1gg1sal" sourceRef="Event_003dbci" targetRef="Activity_00etcsd" />
<bpmn:endEvent id="Event_0e6rn1x">
<bpmn:incoming>Flow_151l7v5</bpmn:incoming>
</bpmn:endEvent>
<bpmn:sequenceFlow id="Flow_151l7v5" sourceRef="Activity_00etcsd" targetRef="Event_0e6rn1x" />
<bpmn:callActivity id="Activity_00etcsd" name="also missing?" calledElement="set_permissions_process">
<bpmn:incoming>Flow_1gg1sal</bpmn:incoming>
<bpmn:outgoing>Flow_151l7v5</bpmn:outgoing>
</bpmn:callActivity>
</bpmn:subProcess>
</bpmn:process>
<bpmndi:BPMNDiagram id="BPMNDiagram_1">
<bpmndi:BPMNPlane id="BPMNPlane_1" bpmnElement="Process_expand_call_activity">
<bpmndi:BPMNShape id="Event_0woz4y5_di" bpmnElement="Event_0woz4y5">
<dc:Bounds x="422" y="-128" width="36" height="36" />
</bpmndi:BPMNShape>
<bpmndi:BPMNShape id="Activity_0jqrbg8_di" bpmnElement="Activity_0jqrbg8" isExpanded="true">
<dc:Bounds x="-170" y="-210" width="350" height="200" />
</bpmndi:BPMNShape>
<bpmndi:BPMNShape id="Event_1gj4k6s_di" bpmnElement="Event_1gj4k6s">
<dc:Bounds x="-130" y="-128" width="36" height="36" />
</bpmndi:BPMNShape>
<bpmndi:BPMNShape id="Event_12ep3rp_di" bpmnElement="Event_12ep3rp">
<dc:Bounds x="122" y="-128" width="36" height="36" />
</bpmndi:BPMNShape>
<bpmndi:BPMNShape id="Activity_10rwvqv_di" bpmnElement="Activity_0f25k4g">
<dc:Bounds x="-40" y="-150" width="100" height="80" />
<bpmndi:BPMNLabel />
</bpmndi:BPMNShape>
<bpmndi:BPMNEdge id="Flow_09wo95v_di" bpmnElement="Flow_09wo95v">
<di:waypoint x="-94" y="-110" />
<di:waypoint x="-40" y="-110" />
</bpmndi:BPMNEdge>
<bpmndi:BPMNEdge id="Flow_0fbenj5_di" bpmnElement="Flow_0fbenj5">
<di:waypoint x="60" y="-110" />
<di:waypoint x="122" y="-110" />
</bpmndi:BPMNEdge>
<bpmndi:BPMNShape id="Event_0l2o0kx_di" bpmnElement="Event_0l2o0kx">
<dc:Bounds x="-328" y="-128" width="36" height="36" />
</bpmndi:BPMNShape>
<bpmndi:BPMNShape id="Activity_1jcx1cz_di" bpmnElement="Activity_1tglo3a">
<dc:Bounds x="240" y="-150" width="100" height="80" />
<bpmndi:BPMNLabel />
</bpmndi:BPMNShape>
<bpmndi:BPMNEdge id="Flow_1x7ckx0_di" bpmnElement="Flow_1x7ckx0">
<di:waypoint x="180" y="-110" />
<di:waypoint x="240" y="-110" />
</bpmndi:BPMNEdge>
<bpmndi:BPMNEdge id="Flow_0rrlqcy_di" bpmnElement="Flow_0rrlqcy">
<di:waypoint x="-292" y="-110" />
<di:waypoint x="-170" y="-110" />
</bpmndi:BPMNEdge>
<bpmndi:BPMNEdge id="Flow_0q4zwqq_di" bpmnElement="Flow_0q4zwqq">
<di:waypoint x="340" y="-110" />
<di:waypoint x="422" y="-110" />
</bpmndi:BPMNEdge>
</bpmndi:BPMNPlane>
</bpmndi:BPMNDiagram>
<bpmndi:BPMNDiagram id="BPMNDiagram_16455gw">
<bpmndi:BPMNPlane id="BPMNPlane_0yuaj40" bpmnElement="Activity_1tglo3a">
<bpmndi:BPMNShape id="Event_003dbci_di" bpmnElement="Event_003dbci">
<dc:Bounds x="312" y="162" width="36" height="36" />
</bpmndi:BPMNShape>
<bpmndi:BPMNShape id="Event_0e6rn1x_di" bpmnElement="Event_0e6rn1x">
<dc:Bounds x="552" y="162" width="36" height="36" />
</bpmndi:BPMNShape>
<bpmndi:BPMNShape id="Activity_00bloq9_di" bpmnElement="Activity_00etcsd">
<dc:Bounds x="400" y="140" width="100" height="80" />
<bpmndi:BPMNLabel />
</bpmndi:BPMNShape>
<bpmndi:BPMNEdge id="Flow_1gg1sal_di" bpmnElement="Flow_1gg1sal">
<di:waypoint x="348" y="180" />
<di:waypoint x="400" y="180" />
</bpmndi:BPMNEdge>
<bpmndi:BPMNEdge id="Flow_151l7v5_di" bpmnElement="Flow_151l7v5">
<di:waypoint x="500" y="180" />
<di:waypoint x="552" y="180" />
</bpmndi:BPMNEdge>
</bpmndi:BPMNPlane>
</bpmndi:BPMNDiagram>
</bpmn:definitions>