[jbpm-commits] JBoss JBPM SVN: r6830 - in jbpm4/trunk/modules: examples/src/test/java/org/jbpm/examples/bpmn/event/escalation and 3 other directories.

do-not-reply at jboss.org do-not-reply at jboss.org
Wed Nov 17 11:57:07 EST 2010


Author: rebody
Date: 2010-11-17 11:57:06 -0500 (Wed, 17 Nov 2010)
New Revision: 6830

Added:
   jbpm4/trunk/modules/bpmn/src/main/java/org/jbpm/bpmn/flownodes/IntermediateThrowEscalationEvent.java
   jbpm4/trunk/modules/examples/src/test/java/org/jbpm/examples/bpmn/event/escalation/ThrowEscalationEventTest.java
   jbpm4/trunk/modules/examples/src/test/java/org/jbpm/examples/bpmn/event/signal/ThrowSignalEventTest.java
   jbpm4/trunk/modules/examples/src/test/resources/org/jbpm/examples/bpmn/event/escalation/throw_escalation_event_interrupting.bpmn.xml
   jbpm4/trunk/modules/examples/src/test/resources/org/jbpm/examples/bpmn/event/signal/throw_signal_event_interrupting.bpmn.xml
Modified:
   jbpm4/trunk/modules/bpmn/src/main/java/org/jbpm/bpmn/flownodes/IntermediateThrowEventBinding.java
Log:
JBPM-2731 Intermediate Throw Escalation Event

Added: jbpm4/trunk/modules/bpmn/src/main/java/org/jbpm/bpmn/flownodes/IntermediateThrowEscalationEvent.java
===================================================================
--- jbpm4/trunk/modules/bpmn/src/main/java/org/jbpm/bpmn/flownodes/IntermediateThrowEscalationEvent.java	                        (rev 0)
+++ jbpm4/trunk/modules/bpmn/src/main/java/org/jbpm/bpmn/flownodes/IntermediateThrowEscalationEvent.java	2010-11-17 16:57:06 UTC (rev 6830)
@@ -0,0 +1,61 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jbpm.bpmn.flownodes;
+
+import org.jbpm.api.activity.ActivityExecution;
+import org.jbpm.api.listener.EventListener;
+import org.jbpm.api.listener.EventListenerExecution;
+import org.jbpm.pvm.internal.model.ExecutionImpl;
+
+/**
+ *
+ * @author Huisheng Xu
+ */
+public class IntermediateThrowEscalationEvent extends BpmnActivity implements EventListener, BpmnEvent {
+
+  private static final long serialVersionUID = 1L;
+
+  protected String escalationCode;
+
+  public void execute(ActivityExecution execution) {
+    ExecutionImpl executionImpl = (ExecutionImpl) execution;
+    execute(executionImpl);
+    proceed(executionImpl, findOutgoingSequenceFlow(executionImpl, CONDITIONS_CHECKED));
+  }
+
+  public void execute(ExecutionImpl execution) {
+    execution.fire(escalationCode, execution.getActivity());
+  }
+
+  public void notify(EventListenerExecution execution) throws Exception {
+    this.execute((ExecutionImpl) execution);
+  }
+
+  public void setEscalationCode(String escalationCode) {
+    this.escalationCode = escalationCode;
+  }
+
+  public boolean isDefaultEnabled() {
+    return true;
+  }
+
+}

Modified: jbpm4/trunk/modules/bpmn/src/main/java/org/jbpm/bpmn/flownodes/IntermediateThrowEventBinding.java
===================================================================
--- jbpm4/trunk/modules/bpmn/src/main/java/org/jbpm/bpmn/flownodes/IntermediateThrowEventBinding.java	2010-11-17 05:03:57 UTC (rev 6829)
+++ jbpm4/trunk/modules/bpmn/src/main/java/org/jbpm/bpmn/flownodes/IntermediateThrowEventBinding.java	2010-11-17 16:57:06 UTC (rev 6830)
@@ -43,6 +43,8 @@
     Element eventDefinition = XmlUtil.element(element);
     if ("signalEventDefinition".equals(eventDefinition.getNodeName())) {
       return createIntermediateSignalThrowEvent(id, eventDefinition, bpmnParser, parse);
+    } else if ("escalationEventDefinition".equals(eventDefinition.getNodeName())) {
+      return createIntermediateEscalationThrowEvent(id, eventDefinition, bpmnParser, parse);
     } else {
       parse.addProblem("Invalid eventDefinition type : " + eventDefinition.getNodeName());
     }
@@ -62,4 +64,16 @@
     return intermediateThrowSignalEvent;
   }
 
+  protected IntermediateThrowEscalationEvent createIntermediateEscalationThrowEvent(String throwEventId,
+          Element eventDefinitionElement, BpmnParser parser, Parse parse) {
+
+    // String eventName = "INTERMEDIATE_SIGNAL_" + throwEventId;
+    String eventName = XmlUtil.attribute(eventDefinitionElement, "escalationRef");
+
+    IntermediateThrowEscalationEvent intermediateThrowEscalationEvent = new IntermediateThrowEscalationEvent();
+    intermediateThrowEscalationEvent.setEscalationCode(eventName);
+
+    return intermediateThrowEscalationEvent;
+  }
+
 }

Added: jbpm4/trunk/modules/examples/src/test/java/org/jbpm/examples/bpmn/event/escalation/ThrowEscalationEventTest.java
===================================================================
--- jbpm4/trunk/modules/examples/src/test/java/org/jbpm/examples/bpmn/event/escalation/ThrowEscalationEventTest.java	                        (rev 0)
+++ jbpm4/trunk/modules/examples/src/test/java/org/jbpm/examples/bpmn/event/escalation/ThrowEscalationEventTest.java	2010-11-17 16:57:06 UTC (rev 6830)
@@ -0,0 +1,59 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jbpm.examples.bpmn.event.escalation;
+
+import org.jbpm.api.NewDeployment;
+import org.jbpm.api.ProcessInstance;
+import org.jbpm.api.history.HistoryProcessInstance;
+import org.jbpm.test.JbpmTestCase;
+
+/**
+ *
+ * @author Huisheng Xu
+ */
+public class ThrowEscalationEventTest extends JbpmTestCase {
+
+    public void testInterruptingSignalThrowEvent() {
+        NewDeployment deployment = repositoryService.createDeployment();
+        deployment.addResourceFromClasspath("org/jbpm/examples/bpmn/event/escalation/throw_escalation_event_interrupting.bpmn.xml");
+        registerDeployment(deployment.deploy());
+
+        ProcessInstance processInstance = executionService.startProcessInstanceByKey("throw_escalation_event");
+        // assertProcessInstanceEnded(processInstance);
+
+        HistoryProcessInstance hip = historyService.createHistoryProcessInstanceQuery().uniqueResult();
+        assertNotNull(hip);
+    }
+/*
+    public void testNoneInterruptingSignalBoundaryEvent() {
+        NewDeployment deployment = repositoryService.createDeployment();
+        deployment.addResourceFromClasspath("org/jbpm/examples/bpmn/event/signal/boundary_signal_event_none_interrupting.bpmn.xml");
+        registerDeployment(deployment.deploy());
+
+        ProcessInstance processInstance = executionService.startProcessInstanceByKey("boundary_signal_event");
+        // assertProcessInstanceEnded(processInstance);
+
+        HistoryProcessInstance hip = historyService.createHistoryProcessInstanceQuery().uniqueResult();
+        assertNotNull(hip);
+    }
+*/
+}

Added: jbpm4/trunk/modules/examples/src/test/java/org/jbpm/examples/bpmn/event/signal/ThrowSignalEventTest.java
===================================================================
--- jbpm4/trunk/modules/examples/src/test/java/org/jbpm/examples/bpmn/event/signal/ThrowSignalEventTest.java	                        (rev 0)
+++ jbpm4/trunk/modules/examples/src/test/java/org/jbpm/examples/bpmn/event/signal/ThrowSignalEventTest.java	2010-11-17 16:57:06 UTC (rev 6830)
@@ -0,0 +1,59 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jbpm.examples.bpmn.event.signal;
+
+import org.jbpm.api.NewDeployment;
+import org.jbpm.api.ProcessInstance;
+import org.jbpm.api.history.HistoryProcessInstance;
+import org.jbpm.test.JbpmTestCase;
+
+/**
+ *
+ * @author Huisheng Xu
+ */
+public class ThrowSignalEventTest extends JbpmTestCase {
+
+    public void testInterruptingSignalThrowEvent() {
+        NewDeployment deployment = repositoryService.createDeployment();
+        deployment.addResourceFromClasspath("org/jbpm/examples/bpmn/event/signal/throw_signal_event_interrupting.bpmn.xml");
+        registerDeployment(deployment.deploy());
+
+        ProcessInstance processInstance = executionService.startProcessInstanceByKey("throw_signal_event");
+        // assertProcessInstanceEnded(processInstance);
+
+        HistoryProcessInstance hip = historyService.createHistoryProcessInstanceQuery().uniqueResult();
+        assertNotNull(hip);
+    }
+/*
+    public void testNoneInterruptingSignalBoundaryEvent() {
+        NewDeployment deployment = repositoryService.createDeployment();
+        deployment.addResourceFromClasspath("org/jbpm/examples/bpmn/event/signal/boundary_signal_event_none_interrupting.bpmn.xml");
+        registerDeployment(deployment.deploy());
+
+        ProcessInstance processInstance = executionService.startProcessInstanceByKey("boundary_signal_event");
+        // assertProcessInstanceEnded(processInstance);
+
+        HistoryProcessInstance hip = historyService.createHistoryProcessInstanceQuery().uniqueResult();
+        assertNotNull(hip);
+    }
+*/
+}

Added: jbpm4/trunk/modules/examples/src/test/resources/org/jbpm/examples/bpmn/event/escalation/throw_escalation_event_interrupting.bpmn.xml
===================================================================
--- jbpm4/trunk/modules/examples/src/test/resources/org/jbpm/examples/bpmn/event/escalation/throw_escalation_event_interrupting.bpmn.xml	                        (rev 0)
+++ jbpm4/trunk/modules/examples/src/test/resources/org/jbpm/examples/bpmn/event/escalation/throw_escalation_event_interrupting.bpmn.xml	2010-11-17 16:57:06 UTC (rev 6830)
@@ -0,0 +1,41 @@
+<?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/throw_escalation_event"
+  xmlns:jbpm="http://jbpm.org/bpmn2">
+
+  <signal id="MyEscalation" name="MyEscalation" />
+
+  <process id="throw_escalation_event" name="Escalation Throw 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="signal-event"/>
+      <intermediateThrowEvent id="signal-event" name="Signal Event">
+        <escalationEventDefinition escalationRef="MyEscalation"/>
+      </intermediateThrowEvent>
+      <sequenceFlow id="flow4" sourceRef="signal-event" targetRef="sub-task"/>
+      <userTask id="sub-task" name="User 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="boundarySignalEvent" name="Boundary Signal Event" attachedToRef="subProcess" >
+      <escalationEventDefinition escalationRef="MyEscalation" />
+    </boundaryEvent>
+    <sequenceFlow id="flow7" sourceRef="boundarySignalEvent" 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/signal/throw_signal_event_interrupting.bpmn.xml
===================================================================
--- jbpm4/trunk/modules/examples/src/test/resources/org/jbpm/examples/bpmn/event/signal/throw_signal_event_interrupting.bpmn.xml	                        (rev 0)
+++ jbpm4/trunk/modules/examples/src/test/resources/org/jbpm/examples/bpmn/event/signal/throw_signal_event_interrupting.bpmn.xml	2010-11-17 16:57:06 UTC (rev 6830)
@@ -0,0 +1,41 @@
+<?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/throw_signal_event"
+  xmlns:jbpm="http://jbpm.org/bpmn2">
+
+  <signal id="MySignal" name="MySignal" />
+
+  <process id="throw_signal_event" name="Signal Throw 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="signal-event"/>
+      <intermediateThrowEvent id="signal-event" name="Signal Event">
+        <signalEventDefinition signalRef="MySignal"/>
+      </intermediateThrowEvent>
+      <sequenceFlow id="flow4" sourceRef="signal-event" targetRef="sub-task"/>
+      <userTask id="sub-task" name="User 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="boundarySignalEvent" name="Boundary Signal Event" attachedToRef="subProcess" >
+      <signalEventDefinition signalRef="MySignal" />
+    </boundaryEvent>
+    <sequenceFlow id="flow7" sourceRef="boundarySignalEvent" 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