Class OrbeonFormController


  • @Controller
    @Scope("tenant")
    public class OrbeonFormController
    extends AbstractController
    OrbeonFormController Integration for Orbeon Persistence API Use for providing Create, Read, Update and delete services for integrated Orbeon functions. This will also handle Search and other Orbeon provided functions.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      java.lang.String getFormDataData​(java.lang.String applicationId, java.lang.String formId, java.lang.String formDataId, javax.servlet.http.HttpServletResponse response)
      Retrieves the DATA version of a form data.
      java.lang.String getFormDataDraft​(java.lang.String applicationId, java.lang.String formId, java.lang.String formDataId, javax.servlet.http.HttpServletResponse response)
      Retrieves the DRAFT version of a form data.
      java.lang.String getFormDefinition​(java.lang.String applicationId, java.lang.String formId, java.lang.String documentId, javax.servlet.http.HttpServletResponse response)
      Get yForm Definition.
      protected java.lang.String getSearchFormDefinitionBody​(java.lang.String applicationId, java.lang.String formId)  
      void handleAuthenticationCredentialsNotFoundException​(java.lang.Exception ex)  
      void putFormData​(java.lang.String applicationId, java.lang.String formId, java.lang.String formDataType, java.lang.String formDataId, javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response)
      Saves the amend form data back to the database.
      void putFormDefinition​(java.lang.String applicationId, java.lang.String formId, java.lang.String documentId, javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response)
      Put Form Definition.
      void searchFormData​(java.lang.String applicationId, java.lang.String formId, javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response)
      Search for form data, no actual implementation yet, only returns an empty xml, this to minimize error logs on the orbeon side.
      void searchFormDefinitions​(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response)
      Search for form definitions, no actual implementation yet, only returns an empty xml, this to minimize error logs on the orbeon side.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • LOG

        protected static final org.apache.log4j.Logger LOG
      • FR_SERVICE_RESOURCE_PREFIX

        protected static final java.lang.String FR_SERVICE_RESOURCE_PREFIX
        See Also:
        Constant Field Values
      • ORBEON_FORM_DEFINITION_VERSION

        protected static final java.lang.String ORBEON_FORM_DEFINITION_VERSION
        See Also:
        Constant Field Values
      • FORM_BUILDER_NEXT_VERSION

        protected static final java.lang.String FORM_BUILDER_NEXT_VERSION
        See Also:
        Constant Field Values
      • SEARCH_FORMDATA_EMPTY_SET

        protected static final java.lang.String SEARCH_FORMDATA_EMPTY_SET
        See Also:
        Constant Field Values
      • SEARCH_FORMDEFINITIONS_RESPONSE

        protected static final java.lang.String SEARCH_FORMDEFINITIONS_RESPONSE
        See Also:
        Constant Field Values
    • Constructor Detail

      • OrbeonFormController

        public OrbeonFormController()
    • Method Detail

      • getFormDefinition

        @RequestMapping(method=GET,
                        value="/fr/service/hybris/crud/{applicationId}/{formId}/form/form.xhtml",
                        produces="application/xhtml+xml; charset=utf-8")
        @ResponseBody
        @PreAuthorize("isAuthenticated()")
        public java.lang.String getFormDefinition​(@PathVariable
                                                  java.lang.String applicationId,
                                                  @PathVariable
                                                  java.lang.String formId,
                                                  @RequestParam(value="document",required=false)
                                                  java.lang.String documentId,
                                                  javax.servlet.http.HttpServletResponse response)
                                           throws javax.servlet.ServletException,
                                                  java.io.IOException,
                                                  YFormServiceException
        Get yForm Definition.
        On passing in the applicationId and the formId will return a form.xhtml for the Persistence service call. If documentId is provided then it will return the form definition associated to it. This is valid when dealing with a form definition that has multiple versions.
        Parameters:
        applicationId -
        formId -
        documentId -
        response -
        Throws:
        javax.servlet.ServletException
        java.io.IOException
        YFormServiceException
      • putFormDefinition

        @RequestMapping(method=PUT,
                        value="/fr/service/hybris/crud/{applicationId}/{formId}/form/form.xhtml")
        @PreAuthorize("isAuthenticated()")
        public void putFormDefinition​(@PathVariable
                                      java.lang.String applicationId,
                                      @PathVariable
                                      java.lang.String formId,
                                      @RequestParam(value="document",required=false)
                                      java.lang.String documentId,
                                      javax.servlet.http.HttpServletRequest request,
                                      javax.servlet.http.HttpServletResponse response)
                               throws javax.servlet.ServletException,
                                      java.io.IOException
        Put Form Definition.
        Publish at the FormBuilder will save the new form definition by calling this service function.
        Parameters:
        applicationId -
        formId -
        documentId -
        request -
        Throws:
        javax.servlet.ServletException
        java.io.IOException
      • getFormDataDraft

        @RequestMapping(method=GET,
                        value="/fr/service/hybris/crud/{applicationId}/{formId}/draft/{formDataId}/data.xml",
                        produces="application/xml;charset=UTF-8")
        @ResponseBody
        @PreAuthorize("isAuthenticated()")
        public java.lang.String getFormDataDraft​(@PathVariable
                                                 java.lang.String applicationId,
                                                 @PathVariable
                                                 java.lang.String formId,
                                                 @PathVariable
                                                 java.lang.String formDataId,
                                                 javax.servlet.http.HttpServletResponse response)
                                          throws javax.servlet.ServletException,
                                                 java.io.IOException,
                                                 YFormServiceException
        Retrieves the DRAFT version of a form data.
        Parameters:
        applicationId -
        formId -
        formDataId -
        response -
        Throws:
        javax.servlet.ServletException
        java.io.IOException
        YFormServiceException
      • getFormDataData

        @RequestMapping(method=GET,
                        value="/fr/service/hybris/crud/{applicationId}/{formId}/data/{formDataId}/data.xml",
                        produces="application/xml;charset=UTF-8")
        @ResponseBody
        @PreAuthorize("isAuthenticated()")
        public java.lang.String getFormDataData​(@PathVariable
                                                java.lang.String applicationId,
                                                @PathVariable
                                                java.lang.String formId,
                                                @PathVariable
                                                java.lang.String formDataId,
                                                javax.servlet.http.HttpServletResponse response)
                                         throws javax.servlet.ServletException,
                                                java.io.IOException,
                                                YFormServiceException
        Retrieves the DATA version of a form data.
        Parameters:
        applicationId -
        formId -
        formDataId -
        response -
        Throws:
        javax.servlet.ServletException
        java.io.IOException
        YFormServiceException
      • putFormData

        @RequestMapping(method=PUT,
                        value="/fr/service/hybris/crud/{applicationId}/{formId}/{formDataType:data|draft}/{formDataId}/data.xml")
        @PreAuthorize("isAuthenticated()")
        public void putFormData​(@PathVariable
                                java.lang.String applicationId,
                                @PathVariable
                                java.lang.String formId,
                                @PathVariable
                                java.lang.String formDataType,
                                @PathVariable
                                java.lang.String formDataId,
                                javax.servlet.http.HttpServletRequest request,
                                javax.servlet.http.HttpServletResponse response)
                         throws javax.servlet.ServletException,
                                java.io.IOException,
                                YFormServiceException
        Saves the amend form data back to the database. Creates a new YFormData if it does not exist previously.
        Parameters:
        applicationId -
        formId -
        formDataType -
        formDataId -
        request -
        response -
        Throws:
        javax.servlet.ServletException
        java.io.IOException
        YFormServiceException
      • searchFormData

        @RequestMapping(method=POST,
                        value="/fr/service/hybris/search/{applicationId}/{formId}")
        @PreAuthorize("isAuthenticated()")
        public void searchFormData​(@PathVariable
                                   java.lang.String applicationId,
                                   @PathVariable
                                   java.lang.String formId,
                                   javax.servlet.http.HttpServletRequest request,
                                   javax.servlet.http.HttpServletResponse response)
                            throws javax.servlet.ServletException,
                                   java.io.IOException,
                                   YFormServiceException
        Search for form data, no actual implementation yet, only returns an empty xml, this to minimize error logs on the orbeon side.

        This method is also called when versioning is enabled and the query is as follows:

        only 10 1 en

        When a draft record is found for this document a dialog is shown to the user to make a choice, whether to use the DRAFT record or the DATA one.

        In this implementation, an empty set is returned and the responsibility to deal with this scenario is for getFormDataData()

        Parameters:
        applicationId -
        formId -
        request -
        response -
        Throws:
        javax.servlet.ServletException
        java.io.IOException
        YFormServiceException
      • searchFormDefinitions

        @RequestMapping(method=GET,
                        value={"/fr/service/hybris/form","/fr/service/hybris/form/{applicationId}","/fr/service/hybris/form/{applicationId}/{formId}"})
        @PreAuthorize("isAuthenticated()")
        public void searchFormDefinitions​(javax.servlet.http.HttpServletRequest request,
                                          javax.servlet.http.HttpServletResponse response)
                                   throws javax.servlet.ServletException,
                                          java.io.IOException,
                                          YFormServiceException
        Search for form definitions, no actual implementation yet, only returns an empty xml, this to minimize error logs on the orbeon side.
        Parameters:
        request -
        response -
        Throws:
        javax.servlet.ServletException
        java.io.IOException
        YFormServiceException
      • handleAuthenticationCredentialsNotFoundException

        @ResponseStatus(UNAUTHORIZED)
        @ResponseBody
        @ExceptionHandler(org.springframework.security.authentication.AuthenticationCredentialsNotFoundException.class)
        public void handleAuthenticationCredentialsNotFoundException​(java.lang.Exception ex)