Class SubmissionService

All Implemented Interfaces:
ISubmissionService

public class SubmissionService extends CayenneService implements ISubmissionService
Provides a submission service.
See Also:
  • Field Details

  • Constructor Details

    • SubmissionService

      public SubmissionService()
  • Method Details

    • getAuthenticationService

      public IAuthenticationService getAuthenticationService()
      Return authentication service instance.
      Returns:
      authentication service instance
    • setAuthenticationService

      public void setAuthenticationService(IAuthenticationService authenticationService)
      Set the authentication service.
      Parameters:
      authenticationService - the authentication service
    • isDataExtractsOnBackgroundSave

      public boolean isDataExtractsOnBackgroundSave()
      Returns:
      the dataExtractsOnBackgroundSave
    • setDataExtractsOnBackgroundSave

      public void setDataExtractsOnBackgroundSave(boolean dataExtractsOnBackgroundSave)
      Parameters:
      dataExtractsOnBackgroundSave - the dataExtractsOnBackgroundSave to set
    • isFormSavedProcessorOnBackgroundSave

      public boolean isFormSavedProcessorOnBackgroundSave()
      Returns:
      the formSavedProcessorOnBackgroundSave
    • setFormSavedProcessorOnBackgroundSave

      public void setFormSavedProcessorOnBackgroundSave(boolean formSavedProcessorOnBackgroundSave)
      Parameters:
      formSavedProcessorOnBackgroundSave - the formSavedProcessorOnBackgroundSave to set
    • saveSubmission

      @Deprecated public Submission saveSubmission(SubmissionDataBean submissionDataBean, jakarta.servlet.http.HttpServletRequest request, RequestLog requestLog)
      Deprecated.
      Create a Submission record and persists it into the database for the given submission document. Note that this method contains database transactions.
      Parameters:
      submissionDataBean - submission document
      request - http request
      requestLog - the request log record
      Returns:
      the created Submission record
    • saveSubmission

      public Submission saveSubmission(SubmissionDataBean submissionDataBean, jakarta.servlet.http.HttpServletRequest request, RequestLog requestLog, boolean isBackgroundSave)
      Create a Submission record and persists it into the database for the given submission document. Note that this method contains database transactions.
      Specified by:
      saveSubmission in interface ISubmissionService
      Parameters:
      submissionDataBean - submission document
      request - http request
      requestLog - the request log record
      isBackgroundSave - whether it is back ground save
      Returns:
      the created Submission record
      Since:
      3.6.4
      See Also:
    • prepareReturnToForm

      public void prepareReturnToForm(Submission submission, byte[] submissionXmlData, jakarta.servlet.http.HttpServletRequest request)
      Prepare a submission for a "Return to Form" operation. This will clear out attachments and reset the payment status. The form status will be set to "Saved".
      Parameters:
      submission - the submission (required, form status must not be Completed or Expired)
      submissionXmlData - the submission XML data to store (required)
      request - the user return to form request
      Since:
      4.0.0
    • updateSubmissionDeliveryProcessID

      public void updateSubmissionDeliveryProcessID(Submission submission)
      Deprecated.
      LiveCycle support has been removed
      Update the submission delivery process ID if not already set.
      Parameters:
      submission - the submission record
    • createAndInitialiseSubmission

      public Submission createAndInitialiseSubmission(Form form)
      Create and initialise a new submission object. This method should be used in place of invoking new Submission().
      Parameters:
      form - the submission form (required)
      Returns:
      a new submission object
    • createAndInitialiseSubmission

      public Submission createAndInitialiseSubmission(Form form, String receiptNumber, String trackingCode)
      Create and initialise a new submission object. This method should be used in place of invoking new Submission().
      Parameters:
      form - the submission form (required)
      receiptNumber - the receipt number to use (optional; only set if the receipt number of a previous submission that no longer exists shall be reused)
      trackingCode - (optional; only set if the tracking code of a previous submission that no longer exists shall be reused)
      Returns:
      a new submission object
      Since:
      4.1.0
    • createAndInitialiseSubmission

      public Submission createAndInitialiseSubmission(Form form, String receiptNumber, String trackingCode, jakarta.servlet.http.HttpServletRequest request)
      Create and initialise a new submission object. This method should be used in place of invoking new Submission().
      Parameters:
      form - the submission form (required)
      receiptNumber - the receipt number to use (optional; only set if the receipt number of a previous submission that no longer exists shall be reused)
      trackingCode - (optional; only set if the tracking code of a previous submission that no longer exists shall be reused)
      request - request
      Returns:
      a new submission object
      Since:
      23.10.0
    • getPendingPaymentLog

      public PaymentLog getPendingPaymentLog(Submission submission, String serviceCode)
      Returns the most recent payment log that is pending for the given submission and payment service code
      Parameters:
      submission - the submission (required)
      serviceCode - the payment service code (required)
      Returns:
      the most recent incomplete payment for this submission and payment service code, if one exists
    • updatePaymentTypeForService

      public boolean updatePaymentTypeForService(Submission submission)
      Looks up the payment service for the submission's client and updates the payment type if necessary. This can happen if the form was rendered when a credit card service was configured, but at payment type this has changed to a hosted service or vice versa. This method performs a database commit.
      Parameters:
      submission - the non-null submission with payments outstanding (required)
      Returns:
      true if a change to the payment type was made
    • initializeOpenedSubmission

      public Submission initializeOpenedSubmission(Form form, jakarta.servlet.http.HttpServletRequest request, RequestLog requestLog, Document document, Submission submission)
      Initializes an open submission record ready for filling out. This method will create a new submission record if required.
      Parameters:
      form - the form (required)
      request - the servlet request (required)
      requestLog - the request log (required)
      document - the form XML data (required)
      submission - the assigned task submission, if one already exists (optional)
      Returns:
      the submission
      Since:
      4.0.0
    • createSubmissionHistory

      public SubmissionHistory createSubmissionHistory(Submission submission, jakarta.servlet.http.HttpServletRequest request, RequestLog requestLog, boolean isBackgroundSave)
      Create a new submission history record. Please note this method will does not commit changes.
      Parameters:
      submission - the form submission (required)
      request - the servlet request (required)
      requestLog - the requestLog (required)
      isBackgroundSave - whether the submission history is a background save
      Returns:
      the new submission history object
      Since:
      4.3.3
    • createSubmissionHistory

      public SubmissionHistory createSubmissionHistory(Submission submission, jakarta.servlet.http.HttpServletRequest request, Date requestTime, boolean isBackgroundSave)
      Create a new submission history record. Please note this method will does not commit changes. Note: This method assumes that the submission history is not a background save. If you need to store a background save request, please use
      invalid @link
      {@link this#createSubmissionHistory(Submission, HttpServletRequest, RequestLog, boolean)
      }.
      Parameters:
      submission - the form submission (required)
      request - the servlet request (required)
      requestTime - the request time (required)
      isBackgroundSave - whether the submission history is a background save
      Returns:
      the new submission history object
      Since:
      5.0.0
    • createSubmissionHistory

      public SubmissionHistory createSubmissionHistory(Submission submission, jakarta.servlet.http.HttpServletRequest request, Date requestTime)
      Create a new submission history record. Please note this method will does not commit changes. Note: This method assumes that the submission history is not a background save. If you need to store a background save request, please use
      invalid @link
      {@link this#createSubmissionHistory(Submission, HttpServletRequest, RequestLog, boolean)
      }.
      Parameters:
      submission - the form submission (required)
      request - the servlet request (required)
      requestTime - the request time (required)
      Returns:
      the new submission history object
      Since:
      3.6.1
    • populateSubmissionExtractData

      public void populateSubmissionExtractData(Document document, Submission submission, SchemaSeed schemaSeed)
      Populate submission XML data extract values.
      Parameters:
      document - the submission data (required)
      submission - the submission record (required)
      schemaSeed - the configuration schema seed (required)
    • populateSubmissionExtractData

      public void populateSubmissionExtractData(Document document, Submission submission, SchemaSeedVO schemaSeed)
      Populate submission XML data extract values.
      Parameters:
      document - the submission data (required)
      submission - the submission record (required)
      schemaSeed - the configuration schema seed VO (required)
      Since:
      5.1.0
    • expireTaskSubmission

      public void expireTaskSubmission(Submission submission) throws ApplicationException
      Expires the given task submission and calls the expiry REST endpoint, if defined.
      Parameters:
      submission - the task submission (required)
      Throws:
      ApplicationException - if the submission is already expired or completed, or if an error occurred when calling the REST endpoint
      Since:
      4.0.0
    • retryRESTSubmissionDelivery

      public boolean retryRESTSubmissionDelivery(Submission submission)
      Reset the 'In Progress' delivery to 'Ready' to enable REST Service delivery queue retry.
      Parameters:
      submission - the submission to reset
      Returns:
      true if the submission delivery status was set to 'Ready' or false otherwise
      Since:
      4.1.8
    • setTaskAssigneeGroup

      public void setTaskAssigneeGroup(Submission submission, Group group)
      Update the assignee group for a task submission. Existing submission groups will be deleted. This method does NOT perform a database commit.
      Parameters:
      submission - the submission (required)
      group - the new assignee group (required)
      Since:
      4.0.0
    • copyFormAttachments

      public void copyFormAttachments(Submission sourceSubmission, Submission targetSubmission, Document targetXmlDoc)
      Copy the attachments of the source submission to the target submission and its form XML document.
      Parameters:
      sourceSubmission - the source submission (required)
      targetSubmission - the target submission (required)
      targetXmlDoc - the target Form XML document (optional)
      Since:
      4.1.0
    • pruneOrphanedInFormAttachments

      public void pruneOrphanedInFormAttachments(Document document, Submission submission, jakarta.servlet.http.HttpServletRequest request)
      Prune orphaned In-Form attachments from the submission record based on the form XML document.
      Parameters:
      document - the document containing current submission XML data (required)
      submission - the submission (required, must use in-form attachments and not be on T.Field)
      request - the servlet request (required)
      Since:
      4.3.1
    • setSubmissionExpiryTime

      protected void setSubmissionExpiryTime(Submission submission, Document document)
      Set the submission expiry time based on the associated form configuration.
      Parameters:
      submission - the submission record to determine the maximum submission time of (required)
      document - the submission XML document (required)
      Since:
      4.2.0
    • resumeAbandonedForm

      public void resumeAbandonedForm(Submission submission)
      Resume the abandoned 'Open' or 'Form Start' submission.
      Parameters:
      submission - the submission to resume
      Since:
      4.3.3
    • saveSubmissionUnmanaged

      protected Submission saveSubmissionUnmanaged(UserAccount userAccount, SubmissionDataBean submissionDataBean, jakarta.servlet.http.HttpServletRequest request, RequestLog requestLog, boolean isBackgroundSave)
      Create a submission record Save a submission record without committing the database transaction.
      Parameters:
      userAccount - the associated user account
      submissionDataBean - the submission data bean
      request - the servlet request
      requestLog - the associated request log record
      isBackgroundSave - whether it's background save
      Returns:
      the new submission record
    • setFormStarted

      public void setFormStarted(RequestLog requestLog)
      Set the form started flag based on the request log (to avoid contention on the submission log). This method performs a database commit.
      Parameters:
      requestLog - the request log (required)
      Since:
      4.3.4
    • addServiceLog

      public void addServiceLog(Submission submission, String serviceName, String serviceInfo, String serviceUrl)
      Record service usage for a submission. This method performs a database commit.
      Parameters:
      submission - the submission for which a service was invoked (required)
      serviceName - the service name (required)
      serviceInfo - additional information (optional; up to 200 characters)
      serviceUrl - the URL associated with the service (optional; up to 200 characters)
      Since:
      4.3.4
    • initiateEmailVerification

      public void initiateEmailVerification(Document document, Submission submission, Form form, SchemaSeedVO schemaSeed, jakarta.servlet.http.HttpServletRequest request)
      Initiate submission email verification if configured
      Parameters:
      document - the form XML document (required)
      submission - the submission (required)
      form - the form associated with the submission (required)
      schemaSeed - the schema seed associated with the form (optional)
      request - the submission request (optional)