2 Replies Latest reply on Jun 27, 2007 2:32 AM by Tarun Jain

    Variable resolver

    Olivier Thierry Apprentice

      Hi,

      I am a newbie to jBPM and I need help about variable resolvers.

      I wrote an Action handler with an "idDemande" parameter. This parameter should be an EL expression, so that I my action handler could be context independant. For what I understood, I should use a variable resolver, but I can't understand how it works (and I found no documentation about it).

      My node is configured as following :

      <node name="Valider la demande">
       <transition name="" to="Fin"></transition>
       <action class="fr.horoquartz.t4.workflow.actions.absences.ValiderDemandeAbsenceAction">
       <idDemande>#{processInstance.id_element}</idDemande>
       </action>
      </node>


      I'm not sure the EL expression is right ...

      I wrote this evaluate function in my action handler :

      private String evaluate(String expression, ExecutionContext executionContext) {
       VariableResolver variableResolver = JbpmExpressionEvaluator.getUsedVariableResolver();
       if (variableResolver != null) {
       variableResolver = new JbpmVariableResolver();
       }
       return (String) JbpmExpressionEvaluator.evaluate(expression, executionContext, variableResolver);
       }


      But I have a NullPointerException when I run it.

      Note I can read the process instance variable this way :

      Long idElement = (Long) executionContext.getContextInstance().getVariable("id_element");


      But it makes my action handler context dependant.

      Thanks for your help ;)