Problems with variables in Start-node formular
legux Jul 28, 2009 4:29 PMHi all.
I have got the following problem.
I created a process definition with jbpm 4.
To the start-node i assigned a form where the user can select the value of two variables.
The first transition leads from start to a decision-node, where i want to evaluate the input. I assigned a DecisionHandler to do this.
Using a JUnit-Test everything wents fine.
When i deploy this to the jboss and want to start the process with the jbpm-console, the form is shown and i can select the values, but in the DecisionHandler i can't see the variables.
When i put a human task between the start node and the decision, and assign view.ftl to this node where i show the variables i can see the values and after completing this task the decisionHandler also can evaluate the variables.
Can anybody help me with this problem?
thanks,
steffen
for a better understanding of my problem i will give you a short example:
the test.jpdl.xml
<process name="test" xmlns="http://jbpm.org/4.0/jpdl"> <start form="start.ftl" name="start1"> <transition name="to java1" to="exclusive1"/> </start> <decision name="exclusive1"> <handler class="org.jbpm.test.TestDecision"/> <transition name="to task1" to="task1"/> <transition name="to task2" to="task2"/> </decision> <task assignee="alex" name="task1"> <transition name="to end1" to="end1"/> </task> <task assignee="alex" name="task2"> <transition name="to end1" to="end1"/> </task> <end name="end1"/> </process>
start.ftl
<form action="${form.action}" method="POST" enctype="multipart/form-data">
<h5>Variable A</h5>
<select name="varA">
<option value="1">A1</option>
<option value="2">A2</option>
<option value="3">A3</option>
</select>
<br/>
<h5>Variable B</h5>
<select name="varB">
<option value="1">B1</option>
<option value="0">B0</option>
</select>
<br/>
<input type="submit" name="Done"/>
</form>
TestCase
public void testProcess() throws Exception {
Map<String, Object> variables = new HashMap<String, Object>();
variables.put("varA", "1");
variables.put("varB", "2");
ProcessInstance instance = executionService
.startProcessInstanceByKey("test", variables);
String pid = instance.getId();
assertEquals(true, instance.isActive("task1"));
}