public void execute(ExecutionContext executionContext) throws Exception { SchedulerService schedulerService = executionContext.getJbpmContext().getServices().getSchedulerService(); schedulerService.deleteTimersByName(timerName, executionContext.getToken()); }
public void execute(ExecutionContext executionContext) throws Exception { SchedulerService schedulerService = executionContext.getJbpmContext().getServices().getSchedulerService(); schedulerService.deleteTimersByName(timerName, executionContext.getToken()); }
private void executeActions(List actions, ExecutionContext executionContext, boolean isPropagated) { if (actions == null) return; for (Iterator iter = actions.iterator(); iter.hasNext();) { Action action = (Action) iter.next(); if (!action.acceptsPropagatedEvents() && isPropagated) continue; if (action.isAsync()) { ExecuteActionJob job = createAsyncActionExecutionJob(executionContext.getToken(), action); MessageService messageService = executionContext.getJbpmContext() .getServices() .getMessageService(); messageService.send(job); } else { executeAction(action, executionContext); } } }
private void executeActions(List actions, ExecutionContext executionContext, boolean isPropagated) { if (actions == null) return; for (Iterator iter = actions.iterator(); iter.hasNext();) { Action action = (Action) iter.next(); if (!action.acceptsPropagatedEvents() && isPropagated) continue; if (action.isAsync()) { ExecuteActionJob job = createAsyncActionExecutionJob(executionContext.getToken(), action); MessageService messageService = executionContext.getJbpmContext() .getServices() .getMessageService(); messageService.send(job); } else { executeAction(action, executionContext); } } }
/** * Tells whether the given context can handle exception by checking for: * <ul> * <li>the absence of a previous exception</li> * <li>an active transaction, or no transaction present</li> * </ul> */ private static boolean isAbleToHandleExceptions(ExecutionContext executionContext) { // if executionContext has an exception set, it is already handling an exception // in this case, do not offer exception to handlers; throw at client // see https://jira.jboss.org/browse/JBPM-1887 if (executionContext.getException() != null) return false; // check whether transaction is still active before scanning exception handlers // this way, the exception handlers can be loaded lazily // see https://jira.jboss.org/browse/JBPM-1775 JbpmContext jbpmContext = executionContext.getJbpmContext(); if (jbpmContext != null) { PersistenceService persistenceService = jbpmContext.getServices().getPersistenceService(); if (persistenceService instanceof DbPersistenceService) { DbPersistenceService dbPersistenceService = (DbPersistenceService) persistenceService; return dbPersistenceService.isTransactionActive(); } } // no transaction present; likely running in memory return true; }
public void fireEvent(String eventType, ExecutionContext executionContext) { Token token = executionContext.getToken(); if (log.isDebugEnabled()) log.debug(token + " fires event '" + eventType + "' on " + this); GraphElement eventSource = executionContext.getEventSource(); try { executionContext.setEventSource(this); JbpmContext jbpmContext = executionContext.getJbpmContext(); if (jbpmContext != null) { EventService eventService = (EventService) jbpmContext.getServices() .getService(EventService.SERVICE_NAME); if (eventService != null) eventService.fireEvent(eventType, this, executionContext); } fireAndPropagateEvent(eventType, executionContext); } finally { executionContext.setEventSource(eventSource); } }
public void fireEvent(String eventType, ExecutionContext executionContext) { Token token = executionContext.getToken(); if (log.isDebugEnabled()) log.debug(token + " fires event '" + eventType + "' on " + this); GraphElement eventSource = executionContext.getEventSource(); try { executionContext.setEventSource(this); JbpmContext jbpmContext = executionContext.getJbpmContext(); if (jbpmContext != null) { EventService eventService = (EventService) jbpmContext.getServices() .getService(EventService.SERVICE_NAME); if (eventService != null) eventService.fireEvent(eventType, this, executionContext); } fireAndPropagateEvent(eventType, executionContext); } finally { executionContext.setEventSource(eventSource); } }
/** * Tells whether the given context can handle exception by checking for: * <ul> * <li>the absence of a previous exception</li> * <li>an active transaction, or no transaction present</li> * </ul> */ private static boolean isAbleToHandleExceptions(ExecutionContext executionContext) { // if executionContext has an exception set, it is already handling an exception // in this case, do not offer exception to handlers; throw at client // see https://jira.jboss.org/browse/JBPM-1887 if (executionContext.getException() != null) return false; // check whether transaction is still active before scanning exception handlers // this way, the exception handlers can be loaded lazily // see https://jira.jboss.org/browse/JBPM-1775 JbpmContext jbpmContext = executionContext.getJbpmContext(); if (jbpmContext != null) { PersistenceService persistenceService = jbpmContext.getServices().getPersistenceService(); if (persistenceService instanceof DbPersistenceService) { DbPersistenceService dbPersistenceService = (DbPersistenceService) persistenceService; return dbPersistenceService.isTransactionActive(); } } // no transaction present; likely running in memory return true; }
public void execute(ExecutionContext executionContext) throws Exception { // grab jbpm context JbpmContext jbpmContext = executionContext.getJbpmContext(); if (jbpmContext == null) { throw new JbpmException("jbpm context unavailable"); } // retrieve scheduler service SchedulerService schedulerService = jbpmContext.getServices().getSchedulerService(); if (schedulerService == null) { throw new JbpmException("scheduler service unavailable"); } // schedule timer Timer timer = createTimer(executionContext); schedulerService.createTimer(timer); }
public void execute(ExecutionContext executionContext) throws Exception { // grab jbpm context JbpmContext jbpmContext = executionContext.getJbpmContext(); if (jbpmContext == null) { throw new JbpmException("jbpm context unavailable"); } // retrieve scheduler service SchedulerService schedulerService = jbpmContext.getServices().getSchedulerService(); if (schedulerService == null) { throw new JbpmException("scheduler service unavailable"); } // schedule timer Timer timer = createTimer(executionContext); schedulerService.createTimer(timer); }
JbpmContext jbpmContext = executionContext.getJbpmContext(); Session session; if (jbpmContext != null && (session = jbpmContext.getSession()) != null) {
JbpmContext jbpmContext = executionContext.getJbpmContext(); Session session; if (jbpmContext != null && (session = jbpmContext.getSession()) != null) {
/** * called by a transition to pass execution to this node. */ public void enter(ExecutionContext executionContext) { Token token = executionContext.getToken(); // update the runtime context information token.setNode(this); // register entrance time so that a node-log can be generated upon leaving token.setNodeEnter(Clock.getCurrentTime()); // fire the leave-node event for this node fireEvent(Event.EVENTTYPE_NODE_ENTER, executionContext); // remove the transition references from the runtime context executionContext.setTransition(null); executionContext.setTransitionSource(null); // execute the node if (isAsync) { ExecuteNodeJob job = createAsyncContinuationJob(token); executionContext.getJbpmContext().getServices().getMessageService().send(job); token.lock(job.toString()); } else { execute(executionContext); } }
/** * called by a transition to pass execution to this node. */ public void enter(ExecutionContext executionContext) { Token token = executionContext.getToken(); // update the runtime context information token.setNode(this); // register entrance time so that a node-log can be generated upon leaving token.setNodeEnter(Clock.getCurrentTime()); // fire the leave-node event for this node fireEvent(Event.EVENTTYPE_NODE_ENTER, executionContext); // remove the transition references from the runtime context executionContext.setTransition(null); executionContext.setTransitionSource(null); // execute the node if (isAsync) { ExecuteNodeJob job = createAsyncContinuationJob(token); executionContext.getJbpmContext().getServices().getMessageService().send(job); token.lock(job.toString()); } else { execute(executionContext); } }