Package com.avoka.fc.core.util
Class SubmissionUtils
java.lang.Object
com.avoka.fc.core.util.SubmissionUtils
Provides submission related utility methods.
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionstatic void
addInlineReceiptToken
(jakarta.servlet.http.HttpSession session, Submission submission) Add a token to allow a user to access a receipt inline (as part of the submission process, notably via the confirmation page).static void
addOpenSavedFormToken
(jakarta.servlet.http.HttpSession session, Submission submission) Add a open saved form token.static void
addReceiptAccessToken
(jakarta.servlet.http.HttpSession session, Submission submission) Add a receipt access token.static void
addSessionChallengeJobKey
(jakarta.servlet.http.HttpSession session, Submission submission) Add a successful save challenge job key to the session.static void
addSessionChallengeSubmitKey
(jakarta.servlet.http.HttpSession session, Submission submission) Add a successful save challenge submit key to the session and any submission contact email address if defined.static String
calculateFormSubmitHash
(Document formXmlDoc) Calculate the submitted form data SHA-256 hash, excluding the //SystemProfile element.static boolean
containsSessionChallengeJobKey
(jakarta.servlet.http.HttpServletRequest request, Submission submission) Checks if the session contains a successful save challenge job key for the specified submissionstatic boolean
containsSessionChallengeSubmitKey
(jakarta.servlet.http.HttpServletRequest request, Submission submission) Checks if the request session contains a successful save challenge submit key for the specified submissionstatic String
generateSubmissionXmlMetadata
(Submission submission) Generate submission metadata in XML format describing the submission and attachments.static Map
<String, DataDocument> getDeliveryAttachmentsMap
(Submission submission, DeliveryDetails deliveryDetails, boolean deliveryAttachments) Return the submission delivery attachments map, keyed on attachment key.static String
getReceiptFilename
(Submission submission) Return the PDF receipt filename.static byte[]
getSubmissionDataExcel
(Submission submission) Return the Submission Data Extracts an Excel file byte array, or null if no extracts available.static Portal
getTaskPortal
(jakarta.servlet.http.HttpServletRequest request, Submission task) Return the portal for the associated request and task.static TemplateVersion
getTemplateVersion
(SubmissionDataBean submissionData) Gets the template version given the submission data bean.static String
getTransactionStatus
(Submission submission) Return a formatted transaction status text values, which summarizes the submission transaction status.static boolean
hasInlineReceiptAccessToken
(jakarta.servlet.http.HttpServletRequest request, Submission submission) Returns true if an inline receipt access token is present in the session for a given submission.static boolean
hasOpenSavedFormToken
(jakarta.servlet.http.HttpServletRequest request, Submission submission) Returns true if the open form token is present for a save challenge open form flow.static boolean
hasReceiptAccessToken
(jakarta.servlet.http.HttpServletRequest request, Submission submission) Returns true if a receipt access token is present in the session for a given submission.static boolean
hasSubmissionExpired
(Submission submission) Return true if the submission has expired.static boolean
isSubmissionTaskAvailble
(Submission submission, UserAccount userAccount, String contactEmailAddress) Return true if the submission is available to the current user account or contact email address.static void
logAttachmentEvent
(Submission submission, Attachment attachment, jakarta.servlet.http.HttpServletRequest request, String msg) Log the submission attachment event.static void
populateUserProfile
(Document document, Submission submission) Populates the user profile referenced in the submission with submission data, using the user profile mappings into the schema in reversestatic void
removeSaveChallengeTokens
(jakarta.servlet.http.HttpServletRequest request) Remove session save challenge tokens.static void
resolveAndSetDeliveryDetails
(Submission submission) Resolve and set the submission delivery details for the given submission if not a job submission.static DeliveryDetails
resolveDeliveryDetails
(Submission submission) Resolve the delivery details for the submission object.
-
Constructor Details
-
SubmissionUtils
public SubmissionUtils()
-
-
Method Details
-
calculateFormSubmitHash
Calculate the submitted form data SHA-256 hash, excluding the //SystemProfile element. Please note this method should not be used for calculating the delivery form XML data hash, but is use instead to avoid duplicated submission data records.- Parameters:
formXmlDoc
- the form XML doc (required)- Returns:
- the SHA-256 hash of the submitted form data (excluding //SystemProfile element)
- Since:
- 4.1.0
-
resolveAndSetDeliveryDetails
Resolve and set the submission delivery details for the given submission if not a job submission. If Form Version using new Form HTTP API, then register any delivery functions if required otherwise and use delivery details.- Parameters:
submission
- the form submission object- Since:
- 4.3.4
-
resolveDeliveryDetails
Resolve the delivery details for the submission object.- Parameters:
submission
- the form submission object- Returns:
- the resolved delivery details for the submission object
- Since:
- 4.0.0
-
populateUserProfile
Populates the user profile referenced in the submission with submission data, using the user profile mappings into the schema in reverse- Parameters:
document
- the submitted XMLsubmission
- the submission
-
getTemplateVersion
Gets the template version given the submission data bean.- Parameters:
submissionData
- the submission data bean- Returns:
- the template version
-
getReceiptFilename
Return the PDF receipt filename.- Parameters:
submission
- the form submission- Returns:
- the PDF receipt filename.
-
getDeliveryAttachmentsMap
public static Map<String,DataDocument> getDeliveryAttachmentsMap(Submission submission, DeliveryDetails deliveryDetails, boolean deliveryAttachments) Return the submission delivery attachments map, keyed on attachment key.- Parameters:
submission
- the submissiondeliveryDetails
- the submission delivery detailsdeliveryAttachments
- the delivery attachments flag- Returns:
- the submission attachments Map keyed on attachment key.
-
getSubmissionDataExcel
Return the Submission Data Extracts an Excel file byte array, or null if no extracts available.- Parameters:
submission
- the submission (required)- Returns:
- the Submission Data Extracts an Excel file byte array, or null if no extracts available
- Since:
- 4.0.0
-
generateSubmissionXmlMetadata
public static String generateSubmissionXmlMetadata(Submission submission) throws ParserConfigurationException Generate submission metadata in XML format describing the submission and attachments.- Parameters:
submission
- the submission (required)- Returns:
- the XML metadata as a String
- Throws:
ParserConfigurationException
- if the XML document builder cannot be obtained- Since:
- 4.1.0
-
getTransactionStatus
Return a formatted transaction status text values, which summarizes the submission transaction status.- Parameters:
submission
- the submission transaction (required)- Returns:
- a formatted transaction status text values, which summarizes the submission transaction status
- Since:
- 4.1.6
-
isSubmissionTaskAvailble
public static boolean isSubmissionTaskAvailble(Submission submission, UserAccount userAccount, String contactEmailAddress) Return true if the submission is available to the current user account or contact email address. If the submission form status is 'Abandoned' or 'Expired' this method will return false.- Parameters:
submission
- the submission to testuserAccount
- the user's accountcontactEmailAddress
- the users contact email address- Returns:
- true if the submission is available to the current user account or contact email address
- Since:
- 4.2.0
-
getTaskPortal
public static Portal getTaskPortal(jakarta.servlet.http.HttpServletRequest request, Submission task) Return the portal for the associated request and task.- Parameters:
request
- the server requesttask
- the task- Returns:
- the portal for the associated request and form
- Since:
- 4.2.0
-
addOpenSavedFormToken
public static void addOpenSavedFormToken(jakarta.servlet.http.HttpSession session, Submission submission) Add a open saved form token.- Parameters:
session
- the HTTP session (required)submission
- the submission (required)- Since:
- 4.3.3
-
addReceiptAccessToken
public static void addReceiptAccessToken(jakarta.servlet.http.HttpSession session, Submission submission) Add a receipt access token.- Parameters:
session
- the HTTP session (required)submission
- the submission (required)- Since:
- 5.1.0
-
addInlineReceiptToken
public static void addInlineReceiptToken(jakarta.servlet.http.HttpSession session, Submission submission) Add a token to allow a user to access a receipt inline (as part of the submission process, notably via the confirmation page). Access is still conditional onIFormSubmissionAccessController.getCompletedSubmissionAccessStatus(Submission, HttpServletRequest)
but some additional checks are not enforced.- Parameters:
session
- the HTTP session (required)submission
- the submission (required)- Since:
- 5.1.0
-
hasOpenSavedFormToken
public static boolean hasOpenSavedFormToken(jakarta.servlet.http.HttpServletRequest request, Submission submission) Returns true if the open form token is present for a save challenge open form flow. or if the submission has a job with a session job key.- Parameters:
request
- the form request (required)submission
- the submission to access (required)- Returns:
- true if the open form token is present for a save challenge open form flow. or if the submission has a job with a session job key.
- Since:
- 4.3.3
-
hasReceiptAccessToken
public static boolean hasReceiptAccessToken(jakarta.servlet.http.HttpServletRequest request, Submission submission) Returns true if a receipt access token is present in the session for a given submission. This method can be called multiple times. The token will stay present unless removed explicitly.- Parameters:
request
- the HTTP servlet request (required)submission
- the submission to access (required)- Returns:
- true if a receipt access token is present for the submission.
- Since:
- 5.1.0
-
hasInlineReceiptAccessToken
public static boolean hasInlineReceiptAccessToken(jakarta.servlet.http.HttpServletRequest request, Submission submission) Returns true if an inline receipt access token is present in the session for a given submission. Inline access is access as part of the submission process, e.g. from the confirmation page. This method can be called multiple times. The token will stay present unless removed explicitly.- Parameters:
request
- the HTTP servlet request (required)submission
- the submission to access (required)- Returns:
- true if an inline receipt access token is present for the submission.
- Since:
- 5.1.0
-
addSessionChallengeSubmitKey
public static void addSessionChallengeSubmitKey(jakarta.servlet.http.HttpSession session, Submission submission) Add a successful save challenge submit key to the session and any submission contact email address if defined.- Parameters:
session
- the HTTP session (required)submission
- the submission (required)- Since:
- 4.3.1
-
containsSessionChallengeSubmitKey
public static boolean containsSessionChallengeSubmitKey(jakarta.servlet.http.HttpServletRequest request, Submission submission) Checks if the request session contains a successful save challenge submit key for the specified submission- Parameters:
request
- the request (required)submission
- the submission (required)- Returns:
- true if the submit key is contained in the set of successful save challenges
- Since:
- 4.3.1
-
addSessionChallengeJobKey
public static void addSessionChallengeJobKey(jakarta.servlet.http.HttpSession session, Submission submission) Add a successful save challenge job key to the session.- Parameters:
session
- the HTTP session (required)submission
- the submission (required)- Since:
- 4.3.1
-
containsSessionChallengeJobKey
public static boolean containsSessionChallengeJobKey(jakarta.servlet.http.HttpServletRequest request, Submission submission) Checks if the session contains a successful save challenge job key for the specified submission- Parameters:
request
- the request (required)submission
- the submission (required)- Returns:
- true if the job key is contained in the set of successful save challenges
- Since:
- 4.3.1
-
logAttachmentEvent
public static void logAttachmentEvent(Submission submission, Attachment attachment, jakarta.servlet.http.HttpServletRequest request, String msg) Log the submission attachment event.- Parameters:
submission
- the submission (required)attachment
- the file attachment (required)request
- the servlet request (required)msg
- the message to log (required)- Since:
- 4.3.2
-
hasSubmissionExpired
Return true if the submission has expired.- Parameters:
submission
- the submission record (required)- Returns:
- true if the submission has expired
- Since:
- 4.3.2
-
removeSaveChallengeTokens
public static void removeSaveChallengeTokens(jakarta.servlet.http.HttpServletRequest request) Remove session save challenge tokens.- Parameters:
request
- the request (required)- Since:
- 5.0.0
-