Author: tom.baeyens(a)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 @@
</process></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><process name="Task"
xmlns="http://jbpm.org/4/jpdl">
+ <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><process
name="TaskAssignee">
+
<start>
<transition to="review" />
</start>
- <emphasis role="bold"><task name="review"
- assignee="johndoe"></emphasis>
-
- <transition to="wait" />
- <emphasis role="bold"></task></emphasis>
+ <task name="review"
+ assignee="#{order.owner}">
+
+ <transition to="wait" />
+ </task>
<state name="wait" />
</process></programlisting>
- <para>After starting a process like this
- </para>
-
<programlisting>executionService.startProcessInstanceByKey("Task");</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<String, Object> variables = new
HashMap<String, Object>();
+variables.put("order", new Order("johndoe"));
+Execution execution =
executionService.startProcessInstanceByKey("TaskAssignee",
variables);</programlisting>
+ <para>Then the task list for <literal>johndoe</literal> can be
obtained like this.</para>
+ <programlisting>List<Task> taskList =
taskService.findAssignedTasks("johndoe");</programlisting>
+ <para>Note that it is also possible to put plain text like
+ <literal>assignee="johndoe"</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">