com.atlassian.confluence.importexport.impl
Class ExportUtils

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

public class ExportUtils
extends Object


Field Summary
static String PROP_BACKUP_ATTACHMENTS
           
static String PROP_BUILD_NUMBER
           
static String PROP_EXPORT_TYPE
           
static String PROP_EXPORTED_SPACEKEY
          Indicates a specific space key which has been exported.
 
Constructor Summary
ExportUtils()
           
 
Method Summary
static Properties getExportDescriptor(File exportZip, boolean cleanup)
          Deprecated. since 4.2 use ExportDescriptor.getExportDescriptor(java.io.File) instead.
static String getExportTypeFromExportZip(File exportZip)
          Deprecated. since 4.2 use ExportDescriptor.getScope()
static String getExportTypeFromExportZip(File exportZip, boolean cleanup)
          Deprecated. since 4.2 use ExportDescriptor.getScope()
static String getSpaceKeyFromExportZip(File exportZip)
          Deprecated. this is unnecessary for space exports produced since Confluence 4.2, where you can just use ExportDescriptor.getSpaceKey().
static String getTitleAsFilename(String pageTitle)
           Utility method to return a version of the supplied page title suitable as use in a filename during export.
static String getTitleAsHref(String pageTitle)
           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 file with encoded names on the filesystem).
static boolean isSpaceImport(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 String PROP_BUILD_NUMBER
See Also:
Constant Field Values

PROP_EXPORT_TYPE

public static final String PROP_EXPORT_TYPE
See Also:
Constant Field Values

PROP_BACKUP_ATTACHMENTS

public static final String PROP_BACKUP_ATTACHMENTS
See Also:
Constant Field Values

PROP_EXPORTED_SPACEKEY

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

See Also:
Constant Field Values
Constructor Detail

ExportUtils

public ExportUtils()
Method Detail

getExportTypeFromExportZip

@Deprecated
public static String getExportTypeFromExportZip(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 String getExportTypeFromExportZip(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 Properties getExportDescriptor(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(File importFile)
                             throws ImportExportException,
                                    UnexpectedImportZipFileContents
Deprecated. since 4.2 use ExportDescriptor.isSpaceImport().

Throws:
ImportExportException
UnexpectedImportZipFileContents

getTitleAsFilename

public static String getTitleAsFilename(String pageTitle)

Utility method to return a version of the supplied page title suitable as use in a filename during export. The file name will be URL encoded meaning that file names returned may contain all ascii characters, the percentage sign and the plus sign (representing spaces). These characters are all permitted on ext2, ext3, NTFS, HFS+ and FAT-32 which I believe is full coverage for our supported environments.

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.

It seems in practise that some version of operating systems will struggle with asterisk characters in filenames (see CONF-10741)

Parameters:
pageTitle - the page title to be returned as a filename.
Returns:
the file system safe file name version of the page title.

getTitleAsHref

public static String getTitleAsHref(String pageTitle)

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 file with encoded names on the filesystem). This utility method will perform a URL encode of the supplied 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:
pageTitle - the page title to be made suitable for use in an href.

getSpaceKeyFromExportZip

@Deprecated
public static String getSpaceKeyFromExportZip(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-2013 Atlassian. All Rights Reserved.