Class FlowEngine

java.lang.Object
com.aquima.interactions.flow.model.FlowEngine
All Implemented Interfaces:
IFlowEngine

public class FlowEngine extends Object implements 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 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

      public FlowCrawler getFlowCrawler(InferenceContext profile)
      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 interface IFlowEngine
      Parameters:
      profile - instance of InferenceContext, cannot be null
      Returns:
      instance of FlowCrawler
    • startFlow

      public IFlowState startFlow(String flowName, IFlowHandler handler, IDebugger debugger)
      Description copied from interface: IFlowEngine
      This method starts the flow indicated by the flow name with the specified flow handler.
      Specified by:
      startFlow in interface IFlowEngine
      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 interface IFlowEngine
      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 interface IFlowEngine
      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

      public IFlowDetails[] getAvailableFlows()
      Description copied from interface: IFlowEngine
      This method returns an array containing all the available flows from the flow engine.
      Specified by:
      getAvailableFlows in interface IFlowEngine
      Returns:
      an array containing all the available flows from the flow engine.
    • getFlow

      public IFlowDetails getFlow(String flowName)
      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 interface IFlowEngine
      Parameters:
      flowName - The name of the flow for which the details are requested.
      Returns:
      The flow details for the specified flow name.
    • getFunctionFlowDefinition

      public IFunctionFlowDefinition getFunctionFlowDefinition(String flowName)
      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 interface IFlowEngine
      Parameters:
      flowName - The name of the flow
      Returns:
      Object containing the function flow definition
    • getExternalFlowDefinition

      public IExternalFlowDefinition getExternalFlowDefinition(String flowName)
      Description copied from interface: IFlowEngine
      Returns the definition of the external flow with the given name.
      Specified by:
      getExternalFlowDefinition in interface IFlowEngine
      Parameters:
      flowName - the name of the external flow
      Returns:
      the definition of the external flow
    • getDcmWidgetFlowDefinition

      public IDcmWidgetFlowDefinition getDcmWidgetFlowDefinition(String flowName)
      Description copied from interface: IFlowEngine
      Returns the definition of the DCM widget flow with the given name.
      Specified by:
      getDcmWidgetFlowDefinition in interface IFlowEngine
      Parameters:
      flowName - the name of the DCM widget flow
      Returns:
      the definition of the DCM widget flow
    • allowFlowingOnErrors

      public boolean allowFlowingOnErrors(IFlowState flowState)
      Description copied from interface: IFlowEngine
      Determines if flowing is allowed even if validation errors are present on current page
      Specified by:
      allowFlowingOnErrors in interface IFlowEngine
      Parameters:
      flowState - current flowState of this session
      Returns:
      boolean true if flowing can continue
    • getInternalFlow

      protected InternalFlow getInternalFlow(String name)
    • getInternalNode

      protected InternalNode getInternalNode(NodeID id)