Package org.springframework.webflow.engine.model

Examples of org.springframework.webflow.engine.model.AbstractStateModel


  private void mergeStates() {
    if (flowModel.getStates() == null) {
      return;
    }
    for (Iterator it = flowModel.getStates().iterator(); it.hasNext();) {
      AbstractStateModel childState = (AbstractStateModel) it.next();
      String parent = childState.getParent();
      if (childState.getParent() != null) {
        String flowId;
        String stateId;
        AbstractStateModel parentState = null;
        int hashIndex = parent.indexOf("#");
        if (hashIndex == -1) {
          throw new FlowModelBuilderException("Invalid parent syntax '" + parent
              + "', should take form 'flowId#stateId'");
        }
        flowId = parent.substring(0, hashIndex).trim();
        stateId = parent.substring(hashIndex + 1).trim();
        try {
          parentState = modelLocator.getFlowModel(flowId).getStateById(stateId);
          if (parentState == null) {
            throw new FlowModelBuilderException("Unable to find state '" + stateId + "' in flow '" + flowId
                + "'");
          }
          childState.merge(parentState);
        } catch (NoSuchFlowModelException e) {
          throw new FlowModelBuilderException("Unable to find flow '" + flowId + "' to inherit from", e);
        } catch (ClassCastException e) {
          throw new FlowModelBuilderException("Parent state type '" + parentState.getClass().getName()
              + "' cannot be merged with state type '" + childState.getClass().getName() + "'", e);

        }
      }
    }
View Full Code Here


  public void buildStates() throws FlowBuilderException {
    if (flowModel.getStates() == null) {
      throw new FlowBuilderException("At least one state is required to build a Flow");
    }
    for (Iterator it = flowModel.getStates().iterator(); it.hasNext();) {
      AbstractStateModel state = (AbstractStateModel) it.next();
      if (state instanceof ActionStateModel) {
        parseAndAddActionState((ActionStateModel) state, getFlow());
      } else if (state instanceof ViewStateModel) {
        parseAndAddViewState((ViewStateModel) state, getFlow());
      } else if (state instanceof DecisionStateModel) {
View Full Code Here

    for (AbstractStateModel childState : flowModel.getStates()) {
      String parent = childState.getParent();
      if (childState.getParent() != null) {
        String flowId;
        String stateId;
        AbstractStateModel parentState = null;
        int hashIndex = parent.indexOf("#");
        if (hashIndex == -1) {
          throw new FlowModelBuilderException("Invalid parent syntax '" + parent
              + "', should take form 'flowId#stateId'");
        }
        flowId = parent.substring(0, hashIndex).trim();
        stateId = parent.substring(hashIndex + 1).trim();
        try {
          if (StringUtils.hasText(flowId)) {
            parentState = modelLocator.getFlowModel(flowId).getStateById(stateId);
          } else {
            parentState = flowModel.getStateById(stateId);
          }
          if (parentState == null) {
            throw new FlowModelBuilderException("Unable to find state '" + stateId + "' in flow '" + flowId
                + "'");
          }
          childState.merge(parentState);
        } catch (NoSuchFlowModelException e) {
          throw new FlowModelBuilderException("Unable to find flow '" + flowId + "' to inherit from", e);
        } catch (ClassCastException e) {
          throw new FlowModelBuilderException("Parent state type '" + parentState.getClass().getName()
              + "' cannot be merged with state type '" + childState.getClass().getName() + "'", e);

        }
      }
    }
View Full Code Here

TOP

Related Classes of org.springframework.webflow.engine.model.AbstractStateModel

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.