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

    Variable resolver

    chawax

      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 ;)

        • 1. Re: Variable resolver
          chawax

          I found my error ... It was a not a jPBM issue since I tried to cast the variable id_element as a String while it was set as a Long ... So it throwed a ClassCastException ... Shame on me ...

          Moreover the EL expression could be simpler :

          <action class="fr.xxx.workflow.actions.absences.ValiderDemandeAbsenceAction">
           <idDemande>#{id_element}</idDemande>
           </action>
          


          • 2. Re: Variable resolver
            tarun1981

            Hi chawax,

            I am trying to do same thing but my actionHandler is not evaluating expressions.

            Can you please help me with this

            I am using jbpm-3.1.4

            -Tarun