String xmlBefore = getVersionXml(firstVersionBefore, context); XWikiRCSNodeInfo niBefore = getNode(firstVersionBefore); XWikiRCSNodeContent ncBefore = niBefore.getContent(context); String xmlAfter = getVersionXml(firstVersionAfter, context); String xmlBefore = getVersionXml(firstVersionBefore, context); XWikiRCSNodeInfo niBefore = getNode(firstVersionBefore); XWikiRCSNodeContent ncBefore = niBefore.getContent(context);
/** * @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); } }