嗨iam试图恢复节点的版本。但不顺心的事:JCR Jackrabbit Versionising
Session session = repository.login(new SimpleCredentials("test1", "".toCharArray()));
Workspace ws = session.getWorkspace();
Node parentNode = session.getRootNode();
//Create a first version
Node n = parentNode.addNode("childNode", "nt:unstructured");
n.addMixin("mix:versionable");
n.setProperty("anyProperty", "Blah");
session.save();
Version firstVersion = ws.getVersionManager().checkin("/childNode");
// add new version
ws.getVersionManager().checkout("/childNode");
n.setProperty("anyProperty", "Blah2");
session.save();
ws.getVersionManager().checkin("/childNode");
// restoring old version
ws.getVersionManager().restore("/childNode", firstVersion, true);
之后,我得到
javax.jcr.version.VersionException: VersionManager.restore(String, Version, boolean) not allowed on existing nodes; use VersionManager.restore(Version, boolean) instead: /childNode
通过API的外观,它看起来像使用Sling'VersionManager'。那是对的吗? – 2012-03-30 12:44:26
不,它是“import javax.jcr.version.VersionManager;”与jackrabbit – wutzebaer 2012-03-30 14:59:25