but you're iterating over the properties of the frozen node of the
version, which corresponds to the nt:file.
i think if you change the code to:
Node n = version.getFrozenNode().getNode("jcr:content");
you should get the desired result.
regards, toby
On Fri, Sep 30, 2011 at 5:04 PM, yacur <yacur@yahoo.com> wrote:
> I am trying to retrieved the diff versions for jcr:data node that represented
> by the resNode in the code below. But when going through the versions, the
> jcr:data property is not available. Can someone please inform me why?
>
> So after this snippet:
> Node root = s.getRootNode();
> Node timcard = root.addNode("ntfolder" , JcrConstants.NT_FOLDER
);
> Node fileNode = timcard.addNode("123" , JcrConstants.NT_FILE );
> Node resNode = fileNode.addNode(JcrConstants.JCR_CONTENT,
> JcrConstants.NT_RESOURCE);
> fileNode.addMixin(JcrConstants.MIX_VERSIONABLE);
>
> Binary binary = new BinaryImpl( is );
>
> resNode.setProperty("jcr:data", "hello" );
> s.save();
> VersionManager vm = s.getWorkspace().getVersionManager();
> for(int i=0; i<3; i++) {
> vm.checkout("/ntfolder/123");
> resNode.setProperty("jcr:data", binary );
> s.save();
> vm.checkin("/ntfolder/123");
> }
> s.save();
> VersionHistory history = vm.getVersionHistory("/ntfolder/123");
> for (VersionIterator it = history.getAllVersions(); it.hasNext();)
> {
> Version version = (Version) it.next();
> System.out.println("getting version " + version.getName());
>
> Node n = version.getFrozenNode();
> PropertyIterator pi = n.getProperties();
> while ( pi.hasNext() ) {
> Property p = pi.nextProperty();
> System.out.println( "Prop
name " + p.getName() );
> }
> }
>
> the property jcr:data never shows up:
>
> All versions except the base have:
> Prop name jcr:frozenUuid
> Prop name jcr:uuid
> Prop name jcr:createdBy
> Prop name jcr:frozenPrimaryType
> Prop name jcr:created
> Prop name jcr:frozenMixinTypes
> Prop name jcr:primaryType
>
>
> --
> View this message in context: http://jackrabbit.510166.n4.nabble.com/Jackrabbit-2-2-8-Retrieval-of-JCR-data-node-from-VersionHistory-not-available-tp3860061p3860061.html
> Sent from the Jackrabbit - Dev mailing list archive at Nabble.com.
>
|