com.atlassian.confluence.content.render.xhtml.storage.macro
Class DelegatingStorageMacroMarshaller

java.lang.Object
  extended by com.atlassian.confluence.content.render.xhtml.storage.macro.DelegatingStorageMacroMarshaller
All Implemented Interfaces:
Marshaller<MacroDefinition>, MigrationAware

public class DelegatingStorageMacroMarshaller
extends java.lang.Object
implements Marshaller<MacroDefinition>, MigrationAware

A Marshaller of MacroDefinitions which decided which macro storage format to marshal, depending on the MacroDefinition.

Since:
5.3

Nested Class Summary
 
Nested classes/interfaces inherited from interface com.atlassian.confluence.content.render.xhtml.migration.MigrationAware
MigrationAware.MigrationPerformedPredicate
 
Constructor Summary
DelegatingStorageMacroMarshaller(StorageMacroV1Marshaller v1Marshaller, StorageMacroV2Marshaller v2Marshaller, MacroMetadataManager macroMetadataManager)
           
DelegatingStorageMacroMarshaller(StorageMacroV1Marshaller v1Marshaller, StorageMacroV2Marshaller v2Marshaller, MacroMetadataManager macroMetadataManager, MarshallingRegistry marshallingRegistry)
           
 
Method Summary
 Streamable marshal(MacroDefinition macroDefinition, ConversionContext conversionContext)
          Marshals the supplied MacroDefinition using either V1 or V2 macro storage format.
 boolean wasMigrationPerformed(ConversionContext conversionContext)
          Given a ConversionContext that was previously used to perform a migration, determine if that context contains information that indicates whether a "migration" was performed.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DelegatingStorageMacroMarshaller

public DelegatingStorageMacroMarshaller(StorageMacroV1Marshaller v1Marshaller,
                                        StorageMacroV2Marshaller v2Marshaller,
                                        MacroMetadataManager macroMetadataManager)

DelegatingStorageMacroMarshaller

public DelegatingStorageMacroMarshaller(StorageMacroV1Marshaller v1Marshaller,
                                        StorageMacroV2Marshaller v2Marshaller,
                                        MacroMetadataManager macroMetadataManager,
                                        MarshallingRegistry marshallingRegistry)
Method Detail

marshal

public Streamable marshal(MacroDefinition macroDefinition,
                          ConversionContext conversionContext)
                   throws XhtmlException
Marshals the supplied MacroDefinition using either V1 or V2 macro storage format. Will use V2 storage format in preference, but only if it can find metadata for the macro. If the MacroDefinition originated in V1 format, but is being marshalled as V2, then a flag will be set in the ConversionContext to record that the fact that the macro is being migrated from one storage format to another. This information is then later retrieved via the wasMigrationPerformed(com.atlassian.confluence.content.render.xhtml.ConversionContext) method.

Specified by:
marshal in interface Marshaller<MacroDefinition>
Parameters:
macroDefinition - The macro to be migrated
conversionContext - the conversion context in which to store the migration flag
Returns:
A Streamable containing the marshalled macro defintion.
Throws:
XhtmlException - if an error occurs during marshalling
See Also:
MigrationAware}

wasMigrationPerformed

public boolean wasMigrationPerformed(ConversionContext conversionContext)
Description copied from interface: MigrationAware
Given a ConversionContext that was previously used to perform a migration, determine if that context contains information that indicates whether a "migration" was performed. What constitutes a migration is implementation-dependent.

Specified by:
wasMigrationPerformed in interface MigrationAware
Parameters:
conversionContext - the context used for the migration
Returns:
true if the supplied ConversionContext contains the flag that indicates that a macro storage format migration was performed within that context, false otherwise.
See Also:
MigrationAware}


Copyright © 2003-2014 Atlassian. All Rights Reserved.