Overview | Package | Class | Tree | Deprecated | Index | Help
| Spring Web Flow
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## org.springframework.webflow.engine.impl
Class FlowExecutionImpl

    java.lang.Object
      org.springframework.webflow.engine.impl.FlowExecutionImpl

All Implemented Interfaces:
  java.io.Externalizable, java.io.Serializable, FlowExecution, FlowExecutionContext

    public class FlowExecutionImpl

extends java.lang.Object
implements FlowExecution, java.io.Externalizable

Default implementation of FlowExecution that uses a stack-based data structure to manage spawned flow sessions. This class is closely coupled with package-private `FlowSessionImpl` and `RequestControlContextImpl` . The three classes work together to form a complete flow execution implementation based on a finite state machine.

This implementation of FlowExecution is serializable so it can be safely stored in an HTTP session or other persistent store such as a file, database, or client-side form field. Once deserialized, the `FlowExecutionImplFactory` is expected to be used to restore the execution to a usable state.

Author:
  Keith Donald, Erwin Vervaet, Jeremy Grelle
See Also:
  `FlowExecutionImplFactory`, Serialized Form

Constructor Summary
`FlowExecutionImpl()` Default constructor required for externalizable serialization.
`FlowExecutionImpl(Flow flow)` Create a new flow execution executing the provided flow.

Method Summary
`protected org.springframework.webflow.engine.impl.FlowSessionImpl` | `createFlowSession(Flow flow, org.springframework.webflow.engine.impl.FlowSessionImpl parent)` Create a new flow session object.
`protected RequestControlContext` | `createRequestContext(ExternalContext externalContext, MessageContext messageContext)` Create a flow execution control context.
`FlowSession` | `getActiveSession()` Returns the active flow session of this flow execution.
`AttributeMap` | `getAttributes()` Returns runtime execution attributes that may influence the behavior of flow artifacts, such as states and actions.
`java.lang.String` | `getCaption()`
`MutableAttributeMap` | `getConversationScope()` Returns a mutable map for data held in "conversation scope".
`FlowDefinition` | `getDefinition()` Returns the root flow definition associated with this executing flow.
`MutableAttributeMap` | `getFlashScope()` Returns a mutable map for data held in "flash scope".
`FlowExecutionKey` | `getKey()` Returns the key assigned to this flow execution.
`FlowExecutionOutcome` | `getOutcome()` Returns the outcome reached by this execution, or null if this execution has not yet ended.
`boolean` | `hasEnded()` Returns a flag indicating if this execution has ended.
`boolean` | `hasStarted()` Returns a flag indicating if this execution has been started.
`boolean` | `isActive()` Is the flow execution active? A flow execution is active once it has an `active session` and remains active until it has ended.
`void` | `readExternal(java.io.ObjectInput in)`
`void` | `resume(ExternalContext externalContext)` Resume this flow execution.
`void` | `setCurrentState(java.lang.String stateId)` Jump to a state of the currently active flow.
`void` | `start(MutableAttributeMap input, ExternalContext externalContext)` Start this flow execution.
`java.lang.String` | `toString()`
`void` | `viewRendered(View view, RequestContext context)`
`void` | `viewRendering(View view, RequestContext context)`
`void` | `writeExternal(java.io.ObjectOutput out)`

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait`

Constructor Detail

### FlowExecutionImpl

    public FlowExecutionImpl()

  Default constructor required for externalizable serialization. Should NOT be called programmatically.

### FlowExecutionImpl

    public FlowExecutionImpl(Flow flow)

  Create a new flow execution executing the provided flow. Flow executions are normally created by a flow execution factory.

  Parameters:
    `flow` - the root flow of this flow execution

Method Detail

### getCaption

    public java.lang.String getCaption()

### getKey

    public FlowExecutionKey getKey()

  Description copied from interface: `FlowExecutionContext`
  Returns the key assigned to this flow execution. The flow execution key is the flow execution's persistent identity.

  Specified by:
    `getKey` in interface `FlowExecutionContext`
  Returns:
    the flow execution key; may be `null` if a key has not yet been assigned.

### getDefinition

    public FlowDefinition getDefinition()

  Description copied from interface: `FlowExecutionContext`
  Returns the root flow definition associated with this executing flow.

  A call to this method always returns the same flow definition -- the top-level "root" -- no matter what flow may actually be active (for example, if subflows have been spawned).

  Specified by:
    `getDefinition` in interface `FlowExecutionContext`
  Returns:
    the root flow definition

### hasStarted

    public boolean hasStarted()

  Description copied from interface: `FlowExecutionContext`
  Returns a flag indicating if this execution has been started. A flow execution that has started and is active is currently in progress. A flow execution that has started and is not active has ended.

  Specified by:
    `hasStarted` in interface `FlowExecutionContext`
  Returns:
    true if started, false if not started
  See Also:
    `FlowExecutionContext.isActive()`

### isActive

    public boolean isActive()

  Description copied from interface: `FlowExecutionContext`
  Is the flow execution active? A flow execution is active once it has an `active session` and remains active until it has ended.

  Specified by:
    `isActive` in interface `FlowExecutionContext`
  Returns:
    true if active, false if the flow execution has terminated or has not yet been started

### hasEnded

    public boolean hasEnded()

  Description copied from interface: `FlowExecutionContext`
  Returns a flag indicating if this execution has ended. A flow execution that has ended has been started but is no longer active.

  Specified by:
    `hasEnded` in interface `FlowExecutionContext`
  Returns:
    true if ended, false if not started or still active
  See Also:
    `FlowExecutionContext.hasStarted()`, `FlowExecutionContext.isActive()`

### getOutcome

    public FlowExecutionOutcome getOutcome()

  Description copied from interface: `FlowExecutionContext`
  Returns the outcome reached by this execution, or null if this execution has not yet ended.

  Specified by:
    `getOutcome` in interface `FlowExecutionContext`
  Returns:
    the outcome, or `null` if this execution has not yet ended

### getActiveSession

    public FlowSession getActiveSession()

  Description copied from interface: `FlowExecutionContext`
  Returns the active flow session of this flow execution. The active flow session is the currently executing session. It may be the "root flow" session, or it may be a subflow session if this flow execution has spawned a subflow.

  Specified by:
    `getActiveSession` in interface `FlowExecutionContext`
  Returns:
    the active flow session
  See Also:
    `FlowExecutionContext.isActive()`

### getFlashScope

    public MutableAttributeMap getFlashScope()

  Description copied from interface: `FlowExecutionContext`
  Returns a mutable map for data held in "flash scope". Attributes in this map are cleared out on the next view rendering. Flash attributes survive flow execution refresh operations.

  Specified by:
    `getFlashScope` in interface `FlowExecutionContext`
  Returns:
    flash scope

### getConversationScope

    public MutableAttributeMap getConversationScope()

  Description copied from interface: `FlowExecutionContext`
  Returns a mutable map for data held in "conversation scope". Conversation scope is a data structure that exists for the life of this flow execution and is accessible to all flow sessions.

  Specified by:
    `getConversationScope` in interface `FlowExecutionContext`
  Returns:
    conversation scope

### getAttributes

    public AttributeMap getAttributes()

  Description copied from interface: `FlowExecutionContext`
  Returns runtime execution attributes that may influence the behavior of flow artifacts, such as states and actions.

  Specified by:
    `getAttributes` in interface `FlowExecutionContext`
  Returns:
    execution attributes

### start

    public void start(MutableAttributeMap input,
                      ExternalContext externalContext)
               throws FlowExecutionException,
                      java.lang.IllegalStateException

  Description copied from interface: `FlowExecution`
  Start this flow execution. This method should only be called once.

  When this method returns, execution status is either "paused" or "ended". If ended, the flow execution cannot be used again. If "paused", the flow execution may be `resumed`.

  Specified by:
    `start` in interface `FlowExecution`
  Parameters:
    `input` - flow execution input
    `externalContext` - the external context representing the calling environment
  Throws:
    `FlowExecutionException` - if an exception was thrown within a state of the flow execution during request processing
    `java.lang.IllegalStateException`

### resume

    public void resume(ExternalContext externalContext)
                throws FlowExecutionException,
                       java.lang.IllegalStateException

  Description copied from interface: `FlowExecution`
  Resume this flow execution. May be called when the flow execution is paused. When this method returns, execution status is either "paused" or "ended". If ended, the flow execution cannot be used again. If "paused", the flow execution may be resumed again.

  Specified by:
    `resume` in interface `FlowExecution`
  Parameters:
    `externalContext` - the external context, representing the calling environment, where something happened this flow execution should respond to
  Throws:
    `FlowExecutionException` - if an exception was thrown within a state of the resumed flow execution during event processing
    `java.lang.IllegalStateException`

### setCurrentState

    public void setCurrentState(java.lang.String stateId)

  Jump to a state of the currently active flow. If this execution has not been started, a new session will be activated and its current state will be set. This is a implementation-internal method that bypasses the `start(MutableAttributeMap, ExternalContext)` operation and allows for jumping to an arbitrary flow state. Useful for testing.

  Parameters:
    `stateId` - the identifier of the state to jump to

### readExternal

    public void readExternal(java.io.ObjectInput in)
                      throws java.io.IOException,
                             java.lang.ClassNotFoundException

  Specified by:
    `readExternal` in interface `java.io.Externalizable`
  Throws:
    `java.io.IOException`
    `java.lang.ClassNotFoundException`

### writeExternal

    public void writeExternal(java.io.ObjectOutput out)
                       throws java.io.IOException

  Specified by:
    `writeExternal` in interface `java.io.Externalizable`
  Throws:
    `java.io.IOException`

### toString

    public java.lang.String toString()

  Overrides:
    `toString` in class `java.lang.Object`

### createRequestContext

    protected RequestControlContext createRequestContext(ExternalContext externalContext,
                                                         MessageContext messageContext)

  Create a flow execution control context.

  Parameters:
    `externalContext` - the external context triggering this request

### createFlowSession

    protected org.springframework.webflow.engine.impl.FlowSessionImpl createFlowSession(Flow flow,
                                                                                        org.springframework.webflow.engine.impl.FlowSessionImpl parent)

  Create a new flow session object. Subclasses can override this to return a special implementation if required.

  Parameters:
    `flow` - the flow that should be associated with the flow session
    `parent` - the flow session that should be the parent of the newly created flow session (may be null)
  Returns:
    the newly created flow session

### viewRendering

    public void viewRendering(View view,
                              RequestContext context)

### viewRendered

    public void viewRendered(View view,
                             RequestContext context)

Overview | Package | Class | Tree | Deprecated | Index | Help
| Spring Web Flow
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD