Skip to content

[incubator-kie-issues-1303] BoundaryEvents v7 support #3549

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 8 commits into from
Jun 20, 2024
Merged
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 @@ -310,6 +310,7 @@ private void visitContextExceptionScope(Context context, BlockStmt body) {
new StringLiteralExpr(signalName),
faultCode != null ? new StringLiteralExpr(faultCode) : new NullLiteralExpr(),
faultVariable.<Expression> map(StringLiteralExpr::new).orElse(new NullLiteralExpr())));

});
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,21 +20,17 @@

import org.kie.api.event.process.ProcessNodeLeftEvent;

public class NodeLeftCountDownProcessEventListener extends NodeCountDownProcessEventListener {
public class NodeLeftCountDownProcessEventListener extends DefaultCountDownProcessEventListener {

private boolean reactOnBeforeNodeLeft = false;
private String nodeName;

public NodeLeftCountDownProcessEventListener() {

}

public NodeLeftCountDownProcessEventListener(String nodeName, int threads) {
super(nodeName, threads);
}

public NodeLeftCountDownProcessEventListener(String nodeName, int threads, boolean reactOnBeforeNodeLeft) {
super(nodeName, threads);
this.reactOnBeforeNodeLeft = reactOnBeforeNodeLeft;
super(threads);
this.nodeName = nodeName;
}

@Override
Expand All @@ -43,11 +39,4 @@ public void afterNodeLeft(ProcessNodeLeftEvent event) {
countDown();
}
}

@Override
public void beforeNodeLeft(ProcessNodeLeftEvent event) {
if (reactOnBeforeNodeLeft && nodeName.equals(event.getNodeInstance().getNodeName())) {
countDown();
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -18,23 +18,26 @@
*/
package org.jbpm.test.util;

import java.util.concurrent.CountDownLatch;
import org.kie.api.event.process.ProcessNodeTriggeredEvent;

public class NodeCountDownProcessEventListener extends DefaultCountDownProcessEventListener {
public class NodeTriggeredProcessEventListener extends DefaultCountDownProcessEventListener {

protected String nodeName;

public NodeCountDownProcessEventListener() {
public NodeTriggeredProcessEventListener() {

}

public NodeCountDownProcessEventListener(String nodeName, int threads) {
super(threads);
this.nodeName = nodeName;
@Override
public void afterNodeTriggered(ProcessNodeTriggeredEvent event) {
if (nodeName.equals(event.getNodeInstance().getNodeName())) {
countDown();
}
}

public void reset(String nodeName, int threads) {
public NodeTriggeredProcessEventListener(String nodeName, int threads) {
super(threads);
this.nodeName = nodeName;
this.latch = new CountDownLatch(threads);
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -215,14 +215,12 @@ private boolean checkAndReassign(Map<String, Reassignment> timers,
@Override
protected void addWorkItemListener() {
super.addWorkItemListener();
getProcessInstance().addEventListener(TIMER_TRIGGERED_EVENT, this, false);
getProcessInstance().addEventListener(WORK_ITEM_TRANSITION, this, false);
}

@Override
protected void removeWorkItemListener() {
super.removeWorkItemListener();
getProcessInstance().removeEventListener(TIMER_TRIGGERED_EVENT, this, false);
getProcessInstance().removeEventListener(WORK_ITEM_TRANSITION, this, false);
}

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,195 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
~ Licensed to the Apache Software Foundation (ASF) under one
~ or more contributor license agreements. See the NOTICE file
~ distributed with this work for additional information
~ regarding copyright ownership. The ASF licenses this file
~ to you 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.
-->

<definitions xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:_1="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:bpmn2="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" xmlns:dc="http://www.omg.org/spec/DD/20100524/DC" xmlns:di="http://www.omg.org/spec/DD/20100524/DI" xmlns:tns="http://www.jboss.org/drools" xsi:schemaLocation="http://www.omg.org/spec/BPMN/20100524/MODEL BPMN20.xsd" id="Definitions_1" targetNamespace="http://www.jboss.org/drools">
<error id="Error_1" errorCode="java.lang.RuntimeException"/>
<itemDefinition id="_sItem" structureRef="String"/>
<itemDefinition id="_2_InMessageType" structureRef="java.lang.String"/>
<message id="_2_InMessage" itemRef="_2_InMessageType" name="_2_InMessage"/>
<interface id="_2_ServiceInterface" name="org.jbpm.bpmn2.objects.HelloService">
<operation id="_2_ServiceOperation" name="helloException">
<inMessageRef>_2_InMessage</inMessageRef>
</operation>
</interface>
<process id="ErrorBoundaryEventOnServiceTask" tns:version="1" tns:packageName="org.jbpm.bpmn2.error" tns:adHoc="false" name="Default Process" isExecutable="true">
<property id="s" itemSubjectRef="_sItem"/>
<startEvent id="StartEvent_1" name="start">
<outgoing>SequenceFlow_4</outgoing>
</startEvent>
<userTask id="UserTask_1" name="User Task">
<incoming>SequenceFlow_2</incoming>
<outgoing>SequenceFlow_6</outgoing>
<ioSpecification id="_InputOutputSpecification_6">
<dataInput id="_DataInput_26" name="TaskName"/>
<dataInput id="_DataInput_27" name="Priority"/>
<dataInput id="_DataInput_28" name="Comment"/>
<dataInput id="_DataInput_29" name="GroupId"/>
<dataInput id="_DataInput_30" name="Skippable"/>
<dataInput id="_DataInput_31" name="Content"/>
<inputSet id="_InputSet_6" name=" Input Set 6">
<dataInputRefs>_DataInput_26</dataInputRefs>
<dataInputRefs>_DataInput_27</dataInputRefs>
<dataInputRefs>_DataInput_28</dataInputRefs>
<dataInputRefs>_DataInput_29</dataInputRefs>
<dataInputRefs>_DataInput_30</dataInputRefs>
<dataInputRefs>_DataInput_31</dataInputRefs>
</inputSet>
<outputSet></outputSet>
</ioSpecification>
<dataInputAssociation id="_DataInputAssociation_26">
<targetRef>_DataInput_26</targetRef>
</dataInputAssociation>
<dataInputAssociation id="_DataInputAssociation_27">
<targetRef>_DataInput_27</targetRef>
</dataInputAssociation>
<dataInputAssociation id="_DataInputAssociation_28">
<targetRef>_DataInput_28</targetRef>
</dataInputAssociation>
<dataInputAssociation id="_DataInputAssociation_29">
<targetRef>_DataInput_29</targetRef>
</dataInputAssociation>
<dataInputAssociation id="_DataInputAssociation_30">
<targetRef>_DataInput_30</targetRef>
</dataInputAssociation>
<dataInputAssociation id="_DataInputAssociation_31">
<targetRef>_DataInput_31</targetRef>
</dataInputAssociation>
<potentialOwner id="PotentialOwner_1">
<resourceAssignmentExpression id="ResourceAssignmentExpression_1">
<formalExpression id="FormalExpression_1">john</formalExpression>
</resourceAssignmentExpression>
</potentialOwner>
</userTask>
<serviceTask id="ServiceTask_2" name="Service task error attached" implementation="Other" operationRef="_2_ServiceOperation">
<incoming>SequenceFlow_3</incoming>
<outgoing>SequenceFlow_5</outgoing>
<ioSpecification id="InputOutputSpecification_1">
<dataInput id="_2_param" name="Parameter"/>
<dataOutput id="_2_result" name="Result"/>
<inputSet id="InputSet_1">
<dataInputRefs>_2_param</dataInputRefs>
</inputSet>
<outputSet id="OutputSet_1">
<dataOutputRefs>_2_result</dataOutputRefs>
</outputSet>
</ioSpecification>
<dataInputAssociation id="DataInputAssociation_1">
<sourceRef>s</sourceRef>
<targetRef>_2_param</targetRef>
</dataInputAssociation>
<dataOutputAssociation id="DataOutputAssociation_1">
<sourceRef>_2_result</sourceRef>
<targetRef>s</targetRef>
</dataOutputAssociation>
</serviceTask>
<parallelGateway id="ParallelGateway_1" name="split" gatewayDirection="Diverging">
<incoming>SequenceFlow_4</incoming>
<outgoing>SequenceFlow_2</outgoing>
<outgoing>SequenceFlow_3</outgoing>
</parallelGateway>
<sequenceFlow id="SequenceFlow_2" tns:priority="1" sourceRef="ParallelGateway_1" targetRef="UserTask_1"/>
<sequenceFlow id="SequenceFlow_3" tns:priority="1" sourceRef="ParallelGateway_1" targetRef="ServiceTask_2"/>
<sequenceFlow id="SequenceFlow_4" tns:priority="1" name="" sourceRef="StartEvent_1" targetRef="ParallelGateway_1"/>
<endEvent id="EndEvent_1" name="error1">
<incoming>SequenceFlow_5</incoming>
</endEvent>
<sequenceFlow id="SequenceFlow_5" tns:priority="1" name="" sourceRef="ServiceTask_2" targetRef="EndEvent_1"/>
<sequenceFlow id="SequenceFlow_6" tns:priority="1" sourceRef="UserTask_1" targetRef="EndEvent_2"/>
<endEvent id="EndEvent_2" name="end0">
<incoming>SequenceFlow_6</incoming>
</endEvent>
<boundaryEvent id="BoundaryEvent_1" name="Boundary event" attachedToRef="ServiceTask_2">
<outgoing>SequenceFlow_7</outgoing>
<errorEventDefinition id="ErrorEventDefinition_2" errorRef="Error_1"/>
</boundaryEvent>
<scriptTask id="ScriptTask_1" name="Script Task" scriptFormat="http://www.java.com/java">
<incoming>SequenceFlow_7</incoming>
<outgoing>SequenceFlow_8</outgoing>
<script>System.out.println(&quot;Error handled&quot;);</script>
</scriptTask>
<sequenceFlow id="SequenceFlow_7" tns:priority="1" name="" sourceRef="BoundaryEvent_1" targetRef="ScriptTask_1"/>
<sequenceFlow id="SequenceFlow_8" tns:priority="1" name="" sourceRef="ScriptTask_1" targetRef="EndEvent_3"/>
<endEvent id="EndEvent_3" name="error2">
<incoming>SequenceFlow_8</incoming>
</endEvent>
</process>
<bpmndi:BPMNDiagram id="BPMNDiagram_1" name="Default Process Diagram">
<bpmndi:BPMNPlane id="BPMNPlane_1" bpmnElement="BPMN2-ErrorBoundaryEventOnServiceTask">
<bpmndi:BPMNShape id="BPMNShape_1" bpmnElement="StartEvent_1" isHorizontal="true">
<dc:Bounds height="36.0" width="36.0" x="100.0" y="100.0"/>
</bpmndi:BPMNShape>
<bpmndi:BPMNShape id="BPMNShape_2" bpmnElement="EndEvent_1" isHorizontal="true">
<dc:Bounds height="36.0" width="36.0" x="580.0" y="197.0"/>
</bpmndi:BPMNShape>
<bpmndi:BPMNShape id="BPMNShape_ParallelGateway_1" bpmnElement="ParallelGateway_1" isHorizontal="true">
<dc:Bounds height="50.0" width="50.0" x="210.0" y="93.0"/>
</bpmndi:BPMNShape>
<bpmndi:BPMNShape id="BPMNShape_UserTask_1" bpmnElement="UserTask_1" isHorizontal="true">
<dc:Bounds height="50.0" width="110.0" x="320.0" y="30.0"/>
</bpmndi:BPMNShape>
<bpmndi:BPMNShape id="BPMNShape_ServiceTask_2" bpmnElement="ServiceTask_2" isHorizontal="true">
<dc:Bounds height="50.0" width="110.0" x="320.0" y="190.0"/>
</bpmndi:BPMNShape>
<bpmndi:BPMNShape id="BPMNShape_EndEvent_1" bpmnElement="EndEvent_2" isHorizontal="true">
<dc:Bounds height="36.0" width="36.0" x="580.0" y="38.0"/>
</bpmndi:BPMNShape>
<bpmndi:BPMNShape id="BPMNShape_BoundaryEvent_1" bpmnElement="BoundaryEvent_1" isHorizontal="true">
<dc:Bounds height="36.0" width="36.0" x="362.0" y="222.0"/>
</bpmndi:BPMNShape>
<bpmndi:BPMNShape id="BPMNShape_ScriptTask_1" bpmnElement="ScriptTask_1" isHorizontal="true">
<dc:Bounds height="50.0" width="110.0" x="440.0" y="300.0"/>
</bpmndi:BPMNShape>
<bpmndi:BPMNShape id="BPMNShape_EndEvent_2" bpmnElement="EndEvent_3" isHorizontal="true">
<dc:Bounds height="36.0" width="36.0" x="580.0" y="307.0"/>
</bpmndi:BPMNShape>
<bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_2" bpmnElement="SequenceFlow_2" sourceElement="BPMNShape_ParallelGateway_1" targetElement="BPMNShape_UserTask_1">
<di:waypoint xsi:type="dc:Point" x="235.0" y="93.0"/>
<di:waypoint xsi:type="dc:Point" x="235.0" y="54.0"/>
<di:waypoint xsi:type="dc:Point" x="320.0" y="55.0"/>
</bpmndi:BPMNEdge>
<bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_3" bpmnElement="SequenceFlow_3" sourceElement="BPMNShape_ParallelGateway_1" targetElement="BPMNShape_ServiceTask_2">
<di:waypoint xsi:type="dc:Point" x="235.0" y="144.0"/>
<di:waypoint xsi:type="dc:Point" x="235.0" y="214.0"/>
<di:waypoint xsi:type="dc:Point" x="320.0" y="215.0"/>
</bpmndi:BPMNEdge>
<bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_4" bpmnElement="SequenceFlow_4" sourceElement="BPMNShape_1" targetElement="BPMNShape_ParallelGateway_1">
<di:waypoint xsi:type="dc:Point" x="136.0" y="118.0"/>
<di:waypoint xsi:type="dc:Point" x="210.0" y="118.0"/>
</bpmndi:BPMNEdge>
<bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_5" bpmnElement="SequenceFlow_5" sourceElement="BPMNShape_ServiceTask_2" targetElement="BPMNShape_2">
<di:waypoint xsi:type="dc:Point" x="430.0" y="215.0"/>
<di:waypoint xsi:type="dc:Point" x="580.0" y="215.0"/>
</bpmndi:BPMNEdge>
<bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_6" bpmnElement="SequenceFlow_6" sourceElement="BPMNShape_UserTask_1" targetElement="BPMNShape_EndEvent_1">
<di:waypoint xsi:type="dc:Point" x="430.0" y="55.0"/>
<di:waypoint xsi:type="dc:Point" x="580.0" y="56.0"/>
</bpmndi:BPMNEdge>
<bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_7" bpmnElement="SequenceFlow_7" sourceElement="BPMNShape_BoundaryEvent_1" targetElement="BPMNShape_ScriptTask_1">
<di:waypoint xsi:type="dc:Point" x="380.0" y="258.0"/>
<di:waypoint xsi:type="dc:Point" x="380.0" y="324.0"/>
<di:waypoint xsi:type="dc:Point" x="440.0" y="325.0"/>
</bpmndi:BPMNEdge>
<bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_8" bpmnElement="SequenceFlow_8" sourceElement="BPMNShape_ScriptTask_1" targetElement="BPMNShape_EndEvent_2">
<di:waypoint xsi:type="dc:Point" x="550.0" y="325.0"/>
<di:waypoint xsi:type="dc:Point" x="580.0" y="325.0"/>
</bpmndi:BPMNEdge>
</bpmndi:BPMNPlane>
</bpmndi:BPMNDiagram>
</definitions>
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
<bpmn2:itemDefinition id="ItemDefinition_2" structureRef="Boolean"/>
<bpmn2:itemDefinition id="ItemDefinition_3" structureRef="java.lang.Exception"/>
<bpmn2:error id="Error_1" name="Error_1" structureRef="ItemDefinition_3"/>
<bpmn2:process id="com.sample.bpmn.hello" tns:version="1" tns:packageName="defaultPackage" tns:adHoc="false" name="Hello World" isExecutable="true" processType="Private">
<bpmn2:process id="BoundaryErrorEventDefaultHandlerWithoutErrorCodeWithStructureRef" tns:version="1" tns:packageName="org.jbpm.bpmn2.event" tns:adHoc="false" name="Hello World" isExecutable="true" processType="Private">
<bpmn2:extensionElements>
<tns:import name="java.lang.IllegalArgumentException"/>
</bpmn2:extensionElements>
Expand Down
Loading
Loading