2 Replies Latest reply on May 2, 2006 6:10 PM by lfaggioli

    how to get/set process variables in java code?

    lethrech

      hi,
      i want to get process variables which have been created in task node in a java code,
      can i do that?
      thank you.

        • 1. Re: how to get/set process variables in java code?
          kukeltje

          There are several options:
          - look at the examples/testcases
          - look at the user documentation
          - search this forum
          - look at the api docs
          - ask santa

          hth

          • 2. Re: how to get/set process variables in java code?
            lfaggioli

            You can do it in an Action: override the execute() method, for example like this

            
            import org.jbpm.graph.def.Action;
            import org.jbpm.graph.exe.ExecutionContext;
            
            public class MyAction extends Action {
            
             public void execute(ExecutionContext executionContext) throws Exception {
            
            
             String aVariable = (String) executionContext.getVariable("aVariable");
            
             //do something
            
            
             executionContext.leaveNode();
             }
            }
            
            


            The ExecutionContext class has a setVariable() method too.

            bye
            luca