Class FormDataService


public class FormDataService extends CayenneService
Provides a service to create the form XML model to render with the form.
  • Field Details

  • Constructor Details

    • FormDataService

      public FormDataService()
  • Method Details

    • getAuthenticationService

      public IAuthenticationService getAuthenticationService()
      Return the authentication service (Spring-injected)
      Returns:
      the authentication service
    • setAuthenticationService

      public void setAuthenticationService(IAuthenticationService authenticationService)
      Set the authentication service
      Parameters:
      authenticationService - the new authentication service
    • getGroovyServiceLog

      public GroovyServiceLog getGroovyServiceLog()
      Return the GroovyServiceLog record which may optionally be created after running a form prefill service.
      Returns:
      the GroovyServiceLog record which may optionally be created after running a form prefill service.
      Since:
      4.2.0
    • populateSeedXml

      public String populateSeedXml(Form form, jakarta.servlet.http.HttpServletRequest request, String xmlPrefillData, boolean userAccountPrefill, TemplateVersion templateVersion, RequestLog requestLog, String referer, Submission submission) throws ApplicationException
      Return a populated form seed XML document, populated with the form specific attachments, client properties, user properties and system properties. Note that this method contains database transactions.
      Parameters:
      form - a form instance (required)
      request - http request
      xmlPrefillData - xml prefill data
      userAccountPrefill - whether user account prefill is needed
      templateVersion - the template version
      requestLog - request log (required)
      referer - the referer
      submission - the existing submission (relevant for tasks)
      Returns:
      a populated form seed XML document
      Throws:
      ApplicationException - if any error occurs
    • populateSeedXmlDoc

      public Document populateSeedXmlDoc(Form form, jakarta.servlet.http.HttpServletRequest request, String xmlPrefillData, boolean userAccountPrefill, TemplateVersion version, RequestLog requestLog, String referer, Submission submission) throws ApplicationException
      Return a populated form seed XML document, populated with the form specific attachments, client properties, user properties and system properties. Note that this method contains database transactions.
      Parameters:
      form - a form instance (required)
      request - http request
      xmlPrefillData - xml prefill data
      userAccountPrefill - whether user account prefill is needed
      version - the template version
      requestLog - request log (required)
      referer - the referer
      submission - the existing submission (relevant for tasks)
      Returns:
      a populated form seed XML document
      Throws:
      ApplicationException - if any error occurs
      Since:
      5.1.0
    • populateSeedXmlFromSeed

      public String populateSeedXmlFromSeed(Form form, jakarta.servlet.http.HttpServletRequest request, String seedFileString, boolean userAccountPrefill, TemplateVersion templateVersion, RequestLog requestLog, String referer, Submission submission) throws ApplicationException
      Return a populated form seed XML document, using the input seed XML and adding the system profile and user specific data Note that this method contains database transactions.
      Parameters:
      form - a form instance
      request - http request
      seedFileString - schema seed xml string
      userAccountPrefill - whether user account prefill is needed
      templateVersion - the template version
      requestLog - request log
      referer - the referrer
      submission - the underlying submission (relevant for tasks)
      Returns:
      a populated form seed XML document
      Throws:
      ApplicationException - if any error occurs
    • populateSeedXmlFromSeedDoc

      public Document populateSeedXmlFromSeedDoc(Form form, jakarta.servlet.http.HttpServletRequest request, String seedFileString, boolean userAccountPrefill, TemplateVersion version, RequestLog requestLog, String referer, Submission submission) throws ApplicationException
      Return a populated form seed XML document, using the input seed XML and adding the system profile and user specific data Note that this method contains database transactions.
      Parameters:
      form - a form instance
      request - http request
      seedFileString - schema seed xml string
      userAccountPrefill - whether user account prefill is needed
      version - the template version
      requestLog - request log
      referer - the referrer
      submission - the underlying submission (relevant for tasks)
      Returns:
      a populated form seed XML document
      Throws:
      ApplicationException - if any error occurs
      Since:
      5.1.0
    • populateVersionPropertyValues

      public void populateVersionPropertyValues(Document seedDocument, Form form, TemplateVersion templateVersion, SchemaSeed schemaSeed)
      Populate the form seed document with the form version property value.
      Parameters:
      seedDocument - the form XML seed document
      form - the form
      templateVersion - the form template version
      schemaSeed - the schema seed
    • applyPrefillXmlMappings

      public Document applyPrefillXmlMappings(Document seedDocument, String xmlPrefillData, SchemaSeed schemaSeed)
      Apply the given XML prefill data to the seed document and return the result. Note: If no prefill data is supplied, or the schema seed does not supply XML prefill mappings, the seed document is returned unchanged.
      Parameters:
      seedDocument - the seed document (required)
      xmlPrefillData - the XML prefill data (optional)
      schemaSeed - the schema seed (optional)
      Returns:
      the seed document augmented with XML prefill data, or the XML prefill string if no prefill mappings exist
      Since:
      4.0.0
    • updateSavedFormSystemProfile

      public String updateSavedFormSystemProfile(jakarta.servlet.http.HttpServletRequest request, Submission submission, Document document)
      Update the system profile for a saved form.
      Parameters:
      request - the servlet request
      submission - the submission record
      document - the form XML data
      Returns:
      the update form XML data
      Since:
      4.0.0
    • applyFormPrefillService

      public Document applyFormPrefillService(ServiceDefinition formPrefillSD, Document document, jakarta.servlet.http.HttpServletRequest request, Form form, TemplateVersion templateVersion, Submission submission)
      Apply the form prefill service to the submission document.
      Parameters:
      formPrefillSD - the form prefill service definition (required)
      document - the form XML document (required)
      request - the http request (optional)
      form - the form (required)
      templateVersion - the form version (required)
      submission - the submission object (optional)
      Returns:
      update form XML seed document
      Since:
      4.3.4.2
    • updateSavedFormSystemProfile

      public String updateSavedFormSystemProfile(jakarta.servlet.http.HttpServletRequest request, Submission submission, Document document, RequestLog requestLog)
      Update the system profile for a saved form.
      Parameters:
      request - the servlet request
      submission - the submission record
      document - the form XML data
      requestLog - the requestLog
      Returns:
      the update form XML data
      Since:
      4.3.4
    • populateSytemProfileJobs

      public boolean populateSytemProfileJobs(jakarta.servlet.http.HttpServletRequest request, Document document, Submission submission)
      Populate the SystemProfile Job elements, and return true if system profile job task steps were updated.
      Parameters:
      request - the form request
      document - the XML form data document
      submission - the submission record
      Returns:
      true if the system profile job step tasks were update or false otherwise
      Since:
      4.2.0
    • populateInsightsProfile

      public boolean populateInsightsProfile(jakarta.servlet.http.HttpServletRequest request, Submission submission, Document document)
      Populate the Insights system profile information.
      Parameters:
      request - the HTTP request (required)
      submission - the submission record (required)
      document - the XML form document (required)
      Returns:
      true if the Insights system profile was configured (or attempted to), or false otherwise
      Since:
      18.5.0
    • populateVersionAttachments

      public void populateVersionAttachments(Document seedDocument, Form form, TemplateVersion templateVersion, SchemaSeed schemaSeed)
      Populate the form seed document with the form version attachments.
      Parameters:
      seedDocument - the form XML seed document
      form - the form
      templateVersion - the form template version
      schemaSeed - the schema seed
      Since:
      3.6.5
    • populateDynamicData

      protected void populateDynamicData(Document seedDocument, Form form, jakarta.servlet.http.HttpServletRequest request, UserAccount userAccount, RequestLog requestLog, String referer, Submission submission, TemplateVersion templateVersion, SchemaSeedVO schemaSeed)
      Populate any Dynamic data into the seed document. This method can be overridden by sub classes to inject custom data into the seed file.
    • populateSystemProfile

      protected void populateSystemProfile(Document seedDocument, Form form, jakarta.servlet.http.HttpServletRequest request, UserAccount userAccount, RequestLog requestLog, String referer, Submission submission, TemplateVersion templateVersion)
      Populate the system profile information in the XML seed document.