Interface YFormFacade
- All Known Implementing Classes:
DefaultYFormFacade
public interface YFormFacade
Form Facade to handle yForm definitions and yForm data.
-
Method Summary
Modifier and TypeMethodDescriptioncreateEmptyYFormData(String applicationId, String formId) Creates empty YFormData and assigns it to the corresponding YFormDefinition via orbeon background API.createOrUpdateYFormData(String applicationId, String formId, String formDataId, YFormDataTypeEnum type, String formDataContent) Create or Update YFormDataModel.createOrUpdateYFormData(String applicationId, String formId, String formDataId, YFormDataTypeEnum type, String refId, String formDataContent) Create or Update YFormDataModel.createYFormData(String applicationId, String formId, String formDataId, YFormDataTypeEnum type, String refId, String content) Creates YFormData if it doesn't exist and assigns it to the corresponding YFormDefinition.createYFormDefinition(String applicationId, String formId, String content, String documentId) Create a new YFormDefinition with specific parameters.getFormDataContent(String applicationId, String formId, String formDataId) Returns the content of form data with specific application id, form id and form data id.getFormDataContentTemplate(String applicationId, String formId) For a given application id and form id a form data content template (an empty form data via createEmptyYFormData) is returned.getInlineFormHtml(String applicationId, String formId) For a given application id and form id an inline form definition is returned.
The inline form definition can be injected in to a page instead of getting entire xform tagged betweengetInlineFormHtml(String applicationId, String formId, YFormDataActionEnum action, String formDataId) For a given application id, form id, form data id and action an inline form definition is returned.
The inline form definition can be injected in to a page instead of getting entire xform tagged betweengetInlineFormHtml(String applicationId, String formId, YFormDataActionEnum action, String formDataId, YFormPreprocessorStrategy strategy) For a given application id, form id, form data id, action and strategy an inline form definition is returned.
The inline form definition can be injected in to a page instead of getting entire xform tagged betweengetInlineFormHtml(String applicationId, String formId, YFormDataActionEnum action, String formDataId, YFormPreprocessorStrategy strategy, Map<String, Object> params) For a given application id, form id, form data id, action and strategy (plus parameters) an inline form definition is returned.
The inline form definition can be injected in to a page instead of getting entire xform tagged betweengetInlineFormHtml(String applicationId, String formId, String formDataId) For a given application id, form id and form data id an inline form definition is returned.
The inline form definition can be injected in to a page instead of getting entire xform tagged betweenGenerates a new form Data id.getYFormData(String formDataId) For a given id a form data is returned.getYFormData(String formDataId, YFormDataTypeEnum type) For a given id and type a form data is returned.getYFormData(String applicationId, String formId, String refId) For the given application id, form id and reference id a form data is returned.getYFormData(String applicationId, String formId, String refId, YFormDataTypeEnum type) For the given application id, form id, reference id and form type a form data is returned.getYFormDefinition(String documentId) For a given document id a form definition is returned.getYFormDefinition(String applicationId, String formId) For a given application id and form id a form definition is returned.getYFormDefinition(String applicationId, String formId, int version) This method is available for testing purposes, to get the latest YFormDefinition use other method.recreateYFormDefinitionCounterpart(String applicationId, String formId, int version) Creates the form data counterpart form definition with specific application id, form id and version number.voidsetFormDefinitionStatus(String applicationId, String formId, YFormDefinitionStatusEnum status) Changes the state of a form definition.updateYFormData(String formDataId, YFormDataTypeEnum type, String content) Update YFormData content of form data with specific id and type.updateYFormDefinition(String applicationId, String formId, String content, String documentId) Update YFormDefinition if it exists in the database.booleanIndicates if the given Form Data is valid or not.
-
Method Details
-
getNewFormDataId
String getNewFormDataId()Generates a new form Data id.- Returns:
- generated form data id as string.
-
getYFormDefinition
YFormDefinitionData getYFormDefinition(String applicationId, String formId) throws YFormServiceException For a given application id and form id a form definition is returned.- Parameters:
applicationId- the application id to search form definition forformId- the form id to search form definition for- Returns:
- form definition with given form id and application id
- Throws:
YFormServiceException- if form definition cannot with specified parameters be resolved
-
getYFormDefinition
YFormDefinitionData getYFormDefinition(String applicationId, String formId, int version) throws YFormServiceException This method is available for testing purposes, to get the latest YFormDefinition use other method.- Parameters:
applicationId- the application id to search form definition forformId- the form id to search form definition forversion- form definition version- Returns:
- form definition with specific parameters
- Throws:
YFormServiceException- if form definition cannot with specified parameters be resolved
-
getYFormDefinition
For a given document id a form definition is returned.- Parameters:
documentId- the document id to search form definition for- Returns:
- form definition with given document id
- Throws:
YFormServiceException- if form definition cannot with specified parameters be resolved
-
createYFormDefinition
YFormDefinitionData createYFormDefinition(String applicationId, String formId, String content, String documentId) throws YFormServiceException Create a new YFormDefinition with specific parameters.- Parameters:
applicationId- the application id of the form definitionformId- the form id of the form definitioncontent- the content of the form definitiondocumentId- the document id of the form definition- Returns:
- created form definition POJO
- Throws:
YFormServiceException- if form definition cannot be created
-
updateYFormDefinition
YFormDefinitionData updateYFormDefinition(String applicationId, String formId, String content, String documentId) throws YFormServiceException Update YFormDefinition if it exists in the database.- Parameters:
applicationId- the application id of the form definitionformId- the form id of the form definitioncontent- the content of the form definitiondocumentId- the document id of the form definition- Returns:
- YFormDefinitionData updated form definition POJO
- Throws:
YFormServiceException- if form definition cannot be updated
-
getYFormData
For a given id a form data is returned. First the DRAFT version if there one, else the DATA version of it.- Parameters:
formDataId- the form data id to get data for- Returns:
- form data with given id
- Throws:
YFormServiceException- if form data cannot be found
-
getYFormData
For a given id and type a form data is returned.- Parameters:
formDataId- the form data id to get data fortype- the type of the form data- Returns:
- form data POJO with given id and type
- Throws:
YFormServiceException- if form data cannot be found
-
getYFormData
YFormDataData getYFormData(String applicationId, String formId, String refId, YFormDataTypeEnum type) throws YFormServiceException For the given application id, form id, reference id and form type a form data is returned.- Parameters:
applicationId- the application id of the form dataformId- the form id to get data forrefId- the reference idtype- the type of the form data- Returns:
- form data POJO with given application id, form id, reference id and type
- Throws:
YFormServiceException- if form data cannot be found
-
getYFormData
YFormDataData getYFormData(String applicationId, String formId, String refId) throws YFormServiceException For the given application id, form id and reference id a form data is returned.- Parameters:
applicationId- the application id of the form dataformId- the form id to get data forrefId- the reference id- Returns:
- form data POJO with given application id, form id and reference id
- Throws:
YFormServiceException- if form data cannot be found
-
createEmptyYFormData
Creates empty YFormData and assigns it to the corresponding YFormDefinition via orbeon background API.- Parameters:
applicationId- the application id of the form dataformId- the form id of the form data- Returns:
- new Id for YFormData
- Throws:
YFormServiceException- if form data cannot be created
-
createYFormData
YFormDataData createYFormData(String applicationId, String formId, String formDataId, YFormDataTypeEnum type, String refId, String content) throws YFormServiceException Creates YFormData if it doesn't exist and assigns it to the corresponding YFormDefinition.- Parameters:
applicationId- the application id of the form dataformId- the form id of the form dataformDataId- the form data id of the form datatype- the type of the form datarefId- the reference id of the form datacontent- the content of the form data- Returns:
- form data POJO with given parameters
- Throws:
YFormServiceException- if form data cannot be created
-
updateYFormData
YFormDataData updateYFormData(String formDataId, YFormDataTypeEnum type, String content) throws YFormServiceException Update YFormData content of form data with specific id and type.- Parameters:
formDataId- the id of the form datatype- the type of the form datacontent- new content of the form data- Returns:
- updated form data POJO
- Throws:
YFormServiceException- if form data cannot be updated
-
createOrUpdateYFormData
YFormDataData createOrUpdateYFormData(String applicationId, String formId, String formDataId, YFormDataTypeEnum type, String refId, String formDataContent) throws YFormServiceException Create or Update YFormDataModel.- Parameters:
applicationId- the application id of the form dataformId- the form id of the form dataformDataId- the form data id of the form datatype- the type of the form datarefId- the reference id of the form dataformDataContent- the content of the form data- Returns:
- created or updated form data POJO
- Throws:
YFormServiceException- if form data cannot be created or updated
-
createOrUpdateYFormData
YFormDataData createOrUpdateYFormData(String applicationId, String formId, String formDataId, YFormDataTypeEnum type, String formDataContent) throws YFormServiceException Create or Update YFormDataModel.- Parameters:
applicationId- the application id of the form dataformId- the form id of the form dataformDataId- the form data id of the form datatype- the type of the form dataformDataContent- the content of the form data- Returns:
- created or updated form data POJO
- Throws:
YFormServiceException- if form data cannot be created or updated
-
getInlineFormHtml
String getInlineFormHtml(String applicationId, String formId, String formDataId) throws YFormServiceException For a given application id, form id and form data id an inline form definition is returned.
The inline form definition can be injected in to a page instead of getting entire xform tagged between- Parameters:
applicationId- the application id of the definitionformId- the form id of the definitionformDataId- the form data id of the definition- Returns:
- the inline form definition as string
- Throws:
YFormServiceException- if inline definition cannot be returned
-
getInlineFormHtml
For a given application id and form id an inline form definition is returned.
The inline form definition can be injected in to a page instead of getting entire xform tagged between- Parameters:
applicationId- the application id of the definitionformId- the form id of the definition- Returns:
- the inline form definition as string
- Throws:
YFormServiceException- if inline definition cannot be returned
-
getInlineFormHtml
String getInlineFormHtml(String applicationId, String formId, YFormDataActionEnum action, String formDataId) throws YFormServiceException For a given application id, form id, form data id and action an inline form definition is returned.
The inline form definition can be injected in to a page instead of getting entire xform tagged between- Parameters:
applicationId- the application id of the definitionformId- the form id of the definitionaction- the action on the definitionformDataId- the form data id of the definition- Returns:
- the inline form definition as string
- Throws:
YFormServiceException- if inline definition cannot be returned
-
getInlineFormHtml
String getInlineFormHtml(String applicationId, String formId, YFormDataActionEnum action, String formDataId, YFormPreprocessorStrategy strategy) throws YFormServiceException For a given application id, form id, form data id, action and strategy an inline form definition is returned.
The inline form definition can be injected in to a page instead of getting entire xform tagged between- Parameters:
applicationId- the application id of the definitionformId- the form id of the definitionaction- the action on the definitionformDataId- the form data id of the definitionstrategy- form preprocessor strategy- Returns:
- the inline form definition as string
- Throws:
YFormServiceException- if inline definition cannot be returned
-
getInlineFormHtml
String getInlineFormHtml(String applicationId, String formId, YFormDataActionEnum action, String formDataId, YFormPreprocessorStrategy strategy, Map<String, Object> params) throws YFormServiceExceptionFor a given application id, form id, form data id, action and strategy (plus parameters) an inline form definition is returned.
The inline form definition can be injected in to a page instead of getting entire xform tagged between- Parameters:
applicationId- the application id of the definitionformId- the form id of the definitionaction- the action on the definitionformDataId- the form data id of the definitionstrategy- form preprocessor strategyparams- map with parameters for preprocessor strategy- Returns:
- the inline form definition as string
- Throws:
YFormServiceException- if inline definition cannot be returned
-
getFormDataContent
String getFormDataContent(String applicationId, String formId, String formDataId) throws YFormServiceException Returns the content of form data with specific application id, form id and form data id.- Parameters:
applicationId- the application id of the form dataformId- the form id of the form dataformDataId- the id of the form data- Returns:
- the content of form data
- Throws:
YFormServiceException- if form data was not found or its content is invalid
-
getFormDataContentTemplate
For a given application id and form id a form data content template (an empty form data via createEmptyYFormData) is returned.- Parameters:
applicationId- the application id of the form definitionformId- the form id of the form definition- Returns:
- form data content template for definition with specified parameters
- Throws:
YFormServiceException- if there is no YFormDefinition with given applicationId and formId or YFormDefinition has wrong content
-
recreateYFormDefinitionCounterpart
String recreateYFormDefinitionCounterpart(String applicationId, String formId, int version) throws YFormServiceException Creates the form data counterpart form definition with specific application id, form id and version number.- Parameters:
applicationId- the application id of the form definitionformId- the form id of the form definitionversion- the version number of the form definition- Returns:
- the form id of created form data
- Throws:
YFormServiceException- if form definition cannot be found or updated or form data cannot be created
-
setFormDefinitionStatus
void setFormDefinitionStatus(String applicationId, String formId, YFormDefinitionStatusEnum status) throws YFormServiceException Changes the state of a form definition. This will include all related versions.- Parameters:
applicationId- the application id of the form definitionformId- the form id of the form definitionstatus- new status of the form definition- Throws:
YFormServiceException- if form definition cannot be found or updated
-
validate
boolean validate(String applicationId, String formId, String formDataId) throws YFormServiceException Indicates if the given Form Data is valid or not.- Parameters:
applicationId- the application id of the form dataformId- the form id of the form dataformDataId- the id of the form data- Returns:
- true if form data is valid, false otherwise
- Throws:
YFormServiceException- if form data cannot be found
-