org.springframework.webflow.engine.Flow.setStartState()方法的使用及代码示例

x33g5p2x  于2022-01-19 转载在 其他  
字(11.8k)|赞(0)|评价(0)|浏览(99)

本文整理了Java中org.springframework.webflow.engine.Flow.setStartState()方法的一些代码示例,展示了Flow.setStartState()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Flow.setStartState()方法的具体详情如下:
包路径:org.springframework.webflow.engine.Flow
类名称:Flow
方法名:setStartState

Flow.setStartState介绍

[英]Set the start state for this flow to the state with the provided stateId; a state must exist by the provided stateId.
[中]将此流的开始状态设置为具有提供的stateId的状态;状态必须由提供的stateId存在。

代码示例

代码示例来源:origin: org.springframework.webflow/spring-webflow

/**
 * Set the start state for this flow to the state with the provided <code>stateId</code>; a state must exist by the
 * provided <code>stateId</code>.
 * @param stateId the id of the new start state
 * @throws IllegalArgumentException when no state exists with the id you provided
 */
public void setStartState(String stateId) throws IllegalArgumentException {
  setStartState(getStateInstance(stateId));
}

代码示例来源:origin: org.springframework.webflow/spring-webflow

/**
 * Add given state definition to this flow definition. Marked protected, as this method is to be called by the
 * (privileged) state definition classes themselves during state construction as part of a FlowBuilder invocation.
 * @param state the state to add
 * @throws IllegalArgumentException when the state cannot be added to the flow; for instance if another state shares
 * the same id as the one provided or if given state already belongs to another flow
 */
protected void add(State state) throws IllegalArgumentException {
  if (this != state.getFlow() && state.getFlow() != null) {
    throw new IllegalArgumentException("State " + state + " cannot be added to this flow '" + getId()
        + "' -- it already belongs to a different flow: '" + state.getFlow().getId() + "'");
  }
  if (this.states.contains(state) || this.containsState(state.getId())) {
    throw new IllegalArgumentException("This flow '" + getId() + "' already contains a state with id '"
        + state.getId() + "' -- state ids must be locally unique to the flow definition; "
        + "existing state-ids of this flow include: " + StylerUtils.style(getStateIds()));
  }
  boolean firstAdd = states.isEmpty();
  states.add(state);
  if (firstAdd) {
    setStartState(state);
  }
}

代码示例来源:origin: org.springframework/spring-webflow

/**
 * Set the start state for this flow to the state with the provided <code>stateId</code>; a state must exist by
 * the provided <code>stateId</code>.
 * @param stateId the id of the new start state
 * @throws IllegalArgumentException when no state exists with the id you provided
 */
public void setStartState(String stateId) throws IllegalArgumentException {
  setStartState(getStateInstance(stateId));
}

代码示例来源:origin: org.springframework.webflow/org.springframework.webflow

/**
 * Set the start state for this flow to the state with the provided <code>stateId</code>; a state must exist by the
 * provided <code>stateId</code>.
 * @param stateId the id of the new start state
 * @throws IllegalArgumentException when no state exists with the id you provided
 */
public void setStartState(String stateId) throws IllegalArgumentException {
  setStartState(getStateInstance(stateId));
}

代码示例来源:origin: spring-projects/spring-webflow

/**
 * Set the start state for this flow to the state with the provided <code>stateId</code>; a state must exist by the
 * provided <code>stateId</code>.
 * @param stateId the id of the new start state
 * @throws IllegalArgumentException when no state exists with the id you provided
 */
public void setStartState(String stateId) throws IllegalArgumentException {
  setStartState(getStateInstance(stateId));
}

代码示例来源:origin: org.springframework/spring-webflow

private void parseAndSetStartState(Element element, Flow flow) {
  String startStateId = getStartStateId(element);
  flow.setStartState(startStateId);
}

代码示例来源:origin: org.springframework.webflow/spring-webflow

/**
 * Builds the states of the flow.
 * @throws FlowBuilderException an exception occurred building the flow
 */
public void buildStates() throws FlowBuilderException {
  if (flowModel.getStates() == null) {
    throw new FlowBuilderException("At least one state is required to build a Flow");
  }
  for (AbstractStateModel state : flowModel.getStates()) {
    if (state instanceof ActionStateModel) {
      parseAndAddActionState((ActionStateModel) state, getFlow());
    } else if (state instanceof ViewStateModel) {
      parseAndAddViewState((ViewStateModel) state, getFlow());
    } else if (state instanceof DecisionStateModel) {
      parseAndAddDecisionState((DecisionStateModel) state, getFlow());
    } else if (state instanceof SubflowStateModel) {
      parseAndAddSubflowState((SubflowStateModel) state, getFlow());
    } else if (state instanceof EndStateModel) {
      parseAndAddEndState((EndStateModel) state, getFlow());
    }
  }
  if (flowModel.getStartStateId() != null) {
    getFlow().setStartState(flowModel.getStartStateId());
  }
}

代码示例来源:origin: org.apereo.cas/cas-server-core-webflow-api

@Override
public void setStartState(final Flow flow, final String state) {
  flow.setStartState(state);
  val startState = getStartState(flow);
  LOGGER.trace("Start state is now set to [{}]", startState.getId());
}

代码示例来源:origin: org.jasig.cas/cas-server-core-webflow

/**
 * Sets start state.
 *
 * @param flow  the flow
 * @param state the state
 */
protected void setStartState(final Flow flow, final String state) {
  flow.setStartState(state);
  final TransitionableState startState = getStartState(flow);
  logger.debug("Start state is now set to {}", startState.getId());
}

代码示例来源:origin: org.apereo.cas/cas-server-core-webflow-api

private static void configureFlowStartState(final Flow flow, final ActionState terminateSessionActionState) {
  LOGGER.trace("Setting the start state of the logout webflow identified by [{}] to [{}]", flow.getId(), terminateSessionActionState.getId());
  flow.setStartState(terminateSessionActionState);
}

代码示例来源:origin: spring-projects/spring-webflow

/**
 * Add given state definition to this flow definition. Marked protected, as this method is to be called by the
 * (privileged) state definition classes themselves during state construction as part of a FlowBuilder invocation.
 * @param state the state to add
 * @throws IllegalArgumentException when the state cannot be added to the flow; for instance if another state shares
 * the same id as the one provided or if given state already belongs to another flow
 */
protected void add(State state) throws IllegalArgumentException {
  if (this != state.getFlow() && state.getFlow() != null) {
    throw new IllegalArgumentException("State " + state + " cannot be added to this flow '" + getId()
        + "' -- it already belongs to a different flow: '" + state.getFlow().getId() + "'");
  }
  if (this.states.contains(state) || this.containsState(state.getId())) {
    throw new IllegalArgumentException("This flow '" + getId() + "' already contains a state with id '"
        + state.getId() + "' -- state ids must be locally unique to the flow definition; "
        + "existing state-ids of this flow include: " + StylerUtils.style(getStateIds()));
  }
  boolean firstAdd = states.isEmpty();
  states.add(state);
  if (firstAdd) {
    setStartState(state);
  }
}

代码示例来源:origin: org.springframework.webflow/org.springframework.webflow

/**
 * Add given state definition to this flow definition. Marked protected, as this method is to be called by the
 * (privileged) state definition classes themselves during state construction as part of a FlowBuilder invocation.
 * @param state the state to add
 * @throws IllegalArgumentException when the state cannot be added to the flow; for instance if another state shares
 * the same id as the one provided or if given state already belongs to another flow
 */
protected void add(State state) throws IllegalArgumentException {
  if (this != state.getFlow() && state.getFlow() != null) {
    throw new IllegalArgumentException("State " + state + " cannot be added to this flow '" + getId()
        + "' -- it already belongs to a different flow: '" + state.getFlow().getId() + "'");
  }
  if (this.states.contains(state) || this.containsState(state.getId())) {
    throw new IllegalArgumentException("This flow '" + getId() + "' already contains a state with id '"
        + state.getId() + "' -- state ids must be locally unique to the flow definition; "
        + "existing state-ids of this flow include: " + StylerUtils.style(getStateIds()));
  }
  boolean firstAdd = states.isEmpty();
  states.add(state);
  if (firstAdd) {
    setStartState(state);
  }
}

代码示例来源:origin: org.springframework/spring-webflow

/**
 * Add given state definition to this flow definition. Marked protected, as this method is to be called by the
 * (privileged) state definition classes themselves during state construction as part of a FlowBuilder invocation.
 * @param state the state to add
 * @throws IllegalArgumentException when the state cannot be added to the flow; for instance if another state shares
 * the same id as the one provided or if given state already belongs to another flow
 */
protected void add(State state) throws IllegalArgumentException {
  if (this != state.getFlow() && state.getFlow() != null) {
    throw new IllegalArgumentException("State " + state + " cannot be added to this flow '" + getId()
        + "' -- it already belongs to a different flow: '" + state.getFlow().getId() + "'");
  }
  if (this.states.contains(state) || this.containsState(state.getId())) {
    throw new IllegalArgumentException("This flow '" + getId() + "' already contains a state with id '"
        + state.getId() + "' -- state ids must be locally unique to the flow definition; "
        + "existing state-ids of this flow include: " + StylerUtils.style(getStateIds()));
  }
  boolean firstAdd = states.isEmpty();
  states.add(state);
  if (firstAdd) {
    setStartState(state);
  }
}

代码示例来源:origin: net.unicon/cas-mfa-java

flow.setStartState(actionState);
  LOGGER.debug("Replaced flow {} start state with {}", flow.getId(), flow.getStartState().getId());
} catch (final Exception e) {

代码示例来源:origin: org.springframework.webflow/org.springframework.webflow

/**
 * Builds the states of the flow.
 * @throws FlowBuilderException an exception occurred building the flow
 */
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) {
      parseAndAddDecisionState((DecisionStateModel) state, getFlow());
    } else if (state instanceof SubflowStateModel) {
      parseAndAddSubflowState((SubflowStateModel) state, getFlow());
    } else if (state instanceof EndStateModel) {
      parseAndAddEndState((EndStateModel) state, getFlow());
    }
  }
  if (flowModel.getStartStateId() != null) {
    getFlow().setStartState(flowModel.getStartStateId());
  }
}

代码示例来源:origin: spring-projects/spring-webflow

/**
 * Builds the states of the flow.
 * @throws FlowBuilderException an exception occurred building the flow
 */
public void buildStates() throws FlowBuilderException {
  if (flowModel.getStates() == null) {
    throw new FlowBuilderException("At least one state is required to build a Flow");
  }
  for (AbstractStateModel state : flowModel.getStates()) {
    if (state instanceof ActionStateModel) {
      parseAndAddActionState((ActionStateModel) state, getFlow());
    } else if (state instanceof ViewStateModel) {
      parseAndAddViewState((ViewStateModel) state, getFlow());
    } else if (state instanceof DecisionStateModel) {
      parseAndAddDecisionState((DecisionStateModel) state, getFlow());
    } else if (state instanceof SubflowStateModel) {
      parseAndAddSubflowState((SubflowStateModel) state, getFlow());
    } else if (state instanceof EndStateModel) {
      parseAndAddEndState((EndStateModel) state, getFlow());
    }
  }
  if (flowModel.getStartStateId() != null) {
    getFlow().setStartState(flowModel.getStartStateId());
  }
}

代码示例来源:origin: spring-projects/spring-webflow

public void testCreateWithExecutionKeyFactory() {
  State state = new State(flowDefinition, "state") {
    protected void doEnter(RequestControlContext context) throws FlowExecutionException {
      context.assignFlowExecutionKey();
      context.updateCurrentFlowExecutionSnapshot();
      context.removeCurrentFlowExecutionSnapshot();
      context.removeAllFlowExecutionSnapshots();
    }
  };
  flowDefinition.setStartState(state);
  factory.setExecutionKeyFactory(new MockFlowExecutionKeyFactory());
  FlowExecution execution = factory.createFlowExecution(flowDefinition);
  execution.start(null, new MockExternalContext());
  assertTrue(getKeyCalled);
  assertTrue(removeAllSnapshotsCalled);
  assertTrue(removeSnapshotCalled);
  assertTrue(updateSnapshotCalled);
  assertNull(execution.getKey());
}

相关文章