public PackageAPI(Package plugin, XWikiContext context) throws PackageException { super(context); if (!hasAdminRights()) { throw new PackageException(XWikiException.ERROR_XWIKI_ACCESS_DENIED, "Admin right is needed to use this plugin"); } setPlugin(plugin); }
public List<String> getErrors() { return this.plugin.getErrors(getXWikiContext()); }
public List<String> getSkipped() { return this.plugin.getSkipped(getXWikiContext()); }
public void backupWiki() throws XWikiException, IOException { this.plugin.addAllWikiDocuments(getXWikiContext()); this.export(); }
public boolean add(String docFullName, int DefaultAction) throws XWikiException { return this.plugin.add(docFullName, DefaultAction, getXWikiContext()); }
/** * Load a package in memory from a byte array. It may be installed later using {@link #install()}. * Your should prefer {@link #Import(InputStream, XWikiContext) which may avoid loading the package twice in memory. * * @param file an byte array containing a zipped package file * @return an empty string, useless. * @throws IOException while reading the ZipFile * @throws XWikiException when package content is broken */ public String Import(byte file[]) throws IOException, XWikiException { return this.plugin.Import(file, getXWikiContext()); }
public int testInstall() { return this.plugin.testInstall(false, getXWikiContext()); }
public String toXml() { return this.plugin.toXml(getXWikiContext()); }
public int getStatus() { return this.plugin.getStatus(getXWikiContext()); }
public Api getPluginApi(XWikiPluginInterface plugin, XWikiContext context) { try { return new PackageAPI(new Package(), context); } catch (PackageException e) { return null; } }
/** * @return a representation of this package under the JSON format * * @since 2.2M1 */ public JSONObject toJSON() { return this.plugin.toJSON(getXWikiContext()); }
public int install() throws XWikiException { return this.plugin.install(getXWikiContext()); }
/** * Generate a relative path based on provided document. * * @param doc the document to export. * @return the corresponding path. */ public String getPathFromDocument(XWikiDocument doc, XWikiContext context) { return getDirectoryForDocument(doc) + getFileNameFromDocument(doc, context); }
public List<String> getInstalled() { return this.plugin.getInstalled(getXWikiContext()); }
public PackagePlugin(String name, String className, XWikiContext context) { super(name, className, context); init(context); }
public void filter(XWikiDocument doc, XWikiContext context) throws ExcludeDocumentException { for (DocumentFilter docFilter : this.documentFilters) { docFilter.filter(doc, context); } }
/** * 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). * * @return true if the current user has the rights to import a package as a backup pack, false otherwise */ public boolean hasBackupPackImportRights() { return plugin.hasBackupPackImportRights(context); }
public boolean add(String docFullName) throws XWikiException { return this.plugin.add(docFullName, getXWikiContext()); }
/** * Load a package in memory from an InputStream. It may be installed later using {@link #install()}. * * @param is an InputStream of a zipped package file * @return an empty string, useless. * @throws IOException while reading the ZipFile * @throws XWikiException when package content is broken * @since 2.3M2 */ public String Import(InputStream file) throws IOException, XWikiException { return this.plugin.Import(file, getXWikiContext()); }
public int testInstall(boolean isAdmin) { return this.plugin.testInstall(isAdmin, getXWikiContext()); }