Class FlowEngine
java.lang.Object
com.aquima.interactions.flow.model.FlowEngine
- All Implemented Interfaces:
IFlowEngine
Flow engine handles the evaluation of a flow and holds all information on available flows. This object is reentrant
after initialisation.
- Since:
- 7.0
- Author:
- F. van der Meer, O. Kerpershoek
-
Constructor Summary
ConstructorsConstructorDescriptionFlowEngine
(INodeDetailsFactory nodeFactory, IExpressionParser parser, IFlowEngineDS datasource) Constructs a flow engine with the specified factory, parser and datasource. -
Method Summary
Modifier and TypeMethodDescriptionboolean
allowFlowingOnErrors
(IFlowState flowState) Determines if flowing is allowed even if validation errors are present on current pagecontinueFlow
(IFlowState state, ExitEvent pageEvent, IFlowHandler handler, IDebugger debugger) This method will continue the flow from the point indicated by the flow state.This method returns an array containing all the available flows from the flow engine.getDcmWidgetFlowDefinition
(String flowName) Returns the definition of the DCM widget flow with the given name.getExternalFlowDefinition
(String flowName) Returns the definition of the external flow with the given name.This method returns a details object for the specified flow.getFlowCrawler
(InferenceContext profile) Creates an instance of a class that implements the visitor pattern to navigate the structure of the flowModel contained by this flow-enginegetFunctionFlowDefinition
(String flowName) This method will check if a function flow exists with the given name and return the related {IFunctionFlowDefinition
}protected InternalFlow
getInternalFlow
(String name) protected InternalNode
revertToFlow
(String flowName, IFlowState state, IFlowHandler handler, IDebugger debugger) Revert the flow state to the flow node specified by name and start this flow.startFlow
(String flowName, IFlowHandler handler, IDebugger debugger) This method starts the flow indicated by the flow name with the specified flow handler.
-
Constructor Details
-
FlowEngine
public FlowEngine(INodeDetailsFactory nodeFactory, IExpressionParser parser, IFlowEngineDS datasource) Constructs a flow engine with the specified factory, parser and datasource.- Parameters:
nodeFactory
- The node factory which will be used to create details for flow nodes.parser
- The expression parser which is used to parse expressions for condition nodes.datasource
- The data source for loading all flows.- Throws:
InitializationException
- When the flow engine could not be correctly initialized.
-
-
Method Details
-
getFlowCrawler
Description copied from interface:IFlowEngine
Creates an instance of a class that implements the visitor pattern to navigate the structure of the flowModel contained by this flow-engine- Specified by:
getFlowCrawler
in interfaceIFlowEngine
- Parameters:
profile
- instance of InferenceContext, cannot be null- Returns:
- instance of FlowCrawler
-
startFlow
Description copied from interface:IFlowEngine
This method starts the flow indicated by the flow name with the specified flow handler.- Specified by:
startFlow
in interfaceIFlowEngine
- Parameters:
flowName
- The name of the flow that should be started.handler
- The handler that should be used when processing the flow.debugger
- A debugger instance that is attached, may be null.- Returns:
- Object containing the path that was followed and the result node that was reached.
-
continueFlow
public IFlowState continueFlow(IFlowState state, ExitEvent pageEvent, IFlowHandler handler, IDebugger debugger) Description copied from interface:IFlowEngine
This method will continue the flow from the point indicated by the flow state.- Specified by:
continueFlow
in interfaceIFlowEngine
- Parameters:
state
- The previous flow state from which the flow should continue.pageEvent
- The exit state for the last result node, which determines the next action in the flow engine.handler
- The handler that should be used when processing the flow.debugger
- A debugger instance that is attached, may be null.- Returns:
- Object containing the path that was followed and the result node that was reached.
-
revertToFlow
public IFlowState revertToFlow(String flowName, IFlowState state, IFlowHandler handler, IDebugger debugger) Description copied from interface:IFlowEngine
Revert the flow state to the flow node specified by name and start this flow. Returns null is the node is not found in the flow state. All flow nodes that are passed during revert will call the onFlowAborted method of the handler.- Specified by:
revertToFlow
in interfaceIFlowEngine
- Parameters:
flowName
- The name of the flow that should be started.state
- The previous flow state.handler
- The handler that should be used when processing the flow.debugger
- A debugger instance that is attached, may be null.- Returns:
- Object containing the path that was followed and the result node that was reached.
-
getAvailableFlows
Description copied from interface:IFlowEngine
This method returns an array containing all the available flows from the flow engine.- Specified by:
getAvailableFlows
in interfaceIFlowEngine
- Returns:
- an array containing all the available flows from the flow engine.
-
getFlow
Description copied from interface:IFlowEngine
This method returns a details object for the specified flow. The name of the flow is not case sensitive.- Specified by:
getFlow
in interfaceIFlowEngine
- Parameters:
flowName
- The name of the flow for which the details are requested.- Returns:
- The flow details for the specified flow name.
-
getFunctionFlowDefinition
Description copied from interface:IFlowEngine
This method will check if a function flow exists with the given name and return the related {IFunctionFlowDefinition
}- Specified by:
getFunctionFlowDefinition
in interfaceIFlowEngine
- Parameters:
flowName
- The name of the flow- Returns:
- Object containing the function flow definition
-
getExternalFlowDefinition
Description copied from interface:IFlowEngine
Returns the definition of the external flow with the given name.- Specified by:
getExternalFlowDefinition
in interfaceIFlowEngine
- Parameters:
flowName
- the name of the external flow- Returns:
- the definition of the external flow
-
getDcmWidgetFlowDefinition
Description copied from interface:IFlowEngine
Returns the definition of the DCM widget flow with the given name.- Specified by:
getDcmWidgetFlowDefinition
in interfaceIFlowEngine
- Parameters:
flowName
- the name of the DCM widget flow- Returns:
- the definition of the DCM widget flow
-
allowFlowingOnErrors
Description copied from interface:IFlowEngine
Determines if flowing is allowed even if validation errors are present on current page- Specified by:
allowFlowingOnErrors
in interfaceIFlowEngine
- Parameters:
flowState
- current flowState of this session- Returns:
- boolean true if flowing can continue
-
getInternalFlow
-
getInternalNode
-