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
Hi,

I have a node of primary type "jcr:content" which is versionable 
("mix:simpleVersionable").

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 = 
manager.getVersionHistory("/1/instruction/jcr:content");

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

     }
}

I get the result :

jcr:frozenNode
Property : jcr:frozenUuid
Property : jcr:uuid
Property : jcr:frozenPrimaryType
Property : jcr:frozenMixinTypes
Property : jcr:primaryType
jcr:frozenNode
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.addMixin("mix:simpleVersionable");
content.setProperty("jcr:data", new BinaryImpl(input));
session.save();

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

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

Can someone tell me what I've missed ?

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

Mime
View raw message