Interface FormEngineService


  • public interface FormEngineService
    The Form Engine Service contains all functionality for handling forms. It creates and updates the FormEngineSession and executes FormLogicComponents. Typically invoked from the FormHandlerServlet.
    • Method Detail

      • createFormEngineSession

        FormEngineSession createFormEngineSession​(BasicFormVersion formVersion)
        Creates a new FormEngineSession.
        Parameters:
        formVersion - the form version for which to create a FormEngineSession
        Returns:
        a new FormEngineSession
      • getSession

        FormEngineSession getSession​(String sessionIdentifier)
        Returns the session with the specified identifier.
        Parameters:
        sessionIdentifier - the identifier of the session to lookup
        Returns:
        the session with the specified identifier or null if there was none
      • removeSession

        void removeSession​(FormEngineSession session)
        Terminates the specified session.
        Parameters:
        session - the session to invalidate
      • updateStepState

        boolean updateStepState​(FormEngineSession formSession,
                                FormValuesMap formValuesMap)
        Updates the form state with the specified values. This method expects to find a nl.gx.forms.wmpformapi.WCBConstants.FORM_STEPID_KEY in the formValuesMap in order to determine the step.
        Parameters:
        formSession - the form engine session to be updated
        formValuesMap - the map of values to use
        Returns:
        whether the updating was successfull or not. If this was not the case, further operations on form session should not be performed!
      • validateFragment

        FormScope validateFragment​(FormEngineSession formSession,
                                   String nestedPath)
                            throws FormManagerException
        Runs the validators for the form fragment with the specified nested path. This nested path should be relative to the form step.
        Parameters:
        formSession -
        nestedPath -
        Returns:
        the FormScope in which the fragment was found or null if it was not found at all
        Throws:
        FormManagerException - on error.
      • hasPreHandleFormLogic

        boolean hasPreHandleFormLogic​(BasicFormFragmentContainer container)
        Returns whether the specified FormFragmentContainer has prehandling form logic.
        Parameters:
        container - the container to check for whether it has prehandling form logic
        Returns:
        true if it has prehandling form logic, false otherwise
      • prepareFormFragmentContainer

        RoutingResult prepareFormFragmentContainer​(BasicFormFragmentContainer container,
                                                   FormScope scope)
                                            throws FormManagerException
        Prepares the form for rendering. It prefills the fragments where needed and runs the pre handling form logic if it exists for the specified form logic container. This is typically invoked for BasicFormSteps prior to rendering it.
        Parameters:
        container - the form fragment container (FormStep) to prepare
        scope - the parent scope of the container (e.g. the FormVersion scope for the BasicFormStep)
        Returns:
        an optional RoutingResult or null
        Throws:
        FormManagerException
      • prefill

        void prefill​(Object obj,
                     FormScope scope)
        Recursively prefills a FormFragment or a FormFragmentContainer. Prefilling is performed automatically during preparation of a form fragment container prior to prehandling. This method may be invoked by a prehandler in case it updates the scope in such a way that the result of prefilling expressions may be changed and these changed need to to take effect immediately.
        Parameters:
        obj - the fragment or container to prefill
        scope - the parent scope of the container or fragment
      • evaluateExpression

        boolean evaluateExpression​(String expression)
        Evaluates a Javascript expression and determines whether it is syntactically correct.
        Parameters:
        expression - The expression.
        Returns:
        true when the expression is valid Javascript code, false when not.
        Since:
        10.33.0
      • getRequestHelper

        FormEngineRequestHelper getRequestHelper​(javax.servlet.http.HttpServletRequest request)
        Returns the request helper which contains convenience methods for using the FormEngineSession in combination with a HttpRequest.
        Parameters:
        request - the request
        Returns:
        the FormEngineRequestHelper