Class DefaultYFormService
java.lang.Object
de.hybris.platform.xyformsservices.form.impl.DefaultYFormService
- All Implemented Interfaces:
YFormService
Implementation of the YFormService for managing yForms.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptioncreateOrUpdateYFormData(String applicationId, String formId, String formDataId, YFormDataTypeEnum type, String refId, String content) Create or Update YFormDataModel.createYFormData(String applicationId, String formId, String formDataId, YFormDataTypeEnum type, String refId, String content) Create YFormData if no previous exists.createYFormData(String applicationId, String formId, String formDataId, YFormDataTypeEnum type, String refId, String content, String ownerApplicationId, String ownerFormId) Create YFormData if no previous exists.createYFormData(String applicationId, String formId, String formDataId, YFormDataTypeEnum type, String refId, String content, String ownerApplicationId, String ownerFormId, boolean system) Create YFormData if no previous exists.createYFormDefinition(String applicationId, String formId, String title, String description, String content, String documentId) Create a new YFormDefinition by the given parameters.protected GetVersionNumberStrategyprotected ModelServiceprotected YFormDaogetYFormData(String formDataId, YFormDataTypeEnum type) For a given id and type a form data is returned.getYFormData(String applicationId, String formId, String refId, YFormDataTypeEnum type) For the given parameters a YFormDataModel is returned.getYFormDataByRefId(String refId) For the given refId a list of YFormDataModel is returned.getYFormDefinition(String applicationId, String formId) For a given applicationId and formId a form definition is returned.getYFormDefinition(String applicationId, String formId, int version) For a given applicationId and formId a form definition is returned.voidsetFormDefinitionStatus(String applicationId, String formId, YFormDefinitionStatusEnum status) Set the status for all the form definitions with specific application id and form id.voidsetGetVersionNumberStrategy(GetVersionNumberStrategy getVersionNumberStrategy) voidsetModelService(ModelService modelService) voidsetYFormDao(YFormDao yformDao) updateYFormData(String formDataId, YFormDataTypeEnum type, String content) Update YFormData by the given form data id.updateYFormData(String formDataId, YFormDataTypeEnum type, String content, String refId) Update YFormData by the given form data id.updateYFormDefinition(String applicationId, String formId, String content, String documentId) Update YFormDefinition if it exists in the database.
-
Constructor Details
-
DefaultYFormService
public DefaultYFormService()
-
-
Method Details
-
getYFormDefinition
public YFormDefinitionModel getYFormDefinition(String applicationId, String formId) throws YFormServiceException For a given applicationId and formId a form definition is returned.- Specified by:
getYFormDefinitionin interfaceYFormService- Parameters:
applicationId-formId-- Returns:
- YFormDefinitionModel
- Throws:
YFormServiceException- if definition is not found
-
getYFormDefinition
public YFormDefinitionModel getYFormDefinition(String applicationId, String formId, int version) throws YFormServiceException For a given applicationId and formId a form definition is returned.- Specified by:
getYFormDefinitionin interfaceYFormService- Parameters:
applicationId-formId-version-- Returns:
- YFormDefinitionModel
- Throws:
YFormServiceException- if definition is not found
-
updateYFormDefinition
public YFormDefinitionModel updateYFormDefinition(String applicationId, String formId, String content, String documentId) throws YFormServiceException Update YFormDefinition if it exists in the database.
Catch AmbiguousIdentifierException and throws YFormServiceException with corresponding error messages on retrieval from the DAO.- Specified by:
updateYFormDefinitionin interfaceYFormService- Parameters:
applicationId-formId-content-documentId-- Returns:
- YFormDefinitionModel
- Throws:
ModelNotFoundExceptionYFormServiceException
-
createYFormDefinition
@Transactional(propagation=REQUIRED) public YFormDefinitionModel createYFormDefinition(String applicationId, String formId, String title, String description, String content, String documentId) throws YFormServiceException Create a new YFormDefinition by the given parameters.- Specified by:
createYFormDefinitionin interfaceYFormService- Parameters:
applicationId-formId-title-description-content-documentId-- Returns:
- YFormDefinitionModel
- Throws:
YFormServiceException
-
getYFormData
public YFormDataModel getYFormData(String formDataId, YFormDataTypeEnum type) throws YFormServiceException For a given id and type a form data is returned.- Specified by:
getYFormDatain interfaceYFormService- Parameters:
formDataId-type-- Returns:
- YFormDataModel
- Throws:
YFormServiceException- if form data is not found
-
getYFormData
public YFormDataModel getYFormData(String applicationId, String formId, String refId, YFormDataTypeEnum type) throws YFormServiceException For the given parameters a YFormDataModel is returned.- Specified by:
getYFormDatain interfaceYFormService- Parameters:
applicationId-formId-refId-type-- Returns:
- YFormDataModel
- Throws:
YFormServiceException
-
createOrUpdateYFormData
@Transactional(propagation=REQUIRED) public YFormDataModel createOrUpdateYFormData(String applicationId, String formId, String formDataId, YFormDataTypeEnum type, String refId, String content) throws YFormServiceException Create or Update YFormDataModel.- Specified by:
createOrUpdateYFormDatain interfaceYFormService- Parameters:
applicationId-formId-formDataId-type-refId-content-- Returns:
- YFormDataModel
- Throws:
YFormServiceException- if form data cannot be created or updated
-
updateYFormData
public YFormDataModel updateYFormData(String formDataId, YFormDataTypeEnum type, String content) throws YFormServiceException Update YFormData by the given form data id.- Specified by:
updateYFormDatain interfaceYFormService- Parameters:
formDataId-type-content-- Returns:
- YFormDataModel
- Throws:
ModelNotFoundExceptionYFormServiceException
-
updateYFormData
public YFormDataModel updateYFormData(String formDataId, YFormDataTypeEnum type, String content, String refId) throws YFormServiceException Update YFormData by the given form data id.- Parameters:
formDataId- form data identifiertype- type of the form (DATA, DRAFT)content- form contentrefId- reference id of the form- Returns:
- YFormDataModel
- Throws:
ModelNotFoundException- throws exception if not foundYFormServiceException- throws exception if error during saving
-
createYFormData
public YFormDataModel createYFormData(String applicationId, String formId, String formDataId, YFormDataTypeEnum type, String refId, String content) throws YFormServiceException Create YFormData if no previous exists.
It also assigns it to the corresponding YFormDefinition.- Specified by:
createYFormDatain interfaceYFormService- Parameters:
applicationId-formId-formDataId-type-refId-content-- Returns:
- YFormDataModel
- Throws:
YFormServiceException- if form data cannot be created
-
createYFormData
public YFormDataModel createYFormData(String applicationId, String formId, String formDataId, YFormDataTypeEnum type, String refId, String content, String ownerApplicationId, String ownerFormId) throws YFormServiceException Create YFormData if no previous exists.
It also assigns it to the corresponding YFormDefinition.- Specified by:
createYFormDatain interfaceYFormService- Parameters:
applicationId-formId-formDataId-type-refId-content-ownerApplicationId-ownerFormId-- Returns:
- YFormDataModel
- Throws:
YFormServiceException- if form data cannot be created
-
createYFormData
public YFormDataModel createYFormData(String applicationId, String formId, String formDataId, YFormDataTypeEnum type, String refId, String content, String ownerApplicationId, String ownerFormId, boolean system) throws YFormServiceException Create YFormData if no previous exists.
It also assigns it to the corresponding YFormDefinition.- Specified by:
createYFormDatain interfaceYFormService- Parameters:
applicationId-formId-formDataId-type-refId-content-ownerApplicationId-ownerFormId-system-- Returns:
- YFormDataModel
- Throws:
YFormServiceException- if form data cannot be created
-
getYFormDataByRefId
For the given refId a list of YFormDataModel is returned.- Specified by:
getYFormDataByRefIdin interfaceYFormService- Parameters:
refId-- Returns:
- List
-
setFormDefinitionStatus
@Transactional(propagation=REQUIRED) public void setFormDefinitionStatus(String applicationId, String formId, YFormDefinitionStatusEnum status) Description copied from interface:YFormServiceSet the status for all the form definitions with specific application id and form id.- Specified by:
setFormDefinitionStatusin interfaceYFormService- Parameters:
applicationId- the application id of the form definitionformId- the form id of the form definitionstatus- the new status of the form definition
-
getModelService
-
setModelService
-
getYFormDao
-
setYFormDao
-
getGetVersionNumberStrategy
-
setGetVersionNumberStrategy
-