|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectcom.atlassian.confluence.content.render.xhtml.DefaultXhtmlContent
public class DefaultXhtmlContent
| Constructor Summary | |
|---|---|
DefaultXhtmlContent(Marshaller<MacroDefinition> viewMacroMarshaller,
Marshaller<MacroDefinition> storageMacroMarshaller,
Marshaller<Link> viewLinkMarshaller,
Marshaller<Link> storageLinkMarshaller,
Marshaller<EmbeddedImage> viewEmbeddedImageMarshaller,
Marshaller<EmbeddedImage> storageEmbeddedImageMarshaller,
Marshaller<InlineTaskList> viewInlineTaskMarshaller,
Marshaller<InlineTaskList> storageInlineTaskMarshaller,
Renderer viewRenderer,
XmlEventReaderFactory xmlEventReaderFactory,
ContentTransformerFactory contentTransformerFactory,
ExceptionTolerantMigrator wikiToXhtmlMigrator)
|
|
| Method Summary | ||
|---|---|---|
java.lang.String |
convertEmbeddedImageToStorage(EmbeddedImage embeddedImage,
ConversionContext context)
Returns a storage format fragment for the supplied embeddedImage. |
|
java.lang.String |
convertEmbeddedImageToView(EmbeddedImage embeddedImage,
ConversionContext context)
Returns a view format fragment for the supplied embeddedImage. |
|
java.lang.String |
convertInlineTaskListToStorage(InlineTaskList inlineTaskList,
ConversionContext context)
Returns a storage format fragment for the supplied inlineTaskList. |
|
java.lang.String |
convertInlineTaskListToView(InlineTaskList inlineTaskList,
ConversionContext context)
Returns a view format fragment for the supplied inlineTaskList. |
|
java.lang.String |
convertLinkToStorage(Link link,
ConversionContext context)
Returns a storage format fragment for the supplied link. |
|
java.lang.String |
convertLinkToView(Link link,
ConversionContext context)
Returns a view format fragment for the supplied link. |
|
java.lang.String |
convertMacroDefinitionToStorage(MacroDefinition macroDefinition,
ConversionContext context)
Returns an storage format fragment for the supplied macroDefinition. |
|
java.lang.String |
convertMacroDefinitionToView(MacroDefinition macroDefinition,
ConversionContext context)
Returns a view format fragment for the supplied macroDefinition. |
|
java.lang.String |
convertStorageToView(java.lang.String storageFragment,
ConversionContext context)
Returns a view format fragment for the supplied storageFragment. |
|
|
convertWikiBodyToStorage(T ceo)
Convert the body of the supplied ContentEntityObject to Confluence Storage Format XHTML (if necessary). |
|
java.lang.String |
convertWikiToStorage(java.lang.String wikiContent,
ConversionContext context,
java.util.List<java.lang.RuntimeException> migrationExceptions)
Returns the XHTML storage format equivalent of the supplied wikiContent (wiki markup). |
|
java.lang.String |
convertWikiToView(java.lang.String wikiContent,
ConversionContext context,
java.util.List<java.lang.RuntimeException> migrationExceptions)
Returns the HTML view format equivalent of the supplied wikiContent. |
|
void |
handleMacroDefinitions(java.lang.String storageFragment,
ConversionContext context,
MacroDefinitionHandler handler)
Perform an operation on MacroDefinitions in the supplied storageFragment without making changes
to the storage representation. |
|
void |
handleMacroDefinitions(java.lang.String storageFragment,
ConversionContext context,
MacroDefinitionHandler handler,
MacroDefinitionMarshallingStrategy strategy)
Perform an operation on MacroDefinitions in the supplied storageFragment, with optional changes
to the storage representation defined by the MacroDefinitionMarshallingStrategy. |
|
void |
handleXhtmlElements(java.lang.String storageFragment,
ConversionContext context,
java.util.List<? extends XhtmlVisitor> visitors)
Provides a mechanism for finding arbitrary Xhtml elements in the supplied storageFormat. |
|
java.lang.String |
replaceMacroDefinitionsWithString(java.lang.String storageFragment,
ConversionContext context,
MacroDefinitionReplacer replacer)
Replaces MacroDefinitions in the supplied storageFragment with a String. |
|
java.lang.String |
updateMacroDefinitions(java.lang.String storageFragment,
ConversionContext context,
MacroDefinitionUpdater updater)
Updates MacroDefinitions in the supplied storageFragment. |
|
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public DefaultXhtmlContent(Marshaller<MacroDefinition> viewMacroMarshaller,
Marshaller<MacroDefinition> storageMacroMarshaller,
Marshaller<Link> viewLinkMarshaller,
Marshaller<Link> storageLinkMarshaller,
Marshaller<EmbeddedImage> viewEmbeddedImageMarshaller,
Marshaller<EmbeddedImage> storageEmbeddedImageMarshaller,
Marshaller<InlineTaskList> viewInlineTaskMarshaller,
Marshaller<InlineTaskList> storageInlineTaskMarshaller,
Renderer viewRenderer,
XmlEventReaderFactory xmlEventReaderFactory,
ContentTransformerFactory contentTransformerFactory,
ExceptionTolerantMigrator wikiToXhtmlMigrator)
| Method Detail |
|---|
public java.lang.String convertWikiToStorage(java.lang.String wikiContent,
ConversionContext context,
java.util.List<java.lang.RuntimeException> migrationExceptions)
XhtmlContentwikiContent (wiki markup).
convertWikiToStorage in interface XhtmlContentwikiContent - to be converted.context - for the conversion.migrationExceptions - that will be populated with any exceptions that take place during the migration.
There may be multiple exceptions if there are multiple wiki markup sections.
public <T extends ContentEntityObject> T convertWikiBodyToStorage(T ceo)
XhtmlContentConvert the body of the supplied ContentEntityObject to Confluence Storage Format XHTML (if necessary).
Since for now and the near future Confluence may have both wiki formatted and XHTML formatted ContentEntityObjects in the system (wiki formatted historical versions may be present in an upgraded installation) this method provides a convenient way to ensure you only need to handle ContentEntityObjects with the new XHTML format of body.
Note that the returned ceo is a clone of the passed in version, even if no conversion was necessary.
convertWikiBodyToStorage in interface XhtmlContentceo - the ContentEntityObject to be converted (if necessary).
public java.lang.String convertWikiToView(java.lang.String wikiContent,
ConversionContext context,
java.util.List<java.lang.RuntimeException> migrationExceptions)
throws javax.xml.stream.XMLStreamException,
XhtmlException
XhtmlContentwikiContent.
convertWikiToView in interface XhtmlContentwikiContent - to be converted.context - for the conversion.migrationExceptions - that will be populated with any exceptions that take place during the migration.
There may be multiple exceptions if there are multiple wiki markup sections.
javax.xml.stream.XMLStreamException - if there was a problem reading intermediate storage format data that is created during the conversion.
XhtmlException - if there was a problem creating the view format output.
public java.lang.String convertStorageToView(java.lang.String storageFragment,
ConversionContext context)
throws javax.xml.stream.XMLStreamException,
XhtmlException
XhtmlContentstorageFragment.
convertStorageToView in interface XhtmlContentstorageFragment - to be converted (for example the body of a macro).context - for the conversion.
javax.xml.stream.XMLStreamException - if there was a problem reading the storage fragment.
XhtmlException - if there was a problem creating the view fragment.
public java.lang.String convertMacroDefinitionToView(MacroDefinition macroDefinition,
ConversionContext context)
throws XhtmlException
XhtmlContentmacroDefinition.
convertMacroDefinitionToView in interface XhtmlContentmacroDefinition - that describes the macro.context - for the conversion.
XhtmlException - if there was a problem creating the fragment.
public java.lang.String convertLinkToView(Link link,
ConversionContext context)
throws XhtmlException
XhtmlContentlink.
convertLinkToView in interface XhtmlContentlink - that describes the link.context - for the conversion.
XhtmlException - if there was a problem creating the fragment.
public java.lang.String convertEmbeddedImageToView(EmbeddedImage embeddedImage,
ConversionContext context)
throws XhtmlException
XhtmlContentembeddedImage.
convertEmbeddedImageToView in interface XhtmlContentembeddedImage - that describes the embedded image.context - for the conversion.
XhtmlException - if there was a problem creating the fragment.
public java.lang.String convertInlineTaskListToView(InlineTaskList inlineTaskList,
ConversionContext context)
throws XhtmlException
XhtmlContentinlineTaskList.
convertInlineTaskListToView in interface XhtmlContentinlineTaskList - that describes the inline task list.context - for the conversion.
XhtmlException - if there was a problem creating the fragment.
public java.lang.String convertMacroDefinitionToStorage(MacroDefinition macroDefinition,
ConversionContext context)
throws XhtmlException
XhtmlContentmacroDefinition.
convertMacroDefinitionToStorage in interface XhtmlContentmacroDefinition - that describes the macro.context - for the conversion.
XhtmlException - if there was a problem creating the fragment.
public java.lang.String convertLinkToStorage(Link link,
ConversionContext context)
throws XhtmlException
XhtmlContentlink.
convertLinkToStorage in interface XhtmlContentlink - that describes the link.context - for the conversion.
XhtmlException - if there was a problem creating the fragment.
public java.lang.String convertEmbeddedImageToStorage(EmbeddedImage embeddedImage,
ConversionContext context)
throws XhtmlException
XhtmlContentembeddedImage.
convertEmbeddedImageToStorage in interface XhtmlContentembeddedImage - that describes the embedded image.context - for the conversion.
XhtmlException - if there was a problem creating the fragment.
public java.lang.String convertInlineTaskListToStorage(InlineTaskList inlineTaskList,
ConversionContext context)
throws XhtmlException
XhtmlContentinlineTaskList.
convertInlineTaskListToStorage in interface XhtmlContentinlineTaskList - that describes the inline task list.context - for the conversion.
XhtmlException - if there was a problem creating the fragment.
public java.lang.String updateMacroDefinitions(java.lang.String storageFragment,
ConversionContext context,
MacroDefinitionUpdater updater)
throws XhtmlException
XhtmlContentMacroDefinitions in the supplied storageFragment.
// Changes the name of all "mice" macros to "cheese".
page.setBodyAsString(xhtmlContent.updateMacroDefinitions(page.getBodyAsString(), context, new XhtmlContent.MacroDefinitionUpdater()
{
public MacroDefinition update(MacroDefinition macroDefinition)
{
if ("mice".equals(macroDefinition.getName()))
macroDefinition.setName("cheese");
return macroDefinition;
}
}));
updateMacroDefinitions in interface XhtmlContentstorageFragment - or more typically the storage representation of a complete ContentEntityObject
which might contain macro definitions.context - for the conversion.updater - which is called to update each MacroDefinition found.
XhtmlException - if there was a problem reading the storage fragment, creating the MacroDefinition or
creating the modified fragment.
public java.lang.String replaceMacroDefinitionsWithString(java.lang.String storageFragment,
ConversionContext context,
MacroDefinitionReplacer replacer)
throws XhtmlException
XhtmlContentMacroDefinitions in the supplied storageFragment with a String. Use {link #updateMacroDefinitions}
rather than this method if you wish to replace or update one definition with another.
// Replaces "cheese" macros with some XHTML.
page.setBodyAsString(xhtmlContent.replaceMacroDefinitionsWithString(page.getBodyAsString(), context, new MacroDefinitionReplacer()
{
public String replace(MacroDefinition macroDefinition) throws XhtmlException
{
if ("cheese".equals(macroDefinition.getName()))
return "I hate cheese!
";
return xhtmlContent.convertMacroDefinitionToStorage(macroDefinition, context);
}
}));
replaceMacroDefinitionsWithString in interface XhtmlContentstorageFragment - or more typically the storage representation of a complete ContentEntityObject
which might contain macro definitions.context - for the conversion.replacer - which is called to replace each MacroDefinition found with a replacement in storage format
(typically XHTML).
XhtmlException - if there was a problem reading the storage fragment, creating the MacroDefinition or
creating the modified fragment.
public void handleMacroDefinitions(java.lang.String storageFragment,
ConversionContext context,
MacroDefinitionHandler handler)
throws XhtmlException
XhtmlContentMacroDefinitions in the supplied storageFragment without making changes
to the storage representation.
// Finds the last macro on a page final AtomicReferenceatomicMacroDefinition = new AtomicReference (); xhtmlContent.handleMacroDefinitions(page.getBodyAsString(), context, new MacroDefinitionHandler() { public void handle(MacroDefinition macroDefinition) { atomicMacroDefinition.set(macroDefinition); } }); MacroDefinition lastMacro = atomicMacroDefinition.get();
handleMacroDefinitions in interface XhtmlContentstorageFragment - or more typically the storage representation of a complete ContentEntityObject
which might contain macro definitions.context - for the conversion.handler - which is called each MacroDefinition found.
XhtmlException - if there was a problem reading the storage fragment or creating the MacroDefinition.
public void handleMacroDefinitions(java.lang.String storageFragment,
ConversionContext context,
MacroDefinitionHandler handler,
MacroDefinitionMarshallingStrategy strategy)
throws XhtmlException
XhtmlContentMacroDefinitions in the supplied storageFragment, with optional changes
to the storage representation defined by the MacroDefinitionMarshallingStrategy.
// Finds the last macro on a page, maintaining any nested macros within the MacroDefinition body final AtomicReferenceatomicMacroDefinition = new AtomicReference (); xhtmlContent.handleMacroDefinitions(page.getBodyAsString(), context, new MacroDefinitionHandler() { public void handle(MacroDefinition macroDefinition) { atomicMacroDefinition.set(macroDefinition); } }, MacroDefinitionMarshallingStrategy.MARSHALL_MACRO); MacroDefinition lastMacro = atomicMacroDefinition.get();
handleMacroDefinitions in interface XhtmlContentstorageFragment - or more typically the storage representation of a complete ContentEntityObject
which might contain macro definitions.context - for the conversion.handler - which is called each MacroDefinition found.strategy - the strategy used to transform the body of the handled macros
XhtmlException - if there was a problem reading the storage fragment or creating the MacroDefinition.
public void handleXhtmlElements(java.lang.String storageFragment,
ConversionContext context,
java.util.List<? extends XhtmlVisitor> visitors)
throws XhtmlException
XhtmlContentstorageFormat.
handleXhtmlElements in interface XhtmlContentstorageFragment - or more typically the storage representation of a complete ContentEntityObjectcontext - for the conversionvisitors - a list of visitors
XhtmlException
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||