Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@
package org.flowable.engine.impl.agenda;

import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;

import org.flowable.bpmn.model.Activity;
Expand Down Expand Up @@ -173,9 +172,9 @@ protected void executeSynchronous(FlowNode flowNode) {

if (activityBehavior != null) {
executeActivityBehavior(activityBehavior, flowNode);
executeBoundaryEvents(boundaryEvents, boundaryEventExecutions);
executeBoundaryEvents(boundaryEventExecutions);
} else {
executeBoundaryEvents(boundaryEvents, boundaryEventExecutions);
executeBoundaryEvents(boundaryEventExecutions);
LOGGER.debug("No activityBehavior on activity '{}' with execution {}", flowNode.getId(), execution.getId());
CommandContextUtil.getAgenda().planTakeOutgoingSequenceFlowsOperation(execution, true);
}
Expand Down Expand Up @@ -229,7 +228,7 @@ protected void executeMultiInstanceSynchronous(FlowNode flowNode) {
}
}

executeBoundaryEvents(boundaryEvents, boundaryEventExecutions);
executeBoundaryEvents(boundaryEventExecutions);
}

} else {
Expand Down Expand Up @@ -387,14 +386,11 @@ protected List<ExecutionEntity> createBoundaryEvents(List<BoundaryEvent> boundar
return boundaryEventExecutions;
}

protected void executeBoundaryEvents(List<BoundaryEvent> boundaryEvents, List<ExecutionEntity> boundaryEventExecutions) {
protected void executeBoundaryEvents(List<ExecutionEntity> boundaryEventExecutions) {
if (!CollectionUtil.isEmpty(boundaryEventExecutions)) {
Iterator<BoundaryEvent> boundaryEventsIterator = boundaryEvents.iterator();
Iterator<ExecutionEntity> boundaryEventExecutionsIterator = boundaryEventExecutions.iterator();

while (boundaryEventsIterator.hasNext() && boundaryEventExecutionsIterator.hasNext()) {
BoundaryEvent boundaryEvent = boundaryEventsIterator.next();
ExecutionEntity boundaryEventExecution = boundaryEventExecutionsIterator.next();
for (ExecutionEntity boundaryEventExecution: boundaryEventExecutions) {
BoundaryEvent boundaryEvent = (BoundaryEvent) boundaryEventExecution.getCurrentFlowElement();
ActivityBehavior boundaryEventBehavior = ((ActivityBehavior) boundaryEvent.getBehavior());
LOGGER.debug("Executing boundary event activityBehavior {} with execution {}", boundaryEventBehavior.getClass(), boundaryEventExecution.getId());
boundaryEventBehavior.execute(boundaryEventExecution);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -337,4 +337,11 @@ public void testCompensateNestedSubprocess() {

}

@Test
@Deployment(resources = { "org/flowable/engine/test/bpmn/event/compensate/CompensateEventTest.testCompensationTimerEventBoundary.bpmn20.xml" })
public void testCompensationTimerEventBoundary() {
ProcessInstance processInstance = runtimeService.startProcessInstanceByKey("compensationTimerEventBoundary");
assertThat(processInstance).isNotNull();
}

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
<?xml version="1.0" encoding="UTF-8"?>
<definitions xmlns="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:flowable="http://flowable.org/bpmn" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" xmlns:omgdc="http://www.omg.org/spec/DD/20100524/DC" xmlns:omgdi="http://www.omg.org/spec/DD/20100524/DI" typeLanguage="http://www.w3.org/2001/XMLSchema" expressionLanguage="http://www.w3.org/1999/XPath" targetNamespace="http://www.flowable.org/processdef" exporter="Flowable Open Source Modeler">
<process id="compensationTimerEventBoundary" name="compensationTimerEventBoundary" isExecutable="true">
<startEvent id="startEvent1" flowable:formFieldValidation="true"></startEvent>
<sequenceFlow sourceRef="startEvent1" targetRef="first"></sequenceFlow>

<scriptTask id="first" name="first service task" scriptFormat="groovy">
<script><![CDATA[System.out.println('first service task');]]></script>
</scriptTask>

<boundaryEvent id="firstCompensateEvent" attachedToRef="first" cancelActivity="false">
<compensateEventDefinition/>
</boundaryEvent>

<scriptTask id="compensateServiceTask" name="compensate service task" scriptFormat="groovy" isForCompensation="true">
<script><![CDATA[System.out.println('compensate service task');]]></script>
</scriptTask>

<boundaryEvent id="firstTimerEvent" attachedToRef="first" cancelActivity="false">
<timerEventDefinition>
<timeDuration>PT5M</timeDuration>
</timerEventDefinition>
</boundaryEvent>
<userTask id="userTask" name="initiator" flowable:assignee="$INITIATOR" flowable:formFieldValidation="true"/>

<endEvent id="end"/>
<sequenceFlow sourceRef="first" targetRef="end"></sequenceFlow>
<sequenceFlow sourceRef="firstTimerEvent" targetRef="userTask"></sequenceFlow>
<association sourceRef="firstCompensateEvent" targetRef="compensateServiceTask" associationDirection="None"></association>
</process>
</definitions>