7 Replies Latest reply on Jul 21, 2006 6:00 PM by Ronald van Kuijk

    Inputting context variables to actions

    Andrew Simpson Newbie

      I am trying to use jpdl to pass context variables into actions called by a node. I know it is possible to call the variables from the controller using the context instance but I would like to be able to see the variables used by an action at the process definition level. Is there any way to do this?

      <action class="com.sample.action.MessageHandler">
       (specify variable input here)

        • 1. Re: Inputting context variables to actions
          Ronald van Kuijk Master

          you can specify variable names there and pass the names to the acion (see the docs and examples on how to do this). The action can then retrieve the variable names and use it to retrieve the values in the actionhandler. What I created is something like this:

          <action class="com.sample.action.MessageHandler">
           <message>bla, bla, bla text</message>

          The 'message' is static and taken as a string by the actionhandler. The recipient points to a process variable which is to be used by this generic messagehandler and the 'initiator' is a direct reference to a process variable.


          • 2. Re: Inputting context variables to actions
            falazar Novice

            HOw do we receive these variables in the class?
            I am attempting to pass the initiator user to the class, to call the db.

            so I can test it like so

            System.out.println("Initiator is:"+initiator);

            Have looked around but found nothing in the docs or other yet.

            James Ratcliff

            • 3. Re: Inputting context variables to actions
              Ronald van Kuijk Master

              Come on James, you can do better than that. There is more info on this in the docs and the forum. The (wrong) assumption is that these are process variable names directly and will be filled by the engine. They aren't. If you have a variable in the actionhandler (not the process!!!) the variable is filled with the text within the tag (so the variable message in the actionhandler will get the value 'bla, bla, bla text')

              If you want it to 'indicate' a variable, use the value of the variable as the name of a process variable and use the normal means to get it (the context).

              • 4. Re: Inputting context variables to actions
                falazar Novice

                I looked around, all I find is stuff like this:

                and Ch 10 about context variables...

                I understand that maybe I could pass a simple variable like this, but I need to get the swimlane user.

                Can I just directly ask for the swimlane initiator in some way? I have been searching the forums and the web, but it returns too many results for swimlane itself to make the searches useful... this was the post closest in relation to my issue.

                James Ratcliff

                • 5. Re: Inputting context variables to actions
                  Ronald van Kuijk Master

                  James, one tip: the search in the forum is an OR so you should put an AND between it, or use the other radiobutton.

                  Second tip: Look at the testcases. There are lots, and prove to be a valuable source of information (not documenation if you followed the 'other' thread ;-)

                  You will find things like

                   ProcessInstance processInstance = new ProcessInstance(processDefinition);
                   TaskMgmtInstance taskMgmtInstance = processInstance.getTaskMgmtInstance();
                   TaskInstance changeNappy = (TaskInstance) taskMgmtInstance.getTaskInstances().iterator().next();
                   SwimlaneInstance stalker = taskMgmtInstance.getSwimlaneInstance("stalker");
                   assertEquals("me", stalker.getActorId());
                   assertEquals("me", changeNappy.getActorId())

                  The apidocs is also a valuable source of information

                  • 6. Re: Inputting context variables to actions
                    falazar Novice

                    Just found it under the Swimlanetest right before I read this, thanks,
                    Yeah I keep forgetting the "and" option and getting way too many results...

                    James Ratcliff