/** * @return List of {@link XWikiRCSNodeContent} where vfrom<=version<=vto order by version * @param vfrom - start version * @param vto - end version * @param context - used everywhere * @throws XWikiException if any error */ private List<XWikiRCSNodeContent> loadRCSNodeContents(Version vfrom, Version vto, XWikiContext context) throws XWikiException { List<XWikiRCSNodeContent> result = new ArrayList<XWikiRCSNodeContent>(); for (XWikiRCSNodeInfo nodeInfo : getNodes(vfrom, vto)) { XWikiRCSNodeContent nodeContent = nodeInfo.getContent(context); result.add(nodeContent); } return result; }
/** * @param context - used for load nodes content * @return serialization of class used in {@link com.xpn.xwiki.plugin.packaging.PackagePlugin}. * @throws XWikiException if any error */ public String getArchive(XWikiContext context) throws XWikiException { XWikiRCSArchive archive = new XWikiRCSArchive(getNodes(), context); return archive.toString(); }
/** * @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; }
/** * {@inheritDoc} */ public Version[] getXWikiDocVersions(XWikiDocument doc, XWikiContext context) throws XWikiException { try { XWikiDocumentArchive archive = getXWikiDocumentArchive(doc, context); if (archive == null) { return new Version[0]; } Collection<XWikiRCSNodeInfo> nodes = archive.getNodes(); Version[] versions = new Version[nodes.size()]; Iterator<XWikiRCSNodeInfo> it = nodes.iterator(); for (int i = 0; i < versions.length; i++) { XWikiRCSNodeInfo node = it.next(); versions[versions.length - 1 - i] = node.getId().getVersion(); } return versions; } catch (Exception e) { Object[] args = {doc.getFullName()}; throw new XWikiException(XWikiException.MODULE_XWIKI_STORE, XWikiException.ERROR_XWIKI_STORE_HIBERNATE_READING_REVISIONS, "Exception while reading document {0} revisions", e, args); } }
/** @param versions - collection of XWikiRCSNodeInfo */ public void setNodes(Collection<XWikiRCSNodeInfo> versions) { resetArchive(); for (XWikiRCSNodeInfo node : versions) { updateNode(node); } if (getNodes().size() > 0) { // ensure latest version is full getLatestNode().setDiff(false); updateNode(getLatestNode()); } }
for (Iterator<XWikiRCSNodeInfo> it = getNodes(upperBound, lowerBound).iterator(); it.hasNext();) { XWikiRCSNodeInfo ni = it.next(); fullVersions.remove(ni.getId().getVersion());
XWikiRCSNodeInfo latestNode = getLatestNode(); if (latestNode != null) { int nodesCount = getNodes().size(); int nodesPerFull = context.getWiki() == null ? 5 : Integer.parseInt(context.getWiki().getConfig()