[jbpm-commits] JBoss JBPM SVN: r4474 - in jbpm4/tags/jbpm-4.0.0.Beta1/modules: examples/src/test/java/org/jbpm/examples/task and 13 other directories.

do-not-reply at jboss.org do-not-reply at jboss.org
Tue Apr 7 05:34:55 EDT 2009


Author: tom.baeyens at jboss.com
Date: 2009-04-07 05:34:55 -0400 (Tue, 07 Apr 2009)
New Revision: 4474

Added:
   jbpm4/tags/jbpm-4.0.0.Beta1/modules/test-db/src/test/java/org/jbpm/test/process/process.jpdl.xml
   jbpm4/tags/jbpm-4.0.0.Beta1/modules/test-db/src/test/resources/org/
   jbpm4/tags/jbpm-4.0.0.Beta1/modules/test-db/src/test/resources/org/jbpm/
   jbpm4/tags/jbpm-4.0.0.Beta1/modules/test-db/src/test/resources/org/jbpm/test/
   jbpm4/tags/jbpm-4.0.0.Beta1/modules/test-db/src/test/resources/org/jbpm/test/process/
   jbpm4/tags/jbpm-4.0.0.Beta1/modules/test-db/src/test/resources/org/jbpm/test/process/process.jpdl.xml
   jbpm4/tags/jbpm-4.0.0.Beta1/modules/userguide/src/main/docbook/en/images/gpd.open.in.xml.png
   jbpm4/tags/jbpm-4.0.0.Beta1/modules/userguide/src/main/docbook/en/images/gpd.xml.view.png
   jbpm4/tags/jbpm-4.0.0.Beta1/modules/userguide/src/main/docbook/en/images/process.task.swimlane.png
Removed:
   jbpm4/tags/jbpm-4.0.0.Beta1/modules/examples/src/test/java/org/jbpm/examples/states/
   jbpm4/tags/jbpm-4.0.0.Beta1/modules/examples/src/test/java/org/jbpm/examples/task/cancel/
   jbpm4/tags/jbpm-4.0.0.Beta1/modules/examples/src/test/resources/org/jbpm/examples/task/handler/
   jbpm4/tags/jbpm-4.0.0.Beta1/modules/test-db/src/test/resources/org/jbpm/
   jbpm4/tags/jbpm-4.0.0.Beta1/modules/test-db/src/test/resources/org/jbpm/test/
   jbpm4/tags/jbpm-4.0.0.Beta1/modules/test-db/src/test/resources/org/jbpm/test/process/
   jbpm4/tags/jbpm-4.0.0.Beta1/modules/test-db/src/test/resources/org/jbpm/test/process/process.jpdl.xml
   jbpm4/tags/jbpm-4.0.0.Beta1/modules/userguide/src/main/docbook/en/images/gpd.open.in.xml.png
Modified:
   jbpm4/tags/jbpm-4.0.0.Beta1/modules/examples/src/test/java/org/jbpm/examples/task/candidates/TaskCandidatesTest.java
   jbpm4/tags/jbpm-4.0.0.Beta1/modules/examples/src/test/java/org/jbpm/examples/task/swimlane/TaskSwimlaneTest.java
   jbpm4/tags/jbpm-4.0.0.Beta1/modules/examples/src/test/resources/org/jbpm/examples/task/candidates/process.jpdl.xml
   jbpm4/tags/jbpm-4.0.0.Beta1/modules/examples/src/test/resources/org/jbpm/examples/task/swimlane/process.jpdl.xml
   jbpm4/tags/jbpm-4.0.0.Beta1/modules/test-db/src/test/java/org/jbpm/test/process/DeploymentResourcesTest.java
   jbpm4/tags/jbpm-4.0.0.Beta1/modules/userguide/src/main/docbook/en/images/gpd.new.process.file.png
   jbpm4/tags/jbpm-4.0.0.Beta1/modules/userguide/src/main/docbook/en/images/gpd.new.process.wizard.png
   jbpm4/tags/jbpm-4.0.0.Beta1/modules/userguide/src/main/docbook/en/images/gpd.png
   jbpm4/tags/jbpm-4.0.0.Beta1/modules/userguide/src/main/docbook/en/images/process.concurrency.png
   jbpm4/tags/jbpm-4.0.0.Beta1/modules/userguide/src/main/docbook/en/images/process.end.multiple.png
   jbpm4/tags/jbpm-4.0.0.Beta1/modules/userguide/src/main/docbook/en/images/process.end.processinstance.png
   jbpm4/tags/jbpm-4.0.0.Beta1/modules/userguide/src/main/docbook/en/images/process.end.state.png
   jbpm4/tags/jbpm-4.0.0.Beta1/modules/userguide/src/main/docbook/en/images/process.esb.png
   jbpm4/tags/jbpm-4.0.0.Beta1/modules/userguide/src/main/docbook/en/images/process.exclusive.png
   jbpm4/tags/jbpm-4.0.0.Beta1/modules/userguide/src/main/docbook/en/images/process.hql.png
   jbpm4/tags/jbpm-4.0.0.Beta1/modules/userguide/src/main/docbook/en/images/process.java.png
   jbpm4/tags/jbpm-4.0.0.Beta1/modules/userguide/src/main/docbook/en/images/process.script.png
   jbpm4/tags/jbpm-4.0.0.Beta1/modules/userguide/src/main/docbook/en/images/process.state.choice.png
   jbpm4/tags/jbpm-4.0.0.Beta1/modules/userguide/src/main/docbook/en/images/process.state.sequence.png
   jbpm4/tags/jbpm-4.0.0.Beta1/modules/userguide/src/main/docbook/en/images/process.task.png
   jbpm4/tags/jbpm-4.0.0.Beta1/modules/userguide/src/main/docbook/en/modules/ch03-Gpd.xml
   jbpm4/tags/jbpm-4.0.0.Beta1/modules/userguide/src/main/docbook/en/modules/ch05-Jpdl.xml
Log:
merging tom baeyens and koen aers trunk updates in the beta 1 release tag

Modified: jbpm4/tags/jbpm-4.0.0.Beta1/modules/examples/src/test/java/org/jbpm/examples/task/candidates/TaskCandidatesTest.java
===================================================================
--- jbpm4/tags/jbpm-4.0.0.Beta1/modules/examples/src/test/java/org/jbpm/examples/task/candidates/TaskCandidatesTest.java	2009-04-07 08:16:32 UTC (rev 4473)
+++ jbpm4/tags/jbpm-4.0.0.Beta1/modules/examples/src/test/java/org/jbpm/examples/task/candidates/TaskCandidatesTest.java	2009-04-07 09:34:55 UTC (rev 4474)
@@ -35,26 +35,26 @@
 
   public void testGroupCandidateAssignment() {
     // create johndoe and joesmoe as members of the sales group
-    identityService.createGroup("sales");
-    
+    identityService.createGroup("sales-dept");
+
     identityService.createUser("johndoe", "johndoe", "John", "Doe");
-    identityService.createMembership("johndoe", "sales");
+    identityService.createMembership("johndoe", "sales-dept");
 
     identityService.createUser("joesmoe", "joesmoe", "Joe", "Smoe");
-    identityService.createMembership("joesmoe", "sales");
+    identityService.createMembership("joesmoe", "sales-dept");
 
     // deploy the process
     deployJpdlResource("org/jbpm/examples/task/candidates/process.jpdl.xml");
-    
+
     Execution execution = executionService.startProcessInstanceByKey("TaskCandidates");
     String executionId = execution.getId();
-    
+
     // both johndoe and joesmoe will see the task in their *takable* task list 
     List<Task> taskList = taskService.findTakableTasks("johndoe");
-    assertEquals("Expected a single task in johndoe's takable task list", 1, taskList.size());
+    assertEquals("Expected a single task in johndoe's task list", 1, taskList.size());
     Task task = taskList.get(0);
     assertEquals("review", task.getName());
-    
+
     taskList = taskService.findTakableTasks("joesmoe");
     assertEquals("Expected a single task in joesmoe's takable task list", 1, taskList.size());
     task = taskList.get(0);
@@ -70,7 +70,7 @@
 
     // lets assume that johndoe takes the task
     taskService.assignTask(task.getDbid(), "johndoe");
-    
+
     // johndoe's and joesmoe's takable task list is now empty  
     taskList = taskService.findTakableTasks("johndoe");
     assertEquals(0, taskList.size());
@@ -84,14 +84,14 @@
     task = taskList.get(0);
     assertEquals("review", task.getName());
     assertEquals("johndoe", task.getAssignee());
-    
+
     // joesmoe will not see the task in the assigned task list
     taskList = taskService.findAssignedTasks("joesmoe");
     assertEquals(0, taskList.size());
 
     // now johndoe completes the task
     taskService.completeTask(task.getDbid());
-    
+
     // verify that the task list is now empty
     taskList = taskService.findAssignedTasks("johndoe");
     assertEquals(0, taskList.size());

Modified: jbpm4/tags/jbpm-4.0.0.Beta1/modules/examples/src/test/java/org/jbpm/examples/task/swimlane/TaskSwimlaneTest.java
===================================================================
--- jbpm4/tags/jbpm-4.0.0.Beta1/modules/examples/src/test/java/org/jbpm/examples/task/swimlane/TaskSwimlaneTest.java	2009-04-07 08:16:32 UTC (rev 4473)
+++ jbpm4/tags/jbpm-4.0.0.Beta1/modules/examples/src/test/java/org/jbpm/examples/task/swimlane/TaskSwimlaneTest.java	2009-04-07 09:34:55 UTC (rev 4474)
@@ -32,13 +32,13 @@
  */
 public class TaskSwimlaneTest extends JbpmTestCase {
 
-  public void testTaskSwimlane() {
-	identityService.createGroup("sales");
+  public void testTaskSwimlane() {    
+    identityService.createGroup("sales-dept");
     identityService.createUser("johndoe", "johndoe", "John", "Doe");
-    identityService.createMembership("johndoe", "sales");
+    identityService.createMembership("johndoe", "sales-dept");
 
     deployJpdlResource("org/jbpm/examples/task/swimlane/process.jpdl.xml");
-    
+
     executionService.startProcessInstanceByKey("TaskSwimlane");
 
     List<Task> taskList = taskService.findTakableTasks("johndoe");

Modified: jbpm4/tags/jbpm-4.0.0.Beta1/modules/examples/src/test/resources/org/jbpm/examples/task/candidates/process.jpdl.xml
===================================================================
--- jbpm4/tags/jbpm-4.0.0.Beta1/modules/examples/src/test/resources/org/jbpm/examples/task/candidates/process.jpdl.xml	2009-04-07 08:16:32 UTC (rev 4473)
+++ jbpm4/tags/jbpm-4.0.0.Beta1/modules/examples/src/test/resources/org/jbpm/examples/task/candidates/process.jpdl.xml	2009-04-07 09:34:55 UTC (rev 4474)
@@ -7,7 +7,7 @@
   </start>
 
   <task name="review" 
-        candidate-groups="sales"
+        candidate-groups="sales-dept"
         g="96,16,127,52">
  
      <transition to="wait" />

Modified: jbpm4/tags/jbpm-4.0.0.Beta1/modules/examples/src/test/resources/org/jbpm/examples/task/swimlane/process.jpdl.xml
===================================================================
--- jbpm4/tags/jbpm-4.0.0.Beta1/modules/examples/src/test/resources/org/jbpm/examples/task/swimlane/process.jpdl.xml	2009-04-07 08:16:32 UTC (rev 4473)
+++ jbpm4/tags/jbpm-4.0.0.Beta1/modules/examples/src/test/resources/org/jbpm/examples/task/swimlane/process.jpdl.xml	2009-04-07 09:34:55 UTC (rev 4474)
@@ -3,7 +3,7 @@
 <process name="TaskSwimlane" xmlns="http://jbpm.org/4/jpdl">
 
   <swimlane name="sales representative"
-            candidate-groups="sales" />
+            candidate-groups="sales-dept" />
 
   <start g="20,20,48,48">
     <transition to="enter order data" />

Modified: jbpm4/tags/jbpm-4.0.0.Beta1/modules/test-db/src/test/java/org/jbpm/test/process/DeploymentResourcesTest.java
===================================================================
--- jbpm4/tags/jbpm-4.0.0.Beta1/modules/test-db/src/test/java/org/jbpm/test/process/DeploymentResourcesTest.java	2009-04-07 08:16:32 UTC (rev 4473)
+++ jbpm4/tags/jbpm-4.0.0.Beta1/modules/test-db/src/test/java/org/jbpm/test/process/DeploymentResourcesTest.java	2009-04-07 09:34:55 UTC (rev 4474)
@@ -29,6 +29,7 @@
 import java.util.Arrays;
 
 import org.jbpm.JbpmException;
+import org.jbpm.ProcessDefinition;
 import org.jbpm.test.JbpmTestCase;
 
 
@@ -64,6 +65,25 @@
     assertTrue(Arrays.equals(otherBytes, retrievedOtherBytes));
   }
 
+  public void testLoadProcessAsResource() {
+    ClassLoader classLoader = DeploymentResourcesTest.class.getClassLoader();
+    InputStream inputStream = classLoader.getResourceAsStream("org/jbpm/test/process/process.jpdl.xml");
+    assertNotNull(inputStream);
+    
+    long deploymentDbid = 
+    repositoryService.createDeployment()
+      .addResourceFromInputStream("process.jpdl.xml", inputStream)
+      .deploy();
+    
+    registerDeployment(deploymentDbid);
+
+    ProcessDefinition processDefinition = repositoryService.createProcessDefinitionQuery()
+      .key("Resource")
+      .uniqueResult();
+    
+    assertNotNull(processDefinition);
+  }
+
   protected String generateString(String base, int multiplier) {
     StringBuffer buffer = new StringBuffer();
     for (int i=0; i<multiplier; i++) {

Copied: jbpm4/tags/jbpm-4.0.0.Beta1/modules/test-db/src/test/java/org/jbpm/test/process/process.jpdl.xml (from rev 4384, jbpm4/trunk/modules/test-db/src/test/java/org/jbpm/test/process/process.jpdl.xml)
===================================================================
--- jbpm4/tags/jbpm-4.0.0.Beta1/modules/test-db/src/test/java/org/jbpm/test/process/process.jpdl.xml	                        (rev 0)
+++ jbpm4/tags/jbpm-4.0.0.Beta1/modules/test-db/src/test/java/org/jbpm/test/process/process.jpdl.xml	2009-04-07 09:34:55 UTC (rev 4474)
@@ -0,0 +1,15 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<process name="Resource" xmlns="http://jbpm.org/4/jpdl">
+
+  <start>
+    <transition to="get return code" />
+  </start>
+
+  <state name="get return code">
+    <transition to="ok"/>
+  </state>
+
+  <end name="ok" state="completed"/>
+
+</process>

Copied: jbpm4/tags/jbpm-4.0.0.Beta1/modules/test-db/src/test/resources/org (from rev 4387, jbpm4/trunk/modules/test-db/src/test/resources/org)

Copied: jbpm4/tags/jbpm-4.0.0.Beta1/modules/test-db/src/test/resources/org/jbpm (from rev 4387, jbpm4/trunk/modules/test-db/src/test/resources/org/jbpm)

Copied: jbpm4/tags/jbpm-4.0.0.Beta1/modules/test-db/src/test/resources/org/jbpm/test (from rev 4387, jbpm4/trunk/modules/test-db/src/test/resources/org/jbpm/test)

Copied: jbpm4/tags/jbpm-4.0.0.Beta1/modules/test-db/src/test/resources/org/jbpm/test/process (from rev 4387, jbpm4/trunk/modules/test-db/src/test/resources/org/jbpm/test/process)

Deleted: jbpm4/tags/jbpm-4.0.0.Beta1/modules/test-db/src/test/resources/org/jbpm/test/process/process.jpdl.xml
===================================================================
--- jbpm4/trunk/modules/test-db/src/test/resources/org/jbpm/test/process/process.jpdl.xml	2009-04-02 10:34:41 UTC (rev 4387)
+++ jbpm4/tags/jbpm-4.0.0.Beta1/modules/test-db/src/test/resources/org/jbpm/test/process/process.jpdl.xml	2009-04-07 09:34:55 UTC (rev 4474)
@@ -1,15 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-
-<process name="Resource" xmlns="http://jbpm.org/4/jpdl">
-
-  <start>
-    <transition to="get return code" />
-  </start>
-
-  <state name="get return code">
-    <transition to="ok"/>
-  </state>
-
-  <end name="ok" state="completed"/>
-
-</process>

Copied: jbpm4/tags/jbpm-4.0.0.Beta1/modules/test-db/src/test/resources/org/jbpm/test/process/process.jpdl.xml (from rev 4387, jbpm4/trunk/modules/test-db/src/test/resources/org/jbpm/test/process/process.jpdl.xml)
===================================================================
--- jbpm4/tags/jbpm-4.0.0.Beta1/modules/test-db/src/test/resources/org/jbpm/test/process/process.jpdl.xml	                        (rev 0)
+++ jbpm4/tags/jbpm-4.0.0.Beta1/modules/test-db/src/test/resources/org/jbpm/test/process/process.jpdl.xml	2009-04-07 09:34:55 UTC (rev 4474)
@@ -0,0 +1,15 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<process name="Resource" xmlns="http://jbpm.org/4/jpdl">
+
+  <start>
+    <transition to="get return code" />
+  </start>
+
+  <state name="get return code">
+    <transition to="ok"/>
+  </state>
+
+  <end name="ok" state="completed"/>
+
+</process>

Modified: jbpm4/tags/jbpm-4.0.0.Beta1/modules/userguide/src/main/docbook/en/images/gpd.new.process.file.png
===================================================================
(Binary files differ)

Modified: jbpm4/tags/jbpm-4.0.0.Beta1/modules/userguide/src/main/docbook/en/images/gpd.new.process.wizard.png
===================================================================
(Binary files differ)

Deleted: jbpm4/tags/jbpm-4.0.0.Beta1/modules/userguide/src/main/docbook/en/images/gpd.open.in.xml.png
===================================================================
(Binary files differ)

Copied: jbpm4/tags/jbpm-4.0.0.Beta1/modules/userguide/src/main/docbook/en/images/gpd.open.in.xml.png (from rev 4402, jbpm4/trunk/modules/userguide/src/main/docbook/en/images/gpd.open.in.xml.png)
===================================================================
(Binary files differ)

Modified: jbpm4/tags/jbpm-4.0.0.Beta1/modules/userguide/src/main/docbook/en/images/gpd.png
===================================================================
(Binary files differ)

Copied: jbpm4/tags/jbpm-4.0.0.Beta1/modules/userguide/src/main/docbook/en/images/gpd.xml.view.png (from rev 4402, jbpm4/trunk/modules/userguide/src/main/docbook/en/images/gpd.xml.view.png)
===================================================================
(Binary files differ)

Modified: jbpm4/tags/jbpm-4.0.0.Beta1/modules/userguide/src/main/docbook/en/images/process.concurrency.png
===================================================================
(Binary files differ)

Modified: jbpm4/tags/jbpm-4.0.0.Beta1/modules/userguide/src/main/docbook/en/images/process.end.multiple.png
===================================================================
(Binary files differ)

Modified: jbpm4/tags/jbpm-4.0.0.Beta1/modules/userguide/src/main/docbook/en/images/process.end.processinstance.png
===================================================================
(Binary files differ)

Modified: jbpm4/tags/jbpm-4.0.0.Beta1/modules/userguide/src/main/docbook/en/images/process.end.state.png
===================================================================
(Binary files differ)

Modified: jbpm4/tags/jbpm-4.0.0.Beta1/modules/userguide/src/main/docbook/en/images/process.esb.png
===================================================================
(Binary files differ)

Modified: jbpm4/tags/jbpm-4.0.0.Beta1/modules/userguide/src/main/docbook/en/images/process.exclusive.png
===================================================================
(Binary files differ)

Modified: jbpm4/tags/jbpm-4.0.0.Beta1/modules/userguide/src/main/docbook/en/images/process.hql.png
===================================================================
(Binary files differ)

Modified: jbpm4/tags/jbpm-4.0.0.Beta1/modules/userguide/src/main/docbook/en/images/process.java.png
===================================================================
(Binary files differ)

Modified: jbpm4/tags/jbpm-4.0.0.Beta1/modules/userguide/src/main/docbook/en/images/process.script.png
===================================================================
(Binary files differ)

Modified: jbpm4/tags/jbpm-4.0.0.Beta1/modules/userguide/src/main/docbook/en/images/process.state.choice.png
===================================================================
(Binary files differ)

Modified: jbpm4/tags/jbpm-4.0.0.Beta1/modules/userguide/src/main/docbook/en/images/process.state.sequence.png
===================================================================
(Binary files differ)

Modified: jbpm4/tags/jbpm-4.0.0.Beta1/modules/userguide/src/main/docbook/en/images/process.task.png
===================================================================
(Binary files differ)

Copied: jbpm4/tags/jbpm-4.0.0.Beta1/modules/userguide/src/main/docbook/en/images/process.task.swimlane.png (from rev 4443, jbpm4/trunk/modules/userguide/src/main/docbook/en/images/process.task.swimlane.png)
===================================================================
(Binary files differ)

Modified: jbpm4/tags/jbpm-4.0.0.Beta1/modules/userguide/src/main/docbook/en/modules/ch03-Gpd.xml
===================================================================
--- jbpm4/tags/jbpm-4.0.0.Beta1/modules/userguide/src/main/docbook/en/modules/ch03-Gpd.xml	2009-04-07 08:16:32 UTC (rev 4473)
+++ jbpm4/tags/jbpm-4.0.0.Beta1/modules/userguide/src/main/docbook/en/modules/ch03-Gpd.xml	2009-04-07 09:34:55 UTC (rev 4474)
@@ -33,7 +33,14 @@
 
   <section id="editingtheprocesssource">
     <title>Editing the process source</title>
-    <para>To edit the process XML sources directly, select the process file, right click
+    <para>The GPD contains a 'Source' tab with the XML sources. These are directly editable in
+    this tab and the graphical view will reflect the changes when you switch back to the diagram.</para>
+    <figure id="gpd.source.tab">
+       <title>Editing jPDL using the source view</title>
+      <mediaobject><imageobject><imagedata align="center" fileref="images/gpd.xml.view.png"/></imageobject></mediaobject>
+    </figure>
+    <para>You can of course still edit the process XML sources using the built in XML editor. 
+    To do this, select the process file, right click
     and select 'Open with...' --> 'XML editor'
     </para>
     <figure id="gpd.open.in.xml">
@@ -43,7 +50,7 @@
     <para>After you've done this, eclipse will remember that and the next time 
     you double click it, eclipse will open your process file in the XML Editor 
     automatically.  To open up the process file in the GPD, perform the 
-    same Open-with-action, but select 'jPDL 4 Editor'  
+    same Open-with-action, but select 'jBPM jPDL 4 Editor'  
     </para>
   </section>
   

Modified: jbpm4/tags/jbpm-4.0.0.Beta1/modules/userguide/src/main/docbook/en/modules/ch05-Jpdl.xml
===================================================================
--- jbpm4/tags/jbpm-4.0.0.Beta1/modules/userguide/src/main/docbook/en/modules/ch05-Jpdl.xml	2009-04-07 08:16:32 UTC (rev 4473)
+++ jbpm4/tags/jbpm-4.0.0.Beta1/modules/userguide/src/main/docbook/en/modules/ch05-Jpdl.xml	2009-04-07 09:34:55 UTC (rev 4474)
@@ -526,14 +526,8 @@
 &lt;/process&gt;</programlisting>
     </section>
 
-
-
-
-
-
-
-
-
+    <!-- ### END ########################################################### -->
+    
     <section id="end">
       <title><literal>end</literal></title>
       <para>Ends the execution.
@@ -696,6 +690,8 @@
         respectively.</para>
       </section>
     </section>
+
+    <!-- ### JAVA ########################################################## -->
       
     <section id="java">
       <title><literal>java</literal></title>
@@ -821,62 +817,442 @@
       </para>
     </section>
 
+    <!-- ### TASK ########################################################## -->
+
     <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;
+      
+      <!-- ~~~ TASK ASSIGNEE ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -->
 
+      <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>
+            </tbody>
+          </tgroup>
+        </table>
+	      <figure id="process.task.assignee">
+	        <title>The task assignee 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; 
+        <emphasis role="bold">assignee=&quot;#{order.owner}&quot;</emphasis>&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>
+
+      <!-- ~~~ TASK CANDIDATES ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -->
+
+      <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>
+        <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>candidate-groups</literal></entry>
+                <entry>expression</entry>
+                <entry></entry>
+                <entry>optional</entry>
+                <entry>resolves to a comma separated list of groupIds.
+                All the people in the groups will be candidates for this 
+                task.</entry>
+              </row>
+              <row>
+                <entry><literal>candidate-users</literal></entry>
+                <entry>expression</entry>
+                <entry></entry>
+                <entry>optional</entry>
+                <entry>resolves to a comma separated list of userIds.
+                All the users will be candidates for this task.</entry>
+              </row>
+            </tbody>
+          </tgroup>
+        </table>
+        <figure id="process.task.candidates">
+          <title>The task candidates example process</title>
+          <mediaobject><imageobject><imagedata align="center" fileref="images/process.task.png"/></imageobject></mediaobject>
+        </figure>
+        <para>Here's an example process using task candidates:</para>
+        <programlisting>&lt;process name=&quot;TaskCandidates&quot;&gt;
+
+  &lt;start&gt;
+    &lt;transition to=&quot;review&quot; /&gt;
+  &lt;/start&gt;
+
+  &lt;task name=&quot;review&quot; 
+        <emphasis role="bold">candidate-groups=&quot;sales-dept&quot;</emphasis>&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 task will be created.  The task will not show up in anyone's
+        personal task list.  Following task lists will be empty.
+        </para>
+        <programlisting>taskService.getAssignedTasks(&quot;johndoe&quot;);
+taskService.getAssignedTasks(&quot;joesmoe&quot;);</programlisting>
+        <para>But the task will show up in the takable task list of all members of the <literal>sales-dept</literal>
+        group.   
+        </para>
+        <para>The in our example, the <literal>sales-dept</literal> has two members: johndoe and joesmoe</para>
+        <programlisting>identityService.createGroup(&quot;sales-dept&quot;);
+
+identityService.createUser(&quot;johndoe&quot;, &quot;johndoe&quot;, &quot;John&quot;, &quot;Doe&quot;);
+identityService.createMembership(&quot;johndoe&quot;, &quot;sales-dept&quot;);
+
+identityService.createUser(&quot;joesmoe&quot;, &quot;joesmoe&quot;, &quot;Joe&quot;, &quot;Smoe&quot;);
+identityService.createMembership(&quot;joesmoe&quot;, &quot;sales-dept&quot;); </programlisting>
+        <para>So after the process is created, the task will appear in both the 
+        takable tasks for users johndoe and joesmoe</para>
+        <programlisting>taskService.findTakableTasks("johndoe");
+taskService.findTakableTasks("joesmoe");</programlisting>
+        <para>Candidates must take a task before they can work on it. This will prevent 
+        that two candides start working on the same task.  The user interface must only 
+        offer the action 'Take' for the tasks in the takable task list.    
+        </para>
+        <programlisting>taskService.takeTask(task.getDbid(), &quot;johndoe&quot;);</programlisting>
+        <para>When a user takes a task, the assignee of that task will be set to the given 
+        user.  The task will disappear from all the candidate's takable task list and 
+        it will appear in the user's assigned tasks.
+        </para>
+        <para>Users are only allowed to work on tasks in their personal task list.  This 
+        should be enforced by the user interface.</para>
+        <para>Similarly, the attribute <literal>candidate-users</literal> can be used that 
+        resolves to a comma separated list of userIds.  The <literal>candidate-users</literal>  
+        attribute can be used in combination with other assignment options.
+        </para>
+      </section>
+
+      <!-- ~~~ TASK ASSIGNMENT HANDLER ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -->
+
+      <section id="taskassignmenthandler">
+        <title><literal>task</literal> assignment handler</title>
+        <para>An <literal>AssignmentHandler</literal> can be used to calculate the 
+        assignee and the candidates for a task programmatically. 
+        </para>
+        <programlisting>public interface <emphasis role="bold">AssignmentHandler</emphasis> extends Serializable {
+
+  /** sets the actorId and candidates for the given assignable. */
+  void assign(Assignable assignable, OpenExecution execution) throws Exception;
+}</programlisting>
+        <para><literal>Assignable</literal> is a common interface for Tasks and
+        Swimlanes.  So AssignmentHandlers can be used for tasks as well as swimlanes 
+        (see later).
+        </para>
+        <para><literal>assignment-handler</literal> is a sub element of the task element.
+        It specifies a user code object.  So the attributes and elements of <literal>assignment-handler</literal>
+        are documented in <xref linkend="usercode" />
+        </para>
+        <para>Let's look at the task assignment example process.</para>
+        <figure id="process.task.assignmenthandler">
+          <title>The task assignment handler example process</title>
+          <mediaobject><imageobject><imagedata align="center" fileref="images/process.task.png"/></imageobject></mediaobject>
+        </figure>
+        <programlisting>&lt;process name=&quot;TaskAssignmentHandler&quot; xmlns=&quot;http://jbpm.org/4/jpdl&quot;&gt;
+
+  &lt;start g=&quot;20,20,48,48&quot;&gt;
+    &lt;transition to=&quot;review&quot; /&gt;
+  &lt;/start&gt;
+  
+  &lt;task name=&quot;review&quot; g=&quot;96,16,127,52&quot;&gt;
+    <emphasis role="bold">&lt;assignment-handler class=&quot;org.jbpm.examples.task.assignmenthandler.AssignTask&quot;&gt;
+      &lt;field name=&quot;assignee&quot;&gt;
+        &lt;string value=&quot;johndoe&quot; /&gt;
+      &lt;/field&gt;
+    &lt;/assignment-handler&gt;</emphasis>
+    &lt;transition to=&quot;wait&quot; /&gt;
+  &lt;/task&gt;
+
+  &lt;state name=&quot;wait&quot; g=&quot;255,16,88,52&quot; /&gt;
+  
+&lt;/process&gt;</programlisting>
+        <para>The referenced class <literal>AssignTask</literal> looks like this: </para>
+        <programlisting>public class AssignTask implements AssignmentHandler {
+
+  String assignee;
+
+  public void assign(Assignable assignable, OpenExecution execution) {
+    assignable.setAssignee(assignee);
+  }
+}</programlisting>
+        <para>Please note that potentially, AssignmentHandler implementations can use 
+        the process variables and any other Java API to access resources like your 
+        application database to calculate the assignee and candidate users and groups. 
+        </para>
+        <para>Starting a new process instance of the <literal>TaskAssignmentHandler</literal> 
+        process will immediately bring the new execution to the task activity.  A new 
+        <literal>review</literal> task is created and at that point, the <literal>AssignTask</literal> 
+        assignment handler is called.  That will set <literal>johndoe</literal> as 
+        the assignee.  So John Doe will find the task in his personal task list.
+        </para>
+      </section>
+
+      <!-- ~~~ TASK SWIMLANES ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -->
+
+      <section id="taskswimlanes">
+        <title><literal>task</literal> swimlanes</title>
+        <para>Multiple tasks in a process should be assigned to the same 
+        user or candidates.  Multiple tasks in a process can be associated to a 
+        single swimlane.  The process instance will remember the candidates and user 
+        that performed the first task in the swimlane.  And subsequent tasks in the 
+        same swimlane will be assigned to those user and candidates. 
+        </para>
+        <para>A swimlane can also be considered as a process role.  In some 
+        cases, this might boil down to authorization roles in the 
+        identity component.  But bare in mind that it is not always the 
+        same thing.</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>swimlane</literal></entry>
+                <entry>swimlane (string)</entry>
+                <entry></entry>
+                <entry>optional</entry>
+                <entry>refers to a swimlane that is declared in the process</entry>
+              </row>
+            </tbody>
+          </tgroup>
+        </table>
+        <para>Swimlanes can be declared inside a process element:</para>
+        <table><title><literal>swimlane</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>name</literal></entry>
+                <entry>swimlane (string)</entry>
+                <entry></entry>
+                <entry><emphasis role="bold">required</emphasis></entry>
+                <entry>Name for this swimlane.  This is the 
+                name that will be referenced by task swimlane attributes.
+                </entry>
+              </row>
+              <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>candidate-groups</literal></entry>
+                <entry>expression</entry>
+                <entry></entry>
+                <entry>optional</entry>
+                <entry>resolves to a comma separated list of groupIds.
+                All the people in the groups will be candidates for this 
+                the tasks in this swimlane.</entry>
+              </row>
+              <row>
+                <entry><literal>candidate-users</literal></entry>
+                <entry>expression</entry>
+                <entry></entry>
+                <entry>optional</entry>
+                <entry>resolves to a comma separated list of userIds.
+                All the users will be candidates for the 
+                tasks in this swimlane.</entry>
+              </row>
+            </tbody>
+          </tgroup>
+        </table>
+        <figure id="process.task.swimlane">
+          <title>The task swimlane example process</title>
+          
+          <!-- KOEN: volgende image moet aangepast worden naar  
+                     images/process.task.swimlane.png 
+                     nadat je die hebt toegevoegd aan de images directory -->
+
+          <mediaobject><imageobject><imagedata align="center" fileref="images/process.task.png"/></imageobject></mediaobject>
+        </figure>
+        <para>The task swimlane example has the following process file :</para>
+        <programlisting>&lt;process name=&quot;TaskSwimlane&quot; xmlns=&quot;http://jbpm.org/4/jpdl&quot;&gt;
+
+  <emphasis role="bold">&lt;swimlane name=&quot;sales representative&quot;
+            candidate-groups=&quot;sales-dept&quot; /&gt;</emphasis>
+
+  &lt;start&gt;
+    &lt;transition to=&quot;enter order data&quot; /&gt;
+  &lt;/start&gt;
+  
+  &lt;task name=&quot;enter order data&quot;
+        <emphasis role="bold">swimlane=&quot;sales representative&quot;</emphasis>&gt;
+
+    &lt;transition to=&quot;calculate quote&quot;/&gt;
+  &lt;/task&gt;
+
+  &lt;task 
+      name=&quot;calculate quote&quot; 
+      <emphasis role="bold">swimlane=&quot;sales representative&quot;</emphasis>&gt;
+  &lt;/task&gt;
+
+&lt;/process&gt;</programlisting>
+        <para>In this example we create the following information in the identity 
+        component:</para>
+        <programlisting>identityService.createGroup(&quot;sales-dept&quot;);
+
+identityService.createUser(&quot;johndoe&quot;, &quot;johndoe&quot;, &quot;John&quot;, &quot;Doe&quot;);
+identityService.createMembership(&quot;johndoe&quot;, &quot;sales-dept&quot;);</programlisting>
+        <para>After starting a new process instance, user <literal>johndoe</literal> will 
+        be a candidate for task <literal>enter order data</literal>.  Again like in the 
+        previous task candidates example, John Doe can now take this task like this:
+        </para>
+        <programlisting>taskService.takeTask(taskDbid, &quot;johndoe&quot;);</programlisting>
+        <para>Taking the task will make Lit<literal>johndoe</literal> the assignee for 
+        the task.  And since this task is coupled to the swimlane 
+        <literal>sales representative</literal>, assignee <literal>johndoe</literal> will 
+        also be propagated as the assignee in the swimlane.</para>
+        <para>Next, John Doe can complete the task like this:</para>
+        <programlisting>taskService.completeTask(taskDbid);</programlisting>
+        <para>Completing the task will bring the process execution to the 
+        next task, which is <literal>calculate quote</literal>.  Also 
+        this task is linked to the swimlane.  Therefore, the task will be 
+        assigned to <literal>johndoe</literal>.  Also the candidate users 
+        and candidate groups of the initial assignment will be copied from 
+        the swimlane to the task.  This is relevant in case user <literal>johndoe</literal> 
+        would release the task and offer it back to the other candidates.
+        </para>
+      </section>
+
+      <!-- ~~~ TASK VARIABLES ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -->
+
+      <section id="taskvariables">
+        <title><literal>task</literal> variables</title>
+        <para>Tasks can see and update process variables.  Later tasks will have 
+        the option to declare task-local process variables.  Task variables 
+        are an important part of the task forms.  Task forms typically show 
+        data that comes from the task and the process instance.  Then 
+        input from the user is translated in setting task variables. 
+        </para>
+        <para>Getting task variables can be done like this:</para>
+        <programlisting>List&lt;Task&gt; taskList = taskService.findAssignedTasks(&quot;johndoe&quot;);
+
+Task task = taskList.get(0);
+long taskDbid = task.getDbid();
+
+Set&lt;String&gt; variableNames = taskService.getVariableNames(taskDbid);
+
+Map&lt;String, Object&gt; variables = taskService.getVariables(taskDbid, variableNames);</programlisting>
+        <para>And setting task variables can be done like this:</para>
+        <programlisting>variables = new HashMap&lt;String, Object&gt;();
+variables.put(&quot;category&quot;, &quot;small&quot;);
+variables.put(&quot;lires&quot;, 923874893);
+
+taskService.setVariables(taskDbid, variables);</programlisting>
+      </section>
     </section>
 
+    <!-- ### SCRIPT ######################################################## -->
+
     <section id="script">
       <title><literal>script</literal></title>
       <para>A script activity evaluates a script.  Scripts can be specified in any language for 
@@ -1064,6 +1440,8 @@
       </para>
     </section>
 
+    <!-- ### ESB ########################################################### -->
+
     <section id="esb">
       <title><literal>esb</literal></title>
       <para>An <literal>esb</literal> activity sends a message to a service over the ESB.  
@@ -1153,6 +1531,8 @@
       </para>
     </section>
 
+    <!-- ### HQL ########################################################### -->
+
     <section id="hql">
       <title><literal>hql</literal></title>
       <para>With the<literal>hql</literal> activity, a HQL query can be performed 
@@ -1253,6 +1633,8 @@
 &lt;/process&gt;</programlisting>
     </section>
 
+    <!-- ### SQL ########################################################### -->
+
     <section id="sql">
       <title><literal>sql</literal></title>
       <para>The <literal>sql</literal> activity is exactly the same as the
@@ -1309,4 +1691,100 @@
     </section>
   </section>
 
+  <section id="usercode">
+    <title>User code</title>
+    <para>Various elements in the jPDL process language refer to a an 
+    object on which an interface method will be invoked.  See for example
+    <xref linkend="taskassignmenthandler" />.  This section describes the 
+    attributes and sub elements of those type of user code objects. 
+    </para>
+      <table><title>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>class</literal></entry>
+              <entry>classname</entry>
+              <entry></entry>
+              <entry><emphasis role="bold">required</emphasis></entry>
+              <entry>The fully qualified classname.</entry>
+            </row>
+          </tbody>
+        </tgroup>
+      </table>
+      <table><title>sub 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>field</literal></entry>
+              <entry>0..*</entry>
+              <entry>describes a configuration value to be injected directly in 
+              a memberfield before this user class is used.</entry>
+            </row>
+            <row>
+              <entry><literal>property</literal></entry>
+              <entry>0..*</entry>
+              <entry>describes a configuration value to injected through a setter 
+              method before this user object is used.</entry>
+            </row>
+          </tbody>
+        </tgroup>
+      </table>
+      <table><title><literal>field</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>name</literal></entry>
+              <entry>string</entry>
+              <entry></entry>
+              <entry><emphasis role="bold">required</emphasis></entry>
+              <entry>the name of the field</entry>
+            </row>
+          </tbody>
+        </tgroup>
+      </table>
+      <table><title><literal>field</literal> sub 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>string</literal></entry>
+              <entry>0..1</entry>
+              <entry>represents a string value</entry>
+            </row>
+          </tbody>
+        </tgroup>
+      </table>
+  </section>
+
 </chapter>




More information about the jbpm-commits mailing list