-
Notifications
You must be signed in to change notification settings - Fork 556
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
10714: feat(bpmn-model): support escalation events r=remcowesterhoud a=lzgabel ## Description As a user I can deploy a process definition with escalation event. ## Related issues closes #10688 ## Definition of Done Code changes: * [x] The changes are backwards compatibility with previous versions * [ ] If it fixes a bug then PRs are created to [backport](https://github.com/camunda/zeebe/compare/stable/0.24...main?expand=1&template=backport_template.md&title=[Backport%200.24]) the fix to the last two minor versions. You can trigger a backport by assigning labels (e.g. `backport stable/1.3`) to the PR, in case that fails you need to create backports manually. Testing: * [x] There are unit/integration tests that verify all acceptance criterias of the issue * [x] New tests are written to ensure backwards compatibility with further versions * [ ] The behavior is tested manually * [ ] The change has been verified by a QA run * [ ] The impact of the changes is verified by a benchmark Documentation: * [ ] The documentation is updated (e.g. BPMN reference, configuration, examples, get-started guides, etc.) * [ ] New content is added to the [release announcement](https://drive.google.com/drive/u/0/folders/1DTIeswnEEq-NggJ25rm2BsDjcCQpDape) * [ ] If the PR changes how BPMN processes are validated (e.g. support new BPMN element) then the Camunda modeling team should be informed to adjust the BPMN linting. Please refer to our [review guidelines](https://github.com/camunda/zeebe/wiki/Pull-Requests-and-Code-Reviews#code-review-guidelines). Co-authored-by: lzgabel <lz19960321lz@gmail.com>
- Loading branch information
Showing
15 changed files
with
1,134 additions
and
14 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
54 changes: 54 additions & 0 deletions
54
...in/java/io/camunda/zeebe/model/bpmn/builder/AbstractEscalationEventDefinitionBuilder.java
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,54 @@ | ||
/* | ||
* 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; | ||
|
||
import io.camunda.zeebe.model.bpmn.BpmnModelInstance; | ||
import io.camunda.zeebe.model.bpmn.instance.EscalationEventDefinition; | ||
import io.camunda.zeebe.model.bpmn.instance.Event; | ||
|
||
public abstract class AbstractEscalationEventDefinitionBuilder< | ||
B extends AbstractEscalationEventDefinitionBuilder<B>> | ||
extends AbstractRootElementBuilder<B, EscalationEventDefinition> { | ||
|
||
public AbstractEscalationEventDefinitionBuilder( | ||
final BpmnModelInstance modelInstance, | ||
final EscalationEventDefinition element, | ||
final Class<?> selfType) { | ||
super(modelInstance, element, selfType); | ||
} | ||
|
||
@Override | ||
public B id(final String identifier) { | ||
return super.id(identifier); | ||
} | ||
|
||
/** Sets the escalation attribute with escalationCode. */ | ||
public B escalationCode(final String escalationCode) { | ||
element.setEscalation(findEscalationForCode(escalationCode)); | ||
return myself; | ||
} | ||
|
||
/** | ||
* Finishes the building of a escalation event definition. | ||
* | ||
* @param <T> | ||
* @return the parent event builder | ||
*/ | ||
@SuppressWarnings({"rawtypes", "unchecked"}) | ||
public <T extends AbstractFlowNodeBuilder> T escalationEventDefinitionDone() { | ||
return (T) ((Event) element.getParentElement()).builder(); | ||
} | ||
} |
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
28 changes: 28 additions & 0 deletions
28
...l/src/main/java/io/camunda/zeebe/model/bpmn/builder/EscalationEventDefinitionBuilder.java
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,28 @@ | ||
/* | ||
* 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; | ||
|
||
import io.camunda.zeebe.model.bpmn.BpmnModelInstance; | ||
import io.camunda.zeebe.model.bpmn.instance.EscalationEventDefinition; | ||
|
||
public class EscalationEventDefinitionBuilder | ||
extends AbstractEscalationEventDefinitionBuilder<EscalationEventDefinitionBuilder> { | ||
|
||
public EscalationEventDefinitionBuilder( | ||
final BpmnModelInstance modelInstance, final EscalationEventDefinition element) { | ||
super(modelInstance, element, EscalationEventDefinitionBuilder.class); | ||
} | ||
} |
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
47 changes: 47 additions & 0 deletions
47
...java/io/camunda/zeebe/model/bpmn/validation/zeebe/EscalationEventDefinitionValidator.java
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,47 @@ | ||
/* | ||
* 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.EndEvent; | ||
import io.camunda.zeebe.model.bpmn.instance.EscalationEventDefinition; | ||
import io.camunda.zeebe.model.bpmn.instance.IntermediateThrowEvent; | ||
import org.camunda.bpm.model.xml.instance.ModelElementInstance; | ||
import org.camunda.bpm.model.xml.validation.ModelElementValidator; | ||
import org.camunda.bpm.model.xml.validation.ValidationResultCollector; | ||
|
||
public class EscalationEventDefinitionValidator | ||
implements ModelElementValidator<EscalationEventDefinition> { | ||
|
||
@Override | ||
public Class<EscalationEventDefinition> getElementType() { | ||
return EscalationEventDefinition.class; | ||
} | ||
|
||
@Override | ||
public void validate( | ||
final EscalationEventDefinition element, | ||
final ValidationResultCollector validationResultCollector) { | ||
|
||
if (isEscalationThrowEvent(element) && element.getEscalation() == null) { | ||
validationResultCollector.addError(0, "Must reference an escalation"); | ||
} | ||
} | ||
|
||
private boolean isEscalationThrowEvent(final EscalationEventDefinition element) { | ||
final ModelElementInstance parentElement = element.getParentElement(); | ||
return parentElement instanceof IntermediateThrowEvent || parentElement instanceof EndEvent; | ||
} | ||
} |
Oops, something went wrong.