com.atlassian.confluence.importexport.impl
Class StorageFormatUserRewriter

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

public class StorageFormatUserRewriter
extends java.lang.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(java.lang.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(java.lang.String importedStorageFormat,
                                                                        com.google.common.base.Function<com.atlassian.sal.api.user.UserKey,com.atlassian.sal.api.user.UserKey> userKeyTranslator,
                                                                        ConversionContext conversionContext)
                                                                 throws javax.xml.stream.XMLStreamException,
                                                                        XhtmlException,
                                                                        java.io.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:
javax.xml.stream.XMLStreamException
XhtmlException
java.io.IOException


Copyright © 2003-2013 Atlassian. All Rights Reserved.