public void setDocumentArchive(String sarch) throws XWikiException { XWikiDocumentArchive xda = new XWikiDocumentArchive(getId()); xda.setArchive(sarch); setDocumentArchive(xda); }
/** * @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; } }
/** * @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; }
doc.setDocumentArchive(archiveDoc); } finally { context.setDatabase(db);
doc.getDoc().setDocumentArchive(previousdoc.getDocumentArchive(context));
archive.removeVersions(v1, v2, context); context.getWiki().getVersioningStore().saveXWikiDocArchive(archive, true, context); tdoc.setDocumentArchive(archive);
if (revisions != null) { try { this.document.setDocumentArchive(revisions); } catch (XWikiException e) { throw new WikiStreamException("Failed to set document archive", e);
doc.setDocumentArchive(getDocumentArchive()); doc.setAuthorReference(getAuthorReference()); doc.setContentAuthorReference(getContentAuthorReference());
setDocumentArchive(document.getDocumentArchive()); setAuthor(document.getAuthor()); setContentAuthor(document.getContentAuthor());