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

do-not-reply at jboss.org do-not-reply at jboss.org
Tue May 19 10:29:46 EDT 2009


Author: tom.baeyens at jboss.com
Date: 2009-05-19 10:29:46 -0400 (Tue, 19 May 2009)
New Revision: 4849

Added:
   jbpm4/trunk/modules/devguide/src/main/docbook/en/modules/ch08-AdvancedJpdl.xml
   jbpm4/trunk/modules/devguide/src/main/docbook/en/modules/ch09-Persistence.xml
   jbpm4/trunk/modules/test-db/src/test/java/org/jbpm/examples/
   jbpm4/trunk/modules/test-db/src/test/java/org/jbpm/examples/goup/
   jbpm4/trunk/modules/test-db/src/test/java/org/jbpm/examples/goup/concurrency/
   jbpm4/trunk/modules/test-db/src/test/java/org/jbpm/examples/goup/concurrency/GroupConcurrencyTest.java
   jbpm4/trunk/modules/test-db/src/test/java/org/jbpm/examples/goup/multipleentries/
   jbpm4/trunk/modules/test-db/src/test/java/org/jbpm/examples/goup/multipleentries/MultipleEntriesTest.java
   jbpm4/trunk/modules/test-db/src/test/java/org/jbpm/examples/goup/simple/
   jbpm4/trunk/modules/test-db/src/test/java/org/jbpm/examples/goup/simple/GroupSimpleTest.java
   jbpm4/trunk/modules/test-db/src/test/java/org/jbpm/examples/goup/timer/
   jbpm4/trunk/modules/test-db/src/test/java/org/jbpm/examples/goup/timer/GroupTimerTest.java
   jbpm4/trunk/modules/test-db/src/test/resources/org/jbpm/examples/
   jbpm4/trunk/modules/test-db/src/test/resources/org/jbpm/examples/group/
   jbpm4/trunk/modules/test-db/src/test/resources/org/jbpm/examples/group/concurrency/
   jbpm4/trunk/modules/test-db/src/test/resources/org/jbpm/examples/group/concurrency/process.jpdl.xml
   jbpm4/trunk/modules/test-db/src/test/resources/org/jbpm/examples/group/multipleentries/
   jbpm4/trunk/modules/test-db/src/test/resources/org/jbpm/examples/group/multipleentries/process.jpdl.xml
   jbpm4/trunk/modules/test-db/src/test/resources/org/jbpm/examples/group/simple/
   jbpm4/trunk/modules/test-db/src/test/resources/org/jbpm/examples/group/simple/process.jpdl.xml
   jbpm4/trunk/modules/test-db/src/test/resources/org/jbpm/examples/group/timer/
   jbpm4/trunk/modules/test-db/src/test/resources/org/jbpm/examples/group/timer/process.jpdl.xml
Removed:
   jbpm4/trunk/modules/devguide/src/main/docbook/en/modules/ch08-Persistence.xml
Modified:
   jbpm4/trunk/modules/devguide/src/main/docbook/en/master.xml
   jbpm4/trunk/modules/devguide/src/main/docbook/en/modules/ch03-Configuration.xml
   jbpm4/trunk/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/activity/JpdlBinding.java
   jbpm4/trunk/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/xml/JpdlParser.java
Log:
JBPM-2026 documented group activity in the devguide

Modified: jbpm4/trunk/modules/devguide/src/main/docbook/en/master.xml
===================================================================
--- jbpm4/trunk/modules/devguide/src/main/docbook/en/master.xml	2009-05-19 14:28:27 UTC (rev 4848)
+++ jbpm4/trunk/modules/devguide/src/main/docbook/en/master.xml	2009-05-19 14:29:46 UTC (rev 4849)
@@ -8,7 +8,8 @@
   <!ENTITY ch05-ImplementingBasicActivities    SYSTEM "modules/ch05-ImplementingBasicActivities.xml">
   <!ENTITY ch06-ProcessAnatomy                 SYSTEM "modules/ch06-ProcessAnatomy.xml">
   <!ENTITY ch07-ImplementingAdvancedActivities SYSTEM "modules/ch07-ImplementingAdvancedActivities.xml">
-  <!ENTITY ch08-Persistence                    SYSTEM "modules/ch08-Persistence.xml">
+  <!ENTITY ch08-AdvancedJpdl                   SYSTEM "modules/ch08-AdvancedJpdl.xml">
+  <!ENTITY ch09-Persistence                    SYSTEM "modules/ch09-Persistence.xml">
   <!ENTITY ch10-SoftwareLogging                SYSTEM "modules/ch10-SoftwareLogging.xml">
   <!ENTITY ch11-History                        SYSTEM "modules/ch11-History.xml">
 ]>
@@ -28,7 +29,8 @@
   &ch05-ImplementingBasicActivities;
   &ch06-ProcessAnatomy;
   &ch07-ImplementingAdvancedActivities;
-  &ch08-Persistence;
+  &ch08-AdvancedJpdl;
+  &ch09-Persistence;
   &ch10-SoftwareLogging;
   &ch11-History;
 

Modified: jbpm4/trunk/modules/devguide/src/main/docbook/en/modules/ch03-Configuration.xml
===================================================================
--- jbpm4/trunk/modules/devguide/src/main/docbook/en/modules/ch03-Configuration.xml	2009-05-19 14:28:27 UTC (rev 4848)
+++ jbpm4/trunk/modules/devguide/src/main/docbook/en/modules/ch03-Configuration.xml	2009-05-19 14:29:46 UTC (rev 4849)
@@ -1,6 +1,13 @@
 <chapter id="configuration">
   <title>Configuration</title>
   
+  <para>The userguide explains how to install jBPM into the most 
+  common runtime environments.  That is the most simple and convenient 
+  way to get started with jBPM. Please use those instructions.
+  These docs provide some background information for developers 
+  that want to understand more about the way how configurations are 
+  handled.  Use at your own risk :-)
+  </para>
   <para>The jbpm.jar contains a number of default configuration 
   files that can be imported by the user configuration file.  
   </para>

Added: jbpm4/trunk/modules/devguide/src/main/docbook/en/modules/ch08-AdvancedJpdl.xml
===================================================================
--- jbpm4/trunk/modules/devguide/src/main/docbook/en/modules/ch08-AdvancedJpdl.xml	                        (rev 0)
+++ jbpm4/trunk/modules/devguide/src/main/docbook/en/modules/ch08-AdvancedJpdl.xml	2009-05-19 14:29:46 UTC (rev 4849)
@@ -0,0 +1,314 @@
+<chapter id="advancedjpdl">
+  <title>Advanced jPDL</title>
+
+  <para>This section documents some of the more advanced activities and 
+  features of jPDL that are still in incubation.  Meaning these features 
+  and activities are not supported yet.  But they are available for you
+  to try and use.  We don't give any stability guarantees on these 
+  activities and features.  So use at your own risk.
+  </para>
+
+  <!-- ### GROUP ########################################################## -->
+  <section id="group">
+    <title><literal>group</literal></title>
+    
+    <para>A group groups a set of activities in a process.  Contained groups must  
+    be hierarchically nested.  A group corresponds to a BPMN expanded sub process.
+    </para>
+
+    <table><title><literal>group</literal> elements:</title>
+      <tgroup cols="3" rowsep="1" colsep="1">
+        <thead>
+          <row>
+            <entry>Element</entry>
+            <entry>Multiplicity</entry>
+            <entry>Description</entry>
+          </row>
+        </thead>
+        <tbody>
+          <row>
+            <entry>any activity</entry>
+            <entry>0..*</entry>
+            <entry>Contained activities.
+            </entry>
+          </row>
+          <row>
+            <entry><literal>transition</literal></entry>
+            <entry>0..*</entry>
+            <entry>Outgoing transitions for the group activity.
+            </entry>
+          </row>
+        </tbody>
+      </tgroup>
+    </table>
+
+    <!-- ~~~ GROUP SIMPLE ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -->
+    <section id="groupsimple">
+      <title><literal>group</literal> simple</title>
+      <para>This example scenario shows the basic operations of a <literal>group</literal>.
+      </para>
+      <figure id="process.group.simple">
+        <title>The simple group example process</title>
+        <mediaobject><imageobject><imagedata align="center" fileref="images/process.group.simple.png"/></imageobject></mediaobject>
+      </figure>
+      <programlisting>&lt;process name=&quot;GroupSimple&quot; xmlns=&quot;http://jbpm.org/4.0/jpdl&quot;&gt;
+
+  &lt;start&gt;
+    &lt;transition to=&quot;evaluate document&quot; /&gt;
+  &lt;/start&gt;
+  
+  <emphasis role="bold">&lt;group name=&quot;evaluate document&quot;&gt;</emphasis>
+    &lt;start&gt;
+      &lt;transition to=&quot;distribute document&quot; /&gt;
+    &lt;/start&gt;
+    &lt;state name=&quot;distribute document&quot;&gt;
+      &lt;transition to=&quot;collect feedback&quot; /&gt;
+    &lt;/state&gt;
+    &lt;state name=&quot;collect feedback&quot;&gt;
+      &lt;transition name=&quot;approved&quot; to=&quot;done&quot; /&gt;
+      &lt;transition name=&quot;rejected&quot; to=&quot;update document&quot; /&gt;
+    &lt;/state&gt;
+    &lt;state name=&quot;update document&quot;&gt;
+      &lt;transition to=&quot;distribute document&quot; /&gt;
+    &lt;/state&gt;
+    &lt;end name=&quot;done&quot; /&gt;
+    &lt;transition to=&quot;publish document&quot; /&gt;
+  <emphasis role="bold">&lt;/group&gt;</emphasis>
+  
+  &lt;state name=&quot;publish document&quot; /&gt;
+
+&lt;/process&gt;</programlisting>
+      <para>The next code snippet shows a test scenario that rejects a document
+      when it comes in the <literal>collect feedback</literal> first time round.
+      Then it goes through <literal>update document</literal>, <literal>distribute document</literal>
+      and back to <literal>collect feedback</literal>.  The second time,  
+      it will be approved.  All activities involved are wait <literal>state</literal>s.
+      </para>
+      <programlisting>ProcessInstance processInstance = executionService
+       .startProcessInstanceByKey(&quot;GroupSimple&quot;);
+String pid = processInstance.getId();
+assertEquals(&quot;distribute document&quot;, processInstance.getActivityName());
+
+processInstance = executionService.signalExecutionById(pid);
+assertEquals(&quot;collect feedback&quot;, processInstance.getActivityName());
+
+processInstance = executionService.signalExecutionById(pid, &quot;rejected&quot;);
+assertEquals(&quot;update document&quot;, processInstance.getActivityName());
+
+processInstance = executionService.signalExecutionById(pid);
+assertEquals(&quot;distribute document&quot;, processInstance.getActivityName());
+
+processInstance = executionService.signalExecutionById(pid);
+assertEquals(&quot;collect feedback&quot;, processInstance.getActivityName());
+
+processInstance = executionService.signalExecutionById(pid, &quot;approved&quot;);
+assertEquals(&quot;publish document&quot;, processInstance.getActivityName());</programlisting>
+    </section>
+
+    <!-- ~~~ GROUP TIMER ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -->
+    <section id="grouptimer">
+      <title><literal>group</literal> timer</title>
+      <figure id="process.group.timer">
+        <title>The group timer example process</title>
+        <mediaobject><imageobject><imagedata align="center" fileref="images/process.group.timer.png"/></imageobject></mediaobject>
+      </figure>
+      <programlisting>&lt;process name=&quot;GroupTimer&quot; xmlns=&quot;http://jbpm.org/4.0/jpdl&quot;&gt;
+
+  &lt;start&gt;
+    &lt;transition to=&quot;evaluate document&quot; /&gt;
+  &lt;/start&gt;
+  
+  <emphasis role="bold">&lt;group name=&quot;evaluate document&quot;&gt;</emphasis>
+    &lt;start&gt;
+      &lt;transition to=&quot;approve&quot; /&gt;
+    &lt;/start&gt;
+    &lt;state name=&quot;approve&quot;&gt;
+      &lt;transition to=&quot;done&quot; /&gt;
+    &lt;/state&gt;
+    &lt;end name=&quot;done&quot; /&gt;
+    
+    &lt;transition to=&quot;publish document&quot; /&gt;
+    <emphasis role="bold">&lt;transition name=&quot;timeout&quot; to=&quot;escalate&quot;&gt;
+      &lt;timer duedate=&quot;2 business hours&quot; /&gt;
+    &lt;/transition&gt;</emphasis>
+    
+  <emphasis role="bold">&lt;/group&gt;</emphasis>
+  
+  &lt;state name=&quot;escalate&quot; /&gt;
+  &lt;state name=&quot;publish document&quot; /&gt;
+
+&lt;/process&gt;</programlisting>
+      <para>The next code snippet shows a test scenario in which the timer will 
+      fire before the group activity <literal>evaluate document</literal> completes.
+      </para>
+      <programlisting>ProcessInstance processInstance = executionService
+       .startProcessInstanceByKey(&quot;GroupTimer&quot;);
+Execution approveExecution = processInstance
+       .findActiveExecutionIn(&quot;approve&quot;);
+assertNotNull(approveExecution);
+
+List&lt;Job&gt; jobs = managementService
+  .createJobQuery()
+  .processInstanceId(processInstance.getId())
+  .list();
+
+assertEquals(1, jobs.size());
+
+Timer timer = (Timer) jobs.get(0);
+
+managementService.executeJob(timer.getDbid());
+
+processInstance = executionService
+       .findProcessInstanceById(processInstance.getId());
+assertNotNull(processInstance.findActiveExecutionIn(&quot;escalate&quot;) );</programlisting>
+    </section>
+
+    <!-- ~~~ GROUP MULTIPLE ENTRIES ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -->
+    <section id="groupmultipleentries">
+      <title><literal>group</literal> multiple entries</title>
+      <para>This shows how a group can have multiple exclusive entry points.</para>
+      <para>Analogue to multiple entry points, a group can also have 
+      multiple exit points.</para>
+      <figure id="process.group.multipleentries">
+        <title>The group multiple entries example process</title>
+        <mediaobject><imageobject><imagedata align="center" fileref="images/process.group.multipleentries.png"/></imageobject></mediaobject>
+      </figure>
+      <programlisting>&lt;process name=&quot;GroupMultipleEntries&quot; xmlns=&quot;http://jbpm.org/4.0/jpdl&quot;&gt;
+
+  &lt;start&gt;
+    &lt;transition to=&quot;choose strategy&quot; /&gt;
+  &lt;/start&gt;
+  
+  &lt;decision name=&quot;choose strategy&quot; expr=&quot;#{time}&quot;&gt;
+    <emphasis role="bold">&lt;transition name=&quot;plenty&quot; to=&quot;play&quot; /&gt;
+    &lt;transition name=&quot;running out&quot; to=&quot;plan&quot; /&gt;</emphasis>
+  &lt;/decision&gt;
+  
+  &lt;group name=&quot;evaluate project&quot;&gt;
+    <emphasis role="bold">&lt;start name=&quot;play&quot;&gt;
+      &lt;transition to=&quot;distribute document&quot; /&gt;
+    &lt;/start&gt;</emphasis>
+    &lt;state name=&quot;distribute document&quot; /&gt;
+
+    <emphasis role="bold">&lt;start name=&quot;plan&quot;&gt;
+      &lt;transition to=&quot;make planning&quot; /&gt;
+    &lt;/start&gt;</emphasis>
+    &lt;state name=&quot;make planning&quot; /&gt;
+  &lt;/group&gt;
+  
+&lt;/process&gt;</programlisting>
+      <para>The following scenario will be when there is plenty of time: 
+      </para>
+      <programlisting>Map&lt;String, Object&gt; variables = new HashMap&lt;String, Object&gt;();
+variables.put(&quot;time&quot;, &quot;plenty&quot;);
+
+ProcessInstance pi = executionService
+    .startProcessInstanceByKey(&quot;GroupMultipleEntries&quot;, variables);
+
+assertNotNull(pi.findActiveExecutionIn(&quot;distribute document&quot;));</programlisting>
+      <para>The following scenario will be when there is time is running out: 
+      </para>
+      <programlisting>Map&lt;String, Object&gt; variables = new HashMap&lt;String, Object&gt;();
+variables.put(&quot;time&quot;, &quot;running out&quot;);
+
+ProcessInstance pi = executionService
+    .startProcessInstanceByKey(&quot;GroupMultipleEntries&quot;, variables);
+
+assertNotNull(pi.findActiveExecutionIn(&quot;make planning&quot;));</programlisting>
+    </section>
+    
+    <!-- ~~~ GROUP CONCURRENCY ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -->
+    <section id="groupconcurrency">
+      <title><literal>group</literal> concurrency</title>
+      <para>This scenario shows how a group can be used to create concurrent paths 
+      of execution.  When an execution arrives in a group, each activity that doesn't 
+      have incoming transitions is started.  So the first activities don't have to be 
+      start activities.  The group takes the default transition out when all contained 
+      work is done.
+      </para>
+      <figure id="process.group.concurrency">
+        <title>The group concurrency example process</title>
+        <mediaobject><imageobject><imagedata align="center" fileref="images/process.group.concurrency.png"/></imageobject></mediaobject>
+      </figure>
+      <programlisting>
+
+&lt;process name=&quot;GroupConcurrency&quot; xmlns=&quot;http://jbpm.org/4.0/jpdl&quot;&gt;
+
+  &lt;start&gt;
+    &lt;transition to=&quot;evaluate project&quot; /&gt;
+  &lt;/start&gt;
+  
+  &lt;group name=&quot;evaluate project&quot;&gt;
+    <emphasis role="bold">&lt;start&gt;
+      &lt;transition to=&quot;distribute document&quot; /&gt;
+    &lt;/start&gt;</emphasis>
+    &lt;state name=&quot;distribute document&quot;&gt;
+      &lt;transition to=&quot;collect feedback&quot; /&gt;
+    &lt;/state&gt;
+    &lt;state name=&quot;collect feedback&quot;&gt;
+      &lt;transition to=&quot;document finished&quot; /&gt;
+    &lt;/state&gt;
+    &lt;end name=&quot;document finished&quot; /&gt;
+
+    <emphasis role="bold">&lt;start&gt;
+      &lt;transition to=&quot;make planning&quot; /&gt;
+    &lt;/start&gt;</emphasis>
+    &lt;state name=&quot;make planning&quot;&gt;
+      &lt;transition to=&quot;estimate budget&quot; /&gt;
+    &lt;/state&gt;
+    &lt;state name=&quot;estimate budget&quot;&gt;
+      &lt;transition to=&quot;planning finished&quot; /&gt;
+    &lt;/state&gt;
+    &lt;end name=&quot;planning finished&quot; /&gt;
+
+    &lt;transition to=&quot;public project announcement&quot; /&gt;
+  &lt;/group&gt;
+  
+  &lt;state name=&quot;public project announcement&quot; /&gt;
+
+&lt;/process&gt;</programlisting>
+      <para>The following scenario will show a scenario in which all 
+      wait <literal>state</literal> acitivities are signalled in some random
+      order till all work is done:  
+      </para>
+      <programlisting>ProcessInstance pi = executionService
+    .startProcessInstanceByKey(&quot;GroupConcurrency&quot;);
+
+String documentExecutionId = pi
+    .findActiveExecutionIn(&quot;distribute document&quot;).getId();
+
+String planningExecutionId = pi
+    .findActiveExecutionIn(&quot;make planning&quot;).getId();
+
+pi = executionService.signalExecutionById(documentExecutionId);
+assertNotNull(pi.findActiveExecutionIn(&quot;collect feedback&quot;));
+assertNotNull(pi.findActiveExecutionIn(&quot;make planning&quot;));
+
+pi = executionService.signalExecutionById(planningExecutionId);
+assertNotNull(pi.findActiveExecutionIn(&quot;collect feedback&quot;));
+assertNotNull(pi.findActiveExecutionIn(&quot;estimate budget&quot;));
+
+pi = executionService.signalExecutionById(planningExecutionId);
+assertNotNull(pi.findActiveExecutionIn(&quot;collect feedback&quot;));
+
+pi = executionService.signalExecutionById(documentExecutionId);
+assertNotNull(pi.findActiveExecutionIn(&quot;public project announcement&quot;));</programlisting>
+    
+    </section>
+
+    <!-- ~~~ GROUP SECRET ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -->
+    <section id="groupsecret">
+      <title><literal>group</literal> secret</title>
+      <para>Groups also support that you create transitions over group 
+      boundaries.  So it's possible to have a tranition from an activity 
+      outside the group directly to an activity inside the group without 
+      modelling a start activity on the border of the group.  Similarly 
+      with transitions from activities inside the group to activities 
+      outside the group.  But shhhhhhhhh!
+      Don't tell anyone cause this is not BPMN compliant.
+      </para>
+    </section> 
+    
+  </section>
+
+</chapter>


Property changes on: jbpm4/trunk/modules/devguide/src/main/docbook/en/modules/ch08-AdvancedJpdl.xml
___________________________________________________________________
Name: svn:mime-type
   + text/plain

Deleted: jbpm4/trunk/modules/devguide/src/main/docbook/en/modules/ch08-Persistence.xml
===================================================================
--- jbpm4/trunk/modules/devguide/src/main/docbook/en/modules/ch08-Persistence.xml	2009-05-19 14:28:27 UTC (rev 4848)
+++ jbpm4/trunk/modules/devguide/src/main/docbook/en/modules/ch08-Persistence.xml	2009-05-19 14:29:46 UTC (rev 4849)
@@ -1,15 +0,0 @@
-<chapter id="persistence">
-  <title>Persistence</title>
-
-  <para>Currently jBPM's persistence is based on hibernate.  But in the future we might 
-  switch to JPA.  That is why we recommend to stick with the API as much as possible as 
-  the API will hide you from those changes.
-  </para>
-
-  <para>TODO: leveraging the db for managing concurrent access
-  </para>
-  <para>TODO: hibernate-session and the standard transaction
-  </para>
-  <para>TODO: process definition caching
-  </para>
-</chapter>
\ No newline at end of file

Copied: jbpm4/trunk/modules/devguide/src/main/docbook/en/modules/ch09-Persistence.xml (from rev 4838, jbpm4/trunk/modules/devguide/src/main/docbook/en/modules/ch08-Persistence.xml)
===================================================================
--- jbpm4/trunk/modules/devguide/src/main/docbook/en/modules/ch09-Persistence.xml	                        (rev 0)
+++ jbpm4/trunk/modules/devguide/src/main/docbook/en/modules/ch09-Persistence.xml	2009-05-19 14:29:46 UTC (rev 4849)
@@ -0,0 +1,15 @@
+<chapter id="persistence">
+  <title>Persistence</title>
+
+  <para>Currently jBPM's persistence is based on hibernate.  But in the future we might 
+  switch to JPA.  That is why we recommend to stick with the API as much as possible as 
+  the API will hide you from those changes.
+  </para>
+
+  <para>TODO: leveraging the db for managing concurrent access
+  </para>
+  <para>TODO: hibernate-session and the standard transaction
+  </para>
+  <para>TODO: process definition caching
+  </para>
+</chapter>
\ No newline at end of file

Modified: jbpm4/trunk/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/activity/JpdlBinding.java
===================================================================
--- jbpm4/trunk/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/activity/JpdlBinding.java	2009-05-19 14:28:27 UTC (rev 4848)
+++ jbpm4/trunk/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/activity/JpdlBinding.java	2009-05-19 14:29:46 UTC (rev 4849)
@@ -21,14 +21,9 @@
  */
 package org.jbpm.jpdl.internal.activity;
 
-import java.util.List;
 
-import org.jbpm.api.model.Event;
 import org.jbpm.jpdl.internal.xml.JpdlParser;
-import org.jbpm.jpdl.internal.xml.UnresolvedTransitions;
 import org.jbpm.pvm.internal.model.ActivityImpl;
-import org.jbpm.pvm.internal.model.TimerDefinitionImpl;
-import org.jbpm.pvm.internal.model.TransitionImpl;
 import org.jbpm.pvm.internal.util.TagBinding;
 import org.jbpm.pvm.internal.util.XmlUtil;
 import org.jbpm.pvm.internal.wire.xml.WireParser;
@@ -66,29 +61,4 @@
   public boolean isNameRequired() {
     return true;
   }
-
-  public void parseTransitions(Element element, ActivityImpl activity, Parse parse, JpdlParser jpdlParser) {
-    List<Element> transitionElements = XmlUtil.elements(element, "transition");
-    UnresolvedTransitions unresolvedTransitions = parse.findObject(UnresolvedTransitions.class);
-    for (Element transitionElement: transitionElements) {
-      String transitionName = XmlUtil.attribute(transitionElement, "name", false, parse);
-
-      Element timerElement = XmlUtil.element(transitionElement, "timer");
-      if (timerElement!=null) {
-        if (transitionName!=null) {
-          TimerDefinitionImpl timerDefinitionImpl = jpdlParser.parseTimerDefinition(timerElement, parse, activity);
-          timerDefinitionImpl.setSignalName(transitionName);
-        } else {
-          parse.addProblem("a transition name is required when a timer is placed on a transition", null, "error", element);
-        }
-      }
-
-      TransitionImpl transition = activity.createOutgoingTransition();
-      transition.setName(transitionName);
-
-      unresolvedTransitions.add(transition, transitionElement);
-      
-      jpdlParser.parseOnEvent(transitionElement, transition, Event.TAKE, parse);
-    }
-  }
 }

Modified: jbpm4/trunk/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/xml/JpdlParser.java
===================================================================
--- jbpm4/trunk/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/xml/JpdlParser.java	2009-05-19 14:28:27 UTC (rev 4848)
+++ jbpm4/trunk/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/xml/JpdlParser.java	2009-05-19 14:29:46 UTC (rev 4849)
@@ -34,6 +34,7 @@
 import org.jbpm.api.activity.ActivityBehaviour;
 import org.jbpm.api.env.Environment;
 import org.jbpm.api.listener.EventListener;
+import org.jbpm.api.model.Event;
 import org.jbpm.internal.log.Log;
 import org.jbpm.jpdl.internal.activity.JpdlBinding;
 import org.jbpm.jpdl.internal.model.JpdlProcessDefinition;
@@ -235,7 +236,7 @@
           try {
             activity.setType(activityBinding.getTagName());
             activityBinding.parseName(nestedElement, activity, parse);
-            activityBinding.parseTransitions(nestedElement, activity, parse, this);
+            parseTransitions(nestedElement, activity, parse);
 
             if (XmlUtil.attributeBoolean(nestedElement, "async", false, parse, Boolean.FALSE)) {
               activity.setAsync(true);
@@ -360,6 +361,27 @@
     }
   }
 
+  public void parseTransitions(Element element, ActivityImpl activity, Parse parse) {
+    List<Element> transitionElements = XmlUtil.elements(element, "transition");
+    UnresolvedTransitions unresolvedTransitions = parse.findObject(UnresolvedTransitions.class);
+    for (Element transitionElement: transitionElements) {
+      String transitionName = XmlUtil.attribute(transitionElement, "name", false, parse);
+
+      Element timerElement = XmlUtil.element(transitionElement, "timer");
+      if (timerElement!=null) {
+        TimerDefinitionImpl timerDefinitionImpl = parseTimerDefinition(timerElement, parse, activity);
+        timerDefinitionImpl.setSignalName(transitionName);
+      }
+  
+      TransitionImpl transition = activity.createOutgoingTransition();
+      transition.setName(transitionName);
+  
+      unresolvedTransitions.add(transition, transitionElement);
+      
+      parseOnEvent(transitionElement, transition, Event.TAKE, parse);
+    }
+  }
+
   public static void parseAssignmentAttributes(Element element, AssignableDefinitionImpl assignableDefinition, Parse parse) {
     Element descriptionElement = XmlUtil.element(element, "description");
     if (descriptionElement!=null) {

Added: jbpm4/trunk/modules/test-db/src/test/java/org/jbpm/examples/goup/concurrency/GroupConcurrencyTest.java
===================================================================
--- jbpm4/trunk/modules/test-db/src/test/java/org/jbpm/examples/goup/concurrency/GroupConcurrencyTest.java	                        (rev 0)
+++ jbpm4/trunk/modules/test-db/src/test/java/org/jbpm/examples/goup/concurrency/GroupConcurrencyTest.java	2009-05-19 14:29:46 UTC (rev 4849)
@@ -0,0 +1,73 @@
+/*
+ * 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.goup.concurrency;
+
+import org.jbpm.api.ProcessInstance;
+import org.jbpm.test.JbpmTestCase;
+
+
+/**
+ * @author Tom Baeyens
+ */
+public class GroupConcurrencyTest extends JbpmTestCase {
+
+  long deploymentDbid;
+  
+  protected void setUp() throws Exception {
+    super.setUp();
+    
+    deploymentDbid = repositoryService.createDeployment()
+        .addResourceFromClasspath("org/jbpm/examples/group/concurrency/process.jpdl.xml")
+        .deploy();
+  }
+
+  protected void tearDown() throws Exception {
+    repositoryService.deleteDeploymentCascade(deploymentDbid);
+    
+    super.tearDown();
+  }
+
+  public void testOneFeedbackLoop() {
+    ProcessInstance pi = executionService
+        .startProcessInstanceByKey("GroupConcurrency");
+    
+    String documentExecutionId = pi
+        .findActiveExecutionIn("distribute document").getId();
+    
+    String planningExecutionId = pi
+        .findActiveExecutionIn("make planning").getId();
+    
+    pi = executionService.signalExecutionById(documentExecutionId);
+    assertNotNull(pi.findActiveExecutionIn("collect feedback"));
+    assertNotNull(pi.findActiveExecutionIn("make planning"));
+    
+    pi = executionService.signalExecutionById(planningExecutionId);
+    assertNotNull(pi.findActiveExecutionIn("collect feedback"));
+    assertNotNull(pi.findActiveExecutionIn("estimate budget"));
+    
+    pi = executionService.signalExecutionById(planningExecutionId);
+    assertNotNull(pi.findActiveExecutionIn("collect feedback"));
+    
+    pi = executionService.signalExecutionById(documentExecutionId);
+    assertNotNull(pi.findActiveExecutionIn("public project announcement"));
+  }
+}


Property changes on: jbpm4/trunk/modules/test-db/src/test/java/org/jbpm/examples/goup/concurrency/GroupConcurrencyTest.java
___________________________________________________________________
Name: svn:mime-type
   + text/plain

Added: jbpm4/trunk/modules/test-db/src/test/java/org/jbpm/examples/goup/multipleentries/MultipleEntriesTest.java
===================================================================
--- jbpm4/trunk/modules/test-db/src/test/java/org/jbpm/examples/goup/multipleentries/MultipleEntriesTest.java	                        (rev 0)
+++ jbpm4/trunk/modules/test-db/src/test/java/org/jbpm/examples/goup/multipleentries/MultipleEntriesTest.java	2009-05-19 14:29:46 UTC (rev 4849)
@@ -0,0 +1,72 @@
+/*
+ * 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.goup.multipleentries;
+
+import java.util.HashMap;
+import java.util.Map;
+
+import org.jbpm.api.ProcessInstance;
+import org.jbpm.test.JbpmTestCase;
+
+
+/**
+ * @author Tom Baeyens
+ */
+public class MultipleEntriesTest extends JbpmTestCase {
+
+  
+  long deploymentDbid;
+  
+  protected void setUp() throws Exception {
+    super.setUp();
+    
+    deploymentDbid = repositoryService.createDeployment()
+        .addResourceFromClasspath("org/jbpm/examples/group/multipleentries/process.jpdl.xml")
+        .deploy();
+  }
+
+  protected void tearDown() throws Exception {
+    repositoryService.deleteDeploymentCascade(deploymentDbid);
+    
+    super.tearDown();
+  }
+
+  public void testPlentyOfTime() {
+    Map<String, Object> variables = new HashMap<String, Object>();
+    variables.put("time", "plenty");
+    
+    ProcessInstance pi = executionService
+        .startProcessInstanceByKey("GroupMultipleEntries", variables);
+    
+    assertNotNull(pi.findActiveExecutionIn("distribute document"));
+  }
+
+  public void testTimeIsRunningOut() {
+    Map<String, Object> variables = new HashMap<String, Object>();
+    variables.put("time", "running out");
+    
+    ProcessInstance pi = executionService
+        .startProcessInstanceByKey("GroupMultipleEntries", variables);
+    
+    assertNotNull(pi.findActiveExecutionIn("make planning"));
+  }
+}


Property changes on: jbpm4/trunk/modules/test-db/src/test/java/org/jbpm/examples/goup/multipleentries/MultipleEntriesTest.java
___________________________________________________________________
Name: svn:mime-type
   + text/plain

Added: jbpm4/trunk/modules/test-db/src/test/java/org/jbpm/examples/goup/simple/GroupSimpleTest.java
===================================================================
--- jbpm4/trunk/modules/test-db/src/test/java/org/jbpm/examples/goup/simple/GroupSimpleTest.java	                        (rev 0)
+++ jbpm4/trunk/modules/test-db/src/test/java/org/jbpm/examples/goup/simple/GroupSimpleTest.java	2009-05-19 14:29:46 UTC (rev 4849)
@@ -0,0 +1,72 @@
+/*
+ * 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.goup.simple;
+
+import org.jbpm.api.ProcessInstance;
+import org.jbpm.test.JbpmTestCase;
+
+
+/**
+ * @author Tom Baeyens
+ */
+/**
+ * @author Tom Baeyens
+ */
+public class GroupSimpleTest extends JbpmTestCase {
+
+  long deploymentDbid;
+  
+  protected void setUp() throws Exception {
+    super.setUp();
+    
+    deploymentDbid = repositoryService.createDeployment()
+        .addResourceFromClasspath("org/jbpm/examples/group/simple/process.jpdl.xml")
+        .deploy();
+  }
+
+  protected void tearDown() throws Exception {
+    repositoryService.deleteDeploymentCascade(deploymentDbid);
+    
+    super.tearDown();
+  }
+
+  public void testOneFeedbackLoop() {
+    ProcessInstance processInstance = executionService.startProcessInstanceByKey("GroupSimple");
+    String pid = processInstance.getId();
+    assertEquals("distribute document", processInstance.getActivityName());
+    
+    processInstance = executionService.signalExecutionById(pid);
+    assertEquals("collect feedback", processInstance.getActivityName());
+    
+    processInstance = executionService.signalExecutionById(pid, "rejected");
+    assertEquals("update document", processInstance.getActivityName());
+    
+    processInstance = executionService.signalExecutionById(pid);
+    assertEquals("distribute document", processInstance.getActivityName());
+    
+    processInstance = executionService.signalExecutionById(pid);
+    assertEquals("collect feedback", processInstance.getActivityName());
+    
+    processInstance = executionService.signalExecutionById(pid, "approved");
+    assertEquals("publish document", processInstance.getActivityName());
+  }
+}


Property changes on: jbpm4/trunk/modules/test-db/src/test/java/org/jbpm/examples/goup/simple/GroupSimpleTest.java
___________________________________________________________________
Name: svn:mime-type
   + text/plain

Added: jbpm4/trunk/modules/test-db/src/test/java/org/jbpm/examples/goup/timer/GroupTimerTest.java
===================================================================
--- jbpm4/trunk/modules/test-db/src/test/java/org/jbpm/examples/goup/timer/GroupTimerTest.java	                        (rev 0)
+++ jbpm4/trunk/modules/test-db/src/test/java/org/jbpm/examples/goup/timer/GroupTimerTest.java	2009-05-19 14:29:46 UTC (rev 4849)
@@ -0,0 +1,74 @@
+/*
+ * 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.goup.timer;
+
+import java.util.List;
+
+import org.jbpm.api.Execution;
+import org.jbpm.api.ProcessInstance;
+import org.jbpm.api.job.Job;
+import org.jbpm.api.job.Timer;
+import org.jbpm.test.JbpmTestCase;
+
+
+/**
+ * @author Tom Baeyens
+ */
+public class GroupTimerTest extends JbpmTestCase {
+
+  long deploymentDbid;
+  
+  protected void setUp() throws Exception {
+    super.setUp();
+    
+    deploymentDbid = repositoryService.createDeployment()
+        .addResourceFromClasspath("org/jbpm/examples/group/timer/process.jpdl.xml")
+        .deploy();
+  }
+
+  protected void tearDown() throws Exception {
+    repositoryService.deleteDeploymentCascade(deploymentDbid);
+    
+    super.tearDown();
+  }
+
+  public void testGroupTimerFires() {
+    ProcessInstance processInstance = executionService.startProcessInstanceByKey("GroupTimer");
+    Execution approveExecution = processInstance.findActiveExecutionIn("approve");
+    assertNotNull(approveExecution);
+    
+    List<Job> jobs = managementService
+      .createJobQuery()
+      .processInstanceId(processInstance.getId())
+      .list();
+    
+    assertEquals(1, jobs.size());
+    
+    Timer timer = (Timer) jobs.get(0);
+    
+    managementService.executeJob(timer.getDbid());
+    
+    processInstance = executionService.findProcessInstanceById(processInstance.getId());
+    assertNotNull(processInstance.findActiveExecutionIn("escalate") );
+  }
+  
+}


Property changes on: jbpm4/trunk/modules/test-db/src/test/java/org/jbpm/examples/goup/timer/GroupTimerTest.java
___________________________________________________________________
Name: svn:mime-type
   + text/plain

Added: jbpm4/trunk/modules/test-db/src/test/resources/org/jbpm/examples/group/concurrency/process.jpdl.xml
===================================================================
--- jbpm4/trunk/modules/test-db/src/test/resources/org/jbpm/examples/group/concurrency/process.jpdl.xml	                        (rev 0)
+++ jbpm4/trunk/modules/test-db/src/test/resources/org/jbpm/examples/group/concurrency/process.jpdl.xml	2009-05-19 14:29:46 UTC (rev 4849)
@@ -0,0 +1,37 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<process name="GroupConcurrency" xmlns="http://jbpm.org/4.0/jpdl">
+
+  <start>
+    <transition to="evaluate project" />
+  </start>
+  
+  <group name="evaluate project">
+    <start>
+      <transition to="distribute document" />
+    </start>
+    <state name="distribute document">
+      <transition to="collect feedback" />
+    </state>
+    <state name="collect feedback">
+      <transition to="document finished" />
+    </state>
+    <end name="document finished" />
+
+    <start>
+      <transition to="make planning" />
+    </start>
+    <state name="make planning">
+      <transition to="estimate budget" />
+    </state>
+    <state name="estimate budget">
+      <transition to="planning finished" />
+    </state>
+    <end name="planning finished" />
+
+    <transition to="public project announcement" />
+  </group>
+  
+  <state name="public project announcement" />
+
+</process>


Property changes on: jbpm4/trunk/modules/test-db/src/test/resources/org/jbpm/examples/group/concurrency/process.jpdl.xml
___________________________________________________________________
Name: svn:mime-type
   + text/plain

Added: jbpm4/trunk/modules/test-db/src/test/resources/org/jbpm/examples/group/multipleentries/process.jpdl.xml
===================================================================
--- jbpm4/trunk/modules/test-db/src/test/resources/org/jbpm/examples/group/multipleentries/process.jpdl.xml	                        (rev 0)
+++ jbpm4/trunk/modules/test-db/src/test/resources/org/jbpm/examples/group/multipleentries/process.jpdl.xml	2009-05-19 14:29:46 UTC (rev 4849)
@@ -0,0 +1,26 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<process name="GroupMultipleEntries" xmlns="http://jbpm.org/4.0/jpdl">
+
+  <start>
+    <transition to="choose strategy" />
+  </start>
+  
+  <decision name="choose strategy" expr="#{time}">
+    <transition name="plenty" to="play" />
+    <transition name="running out" to="plan" />
+  </decision>
+  
+  <group name="evaluate project">
+    <start name="play">
+      <transition to="distribute document" />
+    </start>
+    <state name="distribute document" />
+
+    <start name="plan">
+      <transition to="make planning" />
+    </start>
+    <state name="make planning" />
+  </group>
+  
+</process>


Property changes on: jbpm4/trunk/modules/test-db/src/test/resources/org/jbpm/examples/group/multipleentries/process.jpdl.xml
___________________________________________________________________
Name: svn:mime-type
   + text/plain

Added: jbpm4/trunk/modules/test-db/src/test/resources/org/jbpm/examples/group/simple/process.jpdl.xml
===================================================================
--- jbpm4/trunk/modules/test-db/src/test/resources/org/jbpm/examples/group/simple/process.jpdl.xml	                        (rev 0)
+++ jbpm4/trunk/modules/test-db/src/test/resources/org/jbpm/examples/group/simple/process.jpdl.xml	2009-05-19 14:29:46 UTC (rev 4849)
@@ -0,0 +1,29 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<process name="GroupSimple" xmlns="http://jbpm.org/4.0/jpdl">
+
+  <start>
+    <transition to="evaluate document" />
+  </start>
+  
+  <group name="evaluate document">
+    <start>
+      <transition to="distribute document" />
+    </start>
+    <state name="distribute document">
+      <transition to="collect feedback" />
+    </state>
+    <state name="collect feedback">
+      <transition name="approved" to="done" />
+      <transition name="rejected" to="update document" />
+    </state>
+    <state name="update document">
+      <transition to="distribute document" />
+    </state>
+    <end name="done" />
+    <transition to="publish document" />
+  </group>
+  
+  <state name="publish document" />
+
+</process>


Property changes on: jbpm4/trunk/modules/test-db/src/test/resources/org/jbpm/examples/group/simple/process.jpdl.xml
___________________________________________________________________
Name: svn:mime-type
   + text/plain

Added: jbpm4/trunk/modules/test-db/src/test/resources/org/jbpm/examples/group/timer/process.jpdl.xml
===================================================================
--- jbpm4/trunk/modules/test-db/src/test/resources/org/jbpm/examples/group/timer/process.jpdl.xml	                        (rev 0)
+++ jbpm4/trunk/modules/test-db/src/test/resources/org/jbpm/examples/group/timer/process.jpdl.xml	2009-05-19 14:29:46 UTC (rev 4849)
@@ -0,0 +1,27 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<process name="GroupTimer" xmlns="http://jbpm.org/4.0/jpdl">
+
+  <start>
+    <transition to="evaluate document" />
+  </start>
+  
+  <group name="evaluate document">
+    <start>
+      <transition to="approve" />
+    </start>
+    <state name="approve">
+      <transition to="done" />
+    </state>
+    <end name="done" />
+    
+    <transition to="publish document" />
+    <transition name="timeout" to="escalate">
+      <timer duedate="2 business hours" />
+    </transition>
+  </group>
+  
+  <state name="escalate" />
+  <state name="publish document" />
+
+</process>


Property changes on: jbpm4/trunk/modules/test-db/src/test/resources/org/jbpm/examples/group/timer/process.jpdl.xml
___________________________________________________________________
Name: svn:mime-type
   + text/plain




More information about the jbpm-commits mailing list