OK I have found the solution..
VersionHistory versionHistory =
session.getWorkspace().getVersionManager().getVersionHistory(page.getPath());
VersionIterator it = versionHistory.getAllVersions();
it.skip(1);
while ( it.hasNext()) {
Version version = it.nextVersion();
NodeIterator nodeIterator = version.getNodes();
while(nodeIterator.hasNext()){
Node node = nodeIterator.nextNode();
System.out.println(node.getProperty("name").getString() + " " +
node.getProperty("published").getString());
}
}
Why do I need to skip passed the first version?
2009/12/14 Ben Short <[email protected]>:
> Hi,
>
> I'm using Jackrabbit 2. Is the following scenario possible?
>
> Node page = testRootNode.addNode("page");
> page.addMixin("mix:versionable");
> page.setProperty("name", "1");
> page.setProperty("published", true);
>
> session.save();
>
>
> session.getWorkspace().getVersionManager().checkin(page.getPath());
>
>
> session.getWorkspace().getVersionManager().checkout(page.getPath());
> page.setProperty("name", "2");
> page.setProperty("published", false);
>
> session.save();
>
>
> session.getWorkspace().getVersionManager().checkin(page.getPath());
>
> At this point I would want to get the node that has the published
> property set to true.
>
> I can't see how to get the actual node from the version history so I
> can query the bodes properties.
>
> How can I proceed?
>
> Ben Short
>