jackrabbit-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From freak182 <eman.noll...@gmail.com>
Subject Re: Help on versioning
Date Thu, 17 Sep 2009 02:04:17 GMT

Hello,

given the scenario:

 Node file = folder.addNode(name, "nt:file");
 file.addMixin(JcrConstants.MIX_VERSIONABLE);
	    
 Node fileContent = file.addNode("jcr:content", "nt:resource");
 fileContent.addMixin(JcrConstants.MIX_REFERENCEABLE);
 fileContent.setProperty("jcr:mimeType", mimeType);
 fileContent.setProperty("jcr:lastModified", Calendar.getInstance());
 fileContent.setProperty("jcr:data", fileStream);
 session.save();
 file.checkin();

...in that line of code im saving the first version of my picture...but a
bit later i modify a picture such i add some text inside the picture and now
i want to save it as next version. Is saving would be same except for i will
checking out the old node and checking the new fileStream?

 String clildpath = path + name;
 Node child = rootNode.getNode(clildpath);
 fileContent.setProperty("jcr:data", fileStream); --> assuming this is new
fileStream for previous image
 session.save();
 file.checkin();

...is this the correct way?

thanks a lot.
cheers.



Alexander Klimetschek wrote:
> 
> On Wed, Sep 16, 2009 at 12:46, freak182 <eman.nollase@gmail.com> wrote:
>>            Node fileContent = file.addNode("jcr:content", "nt:resource");
>>            fileContent.addMixin(JcrConstants.MIX_VERSIONABLE);
>> ...
>> javax.jcr.UnsupportedRepositoryOperationException: Unable to perform a
>> versioning operation on a non versionable node: node
>> /photo/upload/test/Sangat_Island.jpg
> 
> From looking at the path, it looks very much like you make the
> jcr:content subnode versionable, but not the nt:file node
> (Sangat_Island.jpg).
> 
> Regards,
> Alex
> 
> -- 
> Alexander Klimetschek
> alexander.klimetschek@day.com
> 
> 

-- 
View this message in context: http://www.nabble.com/Help-on-versioning-tp25469946p25483990.html
Sent from the Jackrabbit - Users mailing list archive at Nabble.com.


Mime
View raw message