Interface YFormFacade

  • All Known Implementing Classes:
    DefaultYFormFacade

    public interface YFormFacade
    Form Facade to handle yForm definitions and yForm data.
    • Method Summary

      All Methods Instance Methods Abstract Methods 
      Modifier and Type Method Description
      YFormDataData createOrUpdateYFormData​(java.lang.String applicationId, java.lang.String formId, java.lang.String formDataId, YFormDataTypeEnum type, java.lang.String formDataContent)
      Create or Update YFormDataModel.
      YFormDataData createOrUpdateYFormData​(java.lang.String applicationId, java.lang.String formId, java.lang.String formDataId, YFormDataTypeEnum type, java.lang.String refId, java.lang.String formDataContent)
      Create or Update YFormDataModel.
      YFormDataData createYFormData​(java.lang.String applicationId, java.lang.String formId, java.lang.String formDataId, YFormDataTypeEnum type, java.lang.String refId, java.lang.String content)
      Creates YFormData if it doesn't exist and assigns it to the corresponding YFormDefinition.
      YFormDefinitionData createYFormDefinition​(java.lang.String applicationId, java.lang.String formId, java.lang.String content, java.lang.String documentId)
      Create a new YFormDefinition with specific parameters.
      java.lang.String getFormDataContent​(java.lang.String applicationId, java.lang.String formId, java.lang.String formDataId)
      Returns the content of form data with specific application id, form id and form data id.
      java.lang.String getFormDataContentTemplate​(java.lang.String applicationId, java.lang.String formId)
      For a given application id and form id a form data content template (an empty content generated from YFormDefinition with given form id) is returned.
      java.lang.String getInlineFormHtml​(java.lang.String applicationId, java.lang.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 between
      java.lang.String getInlineFormHtml​(java.lang.String applicationId, java.lang.String formId, YFormDataActionEnum action, java.lang.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 between
      java.lang.String getInlineFormHtml​(java.lang.String applicationId, java.lang.String formId, YFormDataActionEnum action, java.lang.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 between
      java.lang.String getInlineFormHtml​(java.lang.String applicationId, java.lang.String formId, YFormDataActionEnum action, java.lang.String formDataId, YFormPreprocessorStrategy strategy, java.util.Map<java.lang.String,​java.lang.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 between
      java.lang.String getInlineFormHtml​(java.lang.String applicationId, java.lang.String formId, java.lang.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 between
      java.lang.String getNewFormDataId()
      Generates a new form Data id.
      YFormDataData getYFormData​(java.lang.String formDataId)
      For a given id a form data is returned.
      YFormDataData getYFormData​(java.lang.String formDataId, YFormDataTypeEnum type)
      For a given id and type a form data is returned.
      YFormDataData getYFormData​(java.lang.String applicationId, java.lang.String formId, java.lang.String refId)
      For the given application id, form id and reference id a form data is returned.
      YFormDataData getYFormData​(java.lang.String applicationId, java.lang.String formId, java.lang.String refId, YFormDataTypeEnum type)
      For the given application id, form id, reference id and form type a form data is returned.
      YFormDefinitionData getYFormDefinition​(java.lang.String documentId)
      For a given document id a form definition is returned.
      YFormDefinitionData getYFormDefinition​(java.lang.String applicationId, java.lang.String formId)
      For a given application id and form id a form definition is returned.
      YFormDefinitionData getYFormDefinition​(java.lang.String applicationId, java.lang.String formId, int version)
      This method is available for testing purposes, to get the latest YFormDefinition use other method.
      java.lang.String recreateYFormDefinitionCounterpart​(java.lang.String applicationId, java.lang.String formId, int version)
      Creates the form data counterpart form definition with specific application id, form id and version number.
      void setFormDefinitionStatus​(java.lang.String applicationId, java.lang.String formId, YFormDefinitionStatusEnum status)
      Changes the state of a form definition.
      YFormDataData updateYFormData​(java.lang.String formDataId, YFormDataTypeEnum type, java.lang.String content)
      Update YFormData content of form data with specific id and type.
      YFormDefinitionData updateYFormDefinition​(java.lang.String applicationId, java.lang.String formId, java.lang.String content, java.lang.String documentId)
      Update YFormDefinition if it exists in the database.
      boolean validate​(java.lang.String applicationId, java.lang.String formId, java.lang.String formDataId)
      Indicates if the given Form Data is valid or not.
    • Method Detail

      • getNewFormDataId

        java.lang.String getNewFormDataId()
        Generates a new form Data id.
        Returns:
        generated form data id as string.
      • getYFormDefinition

        YFormDefinitionData getYFormDefinition​(java.lang.String applicationId,
                                               java.lang.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 for
        formId - 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​(java.lang.String applicationId,
                                               java.lang.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 for
        formId - the form id to search form definition for
        version - form definition version
        Returns:
        form definition with specific parameters
        Throws:
        YFormServiceException - if form definition cannot with specified parameters be resolved
      • getYFormDefinition

        YFormDefinitionData getYFormDefinition​(java.lang.String documentId)
                                        throws YFormServiceException
        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​(java.lang.String applicationId,
                                                  java.lang.String formId,
                                                  java.lang.String content,
                                                  java.lang.String documentId)
                                           throws YFormServiceException
        Create a new YFormDefinition with specific parameters.
        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:
        created form definition POJO
        Throws:
        YFormServiceException - if form definition cannot be created
      • updateYFormDefinition

        YFormDefinitionData updateYFormDefinition​(java.lang.String applicationId,
                                                  java.lang.String formId,
                                                  java.lang.String content,
                                                  java.lang.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:
        YFormDefinitionData updated form definition POJO
        Throws:
        YFormServiceException - if form definition cannot be updated
      • getYFormData

        YFormDataData getYFormData​(java.lang.String formDataId)
                            throws YFormServiceException
        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

        YFormDataData getYFormData​(java.lang.String formDataId,
                                   YFormDataTypeEnum type)
                            throws YFormServiceException
        For a given id and type a form data is returned.
        Parameters:
        formDataId - the form data id to get data for
        type - 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​(java.lang.String applicationId,
                                   java.lang.String formId,
                                   java.lang.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 data
        formId - the form id to get data for
        refId - the reference id
        type - 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​(java.lang.String applicationId,
                                   java.lang.String formId,
                                   java.lang.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 data
        formId - the form id to get data for
        refId - the reference id
        Returns:
        form data POJO with given application id, form id and reference id
        Throws:
        YFormServiceException - if form data cannot be found
      • createYFormData

        YFormDataData createYFormData​(java.lang.String applicationId,
                                      java.lang.String formId,
                                      java.lang.String formDataId,
                                      YFormDataTypeEnum type,
                                      java.lang.String refId,
                                      java.lang.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:
        form data POJO with given parameters
        Throws:
        YFormServiceException - if form data cannot be created
      • updateYFormData

        YFormDataData updateYFormData​(java.lang.String formDataId,
                                      YFormDataTypeEnum type,
                                      java.lang.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 POJO
        Throws:
        YFormServiceException - if form data cannot be updated
      • createOrUpdateYFormData

        YFormDataData createOrUpdateYFormData​(java.lang.String applicationId,
                                              java.lang.String formId,
                                              java.lang.String formDataId,
                                              YFormDataTypeEnum type,
                                              java.lang.String refId,
                                              java.lang.String formDataContent)
                                       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
        formDataContent - 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​(java.lang.String applicationId,
                                              java.lang.String formId,
                                              java.lang.String formDataId,
                                              YFormDataTypeEnum type,
                                              java.lang.String formDataContent)
                                       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
        formDataContent - the content of the form data
        Returns:
        created or updated form data POJO
        Throws:
        YFormServiceException - if form data cannot be created or updated
      • getInlineFormHtml

        java.lang.String getInlineFormHtml​(java.lang.String applicationId,
                                           java.lang.String formId,
                                           java.lang.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 definition
        formId - the form id of the definition
        formDataId - the form data id of the definition
        Returns:
        the inline form definition as string
        Throws:
        YFormServiceException - if inline definition cannot be returned
      • getInlineFormHtml

        java.lang.String getInlineFormHtml​(java.lang.String applicationId,
                                           java.lang.String formId)
                                    throws YFormServiceException
        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 definition
        formId - the form id of the definition
        Returns:
        the inline form definition as string
        Throws:
        YFormServiceException - if inline definition cannot be returned
      • getInlineFormHtml

        java.lang.String getInlineFormHtml​(java.lang.String applicationId,
                                           java.lang.String formId,
                                           YFormDataActionEnum action,
                                           java.lang.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 definition
        formId - the form id of the definition
        action - the action on the definition
        formDataId - the form data id of the definition
        Returns:
        the inline form definition as string
        Throws:
        YFormServiceException - if inline definition cannot be returned
      • getInlineFormHtml

        java.lang.String getInlineFormHtml​(java.lang.String applicationId,
                                           java.lang.String formId,
                                           YFormDataActionEnum action,
                                           java.lang.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 definition
        formId - the form id of the definition
        action - the action on the definition
        formDataId - the form data id of the definition
        strategy - form preprocessor strategy
        Returns:
        the inline form definition as string
        Throws:
        YFormServiceException - if inline definition cannot be returned
      • getInlineFormHtml

        java.lang.String getInlineFormHtml​(java.lang.String applicationId,
                                           java.lang.String formId,
                                           YFormDataActionEnum action,
                                           java.lang.String formDataId,
                                           YFormPreprocessorStrategy strategy,
                                           java.util.Map<java.lang.String,​java.lang.Object> params)
                                    throws YFormServiceException
        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 between
        Parameters:
        applicationId - the application id of the definition
        formId - the form id of the definition
        action - the action on the definition
        formDataId - the form data id of the definition
        strategy - form preprocessor strategy
        params - map with parameters for preprocessor strategy
        Returns:
        the inline form definition as string
        Throws:
        YFormServiceException - if inline definition cannot be returned
      • getFormDataContent

        java.lang.String getFormDataContent​(java.lang.String applicationId,
                                            java.lang.String formId,
                                            java.lang.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 data
        formId - the form id of the form data
        formDataId - 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

        java.lang.String getFormDataContentTemplate​(java.lang.String applicationId,
                                                    java.lang.String formId)
                                             throws YFormServiceException
        For a given application id and form id a form data content template (an empty content generated from YFormDefinition with given form id) is returned.
        Parameters:
        applicationId - the application id of the form definition
        formId - 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

        java.lang.String recreateYFormDefinitionCounterpart​(java.lang.String applicationId,
                                                            java.lang.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 definition
        formId - the form id of the form definition
        version - 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​(java.lang.String applicationId,
                                     java.lang.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 definition
        formId - the form id of the form definition
        status - new status of the form definition
        Throws:
        YFormServiceException - if form definition cannot be found or updated
      • validate

        boolean validate​(java.lang.String applicationId,
                         java.lang.String formId,
                         java.lang.String formDataId)
                  throws YFormServiceException
        Indicates if the given Form Data is valid or not.
        Parameters:
        applicationId - the application id of the form data
        formId - the form id of the form data
        formDataId - the id of the form data
        Returns:
        true if form data is valid, false otherwise
        Throws:
        YFormServiceException - if form data cannot be found