All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.springframework.webflow.definition.package.html Maven / Gradle / Ivy

The newest version!


Core, stable abstractions for representing flow definitions.

Each flow has an indentifier and is composed of one or more states, one of which is the start state. States may be transitionable, and if so define one or more transitions that lead to other states.

With these types a client can introspect a flow definition to reason on its attributes and traverse its structure, perhaps to display a visual diagram. Note that the types defined in this package do not capture the behavioral characteristics of a flow.

The following code shows the beginnings of a basic flow definition traversal algorithm:

    FlowDefinition flow = ...

    // lookup start state
    StateDefinition state = flow.getStartState();

    // traverse to state transitions
    traverse(state);

    public void traverse(StateDefinition state) {
        logger.info("State: " + state.getId());
        while (state instanceof TransitionableStateDefinition) {
            TransitionableStateDefinition transitionable = (TransitionableStateDefinition)state;
            TransitionDefinition[] transitions = transitionable.getTransitions();
            for (int i = 0; i < transitions.length; i++) {
                Transition t = transitions[i];
                logger.info("Transition " + t.getId());
                traverse(state.getOwner().getState(t.getTargetStateId()); 
            }
        }    
    }





© 2015 - 2024 Weber Informatics LLC | Privacy Policy