I am developing an application using jbpm 5.4. I have deployed my workflow in drools-guvnor.I have added variable definitions as follows task1_lname_out, task1_fname_out Then i have mapped DataInputSet and DataOutputSet for Task1.In Task1 , I have mapped DataOutputSet to Variable definitions.
This is my Task1-taskform.ftl
<html>
<body>
<form action="CompleteTaskServlet" method="post" enctype="multipart/form-data">
First Name : <input name="task1_fname_out" type="text"><br>
Second Name : <input name="task1_lname_out" type="text">
<input value="Complete" type="submit"></form>
</body>
</html>
Now i am going to complete task after filling above task form.I use following code to complete task with task data.
Map<String,Object> result=new HashMap();
try {
taskService=API.getTaskService();
Task task = taskService.getTask(taskid);
result.put("Result", "taskInput");//here i can set the input parameter
BlockingGetContentResponseHandler contentResponseHandler =newBlockingGetContentResponseHandler();
ByteArrayOutputStream bos=new ByteArrayOutputStream();
ObjectOutputStream outS;
if(result!=null){
outS=new ObjectOutputStream(bos);
outS.writeObject(result);
outS.close();
contentData=new ContentData();
contentData.setContent(bos.toByteArray());
contentData.setAccessType(AccessType.Inline);
}
taskService.start(taskid, user);
taskService.complete(taskid, user, contentData);
contentResponseHandler.waitTillDone(5000);
} catch (Exception e) {
// TODO Auto-generated catch block
e.printStackTrace();
};
From drools guvnor, i have mapped DataInputSet ,and Association properly.(Process variables have mapped to DataInputSet). Then, I am going to access next task form, Task2-taskform.ftl
<html>
<body>
First Name:${task1_fname_out}<br>
Last Name: ${task1_lname_out}
<form action="CompleteTaskServlet" method="post" enctype="multipart/form-data">
Age : <input name="task2_age_in" type="text">
<br>
<input value="Complete" type="submit"></form>
</body></html>
Next i am going to access the result like this.
Map<String,Object> results=new HashMap<String,Object>();
long contentId=task.getTaskData().getOutputContentId();
if (contentId != -1) {
Content contents=taskService.getContent(contentId);
Object result=ContentMarshallerHelper.unmarshall(contents.getContent(),null);
results.put("Result",result);
if (result instanceof Map) {
Map<?,?> map=(Map<?,?>)result;
for (Map.Entry<?,?> entry : map.entrySet()) {
if (entry.getKey() instanceof String) {
results.put((String)entry.getKey(),entry.getValue());
out.print("entry.getValue()::"+entry.getValue());
}
}
}
}
My problem is, Task2-taskform.ftl is not displaying Task1-taskform output results. There is no error in DataInput and output mappings, because all works fine via Jbpm console.
Please help me to solve this issue? I am not sure about following line in my code.
result.put("Result", "taskInput");
I have stuck on this point. please help me ???