Package com.avoka.fc.core.service
Class FormDataService
java.lang.Object
com.avoka.fc.core.service.BaseService
com.avoka.fc.core.service.CayenneService
com.avoka.fc.core.service.FormDataService
Provides a service to create the form XML model to render with the form.
-
Field Summary
Modifier and TypeFieldDescriptionstatic final String
Provides an empty schema seed fileprotected ErrorLogService
static final String
The Spring configuration bean name. -
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionapplyFormPrefillService
(ServiceDefinition formPrefillSD, Document document, jakarta.servlet.http.HttpServletRequest request, Form form, TemplateVersion templateVersion, Submission submission) Apply the form prefill service to the submission document.applyPrefillXmlMappings
(Document seedDocument, String xmlPrefillData, SchemaSeed schemaSeed) Apply the given XML prefill data to the seed document and return the result.Return the authentication service (Spring-injected)Return the GroovyServiceLog record which may optionally be created after running a form prefill service.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.boolean
populateInsightsProfile
(jakarta.servlet.http.HttpServletRequest request, Submission submission, Document document) Populate the Insights system profile information.populateSeedXml
(Form form, jakarta.servlet.http.HttpServletRequest request, String xmlPrefillData, boolean userAccountPrefill, TemplateVersion templateVersion, RequestLog requestLog, String referer, Submission submission) Return a populated form seed XML document, populated with the form specific attachments, client properties, user properties and system properties.populateSeedXmlDoc
(Form form, jakarta.servlet.http.HttpServletRequest request, String xmlPrefillData, boolean userAccountPrefill, TemplateVersion version, RequestLog requestLog, String referer, Submission submission) Return a populated form seed XML document, populated with the form specific attachments, client properties, user properties and system properties.populateSeedXmlFromSeed
(Form form, jakarta.servlet.http.HttpServletRequest request, String seedFileString, boolean userAccountPrefill, TemplateVersion templateVersion, RequestLog requestLog, String referer, Submission submission) 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.populateSeedXmlFromSeedDoc
(Form form, jakarta.servlet.http.HttpServletRequest request, String seedFileString, boolean userAccountPrefill, TemplateVersion version, RequestLog requestLog, String referer, Submission submission) 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.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.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.void
populateVersionAttachments
(Document seedDocument, Form form, TemplateVersion templateVersion, SchemaSeed schemaSeed) Populate the form seed document with the form version attachments.void
populateVersionPropertyValues
(Document seedDocument, Form form, TemplateVersion templateVersion, SchemaSeed schemaSeed) Populate the form seed document with the form version property value.void
setAuthenticationService
(IAuthenticationService authenticationService) Set the authentication serviceupdateSavedFormSystemProfile
(jakarta.servlet.http.HttpServletRequest request, Submission submission, Document document) Update the system profile for a saved form.updateSavedFormSystemProfile
(jakarta.servlet.http.HttpServletRequest request, Submission submission, Document document, RequestLog requestLog) Update the system profile for a saved form.Methods inherited from class com.avoka.fc.core.service.CayenneService
commitChanges, deleteObject, deleteObjects, findObject, getDataContext, getDataDomain, getObjectForPK, getObjectStore, newObject, performNamedQuery, performNamedQuery, performNamedQuery, performNonSelectingQuery, performNonSelectingQuery, performNonSelectingQuery, performNonSelectingQuery, performQuery, performQuery, refetchEntity, refetchObject, registerNewObject, rollbackChanges, toMap, toMap
Methods inherited from class com.avoka.fc.core.service.BaseService
getLogger
-
Field Details
-
SPRING_BEAN_NAME
The Spring configuration bean name.- See Also:
-
EMPTY_SEED
Provides an empty schema seed file- See Also:
-
errorLogService
-
-
Constructor Details
-
FormDataService
public FormDataService()
-
-
Method Details
-
getAuthenticationService
Return the authentication service (Spring-injected)- Returns:
- the authentication service
-
setAuthenticationService
Set the authentication service- Parameters:
authenticationService
- the new authentication service
-
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 requestxmlPrefillData
- xml prefill datauserAccountPrefill
- whether user account prefill is neededtemplateVersion
- the template versionrequestLog
- request log (required)referer
- the referersubmission
- 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 requestxmlPrefillData
- xml prefill datauserAccountPrefill
- whether user account prefill is neededversion
- the template versionrequestLog
- request log (required)referer
- the referersubmission
- 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 instancerequest
- http requestseedFileString
- schema seed xml stringuserAccountPrefill
- whether user account prefill is neededtemplateVersion
- the template versionrequestLog
- request logreferer
- the referrersubmission
- 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 instancerequest
- http requestseedFileString
- schema seed xml stringuserAccountPrefill
- whether user account prefill is neededversion
- the template versionrequestLog
- request logreferer
- the referrersubmission
- 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 documentform
- the formtemplateVersion
- the form template versionschemaSeed
- 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 requestsubmission
- the submission recorddocument
- 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 requestsubmission
- the submission recorddocument
- the form XML datarequestLog
- 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 requestdocument
- the XML form data documentsubmission
- 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 documentform
- the formtemplateVersion
- the form template versionschemaSeed
- 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.
-