Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
10589: feat(bpmn-model): added signal events model api support r=saig0 a=skayliu

## Description

<!-- Please explain the changes you made here. -->
Added signal events model api support, inclued all eight signal events as C7 did, [BPMN2.0 Signal Events](https://docs.camunda.org/manual/develop/reference/bpmn20/events/signal-events/)

## Related issues

<!-- Which issues are closed by this PR or are related -->

closes #10530 



10632: deps(maven): bump aws-java-sdk-core from 1.12.317 to 1.12.318 r=oleschoenburg a=dependabot[bot]

Bumps [aws-java-sdk-core](https://github.com/aws/aws-sdk-java) from 1.12.317 to 1.12.318.
<details>
<summary>Changelog</summary>
<p><em>Sourced from <a href="https://github.com/aws/aws-sdk-java/blob/master/CHANGELOG.md">aws-java-sdk-core's changelog</a>.</em></p>
<blockquote>
<h1><strong>1.12.318</strong> <strong>2022-10-06</strong></h1>
<h2><strong>AWS Resilience Hub</strong></h2>
<ul>
<li>
<h3>Features</h3>
<ul>
<li>Documentation change for AWS Resilience Hub. Doc-only update to fix Documentation layout</li>
</ul>
</li>
</ul>
</blockquote>
</details>
<details>
<summary>Commits</summary>
<ul>
<li><a href="https://github.com/aws/aws-sdk-java/commit/e3611b3a30d6f57d3ffba47442e8b26c7026d11c"><code>e3611b3</code></a> AWS SDK for Java 1.12.318</li>
<li><a href="https://github.com/aws/aws-sdk-java/commit/3309b35eba4e45a0a3bc3d300dc85822901e5bac"><code>3309b35</code></a> Update GitHub version number to 1.12.318-SNAPSHOT</li>
<li>See full diff in <a href="https://github.com/aws/aws-sdk-java/compare/1.12.317...1.12.318">compare view</a></li>
</ul>
</details>
<br />


[![Dependabot compatibility score](https://dependabot-badges.githubapp.com/badges/compatibility_score?dependency-name=com.amazonaws:aws-java-sdk-core&package-manager=maven&previous-version=1.12.317&new-version=1.12.318)](https://docs.github.com/en/github/managing-security-vulnerabilities/about-dependabot-security-updates#about-compatibility-scores)

Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting ``@dependabot` rebase`.

[//]: # (dependabot-automerge-start)
[//]: # (dependabot-automerge-end)

---

<details>
<summary>Dependabot commands and options</summary>
<br />

You can trigger Dependabot actions by commenting on this PR:
- ``@dependabot` rebase` will rebase this PR
- ``@dependabot` recreate` will recreate this PR, overwriting any edits that have been made to it
- ``@dependabot` merge` will merge this PR after your CI passes on it
- ``@dependabot` squash and merge` will squash and merge this PR after your CI passes on it
- ``@dependabot` cancel merge` will cancel a previously requested merge and block automerging
- ``@dependabot` reopen` will reopen this PR if it is closed
- ``@dependabot` close` will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually
- ``@dependabot` ignore this major version` will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself)
- ``@dependabot` ignore this minor version` will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself)
- ``@dependabot` ignore this dependency` will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)


</details>

10633: deps(maven): bump software.amazon.awssdk:bom from 2.17.284 to 2.17.289 r=oleschoenburg a=dependabot[bot]

Bumps [software.amazon.awssdk:bom](https://github.com/aws/aws-sdk-java-v2) from 2.17.284 to 2.17.289.
<details>
<summary>Changelog</summary>
<p><em>Sourced from <a href="https://github.com/aws/aws-sdk-java-v2/blob/master/CHANGELOG.md">software.amazon.awssdk:bom's changelog</a>.</em></p>
<blockquote>
<h1><strong>2.17.289</strong> <strong>2022-10-06</strong></h1>
<h2><strong>AWS Resilience Hub</strong></h2>
<ul>
<li>
<h3>Features</h3>
<ul>
<li>Documentation change for AWS Resilience Hub. Doc-only update to fix Documentation layout</li>
</ul>
</li>
</ul>
<h2><strong>AWS SDK for Java v2</strong></h2>
<ul>
<li>
<h3>Features</h3>
<ul>
<li>Updated service endpoint metadata.</li>
</ul>
</li>
<li>
<h3>Bugfixes</h3>
<ul>
<li>Adds support for automatically transforming a FIPS pesudo region (e.g. &quot;fips-us-west-2&quot;), into a standard region name + setting the <code>fips_enabled</code> flag to <code>true</code>.</li>
</ul>
</li>
</ul>
<h1><strong>2.17.288</strong> <strong>2022-10-05</strong></h1>
<h2><strong>AWS Glue</strong></h2>
<ul>
<li>
<h3>Features</h3>
<ul>
<li>This SDK release adds support to sync glue jobs with source control provider. Additionally, a new parameter called SourceControlDetails will be added to Job model.</li>
</ul>
</li>
</ul>
<h2><strong>AWS Network Firewall</strong></h2>
<ul>
<li>
<h3>Features</h3>
<ul>
<li>StreamExceptionPolicy configures how AWS Network Firewall processes traffic when a network connection breaks midstream</li>
</ul>
</li>
</ul>
<h2><strong>AWS Outposts</strong></h2>
<ul>
<li>
<h3>Features</h3>
<ul>
<li>This release adds the Asset state information to the ListAssets response. The ListAssets request supports filtering on Asset state.</li>
</ul>
</li>
</ul>
<h1><strong>2.17.287</strong> <strong>2022-10-04</strong></h1>
<h2><strong>AWS S3 Control</strong></h2>
<ul>
<li>
<h3>Features</h3>
<ul>
<li>S3 Object Lambda adds support to allow customers to intercept HeadObject and ListObjects requests and introduce their own compute. These requests were previously proxied to S3.</li>
</ul>
</li>
</ul>
<h2><strong>AWS SDK for Java v2</strong></h2>
<ul>
<li>
<h3>Features</h3>
<ul>
<li>Updated service endpoint metadata.</li>
</ul>
</li>
<li>
<h3>Bugfixes</h3>
<ul>
<li>Build headers with two-digit day of month to meet RFC 822 reporting requirement
<ul>
<li>Contributed by: <a href="https://github.com/dave-fn"><code>`@​dave-fn</code></a></li>`
</ul>
</li>
</ul>
</li>
</ul>
<h2><strong>Amazon Connect Cases</strong></h2>
<ul>
<li>
<h3>Features</h3>
<ul>
<li>This release adds APIs for Amazon Connect Cases. Cases allows your agents to quickly track and manage customer issues that require multiple interactions, follow-up tasks, and teams in your contact center. For more information, see <a href="https://docs.aws.amazon.com/cases/latest/APIReference/Welcome.html">https://docs.aws.amazon.com/cases/latest/APIReference/Welcome.html</a></li>
</ul>
</li>
</ul>
<h2><strong>Amazon Connect Service</strong></h2>
<ul>
<li>
<h3>Features</h3>
<ul>
<li>Updated the CreateIntegrationAssociation API to support the CASES_DOMAIN IntegrationType.</li>
</ul>
</li>
</ul>
<h2><strong>Amazon EC2 Container Service</strong></h2>
<ul>
<li>
<h3>Features</h3>
<ul>
<li>Documentation updates to address various Amazon ECS tickets.</li>
</ul>
</li>
</ul>
<!-- raw HTML omitted -->
</blockquote>
<p>... (truncated)</p>
</details>
<details>
<summary>Commits</summary>
<ul>
<li><a href="https://github.com/aws/aws-sdk-java-v2/commit/e9fbb3dedaac4fc54a8da80dd7248f7fa01f285a"><code>e9fbb3d</code></a> Merge pull request <a href="https://github-redirect.dependabot.com/aws/aws-sdk-java-v2/issues/2183">#2183</a> from aws/staging/84b12a15-513d-497a-9c74-28a27a300f1f</li>
<li><a href="https://github.com/aws/aws-sdk-java-v2/commit/a1a470c7ba426cd0ab56afa3ce507bf952a416a7"><code>a1a470c</code></a> Release 2.17.289. Updated CHANGELOG.md, README.md and all pom.xml.</li>
<li><a href="https://github.com/aws/aws-sdk-java-v2/commit/234c771059ea1a9f703d4cb9aee5269d1056ae90"><code>234c771</code></a> Updated endpoints.json.</li>
<li><a href="https://github.com/aws/aws-sdk-java-v2/commit/e0641c2a3ba570698888d2ec69a4853842e03b52"><code>e0641c2</code></a> AWS Resilience Hub Update: Documentation change for AWS Resilience Hub. Doc-o...</li>
<li><a href="https://github.com/aws/aws-sdk-java-v2/commit/897bbdef980aba763536e30bdf7da0bfa8d39a96"><code>897bbde</code></a> Fix handling of FIPS pseudo regions (<a href="https://github-redirect.dependabot.com/aws/aws-sdk-java-v2/issues/3460">#3460</a>)</li>
<li><a href="https://github.com/aws/aws-sdk-java-v2/commit/cacdb6d275a4965944662bee490754449b47fa44"><code>cacdb6d</code></a> Update to next snapshot version: 2.17.289-SNAPSHOT</li>
<li><a href="https://github.com/aws/aws-sdk-java-v2/commit/c26fe12a7c5e9db2a1fab867484b39ecc8af6acc"><code>c26fe12</code></a> Merge pull request <a href="https://github-redirect.dependabot.com/aws/aws-sdk-java-v2/issues/2179">#2179</a> from aws/staging/d25ebd20-7ff7-4143-b9ba-3222778682e7</li>
<li><a href="https://github.com/aws/aws-sdk-java-v2/commit/2f74c92b9e8f3336676f573f9b67219a0deef38a"><code>2f74c92</code></a> Release 2.17.288. Updated CHANGELOG.md, README.md and all pom.xml.</li>
<li><a href="https://github.com/aws/aws-sdk-java-v2/commit/2483934280133b65d7242ee2e08efd0fd855509e"><code>2483934</code></a> AWS Outposts Update: This release adds the Asset state information to the Lis...</li>
<li><a href="https://github.com/aws/aws-sdk-java-v2/commit/90478afc0a1f3e3a971781f41b5276196bf47fe8"><code>90478af</code></a> AWS Network Firewall Update: StreamExceptionPolicy configures how AWS Network...</li>
<li>Additional commits viewable in <a href="https://github.com/aws/aws-sdk-java-v2/compare/2.17.284...2.17.289">compare view</a></li>
</ul>
</details>
<br />


[![Dependabot compatibility score](https://dependabot-badges.githubapp.com/badges/compatibility_score?dependency-name=software.amazon.awssdk:bom&package-manager=maven&previous-version=2.17.284&new-version=2.17.289)](https://docs.github.com/en/github/managing-security-vulnerabilities/about-dependabot-security-updates#about-compatibility-scores)

Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting ``@dependabot` rebase`.

[//]: # (dependabot-automerge-start)
[//]: # (dependabot-automerge-end)

---

<details>
<summary>Dependabot commands and options</summary>
<br />

You can trigger Dependabot actions by commenting on this PR:
- ``@dependabot` rebase` will rebase this PR
- ``@dependabot` recreate` will recreate this PR, overwriting any edits that have been made to it
- ``@dependabot` merge` will merge this PR after your CI passes on it
- ``@dependabot` squash and merge` will squash and merge this PR after your CI passes on it
- ``@dependabot` cancel merge` will cancel a previously requested merge and block automerging
- ``@dependabot` reopen` will reopen this PR if it is closed
- ``@dependabot` close` will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually
- ``@dependabot` ignore this major version` will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself)
- ``@dependabot` ignore this minor version` will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself)
- ``@dependabot` ignore this dependency` will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)


</details>

Co-authored-by: skayliu <liushaohua23@crc.com.hk>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
  • Loading branch information
3 people authored Oct 7, 2022
4 parents 994a5af + 40ea06e + f2261df + 5ea223d commit bb33569
Show file tree
Hide file tree
Showing 21 changed files with 1,088 additions and 37 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -225,6 +225,16 @@ protected SignalEventDefinition createSignalEventDefinition(final String signalN
return signalEventDefinition;
}

protected Signal createSignal() {
final Definitions definitions = modelInstance.getDefinitions();
final Signal signal = createChild(definitions, Signal.class);
return signal;
}

protected SignalEventDefinition createEmptySignalEventDefinition() {
return createInstance(SignalEventDefinition.class);
}

protected ErrorEventDefinition findErrorDefinitionForCode(final String errorCode) {
final Collection<ErrorEventDefinition> definitions =
modelInstance.getModelElementsByType(ErrorEventDefinition.class);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,13 @@

import io.camunda.zeebe.model.bpmn.BpmnModelInstance;
import io.camunda.zeebe.model.bpmn.builder.zeebe.MessageBuilder;
import io.camunda.zeebe.model.bpmn.builder.zeebe.SignalBuilder;
import io.camunda.zeebe.model.bpmn.instance.CatchEvent;
import io.camunda.zeebe.model.bpmn.instance.CompensateEventDefinition;
import io.camunda.zeebe.model.bpmn.instance.ConditionalEventDefinition;
import io.camunda.zeebe.model.bpmn.instance.Message;
import io.camunda.zeebe.model.bpmn.instance.MessageEventDefinition;
import io.camunda.zeebe.model.bpmn.instance.Signal;
import io.camunda.zeebe.model.bpmn.instance.SignalEventDefinition;
import io.camunda.zeebe.model.bpmn.instance.TimeCycle;
import io.camunda.zeebe.model.bpmn.instance.TimeDate;
Expand Down Expand Up @@ -105,6 +107,26 @@ public B signal(final String signalName) {
return myself;
}

public B signal(final Consumer<SignalBuilder> signalBuilderConsumer) {
final SignalEventDefinition signalEventDefinition = createInstance(SignalEventDefinition.class);
element.getEventDefinitions().add(signalEventDefinition);

final Signal signal = createSignal();
final SignalBuilder builder = new SignalBuilder(modelInstance, signal);

signalBuilderConsumer.accept(builder);

signalEventDefinition.setSignal(signal);

return myself;
}

public SignalEventDefinitionBuilder signalEventDefinition() {
final SignalEventDefinition eventDefinition = createEmptySignalEventDefinition();
element.getEventDefinitions().add(eventDefinition);
return new SignalEventDefinitionBuilder(modelInstance, eventDefinition);
}

public B timerWithDateExpression(final String timerDate) {
return timerWithDate(asZeebeExpression(timerDate));
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,18 @@ public B signal(final String signalName) {
return myself;
}

/**
* Creates an empty signal event definition with an unique id and returns a builder for the signal
* event definition.
*
* @return the signal event definition builder object
*/
public SignalEventDefinitionBuilder signalEventDefinition() {
final SignalEventDefinition eventDefinition = createEmptySignalEventDefinition();
element.getEventDefinitions().add(eventDefinition);
return new SignalEventDefinitionBuilder(modelInstance, eventDefinition);
}

/**
* Sets an event definition for the given Signal name. If a signal with this name already exists
* it will be used, otherwise a new signal is created. It returns a builder for the Signal Event
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
/*
* Copyright © 2017 camunda services GmbH (info@camunda.com)
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package io.camunda.zeebe.model.bpmn.builder.zeebe;

import io.camunda.zeebe.model.bpmn.BpmnModelInstance;
import io.camunda.zeebe.model.bpmn.builder.AbstractBaseElementBuilder;
import io.camunda.zeebe.model.bpmn.instance.Signal;

public class SignalBuilder extends AbstractBaseElementBuilder<SignalBuilder, Signal> {

public SignalBuilder(final BpmnModelInstance modelInstance, final Signal element) {
super(modelInstance, element, SignalBuilder.class);
}

public SignalBuilder name(final String name) {
element.setName(name);
return this;
}

public SignalBuilder nameExpression(final String nameExpression) {
return name(asZeebeExpression(nameExpression));
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,8 @@
import io.camunda.zeebe.model.bpmn.instance.EventDefinition;
import io.camunda.zeebe.model.bpmn.instance.Message;
import io.camunda.zeebe.model.bpmn.instance.MessageEventDefinition;
import io.camunda.zeebe.model.bpmn.instance.Signal;
import io.camunda.zeebe.model.bpmn.instance.SignalEventDefinition;
import io.camunda.zeebe.model.bpmn.instance.StartEvent;
import io.camunda.zeebe.model.bpmn.instance.SubProcess;
import io.camunda.zeebe.model.bpmn.instance.TimerEventDefinition;
Expand All @@ -41,7 +43,8 @@
public class ModelUtil {

private static final List<Class<? extends EventDefinition>> NON_INTERRUPTING_EVENT_DEFINITIONS =
Arrays.asList(MessageEventDefinition.class, TimerEventDefinition.class);
Arrays.asList(
MessageEventDefinition.class, TimerEventDefinition.class, SignalEventDefinition.class);

public static List<EventDefinition> getEventDefinitionsForBoundaryEvents(final Activity element) {
return element.getBoundaryEvents().stream()
Expand All @@ -58,6 +61,14 @@ public static List<EventDefinition> getEventDefinitionsForEventSubprocesses(
.collect(Collectors.toList());
}

public static List<EventDefinition> getEventDefinitionsForSignalStartEvents(
final ModelElementInstance element) {
return element.getChildElementsByType(StartEvent.class).stream()
.flatMap(i -> i.getEventDefinitions().stream())
.filter(e -> e instanceof SignalEventDefinition)
.collect(Collectors.toList());
}

public static List<String> getDuplicateMessageNames(
final Stream<MessageEventDefinition> eventDefinitions) {

Expand All @@ -80,6 +91,14 @@ public static void verifyNoDuplicatedBoundaryEvents(
verifyNoDuplicatedEventDefinition(definitions, errorCollector);
}

public static void verifyNoDuplicateSignalStartEvents(
final ModelElementInstance element, final Consumer<String> errorCollector) {

final List<EventDefinition> definitions = getEventDefinitionsForSignalStartEvents(element);

verifyNoDuplicatedEventDefinition(definitions, errorCollector);
}

public static void verifyEventDefinition(
final BoundaryEvent boundaryEvent, final Consumer<String> errorCollector) {
boundaryEvent
Expand Down Expand Up @@ -130,6 +149,15 @@ public static void verifyNoDuplicatedEventDefinition(
.map(Error::getErrorCode);

getDuplicatedEntries(errorCodes).map(ModelUtil::duplicatedErrorCodes).forEach(errorCollector);

final Stream<String> signalNames =
getEventDefinition(definitions, SignalEventDefinition.class)
.filter(def -> def.getSignal() != null)
.map(SignalEventDefinition::getSignal)
.filter(signal -> signal.getName() != null && !signal.getName().isEmpty())
.map(Signal::getName);

getDuplicatedEntries(signalNames).map(ModelUtil::duplicatedSignalNames).forEach(errorCollector);
}

public static <T extends EventDefinition> Stream<T> getEventDefinition(
Expand All @@ -154,6 +182,11 @@ private static String duplicatedErrorCodes(final String errorCode) {
errorCode);
}

private static String duplicatedSignalNames(final String signalName) {
return String.format(
"Multiple signal event definitions with the same name '%s' are not allowed.", signalName);
}

private static void verifyEventDefinition(
final EventDefinition definition,
final boolean isInterrupting,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
import io.camunda.zeebe.model.bpmn.instance.ErrorEventDefinition;
import io.camunda.zeebe.model.bpmn.instance.EventDefinition;
import io.camunda.zeebe.model.bpmn.instance.MessageEventDefinition;
import io.camunda.zeebe.model.bpmn.instance.SignalEventDefinition;
import io.camunda.zeebe.model.bpmn.instance.TimerEventDefinition;
import io.camunda.zeebe.model.bpmn.util.ModelUtil;
import java.util.Arrays;
Expand All @@ -31,7 +32,10 @@ public class BoundaryEventValidator implements ModelElementValidator<BoundaryEve

private static final List<Class<? extends EventDefinition>> SUPPORTED_EVENT_DEFINITIONS =
Arrays.asList(
TimerEventDefinition.class, MessageEventDefinition.class, ErrorEventDefinition.class);
TimerEventDefinition.class,
MessageEventDefinition.class,
ErrorEventDefinition.class,
SignalEventDefinition.class);

@Override
public Class<BoundaryEvent> getElementType() {
Expand Down Expand Up @@ -68,7 +72,7 @@ private void validateEventDefinition(
def -> {
if (SUPPORTED_EVENT_DEFINITIONS.stream().noneMatch(type -> type.isInstance(def))) {
validationResultCollector.addError(
0, "Boundary events must be one of: timer, message, error");
0, "Boundary events must be one of: timer, message, error, signal");
}
});

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
import io.camunda.zeebe.model.bpmn.instance.ErrorEventDefinition;
import io.camunda.zeebe.model.bpmn.instance.EventDefinition;
import io.camunda.zeebe.model.bpmn.instance.MessageEventDefinition;
import io.camunda.zeebe.model.bpmn.instance.SignalEventDefinition;
import io.camunda.zeebe.model.bpmn.instance.TerminateEventDefinition;
import java.util.Arrays;
import java.util.Collection;
Expand All @@ -30,7 +31,10 @@ public class EndEventValidator implements ModelElementValidator<EndEvent> {

private static final List<Class<? extends EventDefinition>> SUPPORTED_EVENT_DEFINITIONS =
Arrays.asList(
ErrorEventDefinition.class, MessageEventDefinition.class, TerminateEventDefinition.class);
ErrorEventDefinition.class,
MessageEventDefinition.class,
TerminateEventDefinition.class,
SignalEventDefinition.class);

@Override
public Class<EndEvent> getElementType() {
Expand Down Expand Up @@ -61,7 +65,7 @@ private void validateEventDefinition(
def -> {
if (SUPPORTED_EVENT_DEFINITIONS.stream().noneMatch(type -> type.isInstance(def))) {
validationResultCollector.addError(
0, "End events must be one of: none, error, message, or terminate");
0, "End events must be one of: none, error, message, terminate, or signal");
}
});
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
import io.camunda.zeebe.model.bpmn.instance.ErrorEventDefinition;
import io.camunda.zeebe.model.bpmn.instance.EventDefinition;
import io.camunda.zeebe.model.bpmn.instance.MessageEventDefinition;
import io.camunda.zeebe.model.bpmn.instance.SignalEventDefinition;
import io.camunda.zeebe.model.bpmn.instance.TerminateEventDefinition;
import io.camunda.zeebe.model.bpmn.instance.TimerEventDefinition;
import java.util.Arrays;
Expand All @@ -32,7 +33,8 @@ public class EventDefinitionValidator implements ModelElementValidator<EventDefi
MessageEventDefinition.class,
TimerEventDefinition.class,
ErrorEventDefinition.class,
TerminateEventDefinition.class);
TerminateEventDefinition.class,
SignalEventDefinition.class);

@Override
public Class<EventDefinition> getElementType() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
import io.camunda.zeebe.model.bpmn.instance.EventDefinition;
import io.camunda.zeebe.model.bpmn.instance.IntermediateCatchEvent;
import io.camunda.zeebe.model.bpmn.instance.MessageEventDefinition;
import io.camunda.zeebe.model.bpmn.instance.SignalEventDefinition;
import io.camunda.zeebe.model.bpmn.instance.TimerEventDefinition;
import java.util.Arrays;
import java.util.Collection;
Expand All @@ -28,7 +29,8 @@
public class IntermediateCatchEventValidator
implements ModelElementValidator<IntermediateCatchEvent> {
private static final List<Class<? extends EventDefinition>> SUPPORTED_EVENTS =
Arrays.asList(MessageEventDefinition.class, TimerEventDefinition.class);
Arrays.asList(
MessageEventDefinition.class, TimerEventDefinition.class, SignalEventDefinition.class);

@Override
public Class<IntermediateCatchEvent> getElementType() {
Expand All @@ -48,7 +50,8 @@ public void validate(
final Class<? extends EventDefinition> type = eventDefinition.getClass();

if (SUPPORTED_EVENTS.stream().noneMatch(c -> c.isAssignableFrom(type))) {
validationResultCollector.addError(0, "Event definition must be one of: message, timer");
validationResultCollector.addError(
0, "Event definition must be one of: message, timer, signal");

} else if (eventDefinition instanceof TimerEventDefinition) {
final TimerEventDefinition timerEventDefinition = (TimerEventDefinition) eventDefinition;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,9 @@ public void validate(

ModelUtil.verifyNoDuplicatedEventSubprocesses(
element, error -> validationResultCollector.addError(0, error));

ModelUtil.verifyNoDuplicateSignalStartEvents(
element, error -> validationResultCollector.addError(0, error));
}

private boolean isNoneEvent(final StartEvent startEvent) {
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
/*
* Copyright © 2017 camunda services GmbH (info@camunda.com)
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package io.camunda.zeebe.model.bpmn.validation.zeebe;

import io.camunda.zeebe.model.bpmn.instance.SignalEventDefinition;
import org.camunda.bpm.model.xml.validation.ModelElementValidator;
import org.camunda.bpm.model.xml.validation.ValidationResultCollector;

public class SignalEventDefinitionValidator
implements ModelElementValidator<SignalEventDefinition> {

@Override
public Class<SignalEventDefinition> getElementType() {
return SignalEventDefinition.class;
}

@Override
public void validate(
final SignalEventDefinition element,
final ValidationResultCollector validationResultCollector) {
if (element.getSignal() == null) {
validationResultCollector.addError(0, "Must reference a signal");
}
}
}
Loading

0 comments on commit bb33569

Please sign in to comment.