/** * Executes the actions contained within this action list. Simply iterates over each action and calls execute. * Action result events are ignored. * @param context the action execution request context */ public void execute(RequestContext context) { for (Action action : actions) { ActionExecutor.execute(action, context); } }
public void render() { if (action != null) { ActionExecutor.execute(action, requestContext); } }
protected Event doExecute(RequestContext context) throws Exception { Object result = expression.getValue(context); if (result instanceof Action) { return ActionExecutor.execute((Action) result, context); } else { if (resultExpression != null) { resultExpression.setValue(context, result); } return resultEventFactory.createResultEvent(this, result, context); } }
public boolean test(RequestContext context) { Event result = ActionExecutor.execute(getAction(), context); return result != null && isTrueEvent(result.getId()); }
while (it.hasNext()) { Action action = it.next(); Event event = ActionExecutor.execute(action, context); if (event != null) { eventIds[executionCount] = event.getId();
public void render() { if (action != null) { ActionExecutor.execute(action, requestContext); } }
public void render() { if (action != null) { ActionExecutor.execute(action, requestContext); } }
/** * Executes the actions contained within this action list. Simply iterates over each action and calls execute. * Action result events are ignored. * @param context the action execution request context */ public void execute(RequestContext context) { for (Action action : actions) { ActionExecutor.execute(action, context); } }
/** * Executes the actions contained within this action list. Simply iterates over each action and calls execute. * Action result events are ignored. * @param context the action execution request context */ public void execute(RequestContext context) { Iterator it = actions.iterator(); while (it.hasNext()) { ActionExecutor.execute((Action) it.next(), context); } }
/** * Specialization of State's <code>doEnter</code> template method that executes behavior specific to this state type * in polymorphic fashion. * <p> * This implementation pops the top (active) flow session off the execution stack, ending it, and resumes control in * the parent flow (if necessary). If the ended session is the root flow, a final response is rendered. * @param context the control context for the currently executing flow, used by this state to manipulate the flow * execution * @throws FlowExecutionException if an exception occurs in this state */ protected void doEnter(final RequestControlContext context) throws FlowExecutionException { FlowSession activeSession = context.getFlowExecutionContext().getActiveSession(); if (activeSession.isRoot()) { // entire flow execution is ending; issue the final response if (finalResponseAction != null && !context.getExternalContext().isResponseComplete()) { ActionExecutor.execute(finalResponseAction, context); context.getExternalContext().recordResponseComplete(); } context.endActiveFlowSession(getId(), createSessionOutput(context)); } else { // there is a parent flow that will resume (this flow is a subflow) LocalAttributeMap<Object> sessionOutput = createSessionOutput(context); context.endActiveFlowSession(getId(), sessionOutput); } }
protected Event doExecute(RequestContext context) throws Exception { Object result = expression.getValue(context); if (result instanceof Action) { return ActionExecutor.execute((Action) result, context); } else { if (evaluationResultExposer != null) { evaluationResultExposer.exposeResult(result, context); } return resultEventFactory.createResultEvent(this, result, context); } }
protected Event doExecute(RequestContext context) throws Exception { Object result = expression.getValue(context); if (result instanceof Action) { return ActionExecutor.execute((Action) result, context); } else { if (resultExpression != null) { resultExpression.setValue(context, result); } return resultEventFactory.createResultEvent(this, result, context); } }
public boolean test(RequestContext context) { Event result = ActionExecutor.execute(getAction(), context); return result != null && isTrueEvent(result.getId()); }
public boolean test(RequestContext context) { Event result = ActionExecutor.execute(getAction(), context); return result != null && isTrueEvent(result.getId()); }
public void testExecuteAction() { TestAction action = new TestAction(); Event result = ActionExecutor.execute(action, context); assertNull(context.getCurrentState()); assertEquals("success", result.getId()); }
/** * Specialization of State's <code>doEnter</code> template method that executes behavior specific to this state type * in polymorphic fashion. * <p> * This implementation pops the top (active) flow session off the execution stack, ending it, and resumes control in * the parent flow (if necessary). If the ended session is the root flow, a final response is rendered. * @param context the control context for the currently executing flow, used by this state to manipulate the flow * execution * @throws FlowExecutionException if an exception occurs in this state */ protected void doEnter(final RequestControlContext context) throws FlowExecutionException { FlowSession activeSession = context.getFlowExecutionContext().getActiveSession(); if (activeSession.isRoot()) { // entire flow execution is ending; issue the final response if (finalResponseAction != null && !context.getExternalContext().isResponseComplete()) { ActionExecutor.execute(finalResponseAction, context); context.getExternalContext().recordResponseComplete(); } context.endActiveFlowSession(getId(), createSessionOutput(context)); } else { // there is a parent flow that will resume (this flow is a subflow) LocalAttributeMap<Object> sessionOutput = createSessionOutput(context); context.endActiveFlowSession(getId(), sessionOutput); } }
public void testExecuteActionInState() { context.getMockFlowExecutionContext().getMockActiveSession().setState(state); TestAction action = new TestAction(); Event result = ActionExecutor.execute(action, context); assertSame(state, context.getCurrentState()); assertEquals("success", result.getId()); }
/** * Specialization of State's <code>doEnter</code> template method that executes behavior specific to this state * type in polymorphic fashion. * <p> * This implementation pops the top (active) flow session off the execution stack, ending it, and resumes control in * the parent flow (if necessary). If the ended session is the root flow, a final response is rendered. * @param context the control context for the currently executing flow, used by this state to manipulate the flow * execution * @throws FlowExecutionException if an exception occurs in this state */ protected void doEnter(final RequestControlContext context) throws FlowExecutionException { FlowSession activeSession = context.getFlowExecutionContext().getActiveSession(); if (activeSession.isRoot()) { // entire flow execution is ending; issue the final response if (finalResponseAction != null && context.getExternalContext().isResponseAllowed()) { ActionExecutor.execute(finalResponseAction, context); context.getExternalContext().recordResponseComplete(); } context.endActiveFlowSession(getId(), createSessionOutput(context)); } else { // there is a parent flow that will resume (this flow is a subflow) LocalAttributeMap sessionOutput = createSessionOutput(context); context.endActiveFlowSession(getId(), sessionOutput); } }
public void testExecuteActionWithException() { TestAction action = new TestAction() { protected Event doExecute(RequestContext context) throws Exception { throw new IllegalStateException("Oops"); } }; try { ActionExecutor.execute(action, context); fail("Should've failed"); } catch (ActionExecutionException e) { assertNull(context.getCurrentState()); assertTrue(e.getCause() instanceof IllegalStateException); assertEquals(flow.getId(), e.getFlowId()); assertNull(e.getStateId()); } }
public void testExecuteActionInStateWithException() { context.getMockFlowExecutionContext().getMockActiveSession().setState(state); TestAction action = new TestAction() { protected Event doExecute(RequestContext context) throws Exception { throw new IllegalStateException("Oops"); } }; try { ActionExecutor.execute(action, context); fail("Should've failed"); } catch (ActionExecutionException e) { assertSame(state, context.getCurrentState()); assertTrue(e.getCause() instanceof IllegalStateException); assertEquals(flow.getId(), e.getFlowId()); assertEquals(state.getId(), e.getStateId()); } } }