/** @return latest node in history for document. null if none. */ public XWikiRCSNodeInfo getLatestNode() { return getNode(getLatestVersion()); }
XWikiRCSNodeInfo niBefore = getNode(firstVersionBefore); XWikiRCSNodeContent ncBefore = niBefore.getContent(context); ncBefore.getPatch().setFullVersion(xmlBefore); XWikiRCSNodeInfo niBefore = getNode(firstVersionBefore); XWikiRCSNodeContent ncBefore = niBefore.getContent(context); ncBefore.getPatch().setDiffVersion(xmlBefore, xmlAfter, "");
public XWikiRCSNodeInfo getRevisionInfo(String version, XWikiContext context) throws XWikiException { return getDocumentArchive(context).getNode(new Version(version)); }
/** * @return selected version of document, null if version is not found. * @param version - which version to load * @param context - used for loading * @throws XWikiException if any error */ public XWikiDocument loadDocument(Version version, XWikiContext context) throws XWikiException { XWikiRCSNodeInfo nodeInfo = getNode(version); if (nodeInfo == null) { return null; } try { String content = getVersionXml(version, context); XWikiDocument doc = new XWikiDocument(); doc.fromXML(content); doc.setRCSVersion(version); doc.setComment(nodeInfo.getComment()); doc.setAuthor(nodeInfo.getAuthor()); doc.setMinorEdit(nodeInfo.isMinorEdit()); doc.setMostRecent(version.equals(getLatestVersion())); return doc; } catch (Exception e) { Object[] args = {version.toString(), new Long(getId())}; throw new XWikiException(XWikiException.MODULE_XWIKI_STORE, XWikiException.ERROR_XWIKI_STORE_RCS_READING_REVISIONS, "Exception while reading version [{0}] for document id [{1,number}]", e, args); } }