[jboss-user] [jBPM] - How to read return-variable from bpmn files to java file?

mutou wang do-not-reply at jboss.com
Mon Jun 18 05:43:13 EDT 2012


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

"How to read return-variable from bpmn files to java file?"

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

--------------------------------------------------------------
Hello!

I hava some problems here. 

     StatefulKnowledgeSession ksession = kbase.newStatefulKnowledgeSession();
              Map<String,Object>paras=new HashMap<String,Object>();
             paras.put("i", new Integer("1"));
             paras.put("ret", new Integer("10"));
                         // start a new process instance
                              ProcessInstance instance=(ProcessInstance) ksession.startProcess("org.jbpm.sample.hello",paras);
           System.out.println(paras.get("ret"));

 I hava two parameters here, "i' and "ret", "i" is the input and i want "ret" to be the output. Furthmore, the script in the bpmn file
will process the sentence:
        ret = 2 * i;
 so  "ret" will be 2. However, in my java file after "System.out.println(paras.get("ret"));" was processed, it output 10.
I am confused that how to read the return value "ret" from the bpmn file and in my work, how to print the correct Integer 2 rather than 10???
should I utilize kcontext ? But kcontext is predefined in script, not in java file. How to define kcontext and utilize it to get varible??? 

Thanks !!!
--------------------------------------------------------------

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

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/20120618/da68b7b6/attachment.html 


More information about the jboss-user mailing list