Interface YFormService

All Known Implementing Classes:
DefaultYFormService

public interface YFormService
Implements methods for managing yForms.
  • Method Details

    • getYFormDefinition

      YFormDefinitionModel getYFormDefinition(String applicationId, String formId) throws YFormServiceException
      For a given applicationId and formId a form definition is returned.
      Parameters:
      applicationId - the application id of the form definition
      formId - the form id of the form definition
      Returns:
      form definition with the specific parameters
      Throws:
      YFormServiceException - if definition is not found
    • getYFormDefinition

      YFormDefinitionModel getYFormDefinition(String applicationId, String formId, int version) throws YFormServiceException
      Only for testing purposes, shouldn't be used to get the latest YFormDefinition
      Parameters:
      applicationId - the application id of the form definition
      formId - the form id of the form definition
      version - the version of the form definition
      Returns:
      form definition with the specific parameters
      Throws:
      YFormServiceException - if definition is not found
    • updateYFormDefinition

      YFormDefinitionModel 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 definition
      formId - the form id of the form definition
      content - the content of the form definition
      documentId - the document id of the form definition
      Returns:
      the updated form definition model
      Throws:
      YFormServiceException - if form definition cannot be saved
    • createYFormDefinition

      YFormDefinitionModel createYFormDefinition(String applicationId, String formId, String title, String description, String content, String documentId) throws YFormServiceException
      Create a new YFormDefinition with specific parameters.
      Parameters:
      applicationId - the application id of the form definition, should exist in a catalog
      formId - the form id of the form definition
      title - the tile of the form definition
      description - the description of the form definition
      content - the content of the form definition
      documentId - the document id of the form definition
      Returns:
      created form definition model
      Throws:
      YFormServiceException - if form definition cannot be created
    • getYFormData

      YFormDataModel getYFormData(String formDataId, YFormDataTypeEnum type) throws YFormServiceException
      Return form data model with specific id and type.
      Parameters:
      formDataId - the id of the form data
      type - the type of the form data
      Returns:
      form data model with specific parameters
      Throws:
      YFormServiceException - if form data is not found
    • createOrUpdateYFormData

      YFormDataModel createOrUpdateYFormData(String applicationId, String formId, String formDataId, YFormDataTypeEnum type, String refId, String content) throws YFormServiceException
      Create or Update YFormDataModel.
      Parameters:
      applicationId - the application id of the form data
      formId - the form id of the form data
      formDataId - the form data id of the form data
      type - the type of the form data
      refId - the reference id of the form data
      content - the content of the form data
      Returns:
      created or updated form data model
      Throws:
      YFormServiceException - if form data cannot be created or updated
    • updateYFormData

      YFormDataModel 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 data
      type - the type of the form data
      content - new content of the form data
      Returns:
      updated form data model
      Throws:
      YFormServiceException - if form data cannot be updated
    • createYFormData

      YFormDataModel 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 data
      formId - the form id of the form data
      formDataId - the form data id of the form data
      type - the type of the form data
      refId - the reference id of the form data
      content - the content of the form data
      Returns:
      created form data model with given parameters
      Throws:
      YFormServiceException - if form data cannot be created
    • createYFormData

      YFormDataModel createYFormData(String applicationId, String formId, String formDataId, YFormDataTypeEnum type, String refId, String content, String ownerApplicationId, String ownerFormId) throws YFormServiceException
      Creates YFormData if it doesn't exist already and assigns it to the corresponding YFormDefinition.
      Parameters:
      applicationId - the application id of the form data
      formId - the form id of the form data
      formDataId - the form data id of the form data
      type - the type of the form data
      refId - the reference id of the form data
      content - the content of the form data
      ownerApplicationId - the id of the owner application
      ownerFormId - the id of the owner form
      Returns:
      created form data model with given parameters
      Throws:
      YFormServiceException - if form data cannot be created
    • createYFormData

      YFormDataModel createYFormData(String applicationId, String formId, String formDataId, YFormDataTypeEnum type, String refId, String content, String ownerApplicationId, String ownerFormId, boolean system) throws YFormServiceException
      Creates YFormData if it doesn't exist already and assigns it to the corresponding YFormDefinition.
      Parameters:
      applicationId - the application id of the form data
      formId - the form id of the form data
      formDataId - the form data id of the form data
      type - the type of the form data
      refId - the reference id of the form data
      content - the content of the form data
      ownerApplicationId - the id of the owner application
      ownerFormId - the id of the owner form
      system - the system flag of the form data
      Returns:
      created form data model with given parameters
      Throws:
      YFormServiceException - if form data cannot be created
    • getYFormData

      YFormDataModel getYFormData(String applicationId, String formId, String refId, YFormDataTypeEnum type) throws YFormServiceException
      Return the form data model with the specified parameters.
      Parameters:
      applicationId - the application id of the form data
      formId - the form id of the form data
      refId - the reference id of the form data
      type - the type of the form data
      Returns:
      the form data model with the specified parameters
      Throws:
      YFormServiceException - if form data is not found
    • getYFormDataByRefId

      List<YFormDataModel> getYFormDataByRefId(String refId)
      Return a list of the form data models with specified reference id.
      Parameters:
      refId - the reference id of the form data models
      Returns:
      the list of the form data models with specified reference id
    • setFormDefinitionStatus

      void setFormDefinitionStatus(String applicationId, String formId, YFormDefinitionStatusEnum status)
      Set the status for all the form definitions with specific application id and form id.
      Parameters:
      formId - the form id of the form definition
      applicationId - the application id of the form definition
      status - the new status of the form definition