[jbpm-commits] JBoss JBPM SVN: r6482 - in jbpm4/trunk/modules: userguide/src/main/docbook/en/modules and 1 other directory.

do-not-reply at jboss.org do-not-reply at jboss.org
Thu Jul 15 02:23:54 EDT 2010


Author: alex.guizar at jboss.com
Date: 2010-07-15 02:23:53 -0400 (Thu, 15 Jul 2010)
New Revision: 6482

Modified:
   jbpm4/trunk/modules/devguide/src/main/docbook/en/modules/ch02-Incubation.xml
   jbpm4/trunk/modules/userguide/src/main/docbook/en/modules/ch06-Jpdl.xml
Log:
JBPM-2893: move foreach and assign documentation to dev guide

Modified: jbpm4/trunk/modules/devguide/src/main/docbook/en/modules/ch02-Incubation.xml
===================================================================
--- jbpm4/trunk/modules/devguide/src/main/docbook/en/modules/ch02-Incubation.xml	2010-07-15 06:04:00 UTC (rev 6481)
+++ jbpm4/trunk/modules/devguide/src/main/docbook/en/modules/ch02-Incubation.xml	2010-07-15 06:23:53 UTC (rev 6482)
@@ -2,19 +2,17 @@
   <title>Incubation</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.
+  features of jPDL that are still in incubation.  These features 
+  and activities are not supported yet,  but they are available for you
+  to try and use.  There are no stability guarantees on these 
+  activities and features; use them at your own risk.
   </para>
   
   <!-- ### Timer ########################################################## -->
   <section id="timer">
     <title><literal>timer</literal> </title>
-    <para>IMPORTANT NOTE : Timers will be changed before they are moved to the 
-    Userguide.  See also 
-    <ulink url="https://jira.jboss.org/jira/browse/JBPM-2329">https://jira.jboss.org/jira/browse/JBPM-2329</ulink>
-    </para>
+    <important><para>Timers will be changed before they are moved to the user guide. See <ulink
+      url="https://jira.jboss.org/browse/JBPM-2329">JBPM-2329</ulink>.</para></important>
     <para>A timer can be specified in the <literal>transition</literal>
     element in wait state activities such as <literal>state</literal>s, 
     <literal>task</literal>s, <literal>sub-process</literal>es and 
@@ -120,7 +118,6 @@
       </section>
     </section>
 
-
     <section id="businesscalendar">
       <title>Business calendar</title>
       <para>The default configuration will contain a reference to the file
@@ -357,9 +354,8 @@
   <section id="group">
     <title><literal>group</literal> activity</title>
     
-    <para>A <literal>group</literal> groups a set of activities in a process.  Contained groups must  
-    be hierarchically nested.  A group corresponds to a BPMN expanded sub process.
-    </para>
+    <para>Groups a set of activities in a process together. Contained groups must be nested
+      hierarchically. A group corresponds to a BPMN expanded sub process.</para>
 
     <table><title><literal>group</literal> elements:</title>
       <tgroup cols="3" rowsep="1" colsep="1">
@@ -655,18 +651,89 @@
     </section> 
   </section>
 
+  <!-- ### FOREACH ####################################################### -->
+  <section id="foreach">
+    <title>Multiplicative split with <literal>foreach</literal></title>
 
-  <!-- ### RULES DEPLOYER ####################################################### -->
-  <section id="rulesdeployer">
-    <title>Rules deployer</title>
-    <para>The rules deployer is a convenience integration between jBPM and 
-    <ulink url="http://drools.org">Drools</ulink>.  It creates a KnowledgeBase based 
-    on all .drl files that are included in a business archive deployment.
-    That KnowledgeBase is then stored in the repository cache.  So one 
-    KnowledgeBase is maintained in memory the process-engine-context.  Activities 
-    like the <link linkend="rulesdecision">rules decision</link> leverage 
-    this KnowledgeBase. 
-    </para>
+    <para>Activity <literal>foreach</literal> allows multiple paths of execution
+      to be started over a single branch of the process. Its attributes are
+      described in the table below.</para>
+
+    <table><title><literal>foreach</literal> attributes:</title>
+      <tgroup cols="5" rowsep="1" colsep="1">
+        <thead>
+          <row>
+            <entry>Attribute</entry>
+            <entry>Type</entry>
+            <entry>Default</entry>
+            <entry>Required?</entry>
+            <entry>Description</entry>
+          </row>
+        </thead>
+        <tbody>
+          <row>
+            <entry><literal>in</literal></entry>
+            <entry>expression or text</entry>
+            <entry></entry>
+            <entry>required</entry>
+            <entry>The collection to be iterated. Each item in the collection spawns a new
+            concurrent execution leaving over the default transition. <literal>in</literal>
+            supports collections of any kind, arrays and comma separated strings.</entry>
+          </row>
+          <row>
+            <entry><literal>var</literal></entry>
+            <entry>text</entry>
+            <entry></entry>
+            <entry>required</entry>
+            <entry>The variable where the current item of the collection is stored.
+            This variable is set in the concurrent execution and is visible only to that
+            execution.</entry>
+          </row>
+        </tbody>
+      </tgroup>
+    </table>
+
+    <para>In the example that follows, there is a need to collect reports from
+      different departments. The same task is to be performed by different groups.
+      This situation is easily modeled with <literal>foreach</literal>.
+      Process variable <literal>departments</literal> provides the group names,
+      whereas <literal>quota</literal> indicates how many tasks must be completed
+      before execution leaves the <literal>join</literal> activity.</para>
+
+    <programlisting><![CDATA[<process name="ForEach" xmlns="http://jbpm.org/4.4/jpdl">
+
+   <start g="28,61,48,48" name="start1">
+      <transition to="foreach1"/>
+   </start>
+
+   <foreach var="department" in="#{departments}" g="111,60,48,48" name="foreach1">
+      <transition to="Collect reports"/>
+   </foreach>
+
+   <task candidate-groups="#{department}" g="201,58,92,52" name="Collect reports">
+      <transition to="join1"/>
+   </task>
+
+   <join g="343,59,48,48" multiplicity="#{quorum}" name="join1">
+      <transition to="end1"/>
+   </join>
+
+   <end g="433,60,48,48" name="end1"/>
+
+</process>]]></programlisting>
+
+    <important><para>When using foreach, the corresponding join must have the
+      multiplicity attribute set. Without it, join continues execution based on its
+      incoming transitions. In the preceding example, join has a single incoming transition.
+      If multiplicity is not specified, the first execution that reaches the join
+      activity will cause the parent execution to leave the join.</para></important>
+
+    <para>Here is how to initialize the iterative process variables.</para>
+
+    <programlisting><![CDATA[Map<String, Object> variables = new HashMap<String, Object>();
+variables.put("departments", new String[] { "sales-dept", "hr-dept", "finance-dept" });
+variables.put("quorum", 3);
+ProcessInstance processInstance = executionService.startProcessInstanceByKey("ForEach", variables);]]></programlisting>
   </section>
 
   <!-- ### JAVA ####################################################### -->
@@ -688,15 +755,13 @@
 import javax.ejb.Stateless;
 
 @Stateless
-public class CalculatorBean implements CalculatorRemote, CalculatorLocal
-{
-   public Integer add(Integer x, Integer y)
-   {
+public class CalculatorBean implements CalculatorRemote, CalculatorLocal {
+
+   public Integer add(Integer x, Integer y) {
       return x + y;
    }
 
-   public Integer subtract(Integer x, Integer y)
-   {
+   public Integer subtract(Integer x, Integer y) {
       return x - y;
    }
 }</programlisting>
@@ -739,11 +804,120 @@
       .getId();
   assertEquals(63, executionService.getVariable(executionId, &quot;answer&quot;));
 }</programlisting>
+  </section>
 
+  <!-- ### ASSIGN ######################################################## -->
+  <section id="assign">
+    <title><literal>assign</literal></title>
 
- 
+    <para>The <literal>assign</literal> activity retrieves a value and assigns it
+    to a target location.</para>
+
+    <table><title><literal>assign</literal> attributes:</title>
+      <tgroup cols="5" rowsep="1" colsep="1">
+        <thead>
+          <row>
+            <entry>Attribute</entry>
+            <entry>Type</entry>
+            <entry>Default</entry>
+            <entry>Required?</entry>
+            <entry>Description</entry>
+          </row>
+        </thead>
+        <tbody>
+          <row>
+            <entry><literal>from-var</literal></entry>
+            <entry>string</entry>
+            <entry></entry>
+            <entry morerows="1">one of <literal>from-var</literal>, <literal>from-expr</literal>, <literal>from</literal> is required</entry>
+            <entry>variable that provides the source value</entry>
+          </row>
+          <row>
+            <entry><literal>from-expr</literal></entry>
+            <entry>expression</entry>
+            <entry></entry>
+            <entry>expression that resolves the source value</entry>
+          </row>
+          <row>
+            <entry><literal>lang</literal></entry>
+            <entry>string</entry>
+            <entry>default <emphasis role="bold">expression</emphasis> language defined in <xref linkend="scripting"/></entry>
+            <entry>optional</entry>
+            <entry>language in which <literal>from-expr</literal> is written</entry>
+          </row>
+          <row>
+            <entry><literal>to-var</literal></entry>
+            <entry>string</entry>
+            <entry></entry>
+            <entry morerows="1">one of <literal>to-var</literal>, <literal>to-expr</literal> is required</entry>
+            <entry>variable that provides the target location</entry>
+          </row>
+          <row>
+            <entry><literal>to-expr</literal></entry>
+            <entry>expression</entry>
+            <entry></entry>
+            <entry>expression that resolves the target location</entry>
+          </row>
+        </tbody>
+      </tgroup>
+    </table>
+
+    <table><title><literal>assign</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><literal>from</literal></entry>
+            <entry>0..1</entry>
+            <entry>descriptor that constructs the source value</entry>
+          </row>
+        </tbody>
+      </tgroup>
+    </table>
+
+    <para>Every form of <literal>from</literal> can be combined with any form
+    of <literal>to</literal>. The listing below simply assigns a variable to
+    another.</para>
+
+    <programlisting><![CDATA[<assign name='copy' from-var='person' to-var='clone'>
+  <transition to='wait' />
+</assign>]]></programlisting>
+
+    <para>The next example shows an expression value being assigned to a
+    variable.</para>
+
+    <programlisting><![CDATA[<assign name='resolve' from-expr='#{person.name}' to-var='name'>
+  <transition to='wait' />
+</assign>]]></programlisting>
+
+    <para>Our last example presents a value constructed by a descriptor being
+    assigned to the expression location.</para>
+
+    <programlisting><![CDATA[<assign name='resolve' to-expr='#{person.address.street}'>
+  <from><string value='gasthuisstraat' /></from>
+  <transition to='wait' />
+</assign>]]></programlisting>
   </section>
 
+  <!-- ### RULES DEPLOYER ####################################################### -->
+  <section id="rulesdeployer">
+    <title>Rules deployer</title>
+    <para>The rules deployer is a convenience integration between jBPM and 
+    <ulink url="http://drools.org">Drools</ulink>.  It creates a KnowledgeBase based 
+    on all .drl files that are included in a business archive deployment.
+    That KnowledgeBase is then stored in the repository cache.  So one 
+    KnowledgeBase is maintained in memory the process-engine-context.  Activities 
+    like the <link linkend="rulesdecision">rules decision</link> leverage 
+    this KnowledgeBase. 
+    </para>
+  </section>
+
   <!-- ### RULES DECISION ####################################################### -->
   <section id="rulesdecision">
     <title><literal>rules-decision</literal> activity</title>
@@ -966,7 +1140,6 @@
   
   <!-- ### JMS ####################################################### -->
   <section id="jms">
-  
     <title><literal>jms</literal> activity</title>
     <para>Disclaimer: this activity is not yet stable.  Two aspects will be revisisted 
     in following releases:</para>
@@ -1703,7 +1876,6 @@
    	  handler is specified, they will be executed one after another.
    	  </para>
    	</section>
-   	
   </section>
 
   <section>
@@ -1713,13 +1885,10 @@
     be used to serve all requests.  So you have to make sure that when your user code is used, 
     that it doesn't change the member fields of the user object.  In that case it will be safe
     for your user object to be used by all threads/requests.  This is also called stateless 
-    user objects.       
-    </para>
+    user objects.</para>
     <para>In case you do have a need for stateful user objects, you can specify 
     parameter <literal>cache="disabled"</literal> on the definition of the user 
-    code.  In that case a new user code object will be instatiated for every 
-    usage.
-    </para>
+    code. In that case a new user object will be instatiated for every usage.</para>
   </section>
   
   <section>
@@ -1755,5 +1924,4 @@
       <programlisting>processEngine.execute(new MyUserCommand());</programlisting>
     </section>    
   </section>
-  
 </chapter>

Modified: jbpm4/trunk/modules/userguide/src/main/docbook/en/modules/ch06-Jpdl.xml
===================================================================
--- jbpm4/trunk/modules/userguide/src/main/docbook/en/modules/ch06-Jpdl.xml	2010-07-15 06:04:00 UTC (rev 6481)
+++ jbpm4/trunk/modules/userguide/src/main/docbook/en/modules/ch06-Jpdl.xml	2010-07-15 06:23:53 UTC (rev 6482)
@@ -490,48 +490,13 @@
         the process instance will arrive in activity <literal>Submit document</literal>.
         </para>
       </section>
-
     </section>
 
     <section id="concurrency">
       <title><literal>concurrency</literal></title>
-      <para>With the <literal>fork</literal>, <literal>foreach</literal> and
-      <literal>join</literal> activities, concurrent paths of executions can be modeled.
-      The next two tables describe the <literal>foreach</literal>  and <literal>join</literal>
-      attributes; <literal>fork</literal> has no specific attributes.</para>
-      <table><title><literal>foreach</literal> attributes:</title>
-        <tgroup cols="5" rowsep="1" colsep="1">
-          <thead>
-            <row>
-              <entry>Attribute</entry>
-              <entry>Type</entry>
-              <entry>Default</entry>
-              <entry>Required?</entry>
-              <entry>Description</entry>
-            </row>
-          </thead>
-          <tbody>
-            <row>
-              <entry><literal>in</literal></entry>
-              <entry>expression or text</entry>
-              <entry></entry>
-              <entry>required</entry>
-              <entry>The collection to be iterated. Each item in the collection spawns a new
-              concurrent execution leaving over the default transition. <literal>in</literal>
-              supports collections of any kind, arrays and comma separated strings.</entry>
-            </row>
-            <row>
-              <entry><literal>var</literal></entry>
-              <entry>text</entry>
-              <entry></entry>
-              <entry>required</entry>
-              <entry>The variable where the current item of the collection is stored.
-              This variable is set in the concurrent execution and is visible only to that
-              execution.</entry>
-            </row>
-          </tbody>
-        </tgroup>
-      </table>
+      <para>Concurrent paths of executions can be modeled with the <literal>fork</literal> and
+        <literal>join</literal> activities. The next table describes the <literal>join</literal>
+        attributes; <literal>fork</literal> has no specific attributes.</para>
       <table><title><literal>join</literal> attributes:</title>
         <tgroup cols="5" rowsep="1" colsep="1">
           <thead>
@@ -616,49 +581,6 @@
 
 &lt;/process&gt;</programlisting>
       </section>
-
-      <section>
-        <title>Iterative split with <literal>foreach</literal></title>
-        <para>At a given point in a process, several paths of execution can be initiated
-        in a single branch of the same process instance. In the example, there is a need
-        to collect time sheet reports (called data) from different departments. With
-        <literal>foreach</literal> this can be quite easily achieved. The same task
-        is to be performed by different groups. Process variable <literal>departments</literal>
-        provides the group names, whereas the variable <literal>quota</literal> indicates
-        how many tasks must be completed before execution will leave the <literal>join</literal>
-        activity.</para>
-        <programlisting><![CDATA[<process name="ForEach" xmlns="http://jbpm.org/4.4/jpdl">
-
-   <start g="28,61,48,48" name="start1">
-      <transition to="foreach1"/>
-   </start>
-
-   <foreach var="department" in="#{departments}" g="111,60,48,48" name="foreach1">
-      <transition to="Collect data"/>
-   </foreach>
-
-   <task candidate-groups="#{department}" g="201,58,92,52" name="Collect data">
-      <transition to="join1"/>
-   </task>
-
-   <join g="343,59,48,48" multiplicity="#{quorum}" name="join1">
-      <transition to="end1"/>
-   </join>
-
-   <end g="433,60,48,48" name="end1"/>
-
-</process>]]></programlisting>
-        <important><para>When using foreach, the corresponding join must have the
-        multiplicity attribute set. In general, join continues execution based on its
-        incoming transitions. When using foreach, join has a single incoming transition.
-        If multiplicity is not specified, the first execution that reaches the join
-        activity will trigger continuation.</para></important>
-        <para>Here is how to initialize the iterative process variables.</para>
-        <programlisting><![CDATA[Map<String, Object> variables = new HashMap<String, Object>();
-variables.put("departments", new String[] { "sales-dept", "hr-dept", "finance-dept" });
-variables.put("quorum", 3);
-ProcessInstance processInstance = executionService.startProcessInstanceByKey("ForEach", variables);]]></programlisting>
-      </section>
     </section>
 
     <!-- ### END ########################################################### -->
@@ -2246,97 +2168,6 @@
       </para>
     </section>
 
-    <!-- ### ASSIGN ######################################################## -->
-
-    <section id="assign">
-      <title><literal>assign</literal></title>
-      <para>The <literal>assign</literal> activity retrieves a value and assigns it
-      to a target location.</para>
-      <table><title><literal>assign</literal> attributes:</title>
-        <tgroup cols="5" rowsep="1" colsep="1">
-          <thead>
-            <row>
-              <entry>Attribute</entry>
-              <entry>Type</entry>
-              <entry>Default</entry>
-              <entry>Required?</entry>
-              <entry>Description</entry>
-            </row>
-          </thead>
-          <tbody>
-            <row>
-              <entry><literal>from-var</literal></entry>
-              <entry>string</entry>
-              <entry></entry>
-              <entry morerows="1">one of <literal>from-var</literal>, <literal>from-expr</literal>, <literal>from</literal> is required</entry>
-              <entry>variable that provides the source value</entry>
-            </row>
-            <row>
-              <entry><literal>from-expr</literal></entry>
-              <entry>expression</entry>
-              <entry></entry>
-              <entry>expression that resolves the source value</entry>
-            </row>
-            <row>
-              <entry><literal>lang</literal></entry>
-              <entry>string</entry>
-              <entry>default <emphasis role="bold">expression</emphasis> language defined in <xref linkend="scripting"/></entry>
-              <entry>optional</entry>
-              <entry>language in which <literal>from-expr</literal> is written</entry>
-            </row>
-            <row>
-              <entry><literal>to-var</literal></entry>
-              <entry>string</entry>
-              <entry></entry>
-              <entry morerows="1">one of <literal>to-var</literal>, <literal>to-expr</literal> is required</entry>
-              <entry>variable that provides the target location</entry>
-            </row>
-            <row>
-              <entry><literal>to-expr</literal></entry>
-              <entry>expression</entry>
-              <entry></entry>
-              <entry>expression that resolves the target location</entry>
-            </row>
-          </tbody>
-        </tgroup>
-      </table>
-      <table><title><literal>assign</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><literal>from</literal></entry>
-              <entry>0..1</entry>
-              <entry>descriptor that constructs the source value</entry>
-            </row>
-          </tbody>
-        </tgroup>
-      </table>
-      <para>Every form of <literal>from</literal> can be combined with any form
-      of <literal>to</literal>. The listing below simply assigns a variable to
-      another.</para>
-      <programlisting><![CDATA[<assign name='resolve' from-expr='#{person.name}' to-var='result'>
-  <transition to='wait' />
-</assign>]]></programlisting>
-      <para>The next example shows an expression value being assigned to a
-      variable.</para>
-      <programlisting><![CDATA[<assign name='resolve' from-var='person' to-var='result'>
-  <transition to='wait' />
-</assign>]]></programlisting>
-      <para>Our last example presents a value constructed by a descriptor being
-      assigned to the expression location.</para>
-      <programlisting><![CDATA[<assign name='resolve' to-expr='#{person.address.street}'>
-  <from><string value='gasthuisstraat' /></from>
-  <transition to='wait' />
-</assign>]]></programlisting>
-    </section>
-
     <!-- ### HQL ########################################################### -->
 
     <section id="hql">



More information about the jbpm-commits mailing list