From ffb878045fc9011963fefcf076cae585614e118d Mon Sep 17 00:00:00 2001 From: Ralph Soika Date: Fri, 27 Dec 2024 09:03:37 +0100 Subject: [PATCH] clean up code, added comments (#368) --- .../org/openbpmn/bpmn/elements/Event.java | 27 +++++++------------ 1 file changed, 10 insertions(+), 17 deletions(-) diff --git a/open-bpmn.metamodel/src/main/java/org/openbpmn/bpmn/elements/Event.java b/open-bpmn.metamodel/src/main/java/org/openbpmn/bpmn/elements/Event.java index 9b29d77a..c7eb8ac6 100644 --- a/open-bpmn.metamodel/src/main/java/org/openbpmn/bpmn/elements/Event.java +++ b/open-bpmn.metamodel/src/main/java/org/openbpmn/bpmn/elements/Event.java @@ -187,14 +187,12 @@ public List validate() { this.addValidationMarker(new BPMNValidationMarker("Start Event", "A Start Event may not have incoming Sequence Flows!", this.getId(), BPMNValidationMarker.ErrorType.ERROR)); - } if (this.getOutgoingSequenceFlows().size() != 1) { this.addValidationMarker(new BPMNValidationMarker("Start Event", "A Start Event must have exactly one outgoing Sequence Flow!", this.getId(), BPMNValidationMarker.ErrorType.ERROR)); } - } // END event? @@ -219,8 +217,6 @@ public List validate() { "A Catch Event must have at least one outgoing Sequence Flow!", this.getId(), BPMNValidationMarker.ErrorType.ERROR)); } - - Message message = model.getMessages().iterator().next(); } // Throw Event? @@ -230,17 +226,15 @@ public List validate() { "A Throw Event must have at least one ingoing Sequence Flow!", this.getId(), BPMNValidationMarker.ErrorType.ERROR)); } - } + // validate if the definition reference for message definitions getEventDefinitionsByType(BPMNTypes.EVENT_DEFINITION_MESSAGE) .forEach(ed -> { - boolean hasMessage = - model.getMessages().stream() - .anyMatch(m -> - Objects.equals( - ed.getAttribute("messageRef"), - m.getId())); + boolean hasMessage = model.getMessages().stream() + .anyMatch(m -> Objects.equals( + ed.getAttribute("messageRef"), + m.getId())); if (!hasMessage) { this.addValidationMarker( new BPMNValidationMarker("Event", @@ -249,14 +243,13 @@ public List validate() { } }); + // validate if the definition reference for signal definitions getEventDefinitionsByType(BPMNTypes.EVENT_DEFINITION_SIGNAL) .forEach(ed -> { - boolean hasMessage = - model.getSignals().stream() - .anyMatch(m -> - Objects.equals( - ed.getAttribute("signalRef"), - m.getId())); + boolean hasMessage = model.getSignals().stream() + .anyMatch(m -> Objects.equals( + ed.getAttribute("signalRef"), + m.getId())); if (!hasMessage) { this.addValidationMarker( new BPMNValidationMarker("Event",