This content has been marked as final.
Show 4 replies
-
1. Re: Timers and transitions
kukeltje Aug 3, 2006 2:28 AM (in response to brado)Brad,
As is the other post, please post the pd.xml and the code. It is easier then to comment. -
2. Re: Timers and transitions
brado Aug 3, 2006 10:50 AM (in response to brado)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 -
3. Re: Timers and transitions
kukeltje Aug 3, 2006 10:52 AM (in response to brado)The transitions have no names.
-
4. Re: Timers and transitions
brado Aug 3, 2006 11:58 AM (in response to brado)Ah yes, my dunce alarm wasn't faulty. Thanks for the tip. Somehow from looking at examples I was under the impression that transitions could reference names of the nodes transitioned to, not the name of the transition itself. Thanks for the help -- I added a transition name and it worked.
Brad