com.atlassian.confluence.importexport.impl
Class ExportUtils

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

public class ExportUtils
extends java.lang.Object


Field Summary
static java.lang.String PROP_BACKUP_ATTACHMENTS
           
static java.lang.String PROP_BUILD_NUMBER
          build number of the earliest confluence version that this export can be imported by
static java.lang.String PROP_CREATED_BY_BUILD_NUMBER
          build number of the version of confluence that was used to generate export
static java.lang.String PROP_DEFAULT_USERS_GROUP
          Default users group for this instance, used to remap group permissions on import.
static java.lang.String PROP_EXPORT_TYPE
           
static java.lang.String PROP_EXPORTED_SPACEKEY
          Indicates a specific space key which has been exported.
static java.lang.String PROP_PLUGIN_CREATED_BY_VERSION
          Plugin version used to export (Mostly for ActiveObjects data)
static java.lang.String PROP_PLUGIN_EARLIEST_VERSION
          Earliest plugin version compatible with export
static java.lang.String PROP_PLUGINS_EXPORTING_DATA
           
 
Constructor Summary
ExportUtils()
           
 
Method Summary
static java.util.Properties getExportDescriptor(java.io.File exportZip, boolean cleanup)
          Deprecated. since 4.2 use ExportDescriptor.getExportDescriptor(java.io.File) instead.
static java.lang.String getExportTypeFromExportZip(java.io.File exportZip)
          Deprecated. since 4.2 use ExportDescriptor.getScope()
static java.lang.String getExportTypeFromExportZip(java.io.File exportZip, boolean cleanup)
          Deprecated. since 4.2 use ExportDescriptor.getScope()
static java.lang.String getSpaceKeyFromExportZip(java.io.File exportZip)
          Deprecated. this is unnecessary for space exports produced since Confluence 4.2, where you can just use ExportDescriptor.getSpaceKey().
static java.lang.String getTitleAsFilename(ContentEntityObject ceo)
           Utility method to return a version of the content entity's title that's suitable to be used as a filename in an export.
static java.lang.String getTitleAsFilename(SearchResult searchResult)
           Utility method to return a version of the search result's title that's suitable to be used as a filename in an export.
static java.lang.String getTitleAsFilename(java.lang.String title)
          Deprecated. since 5.1.4. Use getTitleAsFilename(ContentEntityObject) instead (see CONF-27260)
static java.lang.String getTitleAsHref(ContentEntityObject ceo)
           For a URL encoded filename to be used in a link it will need to be double encoded (since the browser will decode the single encoding when resolving the link, and we have files with encoded names on the filesystem).
static java.lang.String getTitleAsHref(SearchResult searchResult)
           For a URL encoded filename to be used in a link it will need to be double encoded (since the browser will decode the single encoding when resolving the link, and we have files with encoded names on the filesystem).
static java.lang.String getTitleAsHref(java.lang.String title)
          Deprecated. since 5.1.4. Use getTitleAsHref(ContentEntityObject) instead (see CONF-27260)
static boolean isSpaceImport(java.io.File importFile)
          Deprecated. since 4.2 use ExportDescriptor.isSpaceImport().
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

PROP_BUILD_NUMBER

public static final java.lang.String PROP_BUILD_NUMBER
build number of the earliest confluence version that this export can be imported by

See Also:
Constant Field Values

PROP_EXPORT_TYPE

public static final java.lang.String PROP_EXPORT_TYPE
See Also:
Constant Field Values

PROP_BACKUP_ATTACHMENTS

public static final java.lang.String PROP_BACKUP_ATTACHMENTS
See Also:
Constant Field Values

PROP_EXPORTED_SPACEKEY

public static final java.lang.String PROP_EXPORTED_SPACEKEY
Indicates a specific space key which has been exported.

See Also:
Constant Field Values

PROP_CREATED_BY_BUILD_NUMBER

public static final java.lang.String PROP_CREATED_BY_BUILD_NUMBER
build number of the version of confluence that was used to generate export

See Also:
Constant Field Values

PROP_DEFAULT_USERS_GROUP

public static final java.lang.String PROP_DEFAULT_USERS_GROUP
Default users group for this instance, used to remap group permissions on import. See {#link com.atlassian.studio.confluence.importexport.PermissionsImportPreProcessor}

See Also:
Constant Field Values

PROP_PLUGIN_CREATED_BY_VERSION

public static final java.lang.String PROP_PLUGIN_CREATED_BY_VERSION
Plugin version used to export (Mostly for ActiveObjects data)

See Also:
Constant Field Values

PROP_PLUGIN_EARLIEST_VERSION

public static final java.lang.String PROP_PLUGIN_EARLIEST_VERSION
Earliest plugin version compatible with export

See Also:
Constant Field Values

PROP_PLUGINS_EXPORTING_DATA

public static final java.lang.String PROP_PLUGINS_EXPORTING_DATA
See Also:
Constant Field Values
Constructor Detail

ExportUtils

public ExportUtils()
Method Detail

getExportTypeFromExportZip

@Deprecated
public static java.lang.String getExportTypeFromExportZip(java.io.File exportZip)
                                                   throws ImportExportException,
                                                          UnexpectedImportZipFileContents
Deprecated. since 4.2 use ExportDescriptor.getScope()

Extracts only the exportDescriptor.properties from an export zip and determines the type of export.

Throws:
ImportExportException
UnexpectedImportZipFileContents

getExportTypeFromExportZip

@Deprecated
public static java.lang.String getExportTypeFromExportZip(java.io.File exportZip,
                                                                     boolean cleanup)
                                                   throws ImportExportException,
                                                          UnexpectedImportZipFileContents
Deprecated. since 4.2 use ExportDescriptor.getScope()

Extracts only the exportDescriptor.properties from an export zip and determines the type of export.

Throws:
ImportExportException
UnexpectedImportZipFileContents

getExportDescriptor

@Deprecated
public static java.util.Properties getExportDescriptor(java.io.File exportZip,
                                                                  boolean cleanup)
                                                throws ImportExportException,
                                                       UnexpectedImportZipFileContents
Deprecated. since 4.2 use ExportDescriptor.getExportDescriptor(java.io.File) instead.

Parameters:
cleanup - this is ignored since 4.2. The directory will *always* be cleaned up.
Throws:
ImportExportException
UnexpectedImportZipFileContents

isSpaceImport

@Deprecated
public static boolean isSpaceImport(java.io.File importFile)
                             throws ImportExportException,
                                    UnexpectedImportZipFileContents
Deprecated. since 4.2 use ExportDescriptor.isSpaceImport().

Throws:
ImportExportException
UnexpectedImportZipFileContents

getTitleAsFilename

public static java.lang.String getTitleAsFilename(ContentEntityObject ceo)

Utility method to return a version of the content entity's title that's suitable to be used as a filename in an export. Falls back to using the content entity's ID if the title contains unsuitable characters.

This method is used to centralise the code since symmetry is required in the creation of the files during export and the creation of the links to these files in the exported content.

Parameters:
ceo - the ContentEntityObject to retrieve a suitable filename for.
Returns:
a suitable filename for the object.

getTitleAsFilename

public static java.lang.String getTitleAsFilename(SearchResult searchResult)

Utility method to return a version of the search result's title that's suitable to be used as a filename in an export. Falls back to using the ID of the entity if the title contains unsuitable characters.

This method is used to centralise the code since symmetry is required in the creation of the files during export and the creation of the links to these files in the exported content.

Parameters:
searchResult - the SearchResult to retrieve a suitable filename for.
Returns:
a suitable filename for the object.

getTitleAsFilename

public static java.lang.String getTitleAsFilename(java.lang.String title)
Deprecated. since 5.1.4. Use getTitleAsFilename(ContentEntityObject) instead (see CONF-27260)


getTitleAsHref

public static java.lang.String getTitleAsHref(ContentEntityObject ceo)

For a URL encoded filename to be used in a link it will need to be double encoded (since the browser will decode the single encoding when resolving the link, and we have files with encoded names on the filesystem).

This utility method calls getTitleAsFilename(ContentEntityObject) to determine the name of the object on the filesystem. It will then perform a URL encode of the filename, making it suitable for use in links.

This is centralised here since links are created both in Velocity (for the index page) and for individual pages as they are exported.

Parameters:
ceo - the ContentEntityObject to be made suitable for use in an href.
Returns:
the URL-safe version of the filename for the object.

getTitleAsHref

public static java.lang.String getTitleAsHref(SearchResult searchResult)

For a URL encoded filename to be used in a link it will need to be double encoded (since the browser will decode the single encoding when resolving the link, and we have files with encoded names on the filesystem).

This utility method calls getTitleAsFilename(SearchResult) to determine the name of the object on the filesystem. It will then perform a URL encode of the filename, making it suitable for use in links.

This is centralised here since links are created both in Velocity (for the index page) and for individual pages as they are exported.

Parameters:
searchResult - the SearchResult to be made suitable for use in an href.
Returns:
the URL-safe version of the filename for the object.

getTitleAsHref

public static java.lang.String getTitleAsHref(java.lang.String title)
Deprecated. since 5.1.4. Use getTitleAsHref(ContentEntityObject) instead (see CONF-27260)


getSpaceKeyFromExportZip

@Deprecated
public static java.lang.String getSpaceKeyFromExportZip(java.io.File exportZip)
                                                 throws ImportExportException,
                                                        UnexpectedImportZipFileContents
Deprecated. this is unnecessary for space exports produced since Confluence 4.2, where you can just use ExportDescriptor.getSpaceKey().

parses entities.xml file and extracts the first space key it finds

Throws:
ImportExportException
UnexpectedImportZipFileContents


Copyright © 2003-2014 Atlassian. All Rights Reserved.