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
AMarshallerofMacroDefinitions 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 Streamablemarshal(MacroDefinition macroDefinition, ConversionContext conversionContext)Marshals the suppliedMacroDefinitionusing either V1 or V2 macro storage format.booleanwasMigrationPerformed(ConversionContext conversionContext)Given aConversionContextthat 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 suppliedMacroDefinitionusing 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
MacroDefinitionoriginated in V1 format, but is being marshalled as V2, then a flag will be set in theConversionContextto 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:
marshalin interfaceMarshaller<MacroDefinition>- Parameters:
macroDefinition- The macro to be migratedconversionContext- the conversion context in which to store the migration flag- Returns:
- A
Streamablecontaining the marshalled macro defintion. - Throws:
XhtmlException- if an error occurs during marshalling
-
wasMigrationPerformed
public boolean wasMigrationPerformed(ConversionContext conversionContext)
Description copied from interface:MigrationAwareGiven aConversionContextthat 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:
wasMigrationPerformedin interfaceMigrationAware- Parameters:
conversionContext- the context used for the migration- Returns:
- true if the supplied
ConversionContextcontains the flag that indicates that a macro storage format migration was performed within that context, false otherwise.
-
-