Package org.springframework.webflow.engine

Examples of org.springframework.webflow.engine.Flow


    }

    @Test
    public void testSubflow() throws Exception {
        final FlowExecutionImplFactory executionFactory = new FlowExecutionImplFactory();
        final Flow flow = createFlowWithSubflow("parent", "child");
        final CasFlowExecutionKeyFactory keyFactory = new CasFlowExecutionKeyFactory(
            this.mockConversationManager,
            new SimpleFlowExecutionSnapshotFactory(executionFactory, newMockFlowLocator(flow)));
        keyFactory.setAlwaysGenerateNewNextKey(true);
        executionFactory.setExecutionKeyFactory(keyFactory);
View Full Code Here


        assertTrue(execution.hasEnded());
    }
   
    private Flow createSimpleFlow(final String id) {
        // Create a flat flow with an action and single view state
        final Flow flow = new Flow(id);
        final ActionState state1 = new ActionState(flow, "state1-action");
        final ViewState state2 = new ViewState(flow, "state2-view", new MockViewFactory("view"));
        new EndState(flow, "state3-end");
        state1.getActionList().add(new MockAction("state1-result"));
        state1.getTransitionSet().add(new Transition(new DefaultTargetStateResolver("state2-view")));
View Full Code Here

        return flow;
    }
   
    private Flow createFlowWithSubflow(final String parentId, final String childId) {
        // Create a flow containing a subflow followed by a view state
        final Flow parent = new Flow(parentId);
        final Flow child = createSimpleFlow(childId);
        final ActionState state1 = new ActionState(parent, "state1-action");
        final SubflowState state2 = new SubflowState(parent, "state2-subflow", new StaticExpression(child));
        final ViewState state3 = new ViewState(parent, "state3-view", new MockViewFactory("parentview"));
        new EndState(parent, "state4-end");
        state1.getActionList().add(new MockAction("state1-result"));
View Full Code Here

      FlowExecutionKey flowExecutionKey, MutableAttributeMap conversationScope,
      FlowDefinitionLocator subflowDefinitionLocator) {
    Assert.isInstanceOf(FlowExecutionImpl.class, flowExecution, "FlowExecution is of the wrong type: ");
    Assert.isInstanceOf(Flow.class, flowDefinition, "FlowDefinition is of the wrong type: ");
    FlowExecutionImpl execution = (FlowExecutionImpl) flowExecution;
    Flow flow = (Flow) flowDefinition;
    execution.setFlow(flow);
    if (execution.hasSessions()) {
      FlowSessionImpl rootSession = execution.getRootSession();
      rootSession.setFlow(flow);
      rootSession.setState(flow.getStateInstance(rootSession.getStateId()));
      if (execution.hasSubflowSessions()) {
        for (Iterator it = execution.getSubflowSessionIterator(); it.hasNext();) {
          FlowSessionImpl subflowSession = (FlowSessionImpl) it.next();
          Flow subflowDef = (Flow) subflowDefinitionLocator.getFlowDefinition(subflowSession.getFlowId());
          subflowSession.setFlow(subflowDef);
          subflowSession.setState(subflowDef.getStateInstance(subflowSession.getStateId()));
        }
      }
    }
    execution.setKey(flowExecutionKey);
    if (conversationScope == null) {
View Full Code Here

  protected final FlowDefinition getFlowDefinition() {
    if (isCacheFlowDefinition() && cachedFlowDefinition != null) {
      return cachedFlowDefinition;
    }
    Flow flow = buildFlow();
    if (isCacheFlowDefinition()) {
      cachedFlowDefinition = flow;
    }
    return flow;
  }
View Full Code Here

      }
    }
    if (logger.isDebugEnabled()) {
      logger.debug("Resuming in " + externalContext);
    }
    Flow activeFlow = getActiveSessionInternal().getFlow();
    MessageContext messageContext = createMessageContext(activeFlow.getApplicationContext());
    RequestControlContext requestContext = createRequestContext(externalContext, messageContext);
    RequestContextHolder.setRequestContext(requestContext);
    listeners.fireRequestSubmitted(requestContext);
    try {
      listeners.fireResuming(requestContext);
      activeFlow.resume(requestContext);
    } catch (FlowExecutionException e) {
      handleException(e, requestContext);
    } catch (Exception e) {
      handleException(wrap(e), requestContext);
    } finally {
View Full Code Here

  /**
   * Creates a new mock flow session that sets a flow with id "mockFlow" as the 'active flow' in state "mockState".
   */
  public MockFlowSession() {
    setDefinition(new Flow("mockFlow"));
    State state = new TransitionableState(definition, "mockState") {
      protected void doEnter(RequestControlContext context) throws FlowExecutionException {
        // nothing to do
      }
    };
View Full Code Here

  }

  private class MockViewState extends ViewState {

    public MockViewState() {
      super(new Flow("mockFlow"), "mockView", new ViewFactory() {

        public View getView(RequestContext context) {
          // TODO Auto-generated method stub
          throw new UnsupportedOperationException("Auto-generated method stub");
        }
View Full Code Here

  Flow flow;

  TransitionableState state;

  protected void setUp() {
    flow = new Flow("myFlow");
    state = new TransitionableState(flow, "state1") {
      protected void doEnter(RequestControlContext context) {
        throw new FlowExecutionException(getFlow().getId(), getId(), "Oops!", new TestException());
      }
    };
View Full Code Here

      public Flow createFlow() throws FlowBuilderException {
        return Flow.create(getContext().getFlowId(), getContext().getFlowAttributes());
      }
    };
    Flow flow = new FlowAssembler(builder, new MockFlowBuilderContext("flow")).assembleFlow();
    FlowExecution execution = new FlowExecutionImplFactory().createFlowExecution(flow);
    execution.start(null, new MockExternalContext());
    assertTrue(execution.isActive());
  }
View Full Code Here

TOP

Related Classes of org.springframework.webflow.engine.Flow

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.