Class FlowStarter


  • @ConditionalOnSingleCandidate(FlowStarter.class)
    @Component
    public class FlowStarter
    extends Object
    This class is used to start an Aquima application by creating a session and starting a flow.

    This class can be subclassed when custom startup is preferred.

    Since:
    8.0
    Author:
    Danny Roest
    • Constructor Summary

      Constructors 
      Constructor Description
      FlowStarter​(com.blueriq.component.api.AquimaBeanProvider provider, SessionHeadersProperties sessionHeadersProperties)
      Constructs a new application starter.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      protected com.blueriq.component.api.IAquimaSession createSession​(com.blueriq.component.api.IProjectReference projectRequest, com.blueriq.component.api.security.IAuthorisationManager authorisationManager, com.blueriq.component.api.IAquimaSessionsMap sessionManager)
      This method creates an Aquima Session for the specified request.
      protected com.aquima.interactions.foundation.ApplicationID determineApplicationId​(com.blueriq.component.api.IProjectReference projectRequest)  
      protected String getFlowName​(com.blueriq.component.api.IProjectReference applicationRequest, com.blueriq.component.api.IAquimaSession aquimaSession)
      This method returns the flow name for the specified request.
      protected boolean isUseRequestParamsAsFlowParams()  
      void setUseRequestParamsAsFlowParams​(boolean useRequestParamsAsFlowParams)
      This method sets whether the additional request parameters should be used as flow parameters.
      protected void startFlow​(com.blueriq.component.api.IAquimaSession aquimaSession, String flowName, com.blueriq.component.api.IProjectReference request)
      This method starts the flow.
      com.blueriq.component.api.IAquimaSession startSession​(com.blueriq.component.api.IProjectReference projectRequest, com.blueriq.component.api.security.IAuthorisationManager authorisationManager, com.blueriq.component.api.IAquimaSessionsMap sessionManager)
      This method creates an AquimaSession and starts a flow based on the project request.
      com.blueriq.component.api.IAquimaSession startSession​(com.blueriq.component.api.IProjectReference projectRequest, com.blueriq.component.api.security.IAuthorisationManager authorisationManager, com.blueriq.component.api.IAquimaSessionsMap sessionManager, boolean handleUnauthorized)
      This method creates an AquimaSession and starts a flow based on the project request.
      protected Map<String,​String> toFlowParameters​(Map<String,​String[]> parameters)
      This method converts a request map to a flow request map.
    • Constructor Detail

      • FlowStarter

        @Autowired
        public FlowStarter​(com.blueriq.component.api.AquimaBeanProvider provider,
                           SessionHeadersProperties sessionHeadersProperties)
        Constructs a new application starter.
        Parameters:
        provider - the aquima engine provider
        sessionHeadersProperties - Session related properties
    • Method Detail

      • startSession

        public com.blueriq.component.api.IAquimaSession startSession​(com.blueriq.component.api.IProjectReference projectRequest,
                                                                     com.blueriq.component.api.security.IAuthorisationManager authorisationManager,
                                                                     com.blueriq.component.api.IAquimaSessionsMap sessionManager)
                                                              throws Exception
        This method creates an AquimaSession and starts a flow based on the project request.
        Parameters:
        projectRequest - The project to create at start.
        authorisationManager - The authentication manager.
        sessionManager - The session manager.
        Returns:
        The Aquima session when the session could be created and the flow started or null if the flow could not be started.
        Throws:
        Exception - When the session could not be created or the flow could not be started.
      • startSession

        public com.blueriq.component.api.IAquimaSession startSession​(com.blueriq.component.api.IProjectReference projectRequest,
                                                                     com.blueriq.component.api.security.IAuthorisationManager authorisationManager,
                                                                     com.blueriq.component.api.IAquimaSessionsMap sessionManager,
                                                                     boolean handleUnauthorized)
                                                              throws Exception,
                                                                     com.aquima.interactions.flow.exception.FlowAccessException
        This method creates an AquimaSession and starts a flow based on the project request.
        Parameters:
        projectRequest - The project to create at start.
        authorisationManager - The authentication manager.
        sessionManager - The session manager.
        handleUnauthorized - The flag that indicates if this method should handle user not authorized at this level.
        Returns:
        The Aquima session when the session could be created and the flow started or null if the flow could not be started.
        Throws:
        Exception - When the session could not be created or the flow could not be started.
        com.aquima.interactions.flow.exception.FlowAccessException - If the current user does not have access to start the flow.
      • createSession

        protected com.blueriq.component.api.IAquimaSession createSession​(com.blueriq.component.api.IProjectReference projectRequest,
                                                                         com.blueriq.component.api.security.IAuthorisationManager authorisationManager,
                                                                         com.blueriq.component.api.IAquimaSessionsMap sessionManager)
                                                                  throws com.aquima.interactions.portal.exception.PortalException,
                                                                         com.aquima.interactions.metamodel.exception.UnknownLanguageException,
                                                                         com.aquima.interactions.foundation.exception.AppException
        This method creates an Aquima Session for the specified request.
        Parameters:
        projectRequest - the application to create a session from
        authorisationManager - the authorisation manager
        sessionManager - the session manager
        Returns:
        an Aquima session if the session could be created
        Throws:
        com.aquima.interactions.portal.exception.PortalException - unexpected exception
        com.aquima.interactions.foundation.exception.AppException - unexpected exception
        com.aquima.interactions.metamodel.exception.UnknownLanguageException - unexpected exception
      • determineApplicationId

        protected com.aquima.interactions.foundation.ApplicationID determineApplicationId​(com.blueriq.component.api.IProjectReference projectRequest)
      • getFlowName

        protected String getFlowName​(com.blueriq.component.api.IProjectReference applicationRequest,
                                     com.blueriq.component.api.IAquimaSession aquimaSession)
        This method returns the flow name for the specified request. If the request has no flow specified the and the application has only one flow, this flow name is returned, else and exception is thrown.
        Parameters:
        applicationRequest - the application request
        aquimaSession - the session started by request
        Returns:
        the name of the flow
        Throws:
        IllegalArgumentException - when there are more than one flows and no flow is specified in the request
      • isUseRequestParamsAsFlowParams

        protected boolean isUseRequestParamsAsFlowParams()
      • setUseRequestParamsAsFlowParams

        public void setUseRequestParamsAsFlowParams​(boolean useRequestParamsAsFlowParams)
        This method sets whether the additional request parameters should be used as flow parameters. Default: true
        Parameters:
        useRequestParamsAsFlowParams - whether the additional request parameters
      • startFlow

        protected void startFlow​(com.blueriq.component.api.IAquimaSession aquimaSession,
                                 String flowName,
                                 com.blueriq.component.api.IProjectReference request)
                          throws com.aquima.interactions.foundation.exception.AppException
        This method starts the flow. This method can be overridden if custom flow starting is desired.
        Parameters:
        aquimaSession - the current session
        flowName - the name of the flow to start
        request - the request
        Throws:
        com.aquima.interactions.foundation.exception.AppException - when the flow could not be started
      • toFlowParameters

        protected Map<String,​String> toFlowParameters​(Map<String,​String[]> parameters)
        This method converts a request map to a flow request map. The string array is converted to string where the values are separated by a |
        Parameters:
        parameters - the application request
        Returns:
        a map with flow parameters