-
Notifications
You must be signed in to change notification settings - Fork 40
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Verify that an ad-hoc sub-process is valid: * Must not contain start or end events. * Every intermediate event must have an outgoing sequence flow. Related to camunda/camunda-modeler#4811
- Loading branch information
1 parent
28ab4cc
commit f5146c2
Showing
14 changed files
with
378 additions
and
56 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
# Ad-hoc Sub-Process (ad-hoc-sub-process) | ||
|
||
Ensure that an Ad-Hoc Sub-Process is valid according to the BPMN specification: | ||
|
||
- Must not contain start or end events. | ||
- Every intermediate event must have an outgoing sequence flow. | ||
|
||
|
||
Example of __incorrect__ usage for this rule: | ||
|
||
 | ||
|
||
Cf. [`ad-hoc-sub-process-incorrect.bpmn`](./examples/no-complex-gateway-incorrect.bpmn). | ||
|
||
|
||
Example of __correct__ usage for this rule: | ||
|
||
 | ||
|
||
Cf. [`ad-hoc-sub-process-correct.bpmn`](./examples/no-complex-gateway-correct.bpmn). |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<definitions xmlns="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" xmlns:omgdi="http://www.omg.org/spec/DD/20100524/DI" xmlns:omgdc="http://www.omg.org/spec/DD/20100524/DC" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" id="sid-38422fae-e03e-43a3-bef4-bd33b32041b2" targetNamespace="http://bpmn.io/bpmn" exporter="Camunda Modeler" exporterVersion="5.32.0-rc.0"> | ||
<process id="Process_1" isExecutable="false"> | ||
<adHocSubProcess id="Activity_1yjcy2x"> | ||
<task id="Activity_0o1bgqx"> | ||
<outgoing>Flow_0njsews</outgoing> | ||
</task> | ||
<task id="Activity_142jk6n"> | ||
<incoming>Flow_0njsews</incoming> | ||
</task> | ||
<sequenceFlow id="Flow_0njsews" sourceRef="Activity_0o1bgqx" targetRef="Activity_142jk6n" /> | ||
<intermediateCatchEvent id="Event_0q40via"> | ||
<outgoing>Flow_1ykoger</outgoing> | ||
<conditionalEventDefinition id="ConditionalEventDefinition_0q04q9v"> | ||
<condition xsi:type="tFormalExpression" /> | ||
</conditionalEventDefinition> | ||
</intermediateCatchEvent> | ||
<task id="Activity_12w8ibt" /> | ||
<task id="Activity_1u082wx"> | ||
<incoming>Flow_1ykoger</incoming> | ||
</task> | ||
<sequenceFlow id="Flow_1ykoger" sourceRef="Event_0q40via" targetRef="Activity_1u082wx" /> | ||
</adHocSubProcess> | ||
</process> | ||
<bpmndi:BPMNDiagram id="BpmnDiagram_1"> | ||
<bpmndi:BPMNPlane id="BpmnPlane_1" bpmnElement="Process_1"> | ||
<bpmndi:BPMNShape id="Activity_02xy6cc_di" bpmnElement="Activity_1yjcy2x" isExpanded="true"> | ||
<omgdc:Bounds x="160" y="80" width="390" height="410" /> | ||
</bpmndi:BPMNShape> | ||
<bpmndi:BPMNShape id="Activity_12w8ibt_di" bpmnElement="Activity_12w8ibt"> | ||
<omgdc:Bounds x="220" y="120" width="100" height="80" /> | ||
</bpmndi:BPMNShape> | ||
<bpmndi:BPMNShape id="Activity_0o1bgqx_di" bpmnElement="Activity_0o1bgqx"> | ||
<omgdc:Bounds x="220" y="240" width="100" height="80" /> | ||
</bpmndi:BPMNShape> | ||
<bpmndi:BPMNShape id="BPMNShape_1b353o5" bpmnElement="Activity_142jk6n"> | ||
<omgdc:Bounds x="380" y="240" width="100" height="80" /> | ||
</bpmndi:BPMNShape> | ||
<bpmndi:BPMNShape id="Activity_1u082wx_di" bpmnElement="Activity_1u082wx"> | ||
<omgdc:Bounds x="380" y="360" width="100" height="80" /> | ||
</bpmndi:BPMNShape> | ||
<bpmndi:BPMNShape id="Event_069bzsw_di" bpmnElement="Event_0q40via"> | ||
<omgdc:Bounds x="252" y="382" width="36" height="36" /> | ||
<bpmndi:BPMNLabel> | ||
<omgdc:Bounds x="408" y="485" width="84" height="27" /> | ||
</bpmndi:BPMNLabel> | ||
</bpmndi:BPMNShape> | ||
<bpmndi:BPMNEdge id="Flow_0njsews_di" bpmnElement="Flow_0njsews"> | ||
<omgdi:waypoint x="320" y="280" /> | ||
<omgdi:waypoint x="380" y="280" /> | ||
</bpmndi:BPMNEdge> | ||
<bpmndi:BPMNEdge id="Flow_1ykoger_di" bpmnElement="Flow_1ykoger"> | ||
<omgdi:waypoint x="288" y="400" /> | ||
<omgdi:waypoint x="380" y="400" /> | ||
</bpmndi:BPMNEdge> | ||
</bpmndi:BPMNPlane> | ||
</bpmndi:BPMNDiagram> | ||
</definitions> |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<definitions xmlns="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" xmlns:omgdi="http://www.omg.org/spec/DD/20100524/DI" xmlns:omgdc="http://www.omg.org/spec/DD/20100524/DC" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" id="sid-38422fae-e03e-43a3-bef4-bd33b32041b2" targetNamespace="http://bpmn.io/bpmn" exporter="Camunda Modeler" exporterVersion="5.32.0-rc.0"> | ||
<process id="Process_1" isExecutable="false"> | ||
<adHocSubProcess id="Activity_1yjcy2x"> | ||
<intermediateCatchEvent id="Event_0q40via"> | ||
<conditionalEventDefinition id="ConditionalEventDefinition_0q04q9v"> | ||
<condition xsi:type="tFormalExpression" /> | ||
</conditionalEventDefinition> | ||
</intermediateCatchEvent> | ||
<startEvent id="Event_03k6pnd"> | ||
<outgoing>Flow_0ej0cl8</outgoing> | ||
</startEvent> | ||
<endEvent id="Event_03gcp25"> | ||
<incoming>Flow_0ej0cl8</incoming> | ||
</endEvent> | ||
<sequenceFlow id="Flow_0ej0cl8" sourceRef="Event_03k6pnd" targetRef="Event_03gcp25" /> | ||
</adHocSubProcess> | ||
</process> | ||
<bpmndi:BPMNDiagram id="BpmnDiagram_1"> | ||
<bpmndi:BPMNPlane id="BpmnPlane_1" bpmnElement="Process_1"> | ||
<bpmndi:BPMNShape id="Activity_02xy6cc_di" bpmnElement="Activity_1yjcy2x" isExpanded="true"> | ||
<omgdc:Bounds x="160" y="80" width="390" height="250" /> | ||
</bpmndi:BPMNShape> | ||
<bpmndi:BPMNShape id="Event_03k6pnd_di" bpmnElement="Event_03k6pnd"> | ||
<omgdc:Bounds x="252" y="132" width="36" height="36" /> | ||
</bpmndi:BPMNShape> | ||
<bpmndi:BPMNShape id="Event_03gcp25_di" bpmnElement="Event_03gcp25"> | ||
<omgdc:Bounds x="422" y="132" width="36" height="36" /> | ||
</bpmndi:BPMNShape> | ||
<bpmndi:BPMNShape id="Event_069bzsw_di" bpmnElement="Event_0q40via"> | ||
<omgdc:Bounds x="252" y="232" width="36" height="36" /> | ||
<bpmndi:BPMNLabel> | ||
<omgdc:Bounds x="408" y="485" width="84" height="27" /> | ||
</bpmndi:BPMNLabel> | ||
</bpmndi:BPMNShape> | ||
<bpmndi:BPMNEdge id="Flow_0ej0cl8_di" bpmnElement="Flow_0ej0cl8"> | ||
<omgdi:waypoint x="288" y="150" /> | ||
<omgdi:waypoint x="422" y="150" /> | ||
</bpmndi:BPMNEdge> | ||
</bpmndi:BPMNPlane> | ||
</bpmndi:BPMNDiagram> | ||
</definitions> |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
const { | ||
is, | ||
isAny | ||
} = require('bpmnlint-utils'); | ||
|
||
/** | ||
* A rule that ensures that an Ad Hoc Sub Process is valid according to the BPMN spec: | ||
* | ||
* - No start or end events | ||
* - Every intermediate event has an outgoing sequence flow | ||
*/ | ||
module.exports = function() { | ||
|
||
function check(node, reporter) { | ||
|
||
if (!is(node, 'bpmn:AdHocSubProcess')) { | ||
return; | ||
} | ||
|
||
const flowElements = node.flowElements || []; | ||
|
||
flowElements.forEach(function(flowElement) { | ||
|
||
if (is(flowElement, 'bpmn:StartEvent')) { | ||
reporter.report(flowElement.id, 'A <Start Event> is not allowed in <Ad Hoc Sub Process>'); | ||
} | ||
|
||
if (is(flowElement, 'bpmn:EndEvent')) { | ||
reporter.report(flowElement.id, 'An <End Event> is not allowed in <Ad Hoc Sub Process>'); | ||
} | ||
|
||
if (isAny(flowElement, [ 'bpmn:IntermediateCatchEvent', 'bpmn:IntermediateThrowEvent' ])) { | ||
if (!flowElement.outgoing || flowElement.outgoing.length === 0) { | ||
reporter.report(flowElement.id, 'An intermediate event inside <Ad Hoc Sub Process> must have an outgoing sequence flow'); | ||
} | ||
} | ||
|
||
}); | ||
} | ||
|
||
return { | ||
check | ||
}; | ||
|
||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.