On Sat, Jan 30, 2010 at 6:51 AM, abhishek reddy <[email protected]> wrote: > here is the code which i tried.... > > // Get the destinationNode to which the file to be added > Node destinationNode = rootNode.addNode( > destinationNodeName); > Node file = destinationNode.addNode(fileName, > "nt:file"); > Node contentNode = file.addNode("jcr:content", > "nt:resource"); > > // Make a stream object using the file path > InputStream fileStream = new > FileInputStream(filePath); > > // set the mandatory properties > contentNode.setProperty("jcr:data", fileStream); > contentNode.setProperty("jcr:lastModified", > Calendar.getInstance()); > contentNode.setProperty("jcr:mimeType", mimeType); > > session.save(); > > Inorder to make node versionable......... do i need to add > > destinationNode.addMixin( "mix:versionable" ); > (or) > contentNode .addMixin( "mix:versionable" );
it depends what you want to version. if you want to version the entire destinationNodeName "folder", you add it there. if you on;y wnat to version the file conten, you add it there. regards, toby > > > > > On Fri, Jan 29, 2010 at 4:02 PM, abhishek reddy <[email protected]> > wrote: >> >> hi every one, >> >> Need help in versioning FileNode....... How to version the FileNode? >> >> >> -- >> Abhishek > > > > -- > Abhishek >
