1 Reply Latest reply on Jul 18, 2011 8:24 PM by Itajubá Segundo

    jBPM 5.1 - How to read variable in a Java application

    Itajubá Segundo Newbie

      I have downloaded the new jbpm-5.1.0.Final-installer-full from JBoss website, and I have started studying jBPM.


      I want my Java application to start a process and during process life cycle I want to read the variable data. Quite simple requirement, right?


      Well I have defined a variable during process design and I use the following code to start a process instance:


      Map<String, Object> params2 = new HashMap<String, Object>();

      params2.put("valor", 20000);

      ksession.startProcess("com.ims.teste.requisicao", params2);


      Then I use the following code to "see" all process instances running(I started other several instance using the code structure):


      ArrayList<ProcessInstance> a = (ArrayList<ProcessInstance>) ksession.getProcessInstances();


      And I can get all instances correctly.


      Well, now how can I access the variable programatically through the same java application?? I could not find any "get" method that look like a "getVariable" or something like that.


      Looking at documentation the best I could find was in jBPM 3 docs using ContextInstance. But it doesn't work with jBPM 5.1.

      Link here: http://docs.jboss.org/jbpm/v3/userguide/context.html


      How can I do this in 5.1?


      Thank you very much.