嗨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