Class PackageAPI


  • public class PackageAPI
    extends Api
    Deprecated.
    since 5.2, use Filter framework instead
    Version:
    $Id: a1f71eea9d685d5f18395b6739dd26e729fef5e3 $
    • 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 with install(). 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 with 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).
        Parameters:
        withVersions - should the versions contained in the archive (if any) be imported when installing.
      • setDocumentAction

        public void setDocumentAction​(String docFullName,
                                      int action)
        Deprecated.
      • setDocumentAction

        public void setDocumentAction​(String docFullName,
                                      String language,
                                      int action)
        Deprecated.
      • importPackageFromByteArray

        public boolean importPackageFromByteArray​(byte[] data)
        Deprecated.
        Similar to 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).
        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 using install(). Your should prefer Import(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 ZipFile
        XWikiException - 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 using install().
        Parameters:
        file - is an InputStream of a zipped package file
        Returns:
        an empty string, useless.
        Throws:
        IOException - while reading the ZipFile
        XWikiException - when package content is broken
        Since:
        2.3M2
      • testInstall

        public int testInstall()
        Deprecated.
      • testInstall

        public int testInstall​(boolean isAdmin)
        Deprecated.
      • 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
      • getErrors

        public List<String> getErrors()
        Deprecated.
      • getSkipped

        public List<String> getSkipped()
        Deprecated.
      • getInstalled

        public List<String> getInstalled()
        Deprecated.
      • getStatus

        public int getStatus()
        Deprecated.