Skip to content

Commit

Permalink
BZ 1015221 Escalation definition should use the 'id' attribute not th…
Browse files Browse the repository at this point in the history
…e 'escalationCode' (cherry picked from commit 4f6440e)
  • Loading branch information
Marco Rietveld committed Oct 8, 2013
1 parent 9a68175 commit 0434396
Show file tree
Hide file tree
Showing 11 changed files with 72 additions and 24 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@ protected void handleEscalationNode(final Node node, final Element element, fina
eventNode.setEventFilters(eventFilters);
eventNode.setMetaData("EscalationEvent", type);
} else {
// general escalation
throw new UnsupportedOperationException("General escalation is not yet supported.");
}
}
xmlNode = xmlNode.getNextSibling();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -69,8 +69,7 @@ public Object start(final String uri, final String localName,
buildData.setMetaData(ProcessHandler.ESCALATIONS, escalations);
}
Escalation e = new Escalation(id, escalationCode);
// BPMN2 spec, p. 83: escalations are referenced by their "escalationCode" attr values
escalations.put(escalationCode, e);
escalations.put(id, e);
return e;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
xmlns:di="http://www.omg.org/spec/DD/20100524/DI"
xmlns:tns="http://www.jboss.org/drools">

<escalation id="MyEscalation" escalationCode="MyEscalation" />
<escalation id="escId" escalationCode="escCode" />
<process processType="Private" isExecutable="true" id="EscalationBoundaryEvent" name="Escalation Boundary Event Process" >

<startEvent id="_1" name="StartProcess" />
Expand All @@ -22,7 +22,7 @@
<sequenceFlow id="_2-1-_2-2" sourceRef="_2-1" targetRef="_2-2" />

<endEvent id="_2-2" name="EscalationEvent" >
<escalationEventDefinition escalationRef="MyEscalation" />
<escalationEventDefinition escalationRef="escId" />
</endEvent>
</subProcess>

Expand All @@ -32,7 +32,7 @@
<sequenceFlow id="_2-_3" sourceRef="_2" targetRef="_3" />

<boundaryEvent id="_4" name="EscalationEvent" attachedToRef="_2" cancelActivity="false" >
<escalationEventDefinition escalationRef="MyEscalation" />
<escalationEventDefinition escalationRef="escId" />
</boundaryEvent>
<sequenceFlow id="_4-_5" sourceRef="_4" targetRef="_5" />

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
xmlns:di="http://www.omg.org/spec/DD/20100524/DI"
xmlns:tns="http://www.jboss.org/drools">

<escalation id="esc" escalationCode="codeRed" />
<escalation id="escId" escalationCode="codeRed" />
<process processType="Private" isExecutable="true" id="EscalationBoundaryEvent" name="Escalation Boundary Event Process" >

<startEvent id="_1" name="StartProcess" />
Expand All @@ -26,7 +26,7 @@
<sequenceFlow id="_2-2-_2-4" sourceRef="_2-2" targetRef="_2-4" />

<endEvent id="_2-3" name="EscalationEvent" >
<escalationEventDefinition escalationRef="codeRed" />
<escalationEventDefinition escalationRef="escId" />
</endEvent>

<task id="_2-4" name="Task" tns:taskName="MyTask" />
Expand All @@ -41,7 +41,7 @@
</endEvent>

<boundaryEvent id="_4" name="EscalationEvent" attachedToRef="_2" cancelActivity="true">
<escalationEventDefinition escalationRef="codeRed" />
<escalationEventDefinition escalationRef="escId" />
</boundaryEvent>
<sequenceFlow id="_4-_5" sourceRef="_4" targetRef="_5" />

Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<definitions xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="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">

<escalation id="MyEscalation" escalationCode="MyEscalation"/>
<escalation id="escId" escalationCode="escCode"/>

<process id="non-interrupting-escalation" tns:version="1" tns:packageName="defaultPackage" name="Default Process">

Expand Down Expand Up @@ -60,7 +60,7 @@

<!-- boundary event-->
<boundaryEvent id="_5" name="Boundary event" attachedToRef="_3" cancelActivity="false">
<escalationEventDefinition id="EscalationEventDefinition_1" escalationRef="MyEscalation"/>
<escalationEventDefinition id="EscalationEventDefinition_1" escalationRef="escId"/>
</boundaryEvent>
<sequenceFlow id="_5-_6" tns:priority="1" name="" sourceRef="_5" targetRef="_6"/>

Expand Down Expand Up @@ -116,7 +116,7 @@
<sequenceFlow id="_8-_9" tns:priority="1" name="" sourceRef="_8" targetRef="_9"/>

<endEvent id="_9" name="end event 3">
<escalationEventDefinition id="EscalationEventDefinition_2" escalationRef="MyEscalation"/>
<escalationEventDefinition id="EscalationEventDefinition_2" escalationRef="escId"/>
</endEvent>

</process>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<bpmn2:definitions xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 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">
<bpmn2:escalation id="MyEscalation" escalationCode="MyEscalation"/>
<bpmn2:escalation id="escId" escalationCode="escCode"/>
<bpmn2:process id="BPMN2-EscalationBoundaryEventOnTask" tns:version="1" tns:packageName="defaultPackage" name="Default Process">
<bpmn2:endEvent id="EndEvent_2" name="end event 2">
<bpmn2:incoming>SequenceFlow_3</bpmn2:incoming>
Expand Down Expand Up @@ -67,7 +67,7 @@
<bpmn2:sequenceFlow id="SequenceFlow_2" tns:priority="1" name="" sourceRef="UserTask_1" targetRef="EndEvent_1"/>
<bpmn2:boundaryEvent id="BoundaryEvent_1" name="Boundary event" attachedToRef="UserTask_1">
<bpmn2:outgoing>SequenceFlow_4</bpmn2:outgoing>
<bpmn2:escalationEventDefinition id="EscalationEventDefinition_1" escalationRef="MyEscalation"/>
<bpmn2:escalationEventDefinition id="EscalationEventDefinition_1" escalationRef="escId"/>
</bpmn2:boundaryEvent>
<bpmn2:sequenceFlow id="SequenceFlow_4" tns:priority="1" name="" sourceRef="BoundaryEvent_1" targetRef="ScriptTask_1"/>
<bpmn2:parallelGateway id="ParallelGateway_1" name="split" gatewayDirection="Diverging">
Expand Down Expand Up @@ -140,7 +140,7 @@
<bpmn2:sequenceFlow id="SequenceFlow_8" tns:priority="1" name="" sourceRef="UserTask_2" targetRef="EndEvent_3"/>
<bpmn2:endEvent id="EndEvent_3" name="end event 3">
<bpmn2:incoming>SequenceFlow_8</bpmn2:incoming>
<bpmn2:escalationEventDefinition id="EscalationEventDefinition_2" escalationRef="MyEscalation"/>
<bpmn2:escalationEventDefinition id="EscalationEventDefinition_2" escalationRef="escId"/>
</bpmn2:endEvent>
</bpmn2:process>
<bpmndi:BPMNDiagram id="BPMNDiagram_1" name="Default Process Diagram">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
xmlns:tns="http://www.jboss.org/drools">

<itemDefinition id="_xItem" structureRef="String" />
<escalation id="esc" escalationCode="Code3" />
<escalation id="escId" escalationCode="Code3" />

<process processType="Private" isExecutable="true" id="non-interrupting-escalation" name="Escalation Boundary Event Process" >

Expand Down Expand Up @@ -44,7 +44,7 @@
</endEvent>

<boundaryEvent id="_4" name="CatchEscalation" attachedToRef="_2" cancelActivity="false" >
<escalationEventDefinition escalationRef="Code3" />
<escalationEventDefinition escalationRef="escId" />
</boundaryEvent>
<sequenceFlow id="_4-_5" sourceRef="_4" targetRef="_5" />

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,13 @@
xmlns:di="http://www.omg.org/spec/DD/20100524/DI"
xmlns:tns="http://www.jboss.org/drools">

<escalation id="MyEscalation" escalationCode="MyEscalation" />
<escalation id="escId" escalationCode="escCode" />
<process processType="Private" isExecutable="true" id="EscalationEndEvent" name="Escalation End Event Process" >

<!-- nodes -->
<startEvent id="_1" name="StartProcess" />
<endEvent id="_2" name="EscalationEvent" >
<escalationEventDefinition escalationRef="MyEscalation" />
<escalationEventDefinition escalationRef="escId" />
</endEvent>

<!-- connections -->
Expand Down
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
<?xml version="1.0" encoding="UTF-8"?>
<bpmn2:definitions xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 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" expressionLanguage="http://www.mvel.org/2.0" targetNamespace="http://www.jboss.org/drools" typeLanguage="http://www.java.com/javaTypes">
<bpmn2:escalation id="MyEscalation" escalationCode="MyEscalation" />
<bpmn2:escalation id="escId" escalationCode="escCode" />
<bpmn2:process id="BPMN2-EventSubprocessEscalation" tns:version="1" tns:packageName="defaultPackage" name="Default Process">
<bpmn2:startEvent id="StartEvent_1" name="start">
<bpmn2:outgoing>SequenceFlow_2</bpmn2:outgoing>
</bpmn2:startEvent>
<bpmn2:sequenceFlow id="SequenceFlow_1" tns:priority="1" sourceRef="UserTask_1" targetRef="EndEvent_1"/>
<bpmn2:endEvent id="EndEvent_1" name="end">
<bpmn2:incoming>SequenceFlow_1</bpmn2:incoming>
<bpmn2:escalationEventDefinition escalationRef="MyEscalation" />
<bpmn2:escalationEventDefinition escalationRef="escId" />
</bpmn2:endEvent>
<bpmn2:userTask id="UserTask_1" name="User Task 1">
<bpmn2:incoming>SequenceFlow_2</bpmn2:incoming>
Expand All @@ -18,7 +18,7 @@
<bpmn2:subProcess id="SubProcess_1" name="Sub Process 1" triggeredByEvent="true" >
<bpmn2:startEvent id="StartEvent_2" name="start-sub" isInterrupting="false">
<bpmn2:outgoing>SequenceFlow_3</bpmn2:outgoing>
<bpmn2:escalationEventDefinition escalationRef="MyEscalation" />
<bpmn2:escalationEventDefinition escalationRef="escId" />
</bpmn2:startEvent>
<bpmn2:scriptTask id="ScriptTask_1" name="Script Task 1">
<bpmn2:incoming>SequenceFlow_3</bpmn2:incoming>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,13 @@
xmlns:di="http://www.omg.org/spec/DD/20100524/DI"
xmlns:tns="http://www.jboss.org/drools">

<escalation id="MyEscalation" escalationCode="MyEscalation" />
<escalation id="escId" escalationCode="escCode" />
<process processType="Private" isExecutable="true" id="EscalationIntermediateThrowEvent" name="Escalation Intermediate Throw Event Process" >

<!-- nodes -->
<startEvent id="_1" name="StartProcess" />
<intermediateThrowEvent id="_2" name="EscalationEvent" >
<escalationEventDefinition escalationRef="MyEscalation"/>
<escalationEventDefinition escalationRef="escId"/>
</intermediateThrowEvent>
<endEvent id="_3" name="EndEvent" />

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
/**
* Copyright 2013 JBoss Inc
*
* 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 org.jbpm.process.core.event;


/**
* This variant of the {@link EventTypeFilter} can be used with structures such
* as Escalations, for which Intermediate (Catching) Events can be triggered
* by both
*
*
*/
public class BroadcastEventTypeFilter extends EventTypeFilter {

private static final long serialVersionUID = 510l;

public boolean acceptsEvent(String type, Object event) {
if( type == null ) {
return false;
}
boolean accepts = false;
if (this.type != null ) {
if( this.type.equals(type)) {
accepts = true;
} else if( type != null && type.startsWith(this.type) ) {
accepts = true;
}
}
return accepts;
}

public String toString() {
return "Broadcast Event filter: [" + this.type + "]";
}
}

0 comments on commit 0434396

Please sign in to comment.