Search in sources :

Example 1 with XWikiRCSArchive

use of com.xpn.xwiki.doc.rcs.XWikiRCSArchive in project xwiki-platform by xwiki.

the class XWikiDocumentArchive method setArchive.

/**
 * Deserialize class. Used in {@link com.xpn.xwiki.plugin.packaging.PackagePlugin}.
 *
 * @param text - archive in JRCS format
 * @throws XWikiException if parse error
 */
public void setArchive(String text) throws XWikiException {
    try {
        XWikiRCSArchive archive = new XWikiRCSArchive(text);
        resetArchive();
        Collection nodes = archive.getNodes(getId());
        for (Iterator it = nodes.iterator(); it.hasNext(); ) {
            XWikiRCSNodeInfo nodeInfo = (XWikiRCSNodeInfo) it.next();
            XWikiRCSNodeContent nodeContent = (XWikiRCSNodeContent) it.next();
            updateNode(nodeInfo);
            this.updatedNodeInfos.add(nodeInfo);
            this.updatedNodeContents.add(nodeContent);
        }
    } catch (Exception e) {
        Object[] args = { text, Long.valueOf(getId()) };
        throw new XWikiException(XWikiException.MODULE_XWIKI_DIFF, XWikiException.ERROR_XWIKI_DIFF_CONTENT_ERROR, "Exception while constructing archive for JRCS string [{0}] for document [{1}]", e, args);
    }
}
Also used : XWikiRCSArchive(com.xpn.xwiki.doc.rcs.XWikiRCSArchive) XWikiRCSNodeContent(com.xpn.xwiki.doc.rcs.XWikiRCSNodeContent) XWikiRCSNodeInfo(com.xpn.xwiki.doc.rcs.XWikiRCSNodeInfo) Iterator(java.util.Iterator) Collection(java.util.Collection) XWikiException(com.xpn.xwiki.XWikiException) XWikiException(com.xpn.xwiki.XWikiException)

Aggregations

XWikiException (com.xpn.xwiki.XWikiException)1 XWikiRCSArchive (com.xpn.xwiki.doc.rcs.XWikiRCSArchive)1 XWikiRCSNodeContent (com.xpn.xwiki.doc.rcs.XWikiRCSNodeContent)1 XWikiRCSNodeInfo (com.xpn.xwiki.doc.rcs.XWikiRCSNodeInfo)1 Collection (java.util.Collection)1 Iterator (java.util.Iterator)1