Skip to content

Commit

Permalink
clean up code, added comments (#368)
Browse files Browse the repository at this point in the history
  • Loading branch information
rsoika committed Dec 27, 2024
1 parent cdec7cb commit ffb8780
Showing 1 changed file with 10 additions and 17 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -187,14 +187,12 @@ public List<BPMNValidationMarker> 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?
Expand All @@ -219,8 +217,6 @@ public List<BPMNValidationMarker> 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?
Expand All @@ -230,17 +226,15 @@ public List<BPMNValidationMarker> 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",
Expand All @@ -249,14 +243,13 @@ public List<BPMNValidationMarker> 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",
Expand Down

0 comments on commit ffb8780

Please sign in to comment.