Package com.xpn.xwiki.plugin.packaging
Class PackageAPI
- java.lang.Object
-
- com.xpn.xwiki.api.Api
-
- com.xpn.xwiki.plugin.packaging.PackageAPI
-
public class PackageAPI extends Api
Deprecated.since 5.2, use Filter framework instead- Version:
- $Id: a1f71eea9d685d5f18395b6739dd26e729fef5e3 $
-
-
Constructor Summary
Constructors Constructor Description PackageAPI(Package plugin, XWikiContext context)
Deprecated.
-
Method Summary
All Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description boolean
add(String docFullName)
Deprecated.boolean
add(String docFullName, int DefaultAction)
Deprecated.void
addDocumentFilter(Object filter)
Deprecated.void
backupWiki()
Deprecated.String
export()
Deprecated.String
getAuthorName()
Deprecated.String
getDescription()
Deprecated.List<String>
getErrors()
Deprecated.List<DocumentInfoAPI>
getFiles()
Deprecated.List<String>
getInstalled()
Deprecated.String
getLicence()
Deprecated.String
getName()
Deprecated.Package
getPackage()
Deprecated.List<String>
getSkipped()
Deprecated.int
getStatus()
Deprecated.String
getVersion()
Deprecated.boolean
hasBackupPackImportRights()
Deprecated.Indicate if the current user has the right to import a package as a backup pack.String
Import(byte[] file)
Deprecated.Load a package in memory from a byte array.String
Import(InputStream file)
Deprecated.Load a package in memory from an InputStream.boolean
importPackageFromByteArray(byte[] data)
Deprecated.Similar toImport(byte[])
, except expected errors are catch.int
install()
Deprecated.boolean
isBackupPack()
Deprecated.boolean
isVersionPreserved()
Deprecated.boolean
isWithVersions()
Deprecated.void
setAuthorName(String authorName)
Deprecated.void
setBackupPack(boolean backupPack)
Deprecated.void
setDescription(String description)
Deprecated.void
setDocumentAction(String docFullName, int action)
Deprecated.void
setDocumentAction(String docFullName, String language, int action)
Deprecated.void
setLicence(String licence)
Deprecated.void
setName(String name)
Deprecated.void
setPreserveVersion(boolean preserveVersion)
Deprecated.Sets the flag for the packager to preserve or not existing versions of documents when installing withinstall()
.void
setVersion(String version)
Deprecated.void
setWithVersions(boolean withVersions)
Deprecated.Sets the flag for the packager to import or not history revisions included in the archive when installing withinstall()
.int
testInstall()
Deprecated.int
testInstall(boolean isAdmin)
Deprecated.net.sf.json.JSONObject
toJSON()
Deprecated.String
toXml()
Deprecated.-
Methods inherited from class com.xpn.xwiki.api.Api
convert, convert, convert, convertAttachments, getAuthorizationManager, getContextualAuthorizationManager, getXWikiContext, hasAccess, hasAccessLevel, hasAdminRights, hasProgrammingRights, hasWikiAdminRights
-
-
-
-
Constructor Detail
-
PackageAPI
public PackageAPI(Package plugin, XWikiContext context) throws PackageException
Deprecated.- Throws:
PackageException
-
-
Method Detail
-
getName
public String getName()
Deprecated.
-
setName
public void setName(String name)
Deprecated.
-
getPackage
public Package getPackage()
Deprecated.
-
getDescription
public String getDescription()
Deprecated.
-
setDescription
public void setDescription(String description)
Deprecated.
-
getVersion
public String getVersion()
Deprecated.
-
setVersion
public void setVersion(String version)
Deprecated.
-
getLicence
public String getLicence()
Deprecated.
-
setLicence
public void setLicence(String licence)
Deprecated.
-
getAuthorName
public String getAuthorName()
Deprecated.
-
setAuthorName
public void setAuthorName(String authorName)
Deprecated.
-
isBackupPack
public boolean isBackupPack()
Deprecated.
-
setBackupPack
public void setBackupPack(boolean backupPack)
Deprecated.
-
hasBackupPackImportRights
public boolean hasBackupPackImportRights()
Deprecated.Indicate if the current user has the right to import a package as a backup pack. In this implementation, to be able to import has backup pack the user must have the admin right on the XWiki.XWikiPreferences document from the main wiki (xwiki:XWiki.XWikiPreferences). The goal is to prevent local wiki administrators from importing documents saved with a global administrator as the author (rights escalation).- Returns:
- true if the current user has the rights to import a package as a backup pack, false otherwise
-
isVersionPreserved
public boolean isVersionPreserved()
Deprecated.
-
setPreserveVersion
public void setPreserveVersion(boolean preserveVersion)
Deprecated.Sets the flag for the packager to preserve or not existing versions of documents when installing withinstall()
. If set to true, the existing history revisions of documents will be preserve, if not, the history will be overridden.- Parameters:
preserveVersion
-
-
isWithVersions
public boolean isWithVersions()
Deprecated.
-
setWithVersions
public void setWithVersions(boolean withVersions)
Deprecated.Sets the flag for the packager to import or not history revisions included in the archive when installing withinstall()
. This flag will be ignored ifisWithVersions()
flag is set to true. This means it's not possible to import with versions, preserving the existing document history. The behavior of the packager in this case fall backs on just adding a new version to the exsting history (ignoring the history from the package).- Parameters:
withVersions
- should the versions contained in the archive (if any) be imported when installing.
-
addDocumentFilter
public void addDocumentFilter(Object filter) throws PackageException
Deprecated.- Throws:
PackageException
-
getFiles
public List<DocumentInfoAPI> getFiles()
Deprecated.
-
add
public boolean add(String docFullName, int DefaultAction) throws XWikiException
Deprecated.- Throws:
XWikiException
-
add
public boolean add(String docFullName) throws XWikiException
Deprecated.- Throws:
XWikiException
-
setDocumentAction
public void setDocumentAction(String docFullName, int action)
Deprecated.
-
setDocumentAction
public void setDocumentAction(String docFullName, String language, int action)
Deprecated.
-
export
public String export() throws IOException, XWikiException
Deprecated.- Throws:
IOException
XWikiException
-
importPackageFromByteArray
public boolean importPackageFromByteArray(byte[] data)
Deprecated.Similar toImport(byte[])
, except expected errors are catch. This version should be privileged when using the packager API from velocity scripts since it will not display stack-trace in case of error (for example if the passed file is not a valid package).- Parameters:
data
- the file to create the package from, as a byte array.- Returns:
- true if the package creation succeeded, false otherwise. If the package creation failed, the error
message is placed in the velocity context under the
import_error
key, - Since:
- 2.2M1
-
Import
public String Import(byte[] file) throws IOException, XWikiException
Deprecated.Load a package in memory from a byte array. It may be installed later usinginstall()
. Your should preferImport(InputStream)
which may avoid loading the package twice in memory.- Parameters:
file
- an byte array containing a zipped package file- Returns:
- an empty string, useless.
- Throws:
IOException
- while reading the ZipFileXWikiException
- when package content is broken
-
Import
public String Import(InputStream file) throws IOException, XWikiException
Deprecated.Load a package in memory from an InputStream. It may be installed later usinginstall()
.- Parameters:
file
- is an InputStream of a zipped package file- Returns:
- an empty string, useless.
- Throws:
IOException
- while reading the ZipFileXWikiException
- when package content is broken- Since:
- 2.3M2
-
testInstall
public int testInstall()
Deprecated.
-
testInstall
public int testInstall(boolean isAdmin)
Deprecated.
-
backupWiki
public void backupWiki() throws XWikiException, IOException
Deprecated.- Throws:
XWikiException
IOException
-
toXml
public String toXml()
Deprecated.
-
toJSON
public net.sf.json.JSONObject toJSON()
Deprecated.- Returns:
- a representation of this package under the JSON format
- Since:
- 2.2M1
-
install
public int install() throws XWikiException
Deprecated.- Throws:
XWikiException
-
getStatus
public int getStatus()
Deprecated.
-
-