Interface FormatConverter

  • All Known Implementing Classes:
    DefaultFormatConverter

    public interface FormatConverter
    Provides a convenient service for transforming to and from the storage format into the editor and view formats.
    Since:
    4.3
    • Method Detail

      • validateAndConvertToStorageFormat

        String validateAndConvertToStorageFormat​(ConfluenceActionSupport action,
                                                 String wysiwygContent,
                                                 com.atlassian.renderer.RenderContext renderContext)
        Validates, and adds any errors to the action. Returns the storage format if successful.
        Parameters:
        action - action to add any errors found into
        wysiwygContent -
        renderContext -
        Returns:
      • validateAndConvertToStorageFormat

        String validateAndConvertToStorageFormat​(String wysiwygContent,
                                                 com.atlassian.renderer.RenderContext renderContext)
                                          throws BadRequestException
        Validates, throwing exceptions if failures found. Returns the storage format if successful.
        Parameters:
        wysiwygContent -
        renderContext -
        Returns:
        Throws:
        BadRequestException
      • convertToStorageFormat

        String convertToStorageFormat​(String wysiwygContent,
                                      com.atlassian.renderer.RenderContext renderContext)
                               throws XhtmlParsingException,
                                      XhtmlException
        Returns the content that has been submitted as part of a user's attempt to add new content or edit existing content. The content is returned in storage format ready for saving.
        Returns:
        the content that has been submitted as part of a user's attempt to add new content or edit existing content.
        Throws:
        XhtmlParsingException
        XhtmlException
      • convertToEditorFormat

        String convertToEditorFormat​(String storageFormat,
                                     com.atlassian.renderer.RenderContext renderContext)
        Converts the storage format into the editor format.
        Parameters:
        storageFormat -
        renderContext -
        Returns:
      • convertToEditorFormatWithResult

        RenderResult convertToEditorFormatWithResult​(String storageFormat,
                                                     com.atlassian.renderer.RenderContext renderContext)
        Converts the storage format into the editor format.
        Parameters:
        storageFormat -
        renderContext -
        Returns:
      • convertToViewFormat

        String convertToViewFormat​(String storageFormat,
                                   com.atlassian.renderer.RenderContext renderContext)
        Converts the storage format into the view format.
        Parameters:
        storageFormat -
        renderContext -
        Returns:
      • cleanEditorFormat

        String cleanEditorFormat​(String editorFormat,
                                 com.atlassian.renderer.RenderContext renderContext)
                          throws XhtmlException
        Cleans the editor format
        Parameters:
        editorFormat -
        renderContext -
        Returns:
        a cleaned version of the editorFormat
        Throws:
        XhtmlException
      • cleanStorageFormat

        String cleanStorageFormat​(String storageFormat)
        Cleans the storage format
        Parameters:
        storageFormat -
        Returns:
        a cleaned version of the storageFormat