com.atlassian.confluence.content.render.xhtml.storage.resource.identifiers
Class StorageUserResourceIdentifierMarshaller

java.lang.Object
  extended by com.atlassian.confluence.content.render.xhtml.storage.resource.identifiers.StorageUserResourceIdentifierMarshaller
All Implemented Interfaces:
Marshaller<UserResourceIdentifier>, MigrationAware

public class StorageUserResourceIdentifierMarshaller
extends java.lang.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
StorageUserResourceIdentifierMarshaller(XmlStreamWriterTemplate xmlStreamWriterTemplate)
           
 
Method Summary
 Streamable marshal(UserResourceIdentifier userResourceIdentifier, ConversionContext conversionContext)
          Marshal the supplied UserResourceIdentifier to 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

StorageUserResourceIdentifierMarshaller

public StorageUserResourceIdentifierMarshaller(XmlStreamWriterTemplate xmlStreamWriterTemplate)
Method Detail

marshal

public Streamable marshal(UserResourceIdentifier userResourceIdentifier,
                          ConversionContext conversionContext)
                   throws XhtmlException
Marshal the supplied UserResourceIdentifier to storage format. Depending on the information contained in the identifier, the output will contain either a UserKey (preferred), or a username (if no UserKey available). If the marshaller detects that the UserResourceIdentifier was originally initialised from a username rather than a UserKey (i.e. pre-user-rename storage format), then it will set a flag in the ConversionContext to record the fact that the identifier was migrated from one format to another. This flag can then be interrogated by calling the wasMigrationPerformed(com.atlassian.confluence.content.render.xhtml.ConversionContext) method.

Specified by:
marshal in interface Marshaller<UserResourceIdentifier>
Parameters:
userResourceIdentifier - The identifier to be marshalled.
conversionContext - the conversion context in which to record the migration flag
Returns:
A Streamable containing the marshalled identifier.
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 a flag indicating that a UserResourceIdentifier was migrated from "old" to "new" storage format in this context, false othewrwise.
See Also:
MigrationAware}


Copyright © 2003-2014 Atlassian. All Rights Reserved.