Class DelegatingStorageMacroMarshaller
- java.lang.Object
-
- com.atlassian.confluence.content.render.xhtml.storage.macro.DelegatingStorageMacroMarshaller
-
- All Implemented Interfaces:
Marshaller<MacroDefinition>
,MigrationAware
public class DelegatingStorageMacroMarshaller extends Object implements Marshaller<MacroDefinition>, MigrationAware
AMarshaller
ofMacroDefinition
s which decided which macro storage format to marshal, depending on theMacroDefinition
.- Since:
- 5.3
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface com.atlassian.confluence.content.render.xhtml.migration.MigrationAware
MigrationAware.MigrationPerformedPredicate
-
-
Constructor Summary
Constructors Constructor Description DelegatingStorageMacroMarshaller(StorageMacroV1Marshaller v1Marshaller, StorageMacroV2Marshaller v2Marshaller, MacroMetadataManager macroMetadataManager, MacroManager macroManager)
DelegatingStorageMacroMarshaller(StorageMacroV1Marshaller v1Marshaller, StorageMacroV2Marshaller v2Marshaller, MacroMetadataManager macroMetadataManager, MacroManager macroManager, MarshallingRegistry marshallingRegistry)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Streamable
marshal(MacroDefinition macroDefinition, ConversionContext conversionContext)
Marshals the suppliedMacroDefinition
using either V1 or V2 macro storage format.boolean
wasMigrationPerformed(ConversionContext conversionContext)
Given aConversionContext
that was previously used to perform a migration, determine if that context contains information that indicates whether a "migration" was performed.
-
-
-
Constructor Detail
-
DelegatingStorageMacroMarshaller
public DelegatingStorageMacroMarshaller(StorageMacroV1Marshaller v1Marshaller, StorageMacroV2Marshaller v2Marshaller, MacroMetadataManager macroMetadataManager, MacroManager macroManager)
-
DelegatingStorageMacroMarshaller
public DelegatingStorageMacroMarshaller(StorageMacroV1Marshaller v1Marshaller, StorageMacroV2Marshaller v2Marshaller, MacroMetadataManager macroMetadataManager, MacroManager macroManager, MarshallingRegistry marshallingRegistry)
-
-
Method Detail
-
marshal
public Streamable marshal(MacroDefinition macroDefinition, ConversionContext conversionContext) throws XhtmlException
Marshals the suppliedMacroDefinition
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 theConversionContext
to record that the fact that the macro is being migrated from one storage format to another. This information is then later retrieved via thewasMigrationPerformed(com.atlassian.confluence.content.render.xhtml.ConversionContext)
method.- Specified by:
marshal
in interfaceMarshaller<MacroDefinition>
- Parameters:
macroDefinition
- The macro to be migratedconversionContext
- 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
-
wasMigrationPerformed
public boolean wasMigrationPerformed(ConversionContext conversionContext)
Description copied from interface:MigrationAware
Given aConversionContext
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 interfaceMigrationAware
- 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.
-
-