2 Replies Latest reply on Dec 7, 2005 5:31 PM by Koen Aers

    Can't get value of field property in my ActionHandler

    Michael Holtzman Newbie

      Greetings. I am trying to write an action handler that has a String field which is populated from the process definition.

      <state name="Run Script 1">
       <transition name="GotoScript2" to="Run Script 2"></transition>
       <event type="node-enter">
       <action name="RunAvsScript1" class="com.olf.workflowmgr.action.LaunchActionHandler" config-type="field">
       <event type="node-leave">
       <action name="SaveScript1Data" class="com.olf.workflowmgr.action.LeaveScript1ActionHandler"></action>

      and the corresponding class:

      public class LaunchActionHandler implements ActionHandler {
       private String scriptName;
       * Creates the variable "argt".
       * @param executionContext
       * the context
       public void execute(ExecutionContext executionContext) {
       ContextInstance ci = executionContext.getContextInstance();
       ProcessInstance pi = executionContext.getProcessInstance();
       String argt = (String)ci.getVariable("argt");
       String script = scriptName;

      The value of "scriptName" is null. Why isn't it being set to "MikeTest" as specified in the process definition xml?


        • 1. Re: Can't get value of field property in my ActionHandler
          Michael Holtzman Newbie

          Problem solved (replaced by new problem).

          The process instance was being created with the wrong process definition, because my process definitions are not being properly versioned when they are imported like this:

           public void initProcessDefinitions() {
           JbpmSession jbpmSession;
           // For now, only load up our sample process.
           String processName = "example_process.par/processdefinition.xml";
           console("Loading process definitions");
           // begin a transaction on the persistence session
           jbpmSession = jbpmSessionFactory.openJbpmSession();
           console("initProcessDefinitions: Reading xml file");
           ProcessDefinition definition = ProcessDefinition.parseXmlResource(processName);
           console("initProcessDefinitions: Loaded process definition '" + definition.getName()+ "' from xml");
           // Save the process definition in the database
           console("initProcessDefinitions: Saving to database");
           // Commit the transaction
           console("initProcessDefinitions: Committing");
           // List out the stored process definitions
           java.util.List defs = jbpmSession.getGraphSession().findAllProcessDefinitions();
           console("Found " + defs.size() + " process definitions in database:");
           for (Iterator it = defs.iterator(); it.hasNext();) {
           ProcessDefinition def = (ProcessDefinition)it.next();
           console("Process definition: " + def.getName() + " / " + def.getVersion());
           console("initProcessDefinitions: Done");

          causing this to return the wrong process definition
          See http://www.jboss.com/index.html?module=bb&op=viewtopic&t=73631

          • 2. Re: Can't get value of field property in my ActionHandler
            Koen Aers Master

            Great, thanks for reporting back!