jackrabbit-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Lubos and Alena Pochman" <pochm...@gmail.com>
Subject Re: [JCR Browser] Is there a way to update nt:file nodes property
Date Wed, 14 Mar 2007 23:09:23 GMT
Hmm, this does not work for me. I am getting "path does not exist" exception
when doing
predecessors[i].getProperty("jcr:frozenNode/jcr:content/jcr:data"),
but I can get the property on the current version with predecessors[i]
.getProperty("jcr:frozenNode/jcr:content/jcr:data")?

What am I doing wrong?

Lubos

On 3/14/07, Jukka Zitting <jukka.zitting@gmail.com> wrote:
>
> Hi,
>
> On 3/14/07, Sudhan <s.kanade@gmail.com> wrote:
> > Actually my application needs to store difference of file size between
> > version 1.1 and 1.0. Say i updated a file abc.txt by adding some 20 kb
> of
> > data. I need to see this 20 kb on version 1.1 so that I can know that
> how kb
> > difference exists between the present version and its predecessor.
> >
> > presently i have a listener which listens to
> /jcr:system/jcr:versionStorage
> > node.
> >
> > Is there any other way to achive above goal.
>
> The version history keeps a full copy of also the binary properties of
> previous versions, so you could use the getLength() method also to
> find the previous file sizes.
>
> The following code would print out size of the current version and of
> all the predecessor versions:
>
>     Node file = <the checked out copy of the file>;
>     System.out.println("Current: "
>         + file.getProperty("jcr:content/jcr:data").getLength());
>     Version base = file.getBaseVersion();
>     System.out.println(base.getCreated() + ": "
>         + base.getProperty
> ("jcr:frozenNode/jcr:content/jcr:data").getLength());
>     Version[] predecessors = base.getPredecessors();
>     for (int i = 0; i < predecessors.length; i++) {
>         System.out.println(predecessors[i].getCreated() + ": "
>             + file.getProperty
> ("jcr:frozenNode/jcr:content/jcr:data").getLength());
>     }
>
> BR,
>
> Jukka Zitting
>

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message