jackrabbit-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Bruno Dusausoy <bruno.dusau...@yp5.be>
Subject JCR 2.0 Versioning
Date Tue, 26 Apr 2011 13:22:09 GMT

I have a node of primary type "jcr:content" which is versionable 

When I update it, I create a new version with the sequence :
1) checkout
2) modification
3) save
4) checkin

Everything is ok at this point, a new version is indeed created.
But when I look at the version history, like this :

Workspace workspace = session.getWorkspace();
VersionManager manager = workspace.getVersionManager();
VersionHistory history = 

VersionIterator iter = history.getAllLinearVersions();
while (iter.hasNext()) {
     Version v = iter.nextVersion();
     NodeIterator ni = v.getNodes();
     while (ni.hasNext()) {
         Node node = ni.nextNode();
         for (PropertyIterator pi = node.getProperties(); pi.hasNext();){
             Property prop = pi.nextProperty();
             System.out.println("Property : " + prop.getName());


I get the result :

Property : jcr:frozenUuid
Property : jcr:uuid
Property : jcr:frozenPrimaryType
Property : jcr:frozenMixinTypes
Property : jcr:primaryType
Property : jcr:frozenUuid
Property : jcr:lastModifiedBy
Property : jcr:uuid
Property : jcr:data
Property : jcr:frozenPrimaryType
Property : jcr:lastModified
Property : jcr:frozenMixinTypes
Property : jcr:primaryType

What I'm interested in here is the jcr:data property, of course.
But as you can see in the output, there is no such property for the 
first one.

Here's the code snippet for the creation of this node :

content = instruction.addNode("jcr:content", "nt:resource");
content.setProperty("jcr:data", new BinaryImpl(input));

I've also tried with these lines after the session.save(); line :
VersionManager versionManager = workspace.getVersionManager();

(where absPath points to the right node, of course) but it doesn't work 

Can someone tell me what I've missed ?

Bruno Dusausoy
YP5 Software
Pensez environnement : limitez l'impression de ce mail.
Please don't print this e-mail unless you really need to.

View raw message