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
-
public class FormDataService extends CayenneService
Provides a service to create the form XML model to render with the form.
-
-
Field Summary
Fields Modifier and Type Field Description static String
EMPTY_SEED
Provides an empty schema seed fileprotected ErrorLogService
errorLogService
static String
SPRING_BEAN_NAME
The Spring configuration bean name.
-
Constructor Summary
Constructors Constructor Description FormDataService()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Document
applyFormPrefillService(ServiceDefinition formPrefillSD, Document document, HttpServletRequest request, Form form, TemplateVersion templateVersion, Submission submission)
Apply the form prefill service to the submission document.Document
applyPrefillXmlMappings(Document seedDocument, String xmlPrefillData, SchemaSeed schemaSeed)
Apply the given XML prefill data to the seed document and return the result.IAuthenticationService
getAuthenticationService()
Return the authentication service (Spring-injected)GroovyServiceLog
getGroovyServiceLog()
Return the GroovyServiceLog record which may optionally be created after running a form prefill service.protected void
populateDynamicData(Document seedDocument, Form form, HttpServletRequest request, UserAccount userAccount, RequestLog requestLog, String referer, Submission submission, TemplateVersion templateVersion, SchemaSeedVO schemaSeed)
Populate any Dynamic data into the seed document.boolean
populateInsightsProfile(HttpServletRequest request, Submission submission, Document document)
Populate the Insights system profile information.String
populateSeedXml(Form form, 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.Document
populateSeedXmlDoc(Form form, 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.String
populateSeedXmlFromSeed(Form form, 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.Document
populateSeedXmlFromSeedDoc(Form form, 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, HttpServletRequest request, UserAccount userAccount, RequestLog requestLog, String referer, Submission submission, TemplateVersion templateVersion)
Populate the system profile information in the XML seed document.boolean
populateSytemProfileJobs(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 serviceString
updateSavedFormSystemProfile(HttpServletRequest request, Submission submission, Document document)
Update the system profile for a saved form.String
updateSavedFormSystemProfile(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 Detail
-
SPRING_BEAN_NAME
public static final String SPRING_BEAN_NAME
The Spring configuration bean name.- See Also:
- Constant Field Values
-
EMPTY_SEED
public static final String EMPTY_SEED
Provides an empty schema seed file- See Also:
- Constant Field Values
-
errorLogService
protected ErrorLogService errorLogService
-
-
Method Detail
-
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, 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, 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, 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, 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(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, 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(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(HttpServletRequest request, Document document, Submission submission)
Populate the SystemProfile Job elements, and return true if system profile job task steps were updated.- Parameters:
submission
- the submission recorddocument
- the XML form data documentrequest
- the form request- Returns:
- true if the system profile job step tasks were update or false otherwise
- Since:
- 4.2.0
-
populateInsightsProfile
public boolean populateInsightsProfile(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, 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, HttpServletRequest request, UserAccount userAccount, RequestLog requestLog, String referer, Submission submission, TemplateVersion templateVersion)
Populate the system profile information in the XML seed document.
-
-