[jbpm-commits] JBoss JBPM SVN: r3549 - jbpm4/trunk/modules/userguide/src/main/docbook/en/modules.

do-not-reply at jboss.org do-not-reply at jboss.org
Wed Dec 24 17:03:07 EST 2008


Author: koen.aers at jboss.com
Date: 2008-12-24 17:03:07 -0500 (Wed, 24 Dec 2008)
New Revision: 3549

Modified:
   jbpm4/trunk/modules/userguide/src/main/docbook/en/modules/ch04-Jpdl.xml
Log:
add the java task documentation

Modified: jbpm4/trunk/modules/userguide/src/main/docbook/en/modules/ch04-Jpdl.xml
===================================================================
--- jbpm4/trunk/modules/userguide/src/main/docbook/en/modules/ch04-Jpdl.xml	2008-12-24 20:45:37 UTC (rev 3548)
+++ jbpm4/trunk/modules/userguide/src/main/docbook/en/modules/ch04-Jpdl.xml	2008-12-24 22:03:07 UTC (rev 3549)
@@ -247,7 +247,149 @@
         </para>
       </section>
     </section>
+    
+    <section id="java">
+      <title><literal>java</literal></title>
+      <para>The Java task. A process execution will execute the method of the class that is configured
+      in this task.</para> 
+      <table><title><literal>java</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>class</literal></entry>
+              <entry></entry>
+              <entry></entry>
+              <entry></entry>
+              <entry></entry>
+            </row>
+            <row>
+              <entry><literal>method</literal></entry>
+              <entry></entry>
+              <entry></entry>
+              <entry></entry>
+              <entry></entry>
+            </row>
+            <row>
+              <entry><literal>var</literal></entry>
+              <entry></entry>
+              <entry></entry>
+              <entry></entry>
+              <entry></entry>
+            </row>
+          </tbody>
+        </tgroup>
+      </table>
+      <table><title><literal>java</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>field</literal></entry>
+              <entry></entry>
+              <entry></entry>
+            </row>
+            <row>
+              <entry><literal>arg</literal></entry>
+              <entry></entry>
+              <entry></entry>
+            </row>
+          </tbody>
+        </tgroup>
+      </table>
+      <para>Consider the following example.</para>
+      <figure id="java">
+        <title>A java task</title>
+        <mediaobject><imageobject><imagedata align="center" fileref="images/java.png"/></imageobject></mediaobject>
+      </figure>
+      <programlisting>&lt;process name=&quot;Java&quot; xmlns=&quot;http://jbpm.org/4/jpdl&quot;&gt;
 
+  &lt;start&gt;
+    &lt;flow to=&quot;invoke java method&quot; /&gt;
+  &lt;/start&gt;
+
+  &lt;java name=&quot;invoke java method&quot; 
+        class=&quot;org.jbpm.examples.java.JohnDoe&quot;
+        method=&quot;hello&quot;
+        var=&quot;answer&quot;&gt;
+        
+    &lt;field name=&quot;state&quot;&gt;&lt;string value=&quot;fine&quot;/&gt;&lt;/field&gt;
+    &lt;field name=&quot;session&quot;&gt;&lt;env type=&quot;org.hibernate.Session&quot;/&gt;&lt;/field&gt;
+
+    &lt;arg&gt;&lt;string value=&quot;Hi, how are you?&quot;/&gt;&lt;/arg&gt;
+    
+    &lt;flow to=&quot;wait&quot; /&gt;
+  &lt;/java&gt;
+  
+  &lt;state name=&quot;wait&quot;&gt;
+
+&lt;/process&gt;
+      </programlisting>
+      <para>The java task specifies that during its execution an instance of the class <literal>org.jbpm.examples.java.JohnDoe</literal>
+      will be instantiated and the method <literal>hello</literal> of this class will be invoked on the resulting object. The variable named
+      <literal>answer</literal> will contain the result of the invocation. Let's look at the class <literal>JohnDoe</literal> below.
+      </para>
+      <programlisting>package org.jbpm.examples.java;
+
+import org.hibernate.Session;
+
+public class JohnDoe {
+  
+  String state;
+  Session session;
+  
+  public String hello(String msg) {
+    if ( (msg.indexOf(&quot;how are you?&quot;)!=-1)
+         &amp;&amp; (session.isOpen())
+       ) {
+      return &quot;I&#39;m &quot;+state+&quot;, thank you.&quot;;
+    }
+    return null;
+  }
+}
+    </programlisting>
+    <para>The class above reveals that it contains two fields named <literal>state</literal> and <literal>session</literal>
+    and that the method <literal>hello</literal> accepts one argument. During the execution the values specified in the 
+    <literal>field</literal> and <literal>arg</literal> configuration elements will be used. The expected result of creating
+    a process instance is that the process variable <literal>answer</literal> contains the string
+    <literal>I'm fine, thank you.</literal>.
+    </para>
+    </section>
+
+    <section id="script">
+      <title><literal>script</literal></title>
+    </section>
+
+    <section id="esb">
+      <title><literal>esb</literal></title>
+    </section>
+
+    <section id="sql">
+      <title><literal>sql</literal></title>
+    </section>
+
+    <section id="hql">
+      <title><literal>hql</literal></title>
+    </section>
+
+    <section id="task">
+      <title><literal>task</literal></title>
+    </section>
+
     <section id="exclusive">
       <title><literal>exclusive</literal></title>
       <para>Takes one path of many alternatives. Also known as a decision. An exclusive 




More information about the jbpm-commits mailing list