jackrabbit-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Marcel Reutegger <marcel.reuteg...@gmx.net>
Subject Re: Version.getPredecessors()?
Date Tue, 08 Apr 2008 15:39:07 GMT
Hi Brett,

Conoly, Brett wrote:
> I'm currently trying to retrieve a list of all the previous versions of
> a node.
> I'm actually using: 
> <pre>
> Version version = node.getBaseVersion();
> Version[] versionArray = version.getPredecessors();
> for (int i = 0; i < versionArray.length; i++)
>        versions.add(versionArray[i]);
> </pre>
> Going through the debugger this doesn't seem to be throwing any errors
> but for some reason this ALWAYS seems to return 1 version no matter how
> many there actually are.

see spec p238, where it says:

"jcr:predecessors: A multi-value REFERENCE property that
points to the immediate predecessors of this version in the
version history."

if you want all predecessors, then you need to traverse the version graph manually.

> Am I doing something wrong? I'm also assuming that the BaseVersion is
> the most recent version, is this right? 

not necessarily. the base version is the version a node is based on in your 
workspace. if you restore your node to a previous version, the base version of 
that node is not the most recent anymore.


View raw message