[jbpm-commits] JBoss JBPM SVN: r6823 - in jbpm4/trunk/modules: examples/src/test/java/org/jbpm/examples/bpmn/event/escalation and 1 other directories.
do-not-reply at jboss.org
do-not-reply at jboss.org
Sun Nov 14 11:38:29 EST 2010
Author: rebody
Date: 2010-11-14 11:38:29 -0500 (Sun, 14 Nov 2010)
New Revision: 6823
Added:
jbpm4/trunk/modules/examples/src/test/resources/org/jbpm/examples/bpmn/event/escalation/boundary_escalation_event_interrupting.bpmn.xml
jbpm4/trunk/modules/examples/src/test/resources/org/jbpm/examples/bpmn/event/escalation/boundary_escalation_event_none_interrupting.bpmn.xml
Removed:
jbpm4/trunk/modules/examples/src/test/resources/org/jbpm/examples/bpmn/event/escalation/boundary_escalation_event.bpmn.xml
Modified:
jbpm4/trunk/modules/bpmn/src/main/java/org/jbpm/bpmn/flownodes/BoundaryEscalationEvent.java
jbpm4/trunk/modules/bpmn/src/main/java/org/jbpm/bpmn/flownodes/BpmnActivity.java
jbpm4/trunk/modules/examples/src/test/java/org/jbpm/examples/bpmn/event/escalation/BoundaryEscalationEventTest.java
Log:
JBPM-2733 none interrupting escalation boundary event
Modified: jbpm4/trunk/modules/bpmn/src/main/java/org/jbpm/bpmn/flownodes/BoundaryEscalationEvent.java
===================================================================
--- jbpm4/trunk/modules/bpmn/src/main/java/org/jbpm/bpmn/flownodes/BoundaryEscalationEvent.java 2010-11-14 16:11:03 UTC (rev 6822)
+++ jbpm4/trunk/modules/bpmn/src/main/java/org/jbpm/bpmn/flownodes/BoundaryEscalationEvent.java 2010-11-14 16:38:29 UTC (rev 6823)
@@ -53,7 +53,12 @@
ExecutionImpl childExecution = parent.createExecution();
childExecution.setState(Execution.STATE_ACTIVE_CONCURRENT);
this.executeBoundaryEventBranch(childExecution);
- this.proceed(execution, this.findOutgoingSequenceFlow(execution, true));
+ if (execution.getState() != Execution.STATE_INACTIVE_CONCURRENT_ROOT) {
+ this.proceed(execution, this.findOutgoingSequenceFlow(execution, true));
+ } else {
+ ExecutionImpl noneInterruptingExecution = parent.createExecution();
+ this.proceed(noneInterruptingExecution, this.findOutgoingSequenceFlow(noneInterruptingExecution, true));
+ }
}
}
Modified: jbpm4/trunk/modules/bpmn/src/main/java/org/jbpm/bpmn/flownodes/BpmnActivity.java
===================================================================
--- jbpm4/trunk/modules/bpmn/src/main/java/org/jbpm/bpmn/flownodes/BpmnActivity.java 2010-11-14 16:11:03 UTC (rev 6822)
+++ jbpm4/trunk/modules/bpmn/src/main/java/org/jbpm/bpmn/flownodes/BpmnActivity.java 2010-11-14 16:38:29 UTC (rev 6823)
@@ -22,6 +22,7 @@
package org.jbpm.bpmn.flownodes;
import java.util.ArrayList;
+import java.util.Collections;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
@@ -40,7 +41,7 @@
/**
* Basic activity for BPMN activities (tasks, gateways)
- *
+ *
* @author bernd.ruecker at camunda.com
* @author Ronald van Kuijk (kukeltje)
* @author Joram Barrez
@@ -53,15 +54,15 @@
protected static final boolean CONDITIONS_CHECKED = true;
protected static final boolean CONDITIONS_IGNORED = !CONDITIONS_CHECKED;
-
+
protected String default_;
protected List<ActivityResource> activityResources = new ArrayList<ActivityResource>();
-
+
public void execute(ActivityExecution execution) throws Exception {
execute((ExecutionImpl) execution);
}
-
+
public abstract void execute(ExecutionImpl executionImpl);
/**
@@ -69,9 +70,9 @@
* Code initially based on the JPDL fork logic.
*/
protected void proceed(ExecutionImpl execution, List<Transition> transitions) {
- if (LOG.isDebugEnabled()) {
- LOG.debug("Proceeding from execution in " + execution.getActivityName());
- }
+ if (LOG.isDebugEnabled()) {
+ LOG.debug("Proceeding from execution in " + execution.getActivityName());
+ }
Activity activity = execution.getActivity();
@@ -106,7 +107,7 @@
concurrentExecution.setState(Execution.STATE_ACTIVE_CONCURRENT);
childExecutionsMap.put(transition, concurrentExecution);
}
-
+
// For a correct functionality, the child executions must all exist before the actual transitions are taken.
// So we start following the outgoing transitions after child execution creation.
for (Transition transition : childExecutionsMap.keySet()) {
@@ -125,22 +126,25 @@
*/
protected List<Transition> findOutgoingSequenceFlow(ExecutionImpl execution, boolean checkConditions) {
ActivityImpl activity = execution.getActivity();
+ if (activity == null) {
+ return Collections.EMPTY_LIST;
+ }
// evaluate the conditions and find the transitions that should be forked
List<Transition> forkingTransitions = new ArrayList<Transition>();
List<TransitionImpl> outgoingTransitions = (List) activity.getOutgoingTransitions();
-
+
for (TransitionImpl transition : outgoingTransitions) {
Condition condition = transition.getCondition();
- if ( ( (condition == null) || (!checkConditions) || (condition.evaluate(execution)) )
+ if ( ( (condition == null) || (!checkConditions) || (condition.evaluate(execution)) )
&& (activity.getDefaultOutgoingTransition() != transition) ) {
forkingTransitions.add(transition);
}
}
-
+
if (LOG.isDebugEnabled()) {
- LOG.debug(forkingTransitions.size() + " out of " + outgoingTransitions.size() + " selected for " + activity.getName());
+ LOG.debug(forkingTransitions.size() + " out of " + outgoingTransitions.size() + " selected for " + activity.getName());
}
-
+
// If no outgoing sequence flow found, check if there is a default sequence flow
if (forkingTransitions.isEmpty() && isDefaultEnabled()) {
Transition defaultSeqFlow = execution.getActivity().getDefaultOutgoingTransition();
@@ -150,29 +154,29 @@
LOG.debug("Selected default sequence flow for " + execution.getActivityName());
}
} else {
- throw new JbpmException("No sequence flow condition evaluated to true for " +
+ throw new JbpmException("No sequence flow condition evaluated to true for " +
execution.getActivityName() + " and no default sequenceFlow was speficied");
}
} else if (forkingTransitions.isEmpty()){
throw new JbpmException("No outgoing sequence flow found for " + execution.getActivityName());
}
-
+
return forkingTransitions;
}
public void addActivityResource(ActivityResource activityResource) {
this.activityResources.add(activityResource);
}
-
+
/**
* Most of the BPMN activities allow to specify a default outgoing sequence
* flow. Subclasses must override this method when the default definition does
* not make sense (eg. ParallelGateway)
*/
public boolean isDefaultEnabled() {
- return true;
+ return true;
}
-
+
public String getDefault() {
return default_;
}
Modified: jbpm4/trunk/modules/examples/src/test/java/org/jbpm/examples/bpmn/event/escalation/BoundaryEscalationEventTest.java
===================================================================
--- jbpm4/trunk/modules/examples/src/test/java/org/jbpm/examples/bpmn/event/escalation/BoundaryEscalationEventTest.java 2010-11-14 16:11:03 UTC (rev 6822)
+++ jbpm4/trunk/modules/examples/src/test/java/org/jbpm/examples/bpmn/event/escalation/BoundaryEscalationEventTest.java 2010-11-14 16:38:29 UTC (rev 6823)
@@ -32,15 +32,11 @@
*/
public class BoundaryEscalationEventTest extends JbpmTestCase {
- @Override
- protected void setUp() throws Exception {
- super.setUp();
+ public void testInterruptingEscalationBoundaryEvent() {
NewDeployment deployment = repositoryService.createDeployment();
- deployment.addResourceFromClasspath("org/jbpm/examples/bpmn/event/escalation/boundary_escalation_event.bpmn.xml");
+ deployment.addResourceFromClasspath("org/jbpm/examples/bpmn/event/escalation/boundary_escalation_event_interrupting.bpmn.xml");
registerDeployment(deployment.deploy());
- }
- public void testProcessStartToEnd() {
ProcessInstance processInstance = executionService.startProcessInstanceByKey("boundary_escalation_event");
assertProcessInstanceEnded(processInstance);
@@ -48,4 +44,16 @@
assertNotNull(hip);
}
+ public void testNoneInterruptingEscalationBoundaryEvent() {
+ NewDeployment deployment = repositoryService.createDeployment();
+ deployment.addResourceFromClasspath("org/jbpm/examples/bpmn/event/escalation/boundary_escalation_event_none_interrupting.bpmn.xml");
+ registerDeployment(deployment.deploy());
+
+ ProcessInstance processInstance = executionService.startProcessInstanceByKey("boundary_escalation_event");
+ // assertProcessInstanceEnded(processInstance);
+
+ HistoryProcessInstance hip = historyService.createHistoryProcessInstanceQuery().uniqueResult();
+ assertNotNull(hip);
+ }
+
}
Deleted: jbpm4/trunk/modules/examples/src/test/resources/org/jbpm/examples/bpmn/event/escalation/boundary_escalation_event.bpmn.xml
===================================================================
--- jbpm4/trunk/modules/examples/src/test/resources/org/jbpm/examples/bpmn/event/escalation/boundary_escalation_event.bpmn.xml 2010-11-14 16:11:03 UTC (rev 6822)
+++ jbpm4/trunk/modules/examples/src/test/resources/org/jbpm/examples/bpmn/event/escalation/boundary_escalation_event.bpmn.xml 2010-11-14 16:38:29 UTC (rev 6823)
@@ -1,43 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<definitions
- xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xsi:schemaLocation="http://www.omg.org/spec/BPMN/20100524/MODEL BPMN20.xsd"
- xmlns="http://www.omg.org/spec/BPMN/20100524/MODEL"
- typeLanguage="http://www.w3.org/2001/XMLSchema"
- expressionLanguage="http://www.w3.org/1999/XPath"
- targetNamespace="http://jbpm.org/example/bpmn2/boundary_escalation_event"
- xmlns:jbpm="http://jbpm.org/bpmn2">
-
- <escalation id="MyEscalation" escalationCode="MyEscalation" />
-
- <process id="boundary_escalation_event" name="Error Boundary Escalation Process">
- <startEvent id="startEvent" name="StartProcess"/>
- <sequenceFlow id="flow1" sourceRef="startEvent" targetRef="subProcess"/>
- <subProcess id="subProcess" name="Hello" >
- <startEvent id="sub-start" name="StartSubProcess"/>
- <sequenceFlow id="flow2" sourceRef="sub-start" targetRef="sub-parallel"/>
- <parallelGateway id="sub-parallel" gatewayDirection="Diverging"/>
- <sequenceFlow id="flow3" sourceRef="sub-parallel" targetRef="sub-error"/>
- <endEvent id="sub-error" name="EscalationEvent">
- <escalationEventDefinition escalationRef="MyEscalation"/>
- </endEvent>
- <sequenceFlow id="flow4" sourceRef="sub-parallel" targetRef="sub-task"/>
- <userTask id="sub-task" name="Task" />
- <sequenceFlow id="flow5" sourceRef="sub-task" targetRef="sub-end"/>
- <endEvent id="sub-end" name="EndEvent"/>
- </subProcess>
- <sequenceFlow id="flow6" sourceRef="subProcess" targetRef="terminateEnd"/>
- <endEvent id="terminateEnd" name="EndProcess">
- <terminateEventDefinition/>
- </endEvent>
- <boundaryEvent id="escalationEvent" name="EscalationEvent" attachedToRef="subProcess" >
- <escalationEventDefinition escalationRef="MyEscalation" />
- </boundaryEvent>
- <sequenceFlow id="flow7" sourceRef="escalationEvent" targetRef="task"/>
- <scriptTask id="task" name="Goodbye">
- <script>System.out.println("Escalation handled");</script>
- </scriptTask>
- <sequenceFlow id="flow8" sourceRef="task" targetRef="endEvent"/>
- <endEvent id="endEvent" name="EndProcess"/>
- </process>
-</definitions>
Copied: jbpm4/trunk/modules/examples/src/test/resources/org/jbpm/examples/bpmn/event/escalation/boundary_escalation_event_interrupting.bpmn.xml (from rev 6821, jbpm4/trunk/modules/examples/src/test/resources/org/jbpm/examples/bpmn/event/escalation/boundary_escalation_event.bpmn.xml)
===================================================================
--- jbpm4/trunk/modules/examples/src/test/resources/org/jbpm/examples/bpmn/event/escalation/boundary_escalation_event_interrupting.bpmn.xml (rev 0)
+++ jbpm4/trunk/modules/examples/src/test/resources/org/jbpm/examples/bpmn/event/escalation/boundary_escalation_event_interrupting.bpmn.xml 2010-11-14 16:38:29 UTC (rev 6823)
@@ -0,0 +1,43 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<definitions
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://www.omg.org/spec/BPMN/20100524/MODEL BPMN20.xsd"
+ xmlns="http://www.omg.org/spec/BPMN/20100524/MODEL"
+ typeLanguage="http://www.w3.org/2001/XMLSchema"
+ expressionLanguage="http://www.w3.org/1999/XPath"
+ targetNamespace="http://jbpm.org/example/bpmn2/boundary_escalation_event"
+ xmlns:jbpm="http://jbpm.org/bpmn2">
+
+ <escalation id="MyEscalation" escalationCode="MyEscalation" />
+
+ <process id="boundary_escalation_event" name="Escalation Boundary Event Process">
+ <startEvent id="startEvent" name="StartProcess"/>
+ <sequenceFlow id="flow1" sourceRef="startEvent" targetRef="subProcess"/>
+ <subProcess id="subProcess" name="Hello" >
+ <startEvent id="sub-start" name="StartSubProcess"/>
+ <sequenceFlow id="flow2" sourceRef="sub-start" targetRef="sub-parallel"/>
+ <parallelGateway id="sub-parallel" gatewayDirection="Diverging"/>
+ <sequenceFlow id="flow3" sourceRef="sub-parallel" targetRef="sub-error"/>
+ <endEvent id="sub-error" name="EscalationEvent">
+ <escalationEventDefinition escalationRef="MyEscalation"/>
+ </endEvent>
+ <sequenceFlow id="flow4" sourceRef="sub-parallel" targetRef="sub-task"/>
+ <userTask id="sub-task" name="Task" />
+ <sequenceFlow id="flow5" sourceRef="sub-task" targetRef="sub-end"/>
+ <endEvent id="sub-end" name="EndEvent"/>
+ </subProcess>
+ <sequenceFlow id="flow6" sourceRef="subProcess" targetRef="terminateEnd"/>
+ <endEvent id="terminateEnd" name="EndProcess">
+ <terminateEventDefinition/>
+ </endEvent>
+ <boundaryEvent id="escalationEvent" name="EscalationEvent" attachedToRef="subProcess" >
+ <escalationEventDefinition escalationRef="MyEscalation" />
+ </boundaryEvent>
+ <sequenceFlow id="flow7" sourceRef="escalationEvent" targetRef="task"/>
+ <scriptTask id="task" name="Goodbye">
+ <script>System.out.println("Escalation handled");</script>
+ </scriptTask>
+ <sequenceFlow id="flow8" sourceRef="task" targetRef="endEvent"/>
+ <endEvent id="endEvent" name="EndProcess"/>
+ </process>
+</definitions>
Added: jbpm4/trunk/modules/examples/src/test/resources/org/jbpm/examples/bpmn/event/escalation/boundary_escalation_event_none_interrupting.bpmn.xml
===================================================================
--- jbpm4/trunk/modules/examples/src/test/resources/org/jbpm/examples/bpmn/event/escalation/boundary_escalation_event_none_interrupting.bpmn.xml (rev 0)
+++ jbpm4/trunk/modules/examples/src/test/resources/org/jbpm/examples/bpmn/event/escalation/boundary_escalation_event_none_interrupting.bpmn.xml 2010-11-14 16:38:29 UTC (rev 6823)
@@ -0,0 +1,43 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<definitions
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://www.omg.org/spec/BPMN/20100524/MODEL BPMN20.xsd"
+ xmlns="http://www.omg.org/spec/BPMN/20100524/MODEL"
+ typeLanguage="http://www.w3.org/2001/XMLSchema"
+ expressionLanguage="http://www.w3.org/1999/XPath"
+ targetNamespace="http://jbpm.org/example/bpmn2/boundary_escalation_event"
+ xmlns:jbpm="http://jbpm.org/bpmn2">
+
+ <escalation id="MyEscalation" escalationCode="MyEscalation" />
+
+ <process id="boundary_escalation_event" name="Escalation Boundary Event Process">
+ <startEvent id="startEvent" name="StartProcess"/>
+ <sequenceFlow id="flow1" sourceRef="startEvent" targetRef="subProcess"/>
+ <subProcess id="subProcess" name="Hello" >
+ <startEvent id="sub-start" name="StartSubProcess"/>
+ <sequenceFlow id="flow2" sourceRef="sub-start" targetRef="sub-parallel"/>
+ <parallelGateway id="sub-parallel" gatewayDirection="Diverging"/>
+ <sequenceFlow id="flow3" sourceRef="sub-parallel" targetRef="sub-error"/>
+ <endEvent id="sub-error" name="EscalationEvent">
+ <escalationEventDefinition escalationRef="MyEscalation"/>
+ </endEvent>
+ <sequenceFlow id="flow4" sourceRef="sub-parallel" targetRef="sub-task"/>
+ <userTask id="sub-task" name="Task" />
+ <sequenceFlow id="flow5" sourceRef="sub-task" targetRef="sub-end"/>
+ <endEvent id="sub-end" name="EndEvent"/>
+ </subProcess>
+ <sequenceFlow id="flow6" sourceRef="subProcess" targetRef="terminateEnd"/>
+ <endEvent id="terminateEnd" name="EndProcess">
+ <terminateEventDefinition/>
+ </endEvent>
+ <boundaryEvent id="escalationEvent" name="EscalationEvent" attachedToRef="subProcess" cancelActivity="false">
+ <escalationEventDefinition escalationRef="MyEscalation" />
+ </boundaryEvent>
+ <sequenceFlow id="flow7" sourceRef="escalationEvent" targetRef="task"/>
+ <scriptTask id="task" name="Goodbye">
+ <script>System.out.println("Escalation handled");</script>
+ </scriptTask>
+ <sequenceFlow id="flow8" sourceRef="task" targetRef="endEvent"/>
+ <endEvent id="endEvent" name="EndProcess"/>
+ </process>
+</definitions>
More information about the jbpm-commits
mailing list