Author: jbarrez
Date: 2009-07-22 09:20:07 -0400 (Wed, 22 Jul 2009)
New Revision: 5335
Added:
jbpm4/trunk/modules/devguide/src/main/docbook/en/images/taskform_example.png
jbpm4/trunk/modules/examples/src/test/resources/org/jbpm/examples/taskform/process.jpdl.xml
Removed:
jbpm4/trunk/modules/examples/src/test/resources/org/jbpm/examples/taskform/accept_message.ftl
jbpm4/trunk/modules/examples/src/test/resources/org/jbpm/examples/taskform/reject_message.ftl
jbpm4/trunk/modules/examples/src/test/resources/org/jbpm/examples/taskform/vacation2.jpdl.xml
Modified:
jbpm4/trunk/modules/devguide/src/main/docbook/en/modules/ch02-Incubation.xml
jbpm4/trunk/modules/examples/src/test/resources/org/jbpm/examples/taskform/request_vacation.ftl
jbpm4/trunk/modules/examples/src/test/resources/org/jbpm/examples/taskform/verify_request.ftl
Log:
JBPM-2423, JBPM-2351, JBPM-2317, JBPM-2301: make taskform example work in demo.setup.
Added: jbpm4/trunk/modules/devguide/src/main/docbook/en/images/taskform_example.png
===================================================================
(Binary files differ)
Property changes on:
jbpm4/trunk/modules/devguide/src/main/docbook/en/images/taskform_example.png
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Modified: jbpm4/trunk/modules/devguide/src/main/docbook/en/modules/ch02-Incubation.xml
===================================================================
---
jbpm4/trunk/modules/devguide/src/main/docbook/en/modules/ch02-Incubation.xml 2009-07-21
20:42:34 UTC (rev 5334)
+++
jbpm4/trunk/modules/devguide/src/main/docbook/en/modules/ch02-Incubation.xml 2009-07-22
13:20:07 UTC (rev 5335)
@@ -617,5 +617,79 @@
<ulink
url="http://www.jboss.org/index.html?module=bb&op=viewtopic&...
</para>
</section>
+
+ <section id="taskforms">
+ <title>Task forms</title>
+ <para>
+ Human interaction happens nowadays most of the times through web interfaces
+ using some kind of form to capture input of the user. Using jBPM
+ task forms, a process designer can attach such input forms to a
+ <emphasis role="bold">task activity</emphasis> or a
<emphasis role="bold">
+ start activity</emphasis>. When using the jBPM console, the forms will
+ automatically be displayed for user input when a process instance is started
+ or when a task is completed. An example process
(<literal>VacationRequest</literal>)
+ is shipped with the default examples of the distribution demo.
+ </para>
+ <section id="taskformsusage">
+ <title>Usage</title>
+ <para>
+ Task form references can be put on start and task activities:
+ <programlisting>
+<start <emphasis
role="bold">form="org/jbpm/examples/taskform/request_vacation.ftl"</emphasis>
name="start">
+ <transition to="verify_request"/>
+</start>
+<task candidate-users="mike,peter" <emphasis
role="bold">form="org/jbpm/examples/taskform/verify_request.ftl"</emphasis>
name="verify_request">
+ <transition name="reject"
to="vacation_rejected"/>
+ <transition name="accept"
to="vacation_accepted"/>
+</task>
+ </programlisting>
+ </para>
+ </section>
+ <section id="taskformsformat">
+ <title>Form format</title>
+ <para>
+ Task forms are plain text files containing arbitray content. However,
+ when using the jBPM console, HTML pages containing a form element
+ are required. The default form plugin of the console leverages the
+ <ulink
url="http://freemarker.sourceforge.net/">freemarker</ulin...
+ templating library. It builds on the following constraints:
+ <itemizedlist>
+ <listitem>Templates need to be suffixed *.ftl and be included with the
deployment:
+
<programlisting>deployment.addResourceFromClasspath("org/jbpm/examples/taskform/verify_request.ftl");</programlisting>
+ </listitem>
+ <listitem>The action of the form must be
"${form.action}"</listitem>
+ <listitem>HTML forms need to provide the correct enctype:
"multipart/form-data"</listitem>
+ <listitem>Form field names become process variables names and vice
versa</listitem>
+ <listitem>A reserved field name is available for signaling execution upon
task completion: "outcome"</listitem>
+ </itemizedlist>
+
+ <programlisting>
+<html>
+ <body>
+ <form action="${form.action}"
method="POST" enctype="multipart/form-data">
+ <h3>Your employee, ${employee_name} would like to go on
vacation</h3>
+ Number of days: ${number_of_days}<br/>
+ <hr>
+ In case you reject, please provide a reason:<br/>
+ <input type="textarea"
name="reason"/><br/>
+ <#list outcome.values as transition>
+ <input type="submit" name="outcome"
value="${transition}">
+ </#list>
+ </form>
+ </body>
+</html>
+ </programlisting>
+ In this example, the process variables
<literal>employee_name</literal>
+ and <literal>number_of_days</literal> is displayed on the
+ screen using a variable reference expression. The value of the input
+ field <literal>reason</literal> will be stored as a process
+ variable.
+ </para>
+ <para>
+ The jBPM console will render the taskforms automatically:
+ <mediaobject><imageobject><imagedata align="center"
fileref="images/taskform_example.png"/></imageobject></mediaobject>
+ </para>
+ </section>
+ </section>
</chapter>
Deleted:
jbpm4/trunk/modules/examples/src/test/resources/org/jbpm/examples/taskform/accept_message.ftl
===================================================================
---
jbpm4/trunk/modules/examples/src/test/resources/org/jbpm/examples/taskform/accept_message.ftl 2009-07-21
20:42:34 UTC (rev 5334)
+++
jbpm4/trunk/modules/examples/src/test/resources/org/jbpm/examples/taskform/accept_message.ftl 2009-07-22
13:20:07 UTC (rev 5335)
@@ -1,12 +0,0 @@
-<html>
-<body>
-
-<h2>Your vacation request has been accepted</h2>
-Number of days: ${number_of_days}
-
-<form action="${form.action}" method="POST"
enctype="multipart/form-data">
- <input type="submit" name="Done"/>
-</form>
-
-</body>
-</html>
\ No newline at end of file
Copied:
jbpm4/trunk/modules/examples/src/test/resources/org/jbpm/examples/taskform/process.jpdl.xml
(from rev 5323,
jbpm4/trunk/modules/examples/src/test/resources/org/jbpm/examples/taskform/vacation2.jpdl.xml)
===================================================================
---
jbpm4/trunk/modules/examples/src/test/resources/org/jbpm/examples/taskform/process.jpdl.xml
(rev 0)
+++
jbpm4/trunk/modules/examples/src/test/resources/org/jbpm/examples/taskform/process.jpdl.xml 2009-07-22
13:20:07 UTC (rev 5335)
@@ -0,0 +1,13 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<process name="VacationRequest"
xmlns="http://jbpm.org/4.0/jpdl">
+ <start form="org/jbpm/examples/taskform/request_vacation.ftl"
g="16,56,48,48" name="start">
+ <transition to="verify_request"/>
+ </start>
+ <task candidate-users="mike,peter"
form="org/jbpm/examples/taskform/verify_request.ftl" g="96,54,178,52"
name="verify_request">
+ <transition g="-34,9" name="reject"
to="vacation_rejected"/>
+ <transition g="-46,-26" name="accept"
to="vacation_accepted"/>
+ </task>
+ <end g="306,16,48,48" name="vacation_accepted"/>
+ <end g="306,96,48,48" name="vacation_rejected"/>
+</process>
\ No newline at end of file
Deleted:
jbpm4/trunk/modules/examples/src/test/resources/org/jbpm/examples/taskform/reject_message.ftl
===================================================================
---
jbpm4/trunk/modules/examples/src/test/resources/org/jbpm/examples/taskform/reject_message.ftl 2009-07-21
20:42:34 UTC (rev 5334)
+++
jbpm4/trunk/modules/examples/src/test/resources/org/jbpm/examples/taskform/reject_message.ftl 2009-07-22
13:20:07 UTC (rev 5335)
@@ -1,10 +0,0 @@
-<html>
-<body>
-
-<h2>Your vacation request has been rejected</h2>
-Reason: ${reason}
-<form action="${form.action}" method="POST"
enctype="multipart/form-data">
- <input type="submit" name="Done"/>
-</form>
-</body>
-</html>
\ No newline at end of file
Modified:
jbpm4/trunk/modules/examples/src/test/resources/org/jbpm/examples/taskform/request_vacation.ftl
===================================================================
---
jbpm4/trunk/modules/examples/src/test/resources/org/jbpm/examples/taskform/request_vacation.ftl 2009-07-21
20:42:34 UTC (rev 5334)
+++
jbpm4/trunk/modules/examples/src/test/resources/org/jbpm/examples/taskform/request_vacation.ftl 2009-07-22
13:20:07 UTC (rev 5335)
@@ -1,18 +1,25 @@
<html>
-<body>
+ <body>
+
+ <form action="${form.action}" method="POST"
enctype="multipart/form-data">
+
+ <h3>How many days would you like to go on vacation?</h3>
+ <select name="number_of_days">
+ <option value="3">3 days</option>
+ <option value="5">5 days</option>
+ <option value="10">10 days</option>
+ </select><br>
+
+ <br/>
+ <br/>
+
+ Your name: <input type="text" name="employee_name"
/><br/>
+
+ <br/>
+ <br/>
+
+ <input type="submit" name="Done"/>
-<h2>How many days would you like to go on vacation?</h2>
-<form action="${form.action}" method="POST"
enctype="multipart/form-data">
-<select name="number_of_days">
- <option value="3">3 days</option>
- <option value="5">5 days</option>
- <option value="10">10 days</option>
-</select><br>
-
-<#list outcome.values as transition>
- <input type="submit" name="outcome"
value="${transition}">
-</#list>
-
-</form>
-</body>
+ </form>
+ </body>
</html>
\ No newline at end of file
Deleted:
jbpm4/trunk/modules/examples/src/test/resources/org/jbpm/examples/taskform/vacation2.jpdl.xml
===================================================================
---
jbpm4/trunk/modules/examples/src/test/resources/org/jbpm/examples/taskform/vacation2.jpdl.xml 2009-07-21
20:42:34 UTC (rev 5334)
+++
jbpm4/trunk/modules/examples/src/test/resources/org/jbpm/examples/taskform/vacation2.jpdl.xml 2009-07-22
13:20:07 UTC (rev 5335)
@@ -1,22 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-
-<process name="VacationRequest"
xmlns="http://jbpm.org/4.0/jpdl">
- <start g="274,13,48,48" name="start1">
- <transition g="-109,-18" name="to number_of_days"
to="request_vacation"/>
- </start>
- <end g="185,364,48,48" name="vacation_rejected"/>
- <task candidate-users="peter,mary" g="237,97,126,52"
name="request_vacation">
- <transition g="-99,-18" name="to grant_vacation"
to="verify_request"/>
- </task>
- <task candidate-users="mike" g="247,193,101,52"
name="verify_request">
- <transition g="-84,-1" name="reject"
to="reject_message"/>
- <transition g="32,-4" name="accept"
to="accept_message"/>
- </task>
- <task candidate-groups="sales" g="148,273,118,52"
name="reject_message">
- <transition g="-51,-9" name="done_rejected"
to="vacation_rejected"/>
- </task>
- <task candidate-groups="sales" g="371,274,108,52"
name="accept_message">
- <transition g="-46,-18" name="done_accepted"
to="vacation_accepted"/>
- </task>
- <end g="408,359,48,48" name="vacation_accepted"/>
-</process>
\ No newline at end of file
Modified:
jbpm4/trunk/modules/examples/src/test/resources/org/jbpm/examples/taskform/verify_request.ftl
===================================================================
---
jbpm4/trunk/modules/examples/src/test/resources/org/jbpm/examples/taskform/verify_request.ftl 2009-07-21
20:42:34 UTC (rev 5334)
+++
jbpm4/trunk/modules/examples/src/test/resources/org/jbpm/examples/taskform/verify_request.ftl 2009-07-22
13:20:07 UTC (rev 5335)
@@ -1,15 +1,20 @@
<html>
-<body>
+ <body>
-<h2>Your employee would like to go on vacation</h2>
-<form action="${form.action}" method="POST"
enctype="multipart/form-data">
-Number of days: ${number_of_days}<br/>
-<hr>
-In case you reject, please provide a reason:<br/>
-<input type="textarea" name="reason"/><br/>
-<#list outcome.values as transition>
- <input type="submit" name="outcome"
value="${transition}">
-</#list>
-</form>
-</body>
+ <form action="${form.action}" method="POST"
enctype="multipart/form-data">
+
+ <h3>Your employee, ${employee_name} would like to go on vacation</h3>
+ Number of days: ${number_of_days}<br/>
+
+ <hr>
+
+ In case you reject, please provide a reason:<br/>
+ <input type="textarea" name="reason"/><br/>
+
+ <#list outcome.values as transition>
+ <input type="submit" name="outcome"
value="${transition}">
+ </#list>
+
+ </form>
+ </body>
</html>
\ No newline at end of file