How to get variable from WorkItemHandler class ??
rickylkl Oct 25, 2012 6:18 AMHi forum,
Anyone who can help or point me how can i GET THE VARIABLE THAT I INSERT IN SESSION or STARTPROCESS(processId, VARIABLE) ?
I got c controller with this method :
private void testDrlJbpm(Channel channel){
Map<String,Object> map = new HashMap<String,Object>();
map.put("channel", channel);
map.put("x",channel.getName());
ksession.insert(channel); // if there is a rule flow in workflow, need to insert obj to run rule
ksession.getWorkItemManager().registerWorkItemHandler("ShowRegPage", new RegistrationHandler());
ksession.getWorkItemManager().registerWorkItemHandler("ShowSubPage", new SubscribeHandler());
ksession.getWorkItemManager().registerWorkItemHandler("ShowPrintPage", new PrintPageHandler());
ProcessInstance processInstance = (ProcessInstance) ksession.startProcess("testflow-web", map); // passing map inside the process, and use kcontext.getvariable() to get obj on if else case
System.out.println(processInstance.getEventTypes());
System.out.println(processInstance.getId());
System.out.println(processInstance.getProcessId());
ksession.fireAllRules(); // fire all rules if there is a rule flow
}
AND i did this method in workItemHandler
@Override
public void executeWorkItem(WorkItem workItem, WorkItemManager manager) {
System.out.println(workItem.getProcessInstanceId());
System.out.println(workItem.getState());
System.out.println(workItem.getId());
System.out.println(workItem.getName());
System.out.println("========= Executing registration =============" + workItem);
setRegistration();
Map<String,Object> resultMap = new HashMap<String,Object>();
resultMap.put("reg", registration);
manager.completeWorkItem(workItem.getId(), resultMap);
}
At last,
i have attache the jpg of flow.
I always get nothing ...
I would like to get the varaible and do variable passing between the workItemHandler and from rules, is there any way i can follow ?? Please Thanks
Thanks a lot to all.
Please Help !!
-
flow.jpg 27.5 KB