A single flow definition. A Flow definition is a reusable, self-contained
controller module that provides the blue print for a user dialog or
conversation. Flows typically orchestrate controlled navigations within web
applications to guide users through fulfillment of a business process/goal
that takes place over a series of steps, modeled as states.
A simple Flow definition could do nothing more than execute an action and
display a view all in one request. A more elaborate Flow definition may be
long-lived and execute across a series of requests, invoking many possible
paths, actions, and subflows.
Especially in Intranet applications there are often "controlled navigations"
where the user is not free to do what he or she wants but must follow the
guidelines provided by the system to complete a process that is transactional
in nature (the quinessential example would be a 'checkout' flow of a shopping
cart application). This is a typical use case appropriate to model as a flow.
Structurally a Flow is composed of a set of states. A
State is a
point in a flow where a behavior is executed; for example, showing a view,
executing an action, spawning a subflow, or terminating the flow. Different
types of states execute different behaviors in a polymorphic fashion.
Each
TransitionableState type has one or more transitions that when
executed move a flow to another state. These transitions define the supported
paths through the flow.
A state transition is triggered by the occurence of an event. An event is
something that happens the flow should respond to, for example a user input
event like ("submit") or an action execution result event like ("success").
When an event occurs in a state of a Flow that event drives a state
transition that decides what to do next.
Each Flow has exactly one start state. A start state is simply a marker
noting the state executions of this Flow definition should start in. The
first state added to the flow will become the start state by default.
Flow definitions may have one or more flow exception handlers. A
FlowExecutionExceptionHandler can execute custom behavior in response
to a specific exception (or set of exceptions) that occur in a state of one
of this flow's executions.
Instances of this class are typically built by
org.springframework.webflow.engine.builder.FlowBuilder implementations but may also be directly instantiated.
This class and the rest of the Spring Web Flow (SWF) engine have been designed
with minimal dependencies on other libraries. Spring Web Flow is usable in a
standalone fashion (as well as in the context of other frameworks like Spring
MVC, Struts, or JSF, for example). The engine system is fully usable outside an
HTTP servlet environment, for example in portlets, tests, or standalone
applications. One of the major architectural benefits of Spring Web Flow is
the ability to design reusable, high-level controller modules that may be
executed in any environment.
Note: flows are singleton definition objects so they should be thread-safe.
You can think a flow definition as analagous somewhat to a Java class,
defining all the behavior of an application module. The core behaviors
Flow.start(RequestControlContext,MutableAttributeMap) start ,
Flow.onEvent(RequestControlContext) on event , and
Flow.end(RequestControlContext,MutableAttributeMap) end each accept a
RequestContext request context that allows for this flow to access
execution state in a thread safe manner. A flow execution is what models a
running instance of this flow definition, somewhat analgous to a java object
that is an instance of a class.
See Also: org.springframework.webflow.engine.State See Also: org.springframework.webflow.engine.TransitionableState See Also: org.springframework.webflow.engine.ActionState See Also: org.springframework.webflow.engine.ViewState See Also: org.springframework.webflow.engine.SubflowState See Also: org.springframework.webflow.engine.EndState See Also: org.springframework.webflow.engine.DecisionState See Also: org.springframework.webflow.engine.Transition See Also: org.springframework.webflow.engine.FlowExecutionExceptionHandler author: Keith Donald author: Erwin Vervaet author: Colin Sampaleanu |