Class StorageUserResourceIdentifierMarshaller
java.lang.Object
com.atlassian.confluence.content.render.xhtml.storage.resource.identifiers.StorageUserResourceIdentifierMarshaller
- All Implemented Interfaces:
Marshaller<UserResourceIdentifier>,MigrationAware
public class StorageUserResourceIdentifierMarshaller
extends Object
implements Marshaller<UserResourceIdentifier>, MigrationAware
Marshals
UserResourceIdentifiers to storage format.-
Nested Class Summary
Nested classes/interfaces inherited from interface com.atlassian.confluence.content.render.xhtml.migration.MigrationAware
MigrationAware.MigrationPerformedPredicate -
Constructor Summary
ConstructorsConstructorDescriptionStorageUserResourceIdentifierMarshaller(XmlStreamWriterTemplate xmlStreamWriterTemplate) -
Method Summary
Modifier and TypeMethodDescriptionmarshal(UserResourceIdentifier userResourceIdentifier, ConversionContext conversionContext) Marshal the suppliedUserResourceIdentifierto 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 Details
-
StorageUserResourceIdentifierMarshaller
-
-
Method Details
-
marshal
public Streamable marshal(UserResourceIdentifier userResourceIdentifier, ConversionContext conversionContext) throws XhtmlException Marshal the suppliedUserResourceIdentifierto storage format. Depending on the information contained in the identifier, the output will contain either aUserKey(preferred), or a username (if no UserKey available).If the marshaller detects that the
UserResourceIdentifierwas originally initialised from a username rather than a UserKey (i.e. pre-user-rename storage format), then it will set a flag in theConversionContextto record the fact that the identifier was migrated from one format to another. This flag can then be interrogated by calling thewasMigrationPerformed(com.atlassian.confluence.content.render.xhtml.ConversionContext)method.- Specified by:
marshalin interfaceMarshaller<UserResourceIdentifier>- Parameters:
userResourceIdentifier- The identifier to be marshalled.conversionContext- the conversion context in which to record the migration flag- Returns:
- A
Streamablecontaining the marshalled identifier. - Throws:
XhtmlException- if an error occurs during marshalling
-
wasMigrationPerformed
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 a flag indicating that aUserResourceIdentifierwas migrated from "old" to "new" storage format in this context, false othewrwise.
-