/** @see Execution#fire(String, ObservableElement) */ public void fire(String eventName, ObservableElement eventSource) { fire(eventName, eventSource, (ObservableElementImpl) eventSource); }
/** this method enables specific process languages to overwrite the event propagation behaviour */ protected void propagateEvent(String eventName, ObservableElement eventSource, ObservableElementImpl observableElement) { fire(eventName, eventSource, observableElement.getParent()); }
public ExecutionImpl beginNode(NodeImpl node) { ExecutionImpl propagatingExecution = this; if (node.isLocalScope()) { propagatingExecution = createScope(node); } fire(Event.NODE_BEGIN, node); return propagatingExecution; }
public ExecutionImpl endNode(NodeImpl node) { ExecutionImpl propagatingExecution = this; fire(Event.NODE_END, node); if (node.isLocalScope()) { propagatingExecution = destroyScope(node); } return propagatingExecution; }
public void begin() { if (state!=STATE_CREATED) { throw new PvmException(toString()+" is already begun: "+state); } ExecutionImpl scopedExecution = initializeScopes(); this.state = STATE_ACTIVE; fire(Event.PROCESS_BEGIN, processDefinition); if (node!=null) { scopedExecution.performAtomicOperation(EXECUTE_NODE); } }
public void signal(ExecutionImpl execution, String signalName, Map<String, ?> parameters) { ActivityImpl activity = execution.getActivity(); if (parameters!=null) { execution.setVariables(parameters); } List<Transition> outgoingTransitions = new ArrayList<Transition>(); if (signalName != null) { Transition transition = activity.findOutgoingTransition(signalName); if (transition == null) { throw new JbpmException("Cannot find an outgoing transition for " + activity.getName() + " named " + signalName); } outgoingTransitions.add(transition); execution.fire(signalName, activity); } else { outgoingTransitions.addAll(findOutgoingSequenceFlow(execution, CONDITIONS_CHECKED)); } proceed(execution, outgoingTransitions); } }
/** fires the event on the given *processElement* and then propagates the event * up to the *processElement* parent chain. */ void fire(String eventName, ObservableElement eventSource, ObservableElementImpl observableElement) { if (observableElement!=null) { EventImpl event = (EventImpl) observableElement.getEvent(eventName); if (event!=null) { if (log.isTraceEnabled()) { if (observableElement==eventSource) { log.trace("firing "+event+" on "+eventSource); } else { log.trace("firing "+event+" on "+observableElement+", propagated from source "+eventSource); } } fire(event, eventSource, observableElement); } propagateEvent(eventName, eventSource, observableElement); } }
fire(Event.PROCESS_END, processDefinition); if (superProcessExecution!=null) { log.trace(toString()+" signals super process execution");
public void signal(ExecutionImpl execution, String signalName, Map<String, ? > parameters) throws Exception { ActivityImpl activity = execution.getActivity(); if (parameters != null) { execution.setVariables(parameters); } execution.fire(signalName, activity); DbSession taskDbSession = EnvironmentImpl.getFromCurrent(DbSession.class); TaskImpl task = taskDbSession.findTaskByExecution(execution); if (task!=null) { task.setSignalling(false); } execution.setVariable("jbpm_outcome", signalName); proceed(execution, findOutgoingSequenceFlow(execution, CONDITIONS_CHECKED)); }
public void perform(ExecutionImpl execution) { TransitionImpl transition = execution.getTransition(); if (execution.getName()!=null) { log.debug(execution.toString()+" takes "+transition); } else { log.debug("taking "+transition); } List<NodeImpl> leftNodes = getNodesLeft(execution.getNode(), transition.getDestination()); ExecutionImpl propagatingExecution = execution; for (NodeImpl leftNode : leftNodes) { propagatingExecution = propagatingExecution.endNode(leftNode); } propagatingExecution.setNode(null); propagatingExecution.fire(Event.TRANSITION_TAKE, transition); boolean wait = false; Condition waitCondition = transition.getWaitCondition(); if (waitCondition!=null) { wait = waitCondition.evaluate(propagatingExecution); } if (!wait) { propagatingExecution.performAtomicOperation(ExecutionImpl.PROCEED_TO_DESTINATION); } }
ObservableElement eventSource = execution.getNode(); if (log.isDebugEnabled()) log.debug("firing event "+signalName+" into "+eventSource); execution.fire(eventName, eventSource);