[jbpm-commits] JBoss JBPM SVN: r4392 - 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 Apr 2 10:51:06 EDT 2009


Author: tom.baeyens at jboss.com
Date: 2009-04-02 10:51:06 -0400 (Thu, 02 Apr 2009)
New Revision: 4392

Removed:
   jbpm4/trunk/modules/examples/src/test/resources/org/jbpm/examples/task/handler/
Modified:
   jbpm4/trunk/modules/userguide/src/main/docbook/en/modules/ch05-Jpdl.xml
Log:
task assignment docs updates

Modified: jbpm4/trunk/modules/userguide/src/main/docbook/en/modules/ch05-Jpdl.xml
===================================================================
--- jbpm4/trunk/modules/userguide/src/main/docbook/en/modules/ch05-Jpdl.xml	2009-04-02 12:34:28 UTC (rev 4391)
+++ jbpm4/trunk/modules/userguide/src/main/docbook/en/modules/ch05-Jpdl.xml	2009-04-02 14:51:06 UTC (rev 4392)
@@ -526,14 +526,6 @@
 &lt;/process&gt;</programlisting>
     </section>
 
-
-
-
-
-
-
-
-
     <section id="end">
       <title><literal>end</literal></title>
       <para>Ends the execution.
@@ -823,58 +815,113 @@
 
     <section id="task">
       <title><literal>task</literal></title>
-      <para>Creates a task for a person in the task component.  The configuration capabilities 
-      of the task activity will be expanded in the next releases.
+
+      <para>Creates a task for a person in the task component.  
       </para>
-      <table><title><literal>task</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>assignee</literal></entry>
-              <entry>text</entry>
-              <entry></entry>
-              <entry><emphasis role="bold">required</emphasis></entry>
-              <entry>id of the person to which this task must be assigned</entry>
-            </row>
-          </tbody>
-        </tgroup>
-      </table>
-      <para>For example:</para>
-      <figure id="process.task">
-        <title>The task example process</title>
-        <mediaobject><imageobject><imagedata align="center" fileref="images/process.task.png"/></imageobject></mediaobject>
-      </figure>
-      <programlisting>&lt;process name=&quot;Task&quot; xmlns=&quot;http://jbpm.org/4/jpdl&quot;&gt;
 
+      <section id="taskassignee">
+        <title><literal>task</literal> assignee</title>
+        <para>A simple task that will be assigned to a specific user
+        </para>
+        <table><title><literal>task</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>assignee</literal></entry>
+                <entry>expression</entry>
+                <entry></entry>
+                <entry>optional</entry>
+                <entry>userId referring to the person that is responsible for 
+                completing this task.</entry>
+              </row>
+              <row>
+                <entry><literal>assignee-lang</literal></entry>
+                <entry>expression language</entry>
+                <entry>juel</entry>
+                <entry>optional</entry>
+                <entry>expression language used in the assignee attribute</entry>
+              </row>
+            </tbody>
+          </tgroup>
+        </table>
+	      <figure id="process.task">
+	        <title>The task example process</title>
+	        <mediaobject><imageobject><imagedata align="center" fileref="images/process.task.png"/></imageobject></mediaobject>
+	      </figure>
+	      <programlisting>&lt;process name=&quot;TaskAssignee&quot;&gt;
+
   &lt;start&gt;
     &lt;transition to=&quot;review&quot; /&gt;
   &lt;/start&gt;
 
-  <emphasis role="bold">&lt;task name=&quot;review&quot; 
-        assignee=&quot;johndoe&quot;&gt;</emphasis>
-        
-    &lt;transition to=&quot;wait&quot; /&gt;
-  <emphasis role="bold">&lt;/task&gt;</emphasis>
+  &lt;task name=&quot;review&quot; 
+        assignee=&quot;#{order.owner}&quot;&gt;
+ 
+     &lt;transition to=&quot;wait&quot; /&gt;
+  &lt;/task&gt;
   
   &lt;state name=&quot;wait&quot; /&gt;
 
 &lt;/process&gt;</programlisting>
-      <para>After starting a process like this
-      </para>
-      <programlisting>executionService.startProcessInstanceByKey(&quot;Task&quot;);</programlisting>
-      <para>The task list for user johndoe can be obtained from the <literal>TaskService</literal>
-      like this</para>
-      <programlisting>taskService.getPersonalTaskList("johndoe", 0, 10);</programlisting>
-      <para>The task list for user 'johndoe' will contain a task named 'review'.</para>
+        <para>This process shows 2 aspects of task assignment.  First, that the
+        attribute <literal>assignee</literal> is used to indicate the user that is 
+        responsible for completing the task.  The assignee is a String property 
+        of a task and refers to a user.
+        </para>
+        <para>Secondly, this attribute is by default evaluated as an expression.
+        In this case the task is assigned to <literal>#{order.owner}</literal>.
+        Which means that first an object is searched for with name order.  One of 
+        the places where this object is looked up is the process variables 
+        associated to the task.  Then the <literal>getOwner()</literal> getter 
+        will be used to get the userId that references the user that is 
+        responsible for completing this task.  
+        </para>
+        <para>Here's the Order class used in our example:</para>
+        <programlisting>public class Order implements Serializable {
+  
+  String owner;
+
+  public Order(String owner) {
+    this.owner = owner;
+  }
+
+  public String getOwner() {
+    return owner;
+  }
+
+  public void setOwner(String owner) {
+    this.owner = owner;
+  }
+}</programlisting>
+          <para>Next a new process instance is created with an order as a process 
+          variable.</para>
+          <programlisting>Map&lt;String, Object&gt; variables = new HashMap&lt;String, Object&gt;(); 
+variables.put(&quot;order&quot;, new Order(&quot;johndoe&quot;));
+Execution execution = executionService.startProcessInstanceByKey(&quot;TaskAssignee&quot;, variables);</programlisting>
+        <para>Then the task list for <literal>johndoe</literal> can be obtained like this.</para>
+        <programlisting>List&lt;Task&gt; taskList = taskService.findAssignedTasks(&quot;johndoe&quot;);</programlisting>
+        <para>Note that it is also possible to put plain text like 
+        <literal>assignee=&quot;johndoe&quot;</literal>.  In that case
+        the task will be assigned to johndoe.   
+        </para>
+	    </section>
+
+      <section id="taskcandidates">
+        <title><literal>task</literal> candidates</title>
+        <para>A task that will be offered to a group of users.  One of the users should then 
+        take the task in order to complete it.
+        </para>
+        <para>TODO</para>
+      </section>
     </section>
 
     <section id="script">




More information about the jbpm-commits mailing list