[jboss-user] [jBPM] - How to get variable from WorkItemHandler class ??

rickylkl do-not-reply at jboss.com
Thu Oct 25 06:18:22 EDT 2012


rickylkl [https://community.jboss.org/people/rickylkl] created the discussion

"How to get variable from  WorkItemHandler class  ??"

To view the discussion, visit: https://community.jboss.org/message/772279#772279

--------------------------------------------------------------
Hi 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  :(  !!
--------------------------------------------------------------

Reply to this message by going to Community
[https://community.jboss.org/message/772279#772279]

Start a new discussion in jBPM at Community
[https://community.jboss.org/choose-container!input.jspa?contentType=1&containerType=14&container=2034]

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/jboss-user/attachments/20121025/caa3e5fb/attachment-0001.html 


More information about the jboss-user mailing list