1 Reply Latest reply on Mar 24, 2006 4:51 AM by Víctor Suárez

    Process Variables in Process Definition

    Romin Irani Newbie

      Hello All,

      I have a defined several Process Definitions. Each of these Process Definitions contain only System Activities i.e. Nodes which have their Action Handlers.

      Now, looking at all the Process Definitions -- I find that I have around 5-6 common Process variables like FromPartnerId, ToPartnerId, Content, etc. I want to define all these variables at the start of the Process Definition -- so that anyone looking at the Process Definition can easily figure out which Process Variables are needed at the minimum.

      How do I do this. Currently -- the way I am doing this is in the code:

      //Create process instance
      ProcessInstance PI = ctx.getGraphSession().findLatestProcessDefinition("some-process-def").createProcessInstance();
      //Set common process variables
      Map ProcessMap = new HashMap();
      ProcessMap.put("FromPartner",new String("Partner-A"));
      ProcessMap.put("ToPartner",new String("Partner-B"));
      //start the process

      How do I define the above common process variables in the process definition itself -- so that at the time of creating the Process instance, I can get a list of global variables definition and then set them dynamically before launching the process.

      I tried to look up the documentation in the jPDL Schema, etc -- but it doesnt seem very clear to me how to exactly define the above.


        • 1. Re: Process Variables in Process Definition
          Víctor Suárez Newbie

          We are using something like this:

          <process-definition name="your_definition">
           <start-state name="start">
           <event type="node-leave">
           <action name="init_vars" class="your_package.YourVaribleAssigmentHandler" config-type="configuration-property">
           <variable name="var1">value1</variable>
           <variable name="var2">value2</variable>
           <transition name="tr" to="next_state"></transition>

          "configuration-property" usage is due to we are using jdom instead of dom4j. After signalling the process instance, you haven't to "pi.getContextInstance().addVariables()", they already are into the process.