com.atlassian.confluence.xhtml.api
Interface EditorFormatService

All Known Implementing Classes:
DefaultEditorFormatService

public interface EditorFormatService

Provides methods that convert between edit and storage formats.


Method Summary
 EmbeddedImage convertEditToEmbeddedImage(java.lang.String editFragment, ConversionContext context)
          Returns a EmbeddedImage from the supplied editFragment.
 Link convertEditToLink(java.lang.String editFragment, ConversionContext context)
          Returns a MacroDefinition from the supplied editFragment.
 MacroDefinition convertEditToMacroDefinition(java.lang.String editFragment, ConversionContext context)
          Returns a MacroDefinition from the supplied editFragment.
 java.lang.String convertEditToStorage(java.lang.String editFragment, ConversionContext context)
          Returns an storage format fragment for the supplied editFragment.
 java.lang.String convertEmbeddedImageToEdit(EmbeddedImage embeddedImage, ConversionContext context)
          Returns an edit format fragment for the supplied embeddedImage.
 java.lang.String convertLinkToEdit(Link link, ConversionContext context)
          Returns an edit format fragment for the supplied link.
 java.lang.String convertMacroDefinitionToEdit(MacroDefinition macroDefinition, ConversionContext context)
          Returns an edit format fragment for the supplied macroDefinition.
 java.lang.String convertStorageToEdit(java.lang.String storageFragment, ConversionContext context)
          Returns an edit format fragment for the supplied storageFragment.
 java.lang.String convertWikiToEdit(java.lang.String wikiContent, ConversionContext context)
          Returns the XHTML edit format equivalent of the supplied wikiContent (Wiki markup).
 

Method Detail

convertWikiToEdit

java.lang.String convertWikiToEdit(java.lang.String wikiContent,
                                   ConversionContext context)
                                   throws XhtmlException
Returns the XHTML edit format equivalent of the supplied wikiContent (Wiki markup).

Parameters:
wikiContent - to be converted.
context - for the conversion.
Returns:
the XHTML storage format equivalent.
Throws:
XhtmlException - if there are any problems during the conversion.

convertStorageToEdit

java.lang.String convertStorageToEdit(java.lang.String storageFragment,
                                      ConversionContext context)
                                      throws javax.xml.stream.XMLStreamException,
                                             XhtmlException
Returns an edit format fragment for the supplied storageFragment.

Parameters:
storageFragment - to be converted (for example the body of a macro).
context - for the conversion.
Returns:
the edit format fragment (HTML rather than XML).
Throws:
javax.xml.stream.XMLStreamException - if there was a problem reading the storage fragment.
XhtmlException - if there was a problem creating the edit fragment.

convertEditToStorage

java.lang.String convertEditToStorage(java.lang.String editFragment,
                                      ConversionContext context)
                                      throws javax.xml.stream.XMLStreamException,
                                             XhtmlException
Returns an storage format fragment for the supplied editFragment.

Parameters:
editFragment - to be converted (for example the body of a macro).
context - for the conversion.
Returns:
the storage format fragment.
Throws:
javax.xml.stream.XMLStreamException - if there was a problem reading the edit fragment.
XhtmlException - if there was a problem creating the storage fragment.

convertMacroDefinitionToEdit

java.lang.String convertMacroDefinitionToEdit(MacroDefinition macroDefinition,
                                              ConversionContext context)
                                              throws XhtmlException
Returns an edit format fragment for the supplied macroDefinition.

The body of the macro definition is expected to be in storage format. It will be transformed to editor format as part of the conversion carried out in this method.

Parameters:
macroDefinition - that describes the macro. The body of this macro definition (returned by MacroDefinition.getBody() is expected to be in storage format.
context - for the conversion.
Returns:
the edit format fragment (HTML rather than XML).
Throws:
XhtmlException - if there was a problem creating the fragment.

convertLinkToEdit

java.lang.String convertLinkToEdit(Link link,
                                   ConversionContext context)
                                   throws XhtmlException
Returns an edit format fragment for the supplied link.

Parameters:
link - that describes the link.
context - for the conversion.
Returns:
the edit format fragment.
Throws:
XhtmlException - if there was a problem creating the fragment.

convertEmbeddedImageToEdit

java.lang.String convertEmbeddedImageToEdit(EmbeddedImage embeddedImage,
                                            ConversionContext context)
                                            throws XhtmlException
Returns an edit format fragment for the supplied embeddedImage.

Parameters:
embeddedImage - that describes the resource (such as an image).
context - for the conversion.
Returns:
the edit format fragment.
Throws:
XhtmlException - if there was a problem creating the fragment.

convertEditToMacroDefinition

MacroDefinition convertEditToMacroDefinition(java.lang.String editFragment,
                                             ConversionContext context)
                                             throws javax.xml.stream.XMLStreamException,
                                                    XhtmlException
Returns a MacroDefinition from the supplied editFragment.

Parameters:
editFragment - which should be the edit format definition of the macro (as XML rather than HTML).
context - for the conversion.
Returns:
the MacroDefinition.
Throws:
javax.xml.stream.XMLStreamException - if there was a problem reading the edit fragment.
XhtmlException - if there was a problem creating the MacroDefinition.

convertEditToLink

Link convertEditToLink(java.lang.String editFragment,
                       ConversionContext context)
                       throws javax.xml.stream.XMLStreamException,
                              XhtmlException
Returns a MacroDefinition from the supplied editFragment.

Parameters:
editFragment - which should be the edit format definition of the link (as XML rather than HTML).
context - for the conversion.
Returns:
the MacroDefinition.
Throws:
javax.xml.stream.XMLStreamException - if there was a problem reading the edit fragment.
XhtmlException - if there was a problem creating the Link.

convertEditToEmbeddedImage

EmbeddedImage convertEditToEmbeddedImage(java.lang.String editFragment,
                                         ConversionContext context)
                                         throws javax.xml.stream.XMLStreamException,
                                                XhtmlException
Returns a EmbeddedImage from the supplied editFragment.

Parameters:
editFragment - which should be the edit format definition of the embedded image (as XHTML rather than HTML).
context - for the conversion.
Returns:
the EmbeddedImage represented by the supplied editFragment.
Throws:
javax.xml.stream.XMLStreamException - if there was a problem reading the edit fragment.
XhtmlException - if there was a problem creating the EmbeddedImage.


Copyright © 2003-2014 Atlassian. All Rights Reserved.