public class MockFlowExecutionContext extends java.lang.Object implements FlowExecutionContext
FlowExecutionContext
Constructor and Description |
---|
MockFlowExecutionContext()
Creates a new mock flow execution context -- automatically installs a root flow definition and active flow
session.
|
MockFlowExecutionContext(Flow flow)
Creates a new mock flow execution context for the specified root flow definition.
|
MockFlowExecutionContext(FlowSession flowSession)
Creates a new mock flow execution context for the specified active flow session.
|
Modifier and Type | Method and Description |
---|---|
FlowSession |
getActiveSession()
Returns the active flow session of this flow execution.
|
MutableAttributeMap |
getAttributeMap()
Returns the mutable execution attribute map.
|
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.
|
Flow |
getDefinitionInternal() |
MutableAttributeMap |
getFlashScope()
Returns a mutable map for data held in "flash scope".
|
FlowExecutionKey |
getKey()
Returns the key assigned to this flow execution.
|
MockFlowSession |
getMockActiveSession()
Returns the mock active flow session.
|
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 |
putAttribute(java.lang.String attributeName,
java.lang.Object attributeValue)
Puts a execution attribute into the context.
|
void |
setActiveSession(FlowSession activeSession)
Sets the mock session to be the active session.
|
void |
setConversationScope(MutableAttributeMap scope)
Sets the flow execution conversation scope.
|
void |
setFlashScope(MutableAttributeMap scope)
Sets the flow execution flash scope.
|
void |
setFlow(FlowDefinition rootFlow)
Sets the top-level flow definition.
|
void |
setKey(FlowExecutionKey key)
Sets the flow execution key
|
void |
setOutcome(FlowExecutionOutcome outcome)
Sets the result of this flow ending.
|
public MockFlowExecutionContext()
public MockFlowExecutionContext(Flow flow)
public MockFlowExecutionContext(FlowSession flowSession)
public FlowExecutionKey getKey()
FlowExecutionContext
getKey
in interface FlowExecutionContext
null
if a key has not yet been assigned.public java.lang.String getCaption()
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 FlowSession getActiveSession() throws java.lang.IllegalStateException
FlowExecutionContext
getActiveSession
in interface FlowExecutionContext
java.lang.IllegalStateException
- if this flow execution is not activeFlowExecutionContext.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 FlowExecutionOutcome getOutcome()
FlowExecutionContext
getOutcome
in interface FlowExecutionContext
null
if this execution has not yet endedpublic Flow getDefinitionInternal()
public void setFlow(FlowDefinition rootFlow)
public void setKey(FlowExecutionKey key)
public void setActiveSession(FlowSession activeSession)
public void setFlashScope(MutableAttributeMap scope)
public void setConversationScope(MutableAttributeMap scope)
public void setOutcome(FlowExecutionOutcome outcome)
outcome
- the ended outcomepublic MockFlowSession getMockActiveSession()
public MutableAttributeMap getAttributeMap()
public void putAttribute(java.lang.String attributeName, java.lang.Object attributeValue)
attributeName
- the attribute nameattributeValue
- the attribute value