[jboss-user] [JBoss jBPM] - Re: Timers and transitions

brado do-not-reply at jboss.com
Thu Aug 3 10:50:22 EDT 2006


Here is the code of my business process:


  | <?xml version="1.0" encoding="UTF-8"?>
  | 
  | <process-definition
  |   xmlns=""  name="Solicit">
  |    <start-state name="start">
  |       <transition name="" to="validateSecurityToken"></transition>
  |    </start-state>
  |    <end-state name="end1"></end-state>
  |    <node name="validateSecurityToken">
  |       <action class="com.capitolsystems.nodeapp.process.ValidateSecurityTokenActionHandler"></action>
  |       <transition name="" to="saveSolicitRequest"></transition>
  |    </node>
  |    <node name="saveSolicitRequest">
  |       <action class="com.capitolsystems.nodeapp.process.SaveSolicitRequestActionHandler"></action>
  |       <transition name="" to="createSolicitTimer"></transition>
  |    </node>
  |    <node name="createSolicitTimer">
  |       <action class="com.capitolsystems.nodeapp.process.CreateSolicitTimerActionHandler"></action>
  |       <transition name="" to="solicitQuery"></transition>
  |    </node>
  |    <node name="solicitQuery">
  |       <transition name="" to="end1"></transition>
  |       <action class="com.capitolsystems.nodeapp.process.SolicitQueryActionHandler"></action>
  |    </node>
  | </process-definition>
  | 

Here is the code to my CreateSolicitTimerActionHandler:


  | public void execute(ExecutionContext executionContext) throws Exception {
  |   log.debug("[execute]: Enter.");
  | 
  |   try {
  |     log.debug("[execute]: Getting context variables.");
  |     String transactionId = (String) executionContext.getVariable(NetworkNode.PVAR_transactionId);
  |     log.debug("[execute]: Creating solicit timer: " + executionContext.getTaskInstance());
  |     Timer timer = new Timer(executionContext.getToken());
  |     timer.setName("Solicit: " + transactionId);
  |     BusinessCalendar businessCalendar = new BusinessCalendar();
  |     //Date dueDate = businessCalendar.findStartOfNextDay(new Date());
  |     GregorianCalendar cal = new GregorianCalendar();
  |     cal.setTime(new Date(System.currentTimeMillis()));
  |     System.out.println("Calendar time before is: " + cal.getTime().toString());
  |     cal.add(Calendar.MINUTE, 1);
  |     System.out.println("Calendar time after is: " + cal.getTime().toString());
  |     Date dueDate = cal.getTime();
  |     timer.setDueDate(dueDate);
  |     timer.setTransitionName("solicitQuery");
  |     timer.setGraphElement(executionContext.getEventSource());
  |     timer.setTaskInstance(executionContext.getTaskInstance());
  |     //timer.setToken(executionContext.getToken());
  |     log.debug("[execute]: Creating solicit timer with scheduler: " + timer);	
  |     SchedulerService schedulerService = (SchedulerService) Services.getCurrentService(Services.SERVICENAME_SCHEDULER);
  |     schedulerService.createTimer(timer);
  |     log.info("[execute]: Solicit timer created with scheduler: " + timer);
  |   } catch (Exception ex) {
  |     if (ex instanceof NodeException) {
  | 	throw ex;
  |     }
  |     log.error("[execute]: Error creating solicit timer: " + ex.getMessage());
  |     throw new NodeException("Error creating solicit timer: " + ex.getMessage(),
  |     ex, IErrorCode.Code.E_UNKNOWN_ERROR);
  |   } finally {
  |     //executionContext.leaveNode();
  |     log.debug("[execute]: Exit.");
  |  }
  | }
  | 

I have stepped through the execution of SchedulerThread's processing on the server, and what is happening is that for some reason, when it processes the timer in question, the org.jbpm.graph.def.Node class is returning false when executing the hasLeavingTransitions() method. I'm not quite sure why this is, as it is clear from the business process definition that the createSolicitTimer node has a transition to solicitQuery. 

I'm sure this is probably something simple I'm missing. Your help is appreciated.

Thanks,

Brad

View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3962873#3962873

Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=3962873



More information about the jboss-user mailing list