2 Replies Latest reply on Jan 14, 2008 5:16 AM by kukeltje

    Dynamic configuration for ActionHandler

      Hello,

      is ist possible to configure an ActionHandler dynamically? More precisely I want to do something like this:

      .
      .
      .
      <node>
       <event type='node-enter'>
       <script>
       <expression>
       myVar="I am a variable";
       </expression>
       <variable name='myVar' access='write' />
       </script>
       <action class='MyAction'>
       <text>#{myVar}</text>
       </action>
       </event>
       <transition to='end'/>
      </node>
      .
      .
      .
      
      

      Means I want to configure the parameter 'text' of my ActionHandler-object with the value of the variable I set before in the script-tag.
      Unfortunately this approach does not work - the synthax is not valid in this context.
      Is there any possibility to get the desired behaviour?

      Thanks in advance,

      Michael

        • 1. Re: Dynamic configuration for ActionHandler
          mwohlf

          Hi,
          most likely the scope of the script variables is destroyed after the script is terminated, i guess you have to store the variables in the process instance somehow and then access them in the execute() method of the action with something like (not tested):

          public void execute(ExecutionContext executionContext) throws Exception {
           ContextInstance contextInstance = executionContext.getContextInstance();
           Token token = executionContext.getToken();
           Object element = contextInstance.getVariable("myVar", token);
           [...]
          


          there is also a nice proxy class for having spring configured actions in jBPM at:
          https://springmodules.dev.java.net/docs/reference/0.8/html/jbpm31.html#d0e5105

          HTH
          Michael[/url]

          • 2. Re: Dynamic configuration for ActionHandler
            kukeltje

            I'm not even sure the script and action run in a pre-determined order.... might be that they do now 'by accident' but without promoting this to 'by design' it might be lost in a new release