Skip to content

Commit

Permalink
fix(link-event): fix check for link event definition
Browse files Browse the repository at this point in the history
  • Loading branch information
philippfromme authored and merge-me[bot] committed Sep 1, 2023
1 parent 41d5ffc commit 9260acc
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 3 deletions.
10 changes: 7 additions & 3 deletions rules/camunda-cloud/link-event.js
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ module.exports = skipInNonExecutableProcess(function() {

// check for missing link catch & throw event names
if (isLinkEvent(node)) {
const linkEventDefinition = getEventDefinition(node, 'bpmn:LinkEventDefinition');
const linkEventDefinition = getEventDefinition(node);

const errors = hasProperties(linkEventDefinition, {
name: {
Expand All @@ -109,15 +109,19 @@ module.exports = skipInNonExecutableProcess(function() {
});

function isLinkEvent(element) {
const eventDefinition = getEventDefinition(element);

return isAny(element, [
'bpmn:IntermediateCatchEvent',
'bpmn:IntermediateThrowEvent'
]) && getEventDefinition(element, 'bpmn:LinkEventDefinition');
]) && eventDefinition && is(eventDefinition, 'bpmn:LinkEventDefinition');
}

function isLinkCatchEvent(element) {
const eventDefinition = getEventDefinition(element);

return is(element, 'bpmn:IntermediateCatchEvent')
&& getEventDefinition(element, 'bpmn:LinkEventDefinition');
&& eventDefinition && is(eventDefinition, 'bpmn:LinkEventDefinition');
}

function getLinkCatchEvents(flowElementsContainer) {
Expand Down
8 changes: 8 additions & 0 deletions test/camunda-cloud/link-event.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,14 @@ const {
const { ERROR_TYPES } = require('../../rules/utils/element');

const valid = [
{
name: 'escalation event',
moddleElement: createModdle(createProcess(`
<bpmn:intermediateCatchEvent id="IntermediateCatchEvent_1">
<bpmn:escalationEventDefinition id="EscalationEventDefinition_1" />
</bpmn:intermediateCatchEvent>
`))
},
{
name: 'link catch events',
moddleElement: createModdle(createProcess(`
Expand Down

0 comments on commit 9260acc

Please sign in to comment.