|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.xpn.xwiki.api.Api
com.xpn.xwiki.plugin.packaging.PackageAPI
public class PackageAPI
Field Summary |
---|
Fields inherited from class com.xpn.xwiki.api.Api |
---|
context |
Constructor Summary | |
---|---|
PackageAPI(Package plugin,
XWikiContext context)
|
Method Summary | |
---|---|
boolean |
add(String docFullName)
|
boolean |
add(String docFullName,
int DefaultAction)
|
void |
addDocumentFilter(Object filter)
|
void |
backupWiki()
|
String |
export()
|
String |
getAuthorName()
|
String |
getDescription()
|
List<String> |
getErrors()
|
List<DocumentInfoAPI> |
getFiles()
|
List<String> |
getInstalled()
|
String |
getLicence()
|
String |
getName()
|
Package |
getPackage()
|
List<String> |
getSkipped()
|
int |
getStatus()
|
String |
getVersion()
|
boolean |
hasBackupPackImportRights()
Indicate if the current user has the right to import a package as a backup pack. |
String |
Import(byte[] file)
Load a package in memory from a byte array. |
String |
Import(InputStream file)
Load a package in memory from an InputStream. |
boolean |
importPackageFromByteArray(byte[] data)
Similar to Import(byte[]) , except expected errors are catch. |
int |
install()
|
boolean |
isBackupPack()
|
boolean |
isVersionPreserved()
|
boolean |
isWithVersions()
|
void |
setAuthorName(String authorName)
|
void |
setBackupPack(boolean backupPack)
|
void |
setDescription(String description)
|
void |
setDocumentAction(String docFullName,
int action)
|
void |
setDocumentAction(String docFullName,
String language,
int action)
|
void |
setLicence(String licence)
|
void |
setName(String name)
|
void |
setPreserveVersion(boolean preserveVersion)
Sets the flag for the packager to preserve or not existing versions of documents when installing with install() . |
void |
setVersion(String version)
|
void |
setWithVersions(boolean withVersions)
Sets the flag for the packager to import or not history revisions included in the archive when installing with install() . |
int |
testInstall()
|
int |
testInstall(boolean isAdmin)
|
net.sf.json.JSONObject |
toJSON()
|
String |
toXml()
|
Methods inherited from class com.xpn.xwiki.api.Api |
---|
convert, convert, convert, convertAttachments, getXWikiContext, hasAccessLevel, hasAdminRights, hasProgrammingRights, hasWikiAdminRights |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public PackageAPI(Package plugin, XWikiContext context) throws PackageException
PackageException
Method Detail |
---|
public String getName()
public void setName(String name)
public Package getPackage()
public String getDescription()
public void setDescription(String description)
public String getVersion()
public void setVersion(String version)
public String getLicence()
public void setLicence(String licence)
public String getAuthorName()
public void setAuthorName(String authorName)
public boolean isBackupPack()
public void setBackupPack(boolean backupPack)
public boolean hasBackupPackImportRights()
public boolean isVersionPreserved()
public void setPreserveVersion(boolean preserveVersion)
install()
. If set to true, the existing history revisions of documents will be preserve, if not, the
history will be overridden.
preserveVersion
- public boolean isWithVersions()
public void setWithVersions(boolean withVersions)
install()
. This flag will be ignored if isWithVersions()
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).
withVersions
- should the versions contained in the archive (if any) be imported when installing.public void addDocumentFilter(Object filter) throws PackageException
PackageException
public List<DocumentInfoAPI> getFiles()
public boolean add(String docFullName, int DefaultAction) throws XWikiException
XWikiException
public boolean add(String docFullName) throws XWikiException
XWikiException
public void setDocumentAction(String docFullName, int action)
public void setDocumentAction(String docFullName, String language, int action)
public String export() throws IOException, XWikiException
IOException
XWikiException
public boolean importPackageFromByteArray(byte[] data)
Import(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).
data
- the file to create the package from, as a byte array.
import_error
key,public String Import(byte[] file) throws IOException, XWikiException
install()
. Your should
prefer Import(InputStream)
which may avoid loading the package twice in memory.
file
- an byte array containing a zipped package file
IOException
- while reading the ZipFile
XWikiException
- when package content is brokenpublic String Import(InputStream file) throws IOException, XWikiException
install()
.
file
- is an InputStream of a zipped package file
IOException
- while reading the ZipFile
XWikiException
- when package content is brokenpublic int testInstall()
public int testInstall(boolean isAdmin)
public void backupWiki() throws XWikiException, IOException
XWikiException
IOException
public String toXml()
public net.sf.json.JSONObject toJSON()
public int install() throws XWikiException
XWikiException
public List<String> getErrors()
public List<String> getSkipped()
public List<String> getInstalled()
public int getStatus()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |