public class FlowExecutionImpl extends java.lang.Object implements FlowExecution, java.io.Externalizable
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.
FlowExecutionImplFactory
,
Serialized FormConstructor and Description |
---|
FlowExecutionImpl()
Default constructor required for externalizable serialization.
|
FlowExecutionImpl(Flow flow)
Create a new flow execution executing the provided flow.
|
Modifier and Type | Method and Description |
---|---|
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) |
public FlowExecutionImpl()
public FlowExecutionImpl(Flow flow)
flow
- the root flow of this flow executionpublic java.lang.String getCaption()
public FlowExecutionKey getKey()
FlowExecutionContext
getKey
in interface FlowExecutionContext
null
if a key has not yet been assigned.public FlowDefinition getDefinition()
FlowExecutionContext
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).
getDefinition
in interface FlowExecutionContext
public boolean hasStarted()
FlowExecutionContext
hasStarted
in interface FlowExecutionContext
FlowExecutionContext.isActive()
public boolean isActive()
FlowExecutionContext
active
session
and remains active until it has ended.isActive
in interface FlowExecutionContext
public boolean hasEnded()
FlowExecutionContext
hasEnded
in interface FlowExecutionContext
FlowExecutionContext.hasStarted()
,
FlowExecutionContext.isActive()
public FlowExecutionOutcome getOutcome()
FlowExecutionContext
getOutcome
in interface FlowExecutionContext
null
if this execution has not yet endedpublic FlowSession getActiveSession()
FlowExecutionContext
getActiveSession
in interface FlowExecutionContext
FlowExecutionContext.isActive()
public MutableAttributeMap getFlashScope()
FlowExecutionContext
getFlashScope
in interface FlowExecutionContext
public MutableAttributeMap getConversationScope()
FlowExecutionContext
getConversationScope
in interface FlowExecutionContext
public AttributeMap getAttributes()
FlowExecutionContext
getAttributes
in interface FlowExecutionContext
public void start(MutableAttributeMap input, ExternalContext externalContext) throws FlowExecutionException, java.lang.IllegalStateException
FlowExecution
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
.
start
in interface FlowExecution
input
- flow execution inputexternalContext
- the external context representing the calling environmentFlowExecutionException
- if an exception was thrown within a state of the flow execution during request
processingjava.lang.IllegalStateException
public void resume(ExternalContext externalContext) throws FlowExecutionException, java.lang.IllegalStateException
FlowExecution
resume
in interface FlowExecution
externalContext
- the external context, representing the calling environment, where something happened this flow
execution should respond toFlowExecutionException
- if an exception was thrown within a state of the resumed flow execution during
event processingjava.lang.IllegalStateException
public void setCurrentState(java.lang.String stateId)
start(MutableAttributeMap, ExternalContext)
operation and allows for jumping to an arbitrary flow state.
Useful for testing.stateId
- the identifier of the state to jump topublic void readExternal(java.io.ObjectInput in) throws java.io.IOException, java.lang.ClassNotFoundException
readExternal
in interface java.io.Externalizable
java.io.IOException
java.lang.ClassNotFoundException
public void writeExternal(java.io.ObjectOutput out) throws java.io.IOException
writeExternal
in interface java.io.Externalizable
java.io.IOException
public java.lang.String toString()
toString
in class java.lang.Object
protected RequestControlContext createRequestContext(ExternalContext externalContext, MessageContext messageContext)
externalContext
- the external context triggering this requestprotected org.springframework.webflow.engine.impl.FlowSessionImpl createFlowSession(Flow flow, org.springframework.webflow.engine.impl.FlowSessionImpl parent)
flow
- the flow that should be associated with the flow sessionparent
- the flow session that should be the parent of the newly created flow session (may be null)public void viewRendering(View view, RequestContext context)
public void viewRendered(View view, RequestContext context)