Skip navigation

This example shows the use of ftl forms that have variables.

 

 

Here is a sample use case.

 

1.) User 1 (krisv) fills in a form that has three variables (Priority, Model Number, Quantity)

2.) User 2 (john) approves another form if the Qunatity is less than 1000.

 

This example also has a diverge node that uses a variable (isAvailable) to determine if this order can be approved by user2 or

it needs to be sent back to user1. The variable (isAvailable) is set to true if the quantity is less than 1000.

 

com.sample.bpmn.sampleHTformvariables.jpg

 

How to install and run this example in an appserver (e.g. JBoss or Tomcat)?

 

 

1.) Copy the SampleHumanTaskFormVariables.bpmn file  to the directory where the other bpmn files are located

(specified using the parameter -Djbpm.console.directory).

 

2.) Copy the sampleHTFormVariables.jar to server's CLASSPATH. For example, it can be one of the options as shown below:

 

Copy the jar file into gwt-console-server war file  ( ..gwt-console-server\WEB-INF\lib)

or Copy the jar file into appserver's lib direcory (JBOSS_HOME\server\default\lib for JBOSS or TOMCAT_HOME\lib for TOMCAT)

 

This jar file basically has a couple of ftl forms for the two users (one for 'krisv' and the other for 'john') and an image file.

 

 

Here are the main steps to create this sample:

 

1.) Create the  bpmn file using jBPM5 Eclispe plugin or any BPMN editor such as Oryx or Koens Aers's BPMN (http://community.jboss.org/thread/160088) editor.

 

2.) Create the required human task forms using ftl templates using the pattern {TaskName}.ftl.

 

3.) Create the image of the BPMN, e.g, using 'Export image(PNG)' option.

 

 

4.) Package all the ftl template files and the image file into a jar file and copy it to the classpath, i.e.,

gwt-console-server's WEB-INF\lib directory. Alternately you can also use Guvnor to load the artifacts.

 

 

 

Here are the main points to note:

 

1.) The  name of a template for a  task node should be same as the 'TaskName' property of the task node.

For example, 'TaskName' for the task node 'Sample Order Task' is defined as 'ProcessOder'. So the template for this node is 'ProcessOder.ftl'

 

 

 

2.) All the variables are defined for the bpmn file as shown below.

 

ScreenHunter_01 Feb. 21 22.18.gif

 

3.) The task node can have the 'Content' parameter set to Map. If a Map is populated with all the required variables, these variables can be accessed from the ftl templates. Note that 'Content' only allows Map at this time, i.e, not multiple variables.

ScreenHunter_02 Feb. 21 22.24.gif

 

4.) It can be seen from the following diagram that 'Parameter Mapping', (i.e input to the 'Sample Order Task') can be set to the Map from the previous step. It can also be seen that all the output variables can be set using 'Result Mapping'. It should be noted that these variables are returned as individual parameters, i.e., not as a Map.

 

ScreenHunter_03 Feb. 21 22.27.gif

 

5.) The ftl templates can be created using various editors (http://freemarker.sourceforge.net/editors.html)

 

ScreenHunter_05 Feb. 21 23.00.gif