/** * {@inheritDoc} * * @see com.xpn.xwiki.doc.XWikiDocument#getDocumentArchive() */ @Override public XWikiDocumentArchive getDocumentArchive() { return getDocument().getDocumentArchive(); }
/** * {@inheritDoc} * * @see com.xpn.xwiki.doc.XWikiDocument#getDocumentArchive(com.xpn.xwiki.XWikiContext) */ @Override public XWikiDocumentArchive getDocumentArchive(XWikiContext context) throws XWikiException { return getDocument().getDocumentArchive(context); }
public XWikiDocumentArchive getDocumentArchive(XWikiContext context) throws XWikiException { loadArchive(context); return getDocumentArchive(); }
/** * @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; }
/** * Get the archive of this document's history. * This function is accessible only if you have the programming rights. * * @return the archive of this document's history as an {@link XWikiDocumentArchive}. */ public XWikiDocumentArchive getDocumentArchive() throws XWikiException { if (hasProgrammingRights()) { return this.doc.getDocumentArchive(getXWikiContext()); } return null; }
public XWikiRCSNodeInfo getRevisionInfo(String version, XWikiContext context) throws XWikiException { return getDocumentArchive(context).getNode(new Version(version)); }
/** * @return the archive of the document in a string format. */ public String getArchive() throws XWikiException { return this.doc.getDocumentArchive(getXWikiContext()).getArchive(getXWikiContext()); }
/** * @return the {@link XWikiDocumentArchive} for this document. If it is not stored in the document, we get it using * the current context. If there is an exception, null is returned. */ public XWikiDocumentArchive loadDocumentArchive() { XWikiDocumentArchive arch = getDocumentArchive(); if (arch != null) { return arch; } XWikiContext xcontext = getXWikiContext(); try { arch = getVersioningStore(xcontext).getXWikiDocumentArchive(this, xcontext); // Put a copy of the archive in the soft reference for later use if needed. setDocumentArchive(arch); return arch; } catch (Exception e) { // VersioningStore.getXWikiDocumentArchive may throw an XWikiException, and xcontext or VersioningStore // may be null (tests) // To maintain the behavior of this method we can't throw an exception. // Formerly, null was returned if there was no SoftReference. LOG.warn("Could not get document archive", e); return null; } }
public List<Delta> getLastChanges(XWikiContext context) throws XWikiException, DifferentiationFailedException { Version version = getRCSVersion(); try { String prev = getDocumentArchive(context).getPrevVersion(version).toString(); XWikiDocument prevDoc = context.getWiki().getDocument(this, prev, context); return getDeltas(Diff.diff(ToString.stringToArray(prevDoc.getContent()), ToString.stringToArray(getContent()))); } catch (Exception ex) { LOG.debug("Exception getting differences from previous version: " + ex.getMessage()); } return new ArrayList<Delta>(); }
doc.setMetaDataDirty(false); } else { if (doc.getDocumentArchive() != null) { context.getWiki().getVersioningStore().saveXWikiDocArchive(doc.getDocumentArchive(), false, context); doc.getDocumentArchive(context);
/** * @since 2.2M1 */ public XWikiDocument copyDocument(DocumentReference newDocumentReference, XWikiContext context) throws XWikiException { loadAttachments(context); loadArchive(context); XWikiDocument newdoc = duplicate(newDocumentReference); newdoc.setOriginalDocument(null); newdoc.setContentDirty(true); newdoc.getXClass().setDocumentReference(newDocumentReference); XWikiDocumentArchive archive = newdoc.getDocumentArchive(); if (archive != null) { newdoc.setDocumentArchive(archive.clone(newdoc.getId(), context)); } return newdoc; }
try { localeParameters.put(XWikiWikiDocumentFilter.PARAMETER_JRCSREVISIONS, document.getDocumentArchive(xcontext).getArchive(xcontext)); } catch (XWikiException e) { this.logger.error("Document [{}] has malformed history", document.getDocumentReference(), e);
XWikiDocumentArchive archiveDoc = doc.getDocumentArchive(); if (archiveDoc != null) { return archiveDoc;
doc.getDoc().setDocumentArchive(previousdoc.getDocumentArchive(context)); if (doc.getDoc().getDocumentArchive() != null) { context.getWiki().getVersioningStore().saveXWikiDocArchive( doc.getDoc().getDocumentArchive(context), true, context);
if (document.isNew() && document.getDocumentArchive() != null) { if (document.getDocumentArchive() != null) { xcontext.getWiki().getVersioningStore() .saveXWikiDocArchive(document.getDocumentArchive(xcontext), true, xcontext);
XWikiDocument tdoc = getTranslatedDocument(doc, language, context); XWikiDocumentArchive archive = tdoc.getDocumentArchive(context); archive.removeVersions(v1, v2, context); context.getWiki().getVersioningStore().saveXWikiDocArchive(archive, true, context);
doc.setDocumentArchive(getDocumentArchive()); doc.setAuthorReference(getAuthorReference()); doc.setContentAuthorReference(getContentAuthorReference());
el = new DOMElement("versions"); try { el.addText(getDocumentArchive(context).getArchive(context)); wr.write(el); } catch (XWikiException e) {
setDocumentArchive(document.getDocumentArchive()); setAuthor(document.getAuthor()); setContentAuthor(document.getContentAuthor());