Skip to content

Commit

Permalink
fixed timer event implementations (#794)
Browse files Browse the repository at this point in the history
  • Loading branch information
jonathanlukas authored Mar 13, 2024
1 parent 2ec03f6 commit 7957ecc
Show file tree
Hide file tree
Showing 7 changed files with 200 additions and 45 deletions.
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
package org.camunda.community.migration.converter.visitor;

import static org.camunda.community.migration.converter.NamespaceUri.*;

import java.util.Objects;
import org.camunda.bpm.model.xml.instance.DomElement;
import org.camunda.community.migration.converter.DomElementVisitorContext;
Expand Down Expand Up @@ -37,6 +39,18 @@ protected boolean isStartEvent(DomElement element) {
&& !isEventSubprocess(element);
}

protected boolean isNonInterruptingIntermediate(DomElement element) {
String cancelActivity =
element.getParentElement().getParentElement().getAttribute(BPMN, "cancelActivity");
return Boolean.FALSE.toString().equals(cancelActivity);
}

protected boolean isNonInterruptingStart(DomElement element) {
String isInterrupting =
element.getParentElement().getParentElement().getAttribute(BPMN, "isInterrupting");
return Boolean.FALSE.toString().equals(isInterrupting);
}

protected boolean isIntermediateEvent(DomElement element) {
return element
.getParentElement()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,9 @@
public class TimeCycleVisitor extends AbstractTimerExpressionVisitor {
@Override
protected SemanticVersion availableFrom(DomElementVisitorContext context) {
if (isStartEvent(context.getElement())) {
if (isStartEvent(context.getElement())
|| isNonInterruptingIntermediate(context.getElement())
|| isNonInterruptingStart(context.getElement())) {
return SemanticVersion._8_0;
}
return null;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,7 @@
public class TimeDateVisitor extends AbstractTimerExpressionVisitor {
@Override
protected SemanticVersion availableFrom(DomElementVisitorContext context) {
if (isStartEvent(context.getElement()) || isEventSubprocess(context.getElement())) {
return SemanticVersion._8_0;
}
return null;
return SemanticVersion._8_0;
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,9 @@ public class TimeDurationVisitor extends AbstractTimerExpressionVisitor {

@Override
protected SemanticVersion availableFrom(DomElementVisitorContext context) {
if (isBoundaryEvent(context.getElement()) || isIntermediateEvent(context.getElement())) {
if (isBoundaryEvent(context.getElement())
|| isIntermediateEvent(context.getElement())
|| isEventSubprocess(context.getElement())) {
return SemanticVersion._8_0;
}
return null;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -462,20 +462,28 @@ void testTimerEvents(String elementId, String expectedExpression) {
value = {
// start events
"CycleStartEvent,true",
"DurationStartEvent1,false",
"DurationStartEvent,false",
"DateStartEvent,true",
// intermediate events
"FlexibleDurationEvent,true",
"FlexibleDateEvent,false",
"FlexibleDateEvent,true",
"FlexibleCycleEvent,false",
// boundary events
"DurationBoundaryEvent,true",
"DateBoundaryEvent,false",
"DateBoundaryEvent,true",
"CycleBoundaryEvent,false",
// boundary events non-interrupting
"DurationNonInterruptingBoundaryEvent,true",
"DateNonInterruptingBoundaryEvent,true",
"CycleNonInterruptingBoundaryEvent,true",
// event sub process
"DateStartEvent1,true",
"DurationStartEvent,false",
"CycleStartEvent1,false"
"DateEventSubprocessStartEvent,true",
"DurationEventSubprocessStartEvent,true",
"CycleEventSubprocessStartEvent,false",
// event sub process non-interrupting
"DateEventSubprocessNonInterruptingStartEvent,true",
"DurationEventSubprocessNonInterruptingStartEvent,true",
"CycleEventSubprocessNonInterruptingStartEvent,true"
})
void testTimerEventMessages(String elementId, boolean allowed) {
BpmnDiagramCheckResult result = loadAndCheck("flexible-timer-event.bpmn");
Expand Down
12 changes: 0 additions & 12 deletions backend-diagram-converter/core/src/test/resources/README.md

This file was deleted.

Loading

0 comments on commit 7957ecc

Please sign in to comment.