/** * 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)); }
/** * 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); } }
/** * 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)); }
/** * 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)); }
/** * 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)); }
private void parseAndSetStartState(Element element, Flow flow) { String startStateId = getStartStateId(element); flow.setStartState(startStateId); }
/** * 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()); } }
@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()); }
/** * 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()); }
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); }
/** * 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); } }
/** * 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); } }
/** * 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); } }
flow.setStartState(actionState); LOGGER.debug("Replaced flow {} start state with {}", flow.getId(), flow.getStartState().getId()); } catch (final Exception e) {
/** * 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()); } }
/** * 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()); } }
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()); }