3 Replies Latest reply on Apr 2, 2009 8:45 AM by kukeltje

    Get Action from Timer. Earlies execution time

      Hello,

      In my process definition we have several nodes (containing actions), that have to have an "earliest start time" associated to them. The best way I found for implementing this functionality was creating a State node, create a timer inside it , and associate the action to the timer. Something like the example below:

      <state name="LoadConvertedCont1" async="true">
       <timer duedate='#{executionStartTime + 1 Hour}' >
       <action class="com.xxxxx.jbpm.actions.Adaptor" async="true" name="loadConvertedContributions">
       <taskBeanId>
       loadConvertedContributions
       </taskBeanId>
       <maxDurationMinutes>
       60
       </maxDurationMinutes>
       </action>
       </timer>
       <transition to="LoadConvertedCon2"></transition>
       </state>


      Everything is fine, until I try to stop the execution of the action. I have my own implementation of the JobExecutorThread. I extended the API for being to interrupt the execution of an the action. If the action was inside a node of type node, the code for accessing it, is quite easy :

      Action action = job.getToken().getNode().getAction();



      But when the action is inside a timer and the timer is inside a Node of type State, I don't see an easy way of retrieving the action object, and the only possible way that I have found is using the HibernateProxy provided by Hibernate, although I don't consider this is the best option

      Timer timer = (Timer)((HibernateProxy)job).getHibernateLazyInitializer().getImplementation();
      Action action = timer.getAction();



      Is there any way, using the JBPM API for retrieving the action being executed from the JobExecutorThread ?

      job.getToken().getNode().getName();
      //is providing me the correct name of the Node (even if it is if type State)
      
      runningJob.getToken().getNode().getAction();
      //is null when the action is inside the timer, and the timer inside the State Node.



      Regards.
      Jose.