[jbpm-commits] JBoss JBPM SVN: r5969 - in jbpm4/trunk/modules: devguide/src/main/docbook/en/images and 7 other directories.

do-not-reply at jboss.org do-not-reply at jboss.org
Wed Dec 16 08:55:10 EST 2009


Author: jbarrez
Date: 2009-12-16 08:55:09 -0500 (Wed, 16 Dec 2009)
New Revision: 5969

Added:
   jbpm4/trunk/modules/devguide/src/main/docbook/en/images/bpmn2.terminate.end.event.example.png
   jbpm4/trunk/modules/examples/src/test/java/org/jbpm/examples/bpmn/event/terminateend/
   jbpm4/trunk/modules/examples/src/test/java/org/jbpm/examples/bpmn/event/terminateend/TerminateEndTest.java
   jbpm4/trunk/modules/examples/src/test/resources/org/jbpm/examples/bpmn/event/terminateend/
   jbpm4/trunk/modules/examples/src/test/resources/org/jbpm/examples/bpmn/event/terminateend/terminate_end_event.bpmn.xml
Modified:
   jbpm4/trunk/modules/bpmn/src/main/java/org/jbpm/bpmn/flownodes/EndBinding.java
   jbpm4/trunk/modules/devguide/src/main/docbook/en/modules/ch03-Bpmn2.xml
   jbpm4/trunk/modules/examples/src/test/java/org/jbpm/examples/bpmn/event/nonestartend/NoneStartEndEventTest.java
   jbpm4/trunk/modules/test-base/src/main/java/org/jbpm/test/JbpmTestCase.java
Log:
JBPM-2669: terminate end event

Modified: jbpm4/trunk/modules/bpmn/src/main/java/org/jbpm/bpmn/flownodes/EndBinding.java
===================================================================
--- jbpm4/trunk/modules/bpmn/src/main/java/org/jbpm/bpmn/flownodes/EndBinding.java	2009-12-16 11:34:19 UTC (rev 5968)
+++ jbpm4/trunk/modules/bpmn/src/main/java/org/jbpm/bpmn/flownodes/EndBinding.java	2009-12-16 13:55:09 UTC (rev 5969)
@@ -21,6 +21,7 @@
  */
 package org.jbpm.bpmn.flownodes;
 
+import org.jbpm.pvm.internal.util.XmlUtil;
 import org.jbpm.pvm.internal.xml.Parse;
 import org.jbpm.pvm.internal.xml.Parser;
 import org.w3c.dom.Element;
@@ -41,6 +42,14 @@
 
   public Object parse(Element element, Parse parse, Parser parser) {
     EndActivity endActivity = new EndActivity();
+    
+    Element terminateEventDefinition = XmlUtil.element(element, "terminateEventDefinition");
+    if (terminateEventDefinition != null) {
+    	endActivity.setEndProcessInstance(true); 	
+    } else {
+    	endActivity.setEndProcessInstance(false); // default is to end execution, not the process instance    
+    }
+    
     return endActivity;
   }
 }

Added: jbpm4/trunk/modules/devguide/src/main/docbook/en/images/bpmn2.terminate.end.event.example.png
===================================================================
(Binary files differ)


Property changes on: jbpm4/trunk/modules/devguide/src/main/docbook/en/images/bpmn2.terminate.end.event.example.png
___________________________________________________________________
Name: svn:mime-type
   + application/octet-stream

Modified: jbpm4/trunk/modules/devguide/src/main/docbook/en/modules/ch03-Bpmn2.xml
===================================================================
--- jbpm4/trunk/modules/devguide/src/main/docbook/en/modules/ch03-Bpmn2.xml	2009-12-16 11:34:19 UTC (rev 5968)
+++ jbpm4/trunk/modules/devguide/src/main/docbook/en/modules/ch03-Bpmn2.xml	2009-12-16 13:55:09 UTC (rev 5969)
@@ -146,7 +146,7 @@
   
   </section>
   
-  <section id="Bpmn2Constructs" >
+  <section id="Bpmn2Execution" >
   
     <title>Bpmn 2.0 execution</title>
 
@@ -202,6 +202,24 @@
     
     </section>
     
+    <section id="bpmn2Examples">
+    
+      <title>Examples</title>
+    
+      <para>
+        The examples that are shipped with the distribution also contain examples for every 
+        construct that is discussed in the following sections. Look for example BPMN 2.0
+        processes and test cases in the <emphasis role="bold">org.jbpm.examples.bpmn.* package
+        </emphasis>.
+      </para>
+      
+      <para>
+        See the userguide, chapter 2 (Installation), for a walktough on how to import the examples.
+        Look for the section <emphasis role="bold">'Importing the Examples'</emphasis>.
+      </para>
+    
+    </section>
+    
     <section id="basicConstructs">
     
       <title>Basic constructs</title>
@@ -239,6 +257,13 @@
             semantics. Process instances whose process definition has a 'none start event' are 
             created using the typical API calls on the <emphasis role="bold">executionService</emphasis>.
            </para>
+           
+           <para>
+            A none start event is defined as follows. An id is required, a name is optional.
+            <programlisting>
+&lt;startEvent id=&quot;start&quot;  name=&quot;myStart&quot; /&gt;            
+            </programlisting>
+           </para>
         
         </section>
         
@@ -259,8 +284,15 @@
            </para>
            
            <para>
+            A none end event is defined as follows. An id is required, a name is optional.
+            <programlisting>
+&lt;endEvent id=&quot;end&quot; name=&quot;myEnd&quot; /&gt;            
+            </programlisting>
+           </para>
+           
+           <para>
             The following example shows a process with only a none start and end event:
-             <mediaobject><imageobject><imagedata align="center" fileref="images/bpmn2.none.start.end.event.png"/></imageobject></mediaobject>
+            <mediaobject><imageobject><imagedata align="center" fileref="images/bpmn2.none.start.end.event.png"/></imageobject></mediaobject>
            </para>
            
            <para>
@@ -289,11 +321,44 @@
            </para>
         
         </section>
+        
+        <section id="terminateEndEvent">
+        
+          <title>Terminate end event</title>
+        
+          <para>
+            The difference between a 'terminate' and a <link linkend="noneEndEvent">'none' end event</link> 
+            lies in the fact how a path of execution is treated (or a 'token' in BPMN 2.0 terminology).
+            The 'terminate' end event will end the complete process instance, whereas the 'none' 
+            end event will only end the current path of execution. They both don't throw anything
+            when the end event is reached.
+          </para>
+          
+          <para>
+            A terminate end event is defined as follows. An id is required, a name is optional.
+            <programlisting>
+&lt;endEvent id=&quot;terminateEnd&quot; name=&quot;myTerminateEnd&quot;&gt;
+  &lt;terminateEventDefinition/&gt;
+&lt;/endEvent&gt;            
+            </programlisting>
+          </para>
+          
+          <para>
+            A terminate end event is depicted as a typical end event (circle with thick border), 
+            with a full circle as icon inside. In the following example, completing the 'task1'
+            will end the process instance, while completing the 'task2' will only end the path
+            of execution which enters the end event.
+            <mediaobject><imageobject><imagedata align="center" fileref="images/bpmn2.terminate.end.event.example.png"/></imageobject></mediaobject>
+            See the examples shipped with the jBPM distribution for the unit test and XML counterpart
+            of this business process.
+          </para>
+        
+        </section>
       
-      </section>
+      </section> <!-- End of basic events section -->
     
-    </section>
+    </section> <!-- End of basic constructs section -->
   
-  </section>
+  </section> <!-- End of Bpmn 2.0 execution section -->
   
 </chapter>

Modified: jbpm4/trunk/modules/examples/src/test/java/org/jbpm/examples/bpmn/event/nonestartend/NoneStartEndEventTest.java
===================================================================
--- jbpm4/trunk/modules/examples/src/test/java/org/jbpm/examples/bpmn/event/nonestartend/NoneStartEndEventTest.java	2009-12-16 11:34:19 UTC (rev 5968)
+++ jbpm4/trunk/modules/examples/src/test/java/org/jbpm/examples/bpmn/event/nonestartend/NoneStartEndEventTest.java	2009-12-16 13:55:09 UTC (rev 5969)
@@ -1,3 +1,24 @@
+/*
+ * 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.nonestartend;
 
 import org.jbpm.api.NewDeployment;

Added: jbpm4/trunk/modules/examples/src/test/java/org/jbpm/examples/bpmn/event/terminateend/TerminateEndTest.java
===================================================================
--- jbpm4/trunk/modules/examples/src/test/java/org/jbpm/examples/bpmn/event/terminateend/TerminateEndTest.java	                        (rev 0)
+++ jbpm4/trunk/modules/examples/src/test/java/org/jbpm/examples/bpmn/event/terminateend/TerminateEndTest.java	2009-12-16 13:55:09 UTC (rev 5969)
@@ -0,0 +1,65 @@
+/*
+ * 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.terminateend;
+
+import org.jbpm.api.NewDeployment;
+import org.jbpm.api.ProcessInstance;
+import org.jbpm.api.task.Task;
+import org.jbpm.test.JbpmTestCase;
+
+/**
+ * 
+ * @author Joram Barrez
+ */
+public class TerminateEndTest extends JbpmTestCase {
+	
+	@Override
+	protected void setUp() throws Exception {
+		super.setUp();
+		NewDeployment deployment = repositoryService.createDeployment();
+		deployment.addResourceFromClasspath("org/jbpm/examples/bpmn/event/terminateend/terminate_end_event.bpmn.xml");
+		registerDeployment(deployment.deploy());
+	}
+	
+	public void testCompleteTask1() {
+		ProcessInstance processInstance = executionService.startProcessInstanceByKey("terminateEndEvent");
+		Task task1 = taskService.createTaskQuery().activityName("task1").uniqueResult();
+		taskService.completeTask(task1.getId());
+		assertProcessInstanceEnded(processInstance);
+	}
+	
+	public void testCompleteTask2() {
+		ProcessInstance processInstance = executionService.startProcessInstanceByKey("terminateEndEvent");
+		Task task2 = taskService.createTaskQuery().activityName("task2").uniqueResult();
+		taskService.completeTask(task2.getId());
+		assertProcessInstanceActive(processInstance);
+		
+		// task1 should still be open
+		Task task1 = taskService.createTaskQuery().activityName("task1").uniqueResult();
+		assertNotNull(task2);
+		
+		// We can now finish the process
+		taskService.completeTask(task1.getId());
+		assertProcessInstanceEnded(processInstance);
+	}
+
+}

Added: jbpm4/trunk/modules/examples/src/test/resources/org/jbpm/examples/bpmn/event/terminateend/terminate_end_event.bpmn.xml
===================================================================
--- jbpm4/trunk/modules/examples/src/test/resources/org/jbpm/examples/bpmn/event/terminateend/terminate_end_event.bpmn.xml	                        (rev 0)
+++ jbpm4/trunk/modules/examples/src/test/resources/org/jbpm/examples/bpmn/event/terminateend/terminate_end_event.bpmn.xml	2009-12-16 13:55:09 UTC (rev 5969)
@@ -0,0 +1,39 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<definitions 
+  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+  xsi:schemaLocation="http://schema.omg.org/spec/BPMN/2.0 ../../../../../../../../../../bpmn/src/main/resources/BPMN20.xsd"
+  xmlns="http://schema.omg.org/spec/BPMN/2.0"
+  typeLanguage="http://www.w3.org/2001/XMLSchema"
+  expressionLanguage="http://www.w3.org/1999/XPath" 
+  targetNamespace="http://jbpm.org/example/bpmn2/terminate_end_event"
+  xmlns:jbpm="http://jbpm.org/bpmn2">
+
+  <process id="terminateEndEvent" name="BPMN2 Example terminate end event">
+
+    <startEvent id="start" />
+
+    <sequenceFlow id="flow1" name="fromStartToTask1"
+      sourceRef="start" targetRef="task1" />
+
+    <sequenceFlow id="flow2" name="fromStartToTask2"
+      sourceRef="start" targetRef="task2" />
+      
+    <userTask id="task1" name="task1" />
+    
+    <sequenceFlow id="flow3" name="fromTask1ToTerminateEnd"
+      sourceRef="task1" targetRef="terminateEnd" />
+      
+    <endEvent id="terminateEnd" name="terminateEnd">
+      <terminateEventDefinition/>
+    </endEvent>
+    
+    <userTask id="task2" name="task2" />
+    
+     <sequenceFlow id="flow4" name="fromTask2ToEnd"
+      sourceRef="task2" targetRef="noneEnd" />
+
+    <endEvent id="noneEnd" name="noneEnd" />
+
+  </process>
+  
+</definitions>

Modified: jbpm4/trunk/modules/test-base/src/main/java/org/jbpm/test/JbpmTestCase.java
===================================================================
--- jbpm4/trunk/modules/test-base/src/main/java/org/jbpm/test/JbpmTestCase.java	2009-12-16 11:34:19 UTC (rev 5968)
+++ jbpm4/trunk/modules/test-base/src/main/java/org/jbpm/test/JbpmTestCase.java	2009-12-16 13:55:09 UTC (rev 5969)
@@ -217,6 +217,10 @@
     assertExecutionEnded(processInstance.getId());
   }
   
+  public void assertProcessInstanceActive(ProcessInstance processInstance) {
+	  assertProcessInstanceActive(processInstance.getId());
+  }
+  
   public void assertProcessInstanceActive(String processInstanceId) {
     assertNotNull("Error: an active process instance with id " + processInstanceId + " was not found",
             executionService.findProcessInstanceById(processInstanceId));



More information about the jbpm-commits mailing list