public static int actionToInt(String status) { return DocumentInfo.actionToInt(status); } }
public static String actionToString(int status) { return DocumentInfo.actionToString(status); }
public int getAction() { return doc.getAction(); }
private void setDocumentDefaultAction(String docName, String language, int defaultAction) { if (this.files == null) { return; } for (DocumentInfo docInfo : this.files) { if (docInfo.getFullName().equals(docName) && docInfo.getLanguage().equals(language)) { docInfo.setAction(defaultAction); return; } } }
public void setDocumentAction(String docFullName, int action) { for (DocumentInfo docInfo : this.plugin.getFiles()) { if (docInfo.getFullName().compareTo(docFullName) == 0) { docInfo.setAction(action); } } }
fileInfos.put("defaultAction", String.valueOf(docInfo.getAction())); fileInfos.put("language", String.valueOf(docInfo.getLanguage())); fileInfos.put("fullName", docInfo.getFullName()); if (files.get(docInfo.getDoc().getSpace()) == null) { files.put(docInfo.getDoc().getSpace(), new HashMap<String, List<Map<String, String>>>()); if (files.get(docInfo.getDoc().getSpace()).get(docInfo.getDoc().getName()) == null) { files.get(docInfo.getDoc().getSpace()).put(docInfo.getDoc().getName(), new ArrayList<Map<String, String>>()); files.get(docInfo.getDoc().getSpace()).get(docInfo.getDoc().getName()).add(fileInfos);
if (di.getFullName().equals(doc.getFullName()) && (di.getLanguage().equals(doc.getLanguage()))) { if (defaultAction != DocumentInfo.ACTION_NOT_DEFINED) { di.setAction(defaultAction); di.setDoc(doc); filter(doc, context); DocumentInfo docinfo = new DocumentInfo(doc); docinfo.setAction(defaultAction); this.files.add(docinfo); BaseClass bclass = doc.getXClass();
/** * @return true if the passed document contains a (not-empty) history of previous versions, false otherwise */ private boolean documentContainsHistory(DocumentInfo doc) { if ((doc.getDoc().getDocumentArchive() == null) || (doc.getDoc().getDocumentArchive().getNodes() == null) || (doc.getDoc().getDocumentArchive().getNodes().size() == 0)) { return false; } return true; }
elfile.addAttribute("defaultAction", String.valueOf(docInfo.getAction())); elfile.addAttribute("language", String.valueOf(docInfo.getLanguage())); elfile.addText(docInfo.getFullName()); wr.write(elfile);
public int testInstall(boolean isAdmin, XWikiContext context) log.debug("Package test install document " + ((doc == null) ? "" : getFullName()) + " " + ((doc == null) ? "" : getLanguage())); } finally { if (log.isDebugEnabled()) { log.debug("Package test install document " + ((doc == null) ? "" : getFullName()) + " " + ((doc == null) ? "" : getLanguage()) + " result " + installable);
public static String installStatusToString(int status) { return DocumentInfo.installStatusToString(status); }
/** * @return the language of the described document * * @since 2.2M1 */ public String getLanguage() { return doc.getLanguage(); }
public String getFullName() { return doc.getFullName(); }
public int getFileType() { return doc.getFileType(); }
public int isInstallable() { return doc.isInstallable(); }
LOG.debug("Package installing document " + doc.getFullName() + " " + doc.getLanguage()); if (doc.getAction() == DocumentInfo.ACTION_SKIP) { addToSkipped(doc.getFullName() + ":" + doc.getLanguage(), context); return DocumentInfo.INSTALL_OK; int status = doc.testInstall(isAdmin, context); if (status == DocumentInfo.INSTALL_IMPOSSIBLE) { addToErrors(doc.getFullName() + ":" + doc.getLanguage(), context); return DocumentInfo.INSTALL_IMPOSSIBLE; && doc.getAction() == DocumentInfo.ACTION_OVERWRITE) { XWikiDocument previousdoc = null; if (status == DocumentInfo.INSTALL_ALREADY_EXIST) { previousdoc = context.getWiki().getDocument(doc.getFullName(), context); if (doc.getDoc().getTranslation() != 0) { previousdoc = previousdoc.getTranslatedDocument(doc.getLanguage(), context); addToErrors(doc.getFullName() + ":" + doc.getLanguage(), context); if (LOG.isErrorEnabled()) { LOG.error("Failed to delete document " + previousdoc.getDocumentReference()); doc.getDoc().setAuthor(context.getUser()); doc.getDoc().setContentAuthor(context.getUser()); doc.getDoc().setDate(date); doc.getDoc().setContentUpdateDate(date);
public String export(OutputStream os, XWikiContext context) throws IOException, XWikiException { if (this.files.size() == 0) { return "No Selected file"; } ZipOutputStream zos = new ZipOutputStream(os); for (int i = 0; i < this.files.size(); i++) { DocumentInfo docinfo = this.files.get(i); XWikiDocument doc = docinfo.getDoc(); addToZip(doc, zos, this.withVersions, context); } addInfosToZip(zos, context); zos.finish(); zos.flush(); return ""; }
public void setDocumentAction(String docFullName, String language, int action) { for (DocumentInfo docInfo : this.plugin.getFiles()) { if ((docInfo.getFullName().compareTo(docFullName) == 0) && (language.equals(docInfo.getLanguage()))) { docInfo.setAction(action); } } }
public String exportToDir(File dir, XWikiContext context) throws IOException, XWikiException { if (!dir.exists()) { if (!dir.mkdirs()) { Object[] args = new Object[1]; args[0] = dir.toString(); throw new XWikiException(XWikiException.MODULE_XWIKI, XWikiException.ERROR_XWIKI_MKDIR, "Error creating directory {0}", null, args); } } for (int i = 0; i < this.files.size(); i++) { DocumentInfo docinfo = this.files.get(i); XWikiDocument doc = docinfo.getDoc(); addToDir(doc, dir, this.withVersions, context); } addInfosToDir(dir, context); return ""; }
BaseClass bclass = docinfo.getDoc().getXClass(); hasCustomMappings |= context.getWiki().getStore().injectCustomMapping(bclass, context);