com.atlassian.confluence.importexport.impl
Class StorageFormatUserRewriter

java.lang.Object
  extended by com.atlassian.confluence.importexport.impl.StorageFormatUserRewriter

public class StorageFormatUserRewriter
extends Object

Provides facilities for extracting and rewriting storage format content that contains UserKeys as components of UserResourceIdentifiers. This is required when importing content containing UserKeys from one Confluence installation into another, where the user keys may be different.

Since:
v5.3

Nested Class Summary
static class StorageFormatUserRewriter.RewriteResult
          Represents the results of the content rewrite operation.
 
Constructor Summary
StorageFormatUserRewriter(XmlEventReaderFactory xmlEventReaderFactory, XmlOutputFactory xmlOutputFactory, Unmarshaller<UserResourceIdentifier> userResourceIdentifierUnmarshaller, Marshaller<UserResourceIdentifier> userResourceIdentifierMarshaller)
           
 
Method Summary
 StorageFormatUserRewriter.RewriteResult rewriteUserKeysInContent(String importedStorageFormat, com.google.common.base.Function<com.atlassian.sal.api.user.UserKey,com.atlassian.sal.api.user.UserKey> userKeyTranslator, ConversionContext conversionContext)
          Rewrites any UserKeys in UserResourceIdentifiers in the supplied storage format content, by using the supplied function to map on userkey to another.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

StorageFormatUserRewriter

public StorageFormatUserRewriter(XmlEventReaderFactory xmlEventReaderFactory,
                                 XmlOutputFactory xmlOutputFactory,
                                 Unmarshaller<UserResourceIdentifier> userResourceIdentifierUnmarshaller,
                                 Marshaller<UserResourceIdentifier> userResourceIdentifierMarshaller)
Method Detail

rewriteUserKeysInContent

public StorageFormatUserRewriter.RewriteResult rewriteUserKeysInContent(String importedStorageFormat,
                                                                        com.google.common.base.Function<com.atlassian.sal.api.user.UserKey,com.atlassian.sal.api.user.UserKey> userKeyTranslator,
                                                                        ConversionContext conversionContext)
                                                                 throws XMLStreamException,
                                                                        XhtmlException,
                                                                        IOException
Rewrites any UserKeys in UserResourceIdentifiers in the supplied storage format content, by using the supplied function to map on userkey to another. If a given userkey cannot be translated, the original userkey will be written unmodified.

Parameters:
storageFormatReader - Supplies the input storage format
storageFormatWriter - The rewritten storage format will be written to this
userKeyTranslator - The function that translates one userkey to another
conversionContext -
Returns:
A Map of the userkey translations used for this content. Untranslated userkeys will be represented as null values.
Throws:
XMLStreamException
XhtmlException
IOException


Copyright © 2003–2015 Atlassian. All rights reserved.