/** * Try to handle given exception using execution exception handlers registered at the flow level. Returns null if no * handler handled the exception. * @return true if the exception was handled */ private boolean tryFlowHandlers(FlowExecutionException exception, RequestControlContext context) { return getActiveSessionInternal().getFlow().handleException(exception, context); }
boolean handleEvent(Event event, RequestControlContext context) { listeners.fireEventSignaled(context, event); return getActiveSessionInternal().getFlow().handleEvent(context); }
TransitionDefinition getMatchingTransition(String eventId) { FlowSessionImpl session = getActiveSessionInternal(); if (session == null) { return null; } TransitionableState currentState = (TransitionableState) session.getState(); TransitionDefinition transition = currentState.getTransition(eventId); if (transition == null) { transition = session.getFlow().getGlobalTransition(eventId); } return transition; }
void endActiveFlowSession(String outcome, MutableAttributeMap<Object> output, RequestControlContext context) { FlowSessionImpl session = getActiveSessionInternal(); listeners.fireSessionEnding(context, session, outcome, output); session.getFlow().end(context, outcome, output); flowSessions.removeLast(); boolean executionEnded = flowSessions.isEmpty(); if (executionEnded) { // set the root flow execution outcome for external clients to use this.outcome = new FlowExecutionOutcome(outcome, output); status = FlowExecutionStatus.ENDED; } listeners.fireSessionEnded(context, session, outcome, output); if (!executionEnded) { // restore any variables that may have transient references getActiveSessionInternal().getFlow().restoreVariables(context); // treat the outcome as an event against the current state of the new active flow context.handleEvent(new Event(session.getState(), outcome, output)); } }
/** * Jump to a state of the currently active flow. If this execution has not been started, a new session will be * activated and its current state will be set. This is a implementation-internal method that bypasses the * {@link #start(MutableAttributeMap, ExternalContext)} operation and allows for jumping to an arbitrary flow state. * Useful for testing. * @param stateId the identifier of the state to jump to */ public void setCurrentState(String stateId) { FlowSessionImpl session; if (status == FlowExecutionStatus.NOT_STARTED) { session = activateSession(flow); status = FlowExecutionStatus.ACTIVE; } else { session = getActiveSessionInternal(); } State state = session.getFlow().getStateInstance(stateId); session.setCurrentState(state); }
/** * Try to handle given exception using execution exception handlers registered at the state level. Returns null if * no handler handled the exception. * @return true if the exception was handled */ private boolean tryStateHandlers(FlowExecutionException exception, RequestControlContext context) { if (exception.getStateId() != null) { State state = getActiveSessionInternal().getFlow().getStateInstance(exception.getStateId()); return state.handleException(exception, context); } else { return false; } }
logger.debug("Resuming in " + externalContext); Flow activeFlow = getActiveSessionInternal().getFlow(); MessageContext messageContext = createMessageContext(activeFlow.getApplicationContext()); RequestControlContext requestContext = createRequestContext(externalContext, messageContext);
/** * Try to handle given exception using execution exception handlers registered at the flow level. Returns null if no * handler handled the exception. * @return true if the exception was handled */ private boolean tryFlowHandlers(FlowExecutionException exception, RequestControlContext context) { return getActiveSessionInternal().getFlow().handleException(exception, context); }
/** * Returns the current flow which may or may not yet be active. */ private Flow getCurrentFlow() { if (isActive()) { return getActiveSessionInternal().getFlow(); } else { return flow; } }
boolean handleEvent(Event event, RequestControlContext context) { listeners.fireEventSignaled(context, event); return getActiveSessionInternal().getFlow().handleEvent(context); }
boolean handleEvent(Event event, RequestControlContext context) { listeners.fireEventSignaled(context, event); return getActiveSessionInternal().getFlow().handleEvent(context); }
TransitionDefinition getMatchingTransition(String eventId) { FlowSessionImpl session = getActiveSessionInternal(); if (session == null) { return null; } TransitionableState currentState = (TransitionableState) session.getState(); TransitionDefinition transition = currentState.getTransition(eventId); if (transition == null) { transition = session.getFlow().getGlobalTransition(eventId); } return transition; }
TransitionDefinition getMatchingTransition(String eventId) { FlowSessionImpl session = getActiveSessionInternal(); TransitionableState currentState = (TransitionableState) session.getState(); TransitionDefinition transition = currentState.getTransition(eventId); if (transition == null) { transition = session.getFlow().getGlobalTransition(eventId); } return transition; }
void endActiveFlowSession(String outcome, MutableAttributeMap<Object> output, RequestControlContext context) { FlowSessionImpl session = getActiveSessionInternal(); listeners.fireSessionEnding(context, session, outcome, output); session.getFlow().end(context, outcome, output); flowSessions.removeLast(); boolean executionEnded = flowSessions.isEmpty(); if (executionEnded) { // set the root flow execution outcome for external clients to use this.outcome = new FlowExecutionOutcome(outcome, output); status = FlowExecutionStatus.ENDED; } listeners.fireSessionEnded(context, session, outcome, output); if (!executionEnded) { // restore any variables that may have transient references getActiveSessionInternal().getFlow().restoreVariables(context); // treat the outcome as an event against the current state of the new active flow context.handleEvent(new Event(session.getState(), outcome, output)); } }
/** * Jump to a state of the currently active flow. If this execution has not been started, a new session will be * activated and its current state will be set. This is a implementation-internal method that bypasses the * {@link #start(MutableAttributeMap, ExternalContext)} operation and allows for jumping to an arbitrary flow state. * Useful for testing. * @param stateId the identifier of the state to jump to */ public void setCurrentState(String stateId) { FlowSessionImpl session; if (status == FlowExecutionStatus.NOT_STARTED) { session = activateSession(flow); status = FlowExecutionStatus.ACTIVE; } else { session = getActiveSessionInternal(); } State state = session.getFlow().getStateInstance(stateId); session.setCurrentState(state); }
/** * Try to handle given exception using execution exception handlers registered at the state level. Returns null if * no handler handled the exception. * @return true if the exception was handled */ private boolean tryStateHandlers(FlowExecutionException exception, RequestControlContext context) { if (exception.getStateId() != null) { State state = getActiveSessionInternal().getFlow().getStateInstance(exception.getStateId()); return state.handleException(exception, context); } else { return false; } }
/** * Jump to a state of the currently active flow. If this execution has not been started, a new session will be * activated and its current state will be set. This is a implementation-internal method that bypasses the * {@link #start(MutableAttributeMap, ExternalContext)} operation and allows for jumping to an arbitrary flow state. * Useful for testing. * @param stateId the identifier of the state to jump to */ public void setCurrentState(String stateId) { FlowSessionImpl session; if (started) { session = getActiveSessionInternal(); } else { session = activateSession(flow); started = true; } State state = session.getFlow().getStateInstance(stateId); session.setCurrentState(state); }
void endActiveFlowSession(String outcome, MutableAttributeMap output, RequestControlContext context) { FlowSessionImpl session = getActiveSessionInternal(); listeners.fireSessionEnding(context, session, outcome, output); session.getFlow().end(context, outcome, output); flowSessions.removeLast(); boolean executionEnded = hasEnded(); if (executionEnded) { // set the root flow execution outcome for external clients to use this.outcome = new FlowExecutionOutcome(outcome, output); } listeners.fireSessionEnded(context, session, outcome, output); if (!executionEnded) { // restore any variables that may have transient references getActiveSessionInternal().getFlow().restoreVariables(context); // treat the outcome as an event against the current state of the new active flow context.handleEvent(new Event(session.getState(), outcome, output)); } }
logger.debug("Resuming in " + externalContext); Flow activeFlow = getActiveSessionInternal().getFlow(); MessageContext messageContext = createMessageContext(activeFlow.getApplicationContext()); RequestControlContext requestContext = createRequestContext(externalContext, messageContext);
logger.debug("Resuming in " + externalContext); Flow activeFlow = getActiveSessionInternal().getFlow(); MessageContext messageContext = createMessageContext(activeFlow.getApplicationContext()); RequestControlContext requestContext = createRequestContext(externalContext, messageContext);