You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@jackrabbit.apache.org by JavaJ <po...@yahoo.com> on 2006/09/21 00:10:37 UTC

Version properties

I'm having a problem with getting Node properties from the different Versions
of a Node.  For example:

javax.jcr.Node node = session.getNodeByUUID(id);
javax.jcr.version.VersionIterator it =
nodeToRestore.getVersionHistory().getAllVersions();
while (it.hasNext()) {
    javax.jcr.version.Version version = it.nextVersion();                        	
    version.getProperty("myProp");  <-- this throws a PathNotFoundException
}

I'm not sure why this throws the exception.   I thought that Version is just
a wrapper around the versioned Node.  So shouldn't you be able to get all
the properties in that version of the Node?  It appears that only the
mix:versionable properties are available, i.e. jcr:predecessors,
jcr:isCheckedOut...

Is there a way around this?  Like maybe a way of getting the versionable
Node?



-- 
View this message in context: http://www.nabble.com/Version-properties-tf2308388.html#a6417705
Sent from the Jackrabbit - Users mailing list archive at Nabble.com.


Re: Version properties

Posted by Michael Neale <mi...@gmail.com>.
yeah, thats the trick - fortunately I had someone show me that but at first
it stumped me - perhaps put something on the FAQ in the wiki so others can
benefit?

On 9/20/06, JavaJ <po...@yahoo.com> wrote:
>
>
>
>
> JavaJ wrote:
> >
> > I'm having a problem with getting Node properties from the different
> > Versions of a Node.  For example:
> >
> > javax.jcr.Node node = session.getNodeByUUID(id);
> > javax.jcr.version.VersionIterator it =
> > nodeToRestore.getVersionHistory().getAllVersions();
> > while (it.hasNext()) {
> >     javax.jcr.version.Version version = it.nextVersion();
> >     version.getProperty("myProp");  <-- this throws a
> > PathNotFoundException
> > }
> >
> > I'm not sure why this throws the exception.   I thought that Version is
> > just a wrapper around the versioned Node.  So shouldn't you be able to
> get
> > all the properties in that version of the Node?  It appears that only
> the
> > mix:versionable properties are available, i.e. jcr:predecessors,
> > jcr:isCheckedOut...
> >
> > Is there a way around this?  Like maybe a way of getting the versionable
> > Node?
> >
>
> Ah nevermind.  I just had to get the "jcr:frozenNode" child node.  Duh. :)
> --
> View this message in context:
> http://www.nabble.com/Version-properties-tf2308388.html#a6418106
> Sent from the Jackrabbit - Users mailing list archive at Nabble.com.
>
>

Re: Version properties

Posted by JavaJ <po...@yahoo.com>.


JavaJ wrote:
> 
> I'm having a problem with getting Node properties from the different
> Versions of a Node.  For example:
> 
> javax.jcr.Node node = session.getNodeByUUID(id);
> javax.jcr.version.VersionIterator it =
> nodeToRestore.getVersionHistory().getAllVersions();
> while (it.hasNext()) {
>     javax.jcr.version.Version version = it.nextVersion();                        	
>     version.getProperty("myProp");  <-- this throws a
> PathNotFoundException
> }
> 
> I'm not sure why this throws the exception.   I thought that Version is
> just a wrapper around the versioned Node.  So shouldn't you be able to get
> all the properties in that version of the Node?  It appears that only the
> mix:versionable properties are available, i.e. jcr:predecessors,
> jcr:isCheckedOut...
> 
> Is there a way around this?  Like maybe a way of getting the versionable
> Node?
> 

Ah nevermind.  I just had to get the "jcr:frozenNode" child node.  Duh. :)
-- 
View this message in context: http://www.nabble.com/Version-properties-tf2308388.html#a6418106
Sent from the Jackrabbit - Users mailing list archive at Nabble.com.