Class Submission

java.lang.Object
formflow.library.data.Submission

@Entity @Component public class Submission extends Object
A class representing what a submission of the form flow looks like in the database.

This class also provides a few static functions to work with Submissions.

  • Constructor Details

    • Submission

      public Submission()
      Creates a new Submission with empty content
  • Method Details

    • getSubflowEntryByUuid

      public Map<String,Object> getSubflowEntryByUuid(String subflowName, String uuid)
      Provides access to a specific subflow's submission data for a particular UUID, if the subflow is present in the submission.

      If the subflow is present in the submission, this method will return the data matching the passed in UUID for that subflow.

      If the subflow is not present in the submission or the UUID is not present in a set of the subflow's data, null will be returned. TODO this will actually throw an exception, it seems, if the subflow is found, but the UUID is not in it - maybe that's okay?

      Parameters:
      subflowName - subflow of interest, not null
      uuid - the uuid of the data of interest in the subflow, not null
      Returns:
      the requested subflow's set of data for the uuid, null if subflow not present
    • mergeFormDataWithSubmissionData

      public void mergeFormDataWithSubmissionData(FormSubmission formSubmission)
      Merges the passed in data into the data stored in the Submission.

      The Submission will be updated with the merged data.

      Parameters:
      formSubmission - new data to be merged with data in the submission, may be empty but should not be null
    • mergeUrlParamsWithData

      public void mergeUrlParamsWithData(Map<String,String> queryParams)
      Merges the passed in query parameters into the Submission's urlParams Map
      Parameters:
      queryParams - the Map of query parameters to merge in
    • mergeFormDataWithSubflowIterationData

      public void mergeFormDataWithSubflowIterationData(String subflowName, Map<String,Object> iterationToUpdate, Map<String,Object> formDataSubmission)
      Merges the passed in subflow's iteration data into the Submission's subflow's data for that iteration.
      Parameters:
      subflowName - subflow that the iteration data belongs with, not null
      iterationToUpdate - existing data for a particular iteration of a subflow, may be empty, but not null
      formDataSubmission - new data for a particular iteration of a subflow, not null
    • removeIncompleteIterations

      public void removeIncompleteIterations(String subflowName, String currentUuid)
      Removes any data in an interation that has "iterationIsComplete" set to "false" and has a uuid not equal to the currentUuid provided.
      Parameters:
      subflowName - subflow that we are checking the iteration data for, not null
      currentUuid - The current uuid being worked on, not null. The data associated with this uuid will not be deleted.
    • clearAddressFields

      public void clearAddressFields(String inputName)
      Removes the data in the inputData pertaining to the inputName of the address passed in.
      Parameters:
      inputName - name of the address field to clear the data of
    • copySubmission

      public static Submission copySubmission(Submission origSubmission)
      Create a deep copy of the given submission.
      Parameters:
      origSubmission - given submission to copy
      Returns:
      deep copy of origSubmission
    • equals

      public boolean equals(Object o)
      Overrides:
      equals in class Object
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object