[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><process name="Java" xmlns="http://jbpm.org/4/jpdl">
+ <start>
+ <flow to="invoke java method" />
+ </start>
+
+ <java name="invoke java method"
+ class="org.jbpm.examples.java.JohnDoe"
+ method="hello"
+ var="answer">
+
+ <field name="state"><string value="fine"/></field>
+ <field name="session"><env type="org.hibernate.Session"/></field>
+
+ <arg><string value="Hi, how are you?"/></arg>
+
+ <flow to="wait" />
+ </java>
+
+ <state name="wait">
+
+</process>
+ </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("how are you?")!=-1)
+ && (session.isOpen())
+ ) {
+ return "I'm "+state+", thank you.";
+ }
+ 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