[jboss-svn-commits] JBL Code SVN: r25896 - in labs/jbossrules/trunk/drools-docs/drools-docs-flow/src/main/docbook: images/Chapter-HumanTasks and 1 other directory.

jboss-svn-commits at lists.jboss.org jboss-svn-commits at lists.jboss.org
Tue Mar 31 11:24:14 EDT 2009


Author: KrisVerlaenen
Date: 2009-03-31 11:24:14 -0400 (Tue, 31 Mar 2009)
New Revision: 25896

Added:
   labs/jbossrules/trunk/drools-docs/drools-docs-flow/src/main/docbook/images/Chapter-HumanTasks/human_task_view.png
Modified:
   labs/jbossrules/trunk/drools-docs/drools-docs-flow/src/main/docbook/en-US/Chapter-HumanTasks/Chapter-HumanTasks.xml
Log:
 - updated Drools Flow docs

Modified: labs/jbossrules/trunk/drools-docs/drools-docs-flow/src/main/docbook/en-US/Chapter-HumanTasks/Chapter-HumanTasks.xml
===================================================================
--- labs/jbossrules/trunk/drools-docs/drools-docs-flow/src/main/docbook/en-US/Chapter-HumanTasks/Chapter-HumanTasks.xml	2009-03-31 13:02:58 UTC (rev 25895)
+++ labs/jbossrules/trunk/drools-docs/drools-docs-flow/src/main/docbook/en-US/Chapter-HumanTasks/Chapter-HumanTasks.xml	2009-03-31 15:24:14 UTC (rev 25896)
@@ -197,18 +197,17 @@
       the implementation of the following methods to interact with Human
       Tasks:</para>
 
-      <para><programlisting>  public void start(long taskId, String userId, TaskOperationResponseHandler responseHandler)
-  public void stop(long taskId, String userId, TaskOperationResponseHandler responseHandler)
-  public void release(long taskId, String userId, TaskOperationResponseHandler responseHandler)
-  public void suspend(long taskId, String userId, TaskOperationResponseHandler responseHandler)
-  public void resume(long taskId, String userId, TaskOperationResponseHandler responseHandler)
-  public void skip(long taskId, String userId, TaskOperationResponseHandler responseHandler)
-  public void delegate(long taskId, String userId, String targetUserId, TaskOperationResponseHandler responseHandler)
-  public void complete(long taskId, String userId, ContentData outputData, TaskOperationResponseHandler responseHandler)
-  ...
+      <para><programlisting>
+public void start(long taskId, String userId, TaskOperationResponseHandler responseHandler)
+public void stop(long taskId, String userId, TaskOperationResponseHandler responseHandler)
+public void release(long taskId, String userId, TaskOperationResponseHandler responseHandler)
+public void suspend(long taskId, String userId, TaskOperationResponseHandler responseHandler)
+public void resume(long taskId, String userId, TaskOperationResponseHandler responseHandler)
+public void skip(long taskId, String userId, TaskOperationResponseHandler responseHandler)
+public void delegate(long taskId, String userId, String targetUserId, TaskOperationResponseHandler responseHandler)
+public void complete(long taskId, String userId, ContentData outputData, TaskOperationResponseHandler responseHandler)
+...</programlisting></para>
 
-    </programlisting></para>
-
       <para>Using this methods we will implement any kind of GUI that the end
       user will use to do the task that they have assigned. If you take a look
       a this method signatures you will notice that almost all of this method
@@ -241,27 +240,27 @@
       implement the correct action. A creation of one of this messages will be
       like this:</para>
 
-      <para><programlisting>    public void complete(long taskId,
-                         String userId,
-                         ContentData outputData,
-                         TaskOperationResponseHandler responseHandler) {
-        List&lt;Object&gt; args = new ArrayList&lt;Object&gt;( 5 );
-        args.add( Operation.Complete );
-        args.add( taskId );
-        args.add( userId );
-        args.add( null );
-        args.add( outputData );
-        Command cmd = new Command( counter.getAndIncrement(),
-                                   CommandName.OperationRequest,
-                                   args );
+      <para><programlisting>
+public void complete(long taskId,
+                     String userId,
+                     ContentData outputData,
+                     TaskOperationResponseHandler responseHandler) {
+  List&lt;Object&gt; args = new ArrayList&lt;Object&gt;( 5 );
+  args.add( Operation.Complete );
+  args.add( taskId );
+  args.add( userId );
+  args.add( null );
+  args.add( outputData );
+  Command cmd = new Command( counter.getAndIncrement(),
+                             CommandName.OperationRequest,
+                             args );
 
-        handler.addResponseHandler( cmd.getId(),
-                                    responseHandler );
-
-        session.write( cmd );
-    }
-
-    </programlisting>Here we can see that a Command is created and the arguments
+  handler.addResponseHandler( cmd.getId(),
+                              responseHandler );
+  session.write( cmd );
+}</programlisting>
+
+      Here we can see that a Command is created and the arguments
       of the method are inserted inside the command with the type of operation
       that we are trying to execute and then this command is sended to the
       server with session.write( cmd ) method.</para>
@@ -278,8 +277,93 @@
     </section>
 
     <section>
-      <title>Starting the task management component</title>
+      <title>Starting the task management component</title>
 
+      <para>The task management component is a completely independent service
+      that the process engine communicates with.  We therefore recommend to
+      start it as a separate service as well.  To start the task server, you 
+      can use the following code fragment:</para>
+
+      <programlisting>
+EntityManagerFactory emf = Persistence.createEntityManagerFactory("org.drools.task");
+taskService = new TaskService(emf);
+MinaTaskServer server = new MinaTaskServer( taskService );
+Thread thread = new Thread( server );
+thread.start();</programlisting>
+
+      <para>The task management component uses the Java Persistence API (JPA) to
+      store all task information in a persistent manner.  To configure the
+      persistence, you need to modify the persistence.xml configuration file
+      accordingly.  We refer to the JPA documentation on how to do that.  The
+      following fragment shows for example how to use the task management component
+      with hibernate and an in-memory H2 database:</para>
+
+      <programlisting>
+&lt;?xml version="1.0" encoding="UTF-8" standalone="yes"?&gt;
+&lt;persistence
+    version="1.0"
+    xsi:schemaLocation=
+      "http://java.sun.com/xml/ns/persistence
+       http://java.sun.com/xml/ns/persistence/persistence_1_0.xsd
+       http://java.sun.com/xml/ns/persistence/orm
+       http://java.sun.com/xml/ns/persistence/orm_1_0.xsd"
+    xmlns:orm="http://java.sun.com/xml/ns/persistence/orm"
+    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+    xmlns="http://java.sun.com/xml/ns/persistence"&gt;
+
+  &lt;persistence-unit name="org.drools.task"&gt;
+    &lt;provider&gt;org.hibernate.ejb.HibernatePersistence&lt;/provider&gt;
+    &lt;class&gt;org.drools.task.Attachment&lt;/class&gt;
+    &lt;class&gt;org.drools.task.Content&lt;/class&gt;
+    &lt;class&gt;org.drools.task.BooleanExpression&lt;/class&gt;
+    &lt;class&gt;org.drools.task.Comment&lt;/class&gt;
+    &lt;class&gt;org.drools.task.Deadline&lt;/class&gt;
+    &lt;class&gt;org.drools.task.Comment&lt;/class&gt;
+    &lt;class&gt;org.drools.task.Deadline&lt;/class&gt;
+    &lt;class&gt;org.drools.task.Delegation&lt;/class&gt;
+    &lt;class&gt;org.drools.task.Escalation&lt;/class&gt;
+    &lt;class&gt;org.drools.task.Group&lt;/class&gt;
+    &lt;class&gt;org.drools.task.I18NText&lt;/class&gt;
+    &lt;class&gt;org.drools.task.Notification&lt;/class&gt;
+    &lt;class&gt;org.drools.task.EmailNotification&lt;/class&gt;
+    &lt;class&gt;org.drools.task.EmailNotificationHeader&lt;/class&gt;
+    &lt;class&gt;org.drools.task.PeopleAssignments&lt;/class&gt;
+    &lt;class&gt;org.drools.task.Reassignment&lt;/class&gt;
+    &lt;class&gt;org.drools.task.Status&lt;/class&gt;
+    &lt;class&gt;org.drools.task.Task&lt;/class&gt;
+    &lt;class&gt;org.drools.task.TaskData&lt;/class&gt;
+    &lt;class&gt;org.drools.task.SubTasksStrategy&lt;/class&gt;
+    &lt;class&gt;org.drools.task.OnParentAbortAllSubTasksEndStrategy&lt;/class&gt;
+    &lt;class&gt;org.drools.task.OnAllSubTasksEndParentEndStrategy&lt;/class&gt;
+    &lt;class&gt;org.drools.task.User&lt;/class&gt;
+
+    &lt;properties&gt;
+      &lt;property name="hibernate.dialect" value="org.hibernate.dialect.H2Dialect"/&gt;
+      &lt;property name="hibernate.connection.driver_class" value="org.h2.Driver"/&gt;
+      &lt;property name="hibernate.connection.url" value="jdbc:h2:mem:mydb" /&gt;
+      &lt;property name="hibernate.connection.username" value="sa"/&gt;
+      &lt;property name="hibernate.connection.password" value="sasa"/&gt;
+      &lt;property name="hibernate.connection.autocommit" value="false" /&gt;
+      &lt;property name="hibernate.max_fetch_depth" value="3"/&gt;
+      &lt;property name="hibernate.hbm2ddl.auto" value="create" /&gt;
+      &lt;property name="hibernate.show_sql" value="true" /&gt;
+    &lt;/properties&gt;
+  &lt;/persistence-unit&gt;
+&lt;/persistence&gt;</programlisting>
+
+      <para>The first time you start the task management component, you need to
+      make sure that all the necessary users and groups are added to the database.
+      Our implementation requires all users and groups to be predefined before
+      trying to assign a task to that user or group.  So you need to make sure
+      you add the necessary users and group to the database using the
+      taskSession.addUser(user) and taskSession.addGroup(group) methods.  Note
+      that you at least need an "Administrator" user as all tasks are
+      automatically assigned to this user as the administrator role.</para>
+
+      <para>The drools-process-task module contains a org.drools.task.RunTaskService
+      class in the src/test/java source folder that can be used to start a task server.
+      It automatically adds users and groups as defined in LoadUsers.mvel and
+      LoadGroups.mvel configuration files.</para>
     </section>
 
     <section>
@@ -312,7 +396,7 @@
                     arguments. This will generate a new Message (or Command) that will be inserted in the session
                     that the client open when it connects to the server. This message must specify a type that the
                     server recognize and know what to do when the message is recieved. This is the step two in the image.
-                </para>
+                </para>
             </listitem>
             <listitem>
                 <para>
@@ -355,13 +439,28 @@
     <section>
       <title>Eclipse integration</title>
 
-      <para></para>
+      <para>The Drools IDE contains a org.drools.eclipse.task plugin that allows you to test and/or debug
+      processes using human tasks.  In contains a Human Task View that can connect to a running task
+      management component, request the relevant tasks for a particular user (i.e. the tasks where the user
+      is either a potential owner or the tasks that the user already claimed and is executing).  The
+      life cycle of these tasks can then be executed, i.e. claiming or releasing a task, starting or
+      stopping the execution of a task, completing a task, etc.  A screenshot of this Human Task View is
+      shown below.  You can configure which task management component to connect to in the Drools Task
+      preference page (select Window -> Preferences and select Drools Task).  Here you can specify the
+      url and port (default = 127.0.0.1:9123).</para>
+
+      <mediaobject>
+        <imageobject>
+          <imagedata align="center" fileref="images/Chapter-HumanTasks/human_task_view.png" format="PNG" role="" />
+        </imageobject>
+      </mediaobject>
     </section>
 
     <section>
       <title>Web-based task view</title>
 
-      <para></para>
+      <para>We are targeting to add a web-based view that end users can use for managing their tasks
+      for Drools 5.1.</para>
     </section>
 
   </section>

Added: labs/jbossrules/trunk/drools-docs/drools-docs-flow/src/main/docbook/images/Chapter-HumanTasks/human_task_view.png
===================================================================
(Binary files differ)


Property changes on: labs/jbossrules/trunk/drools-docs/drools-docs-flow/src/main/docbook/images/Chapter-HumanTasks/human_task_view.png
___________________________________________________________________
Name: svn:mime-type
   + application/octet-stream




More information about the jboss-svn-commits mailing list