JBoss Community

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

created by mutou wang in jBPM - View the full discussion

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

Start a new discussion in jBPM at Community