5 Replies Latest reply on Jun 18, 2012 6:53 AM by Miloud Haimoune

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

    mutou wang Newbie



      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);



      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 !!!