jackrabbit-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Jukka Zitting" <jukka.zitt...@gmail.com>
Subject Re: Cannot update previous version of nt:file node
Date Thu, 15 Mar 2007 16:32:03 GMT
Hi,

On 3/15/07, Lubos and Alena Pochman <pochmans@gmail.com> wrote:
> thanks for the response. My question is, why is the predecessor empty?

When you create a mix:versionable node, an empty "root version" get's
created in the version storage as a sentinel that acts as the
predecessor of the first actual version that you checkin().

> Didn't I created new version with the document.checkin(), document.checkout()?
> The modification worked, when I retrieve the modified data by using the modified
> document node directly, the new data are there. But where is the previous version?
> When I repeat the process I still get only predecessors.length == 1. So I
> must be doing something wrong in trying to create new version it the code:
>
>         document.checkout();
>         Node content = (Node)document.getPrimaryItem();
>         content.setProperty("jcr:data", new
> ByteArrayInputStream(zipContents));
>         content.setProperty("jcr:lastModified", Calendar.getInstance());
>         this.session.save();
>         document.checkin();
>
> It looks like I am updating the current node without creating a new version?
> And why in this case predecessors.length == 1? Shouldn't it be 0?

It depends on what you did before the document.checkout() call. If you
just created the document node, then the results you describe are
correct. The base version you get using document.getBaseVersion() is
the one checked in with the document.checkin() call, and the one
predecessor is the root version that got created when the versionable
document node was first saved.

You can create new versions of the document node and increase the
predecessors list by repeating the document.checout() ...
document.checkin() cycle.

> To be honest, even after re-reading the JSR-170 spec several times on
> versioning, it is hard for me to get my head around it. Is there any tutorial
> and or book I can use to learn more about the versioning topic?

I feel your pain. Unfortunately there isn't yet very much introductory
material on JCR.

PS. I will be giving a JCR tutorial in ApacheCon EU in early May, see
http://www.eu.apachecon.com/ for the details. The tutorial materials
will sooner or later after the ApacheCon find their way also onto the
Jackrabbit web site.

BR,

Jukka Zitting

Mime
View raw message