jackrabbit-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Shanmugam Gopal" <haishanmu...@hotmail.com>
Subject Re: File node - Version History
Date Wed, 23 Aug 2006 08:20:07 GMT
Hi,

Can I have sample code for creating custom nodes like extending nt:file and 
nt:unstructured node types?

regards,
Shanmugam G


>From: Marcel Reutegger <marcel.reutegger@gmx.net>
>Reply-To: users@jackrabbit.apache.org
>To: users@jackrabbit.apache.org
>Subject: Re: File node - Version History
>Date: Wed, 23 Aug 2006 09:50:15 +0200
>
>please do not cross-post to the jackrabbit dev and the user list. as a 
>quick guideline: if you don't know how to achieve something ask on the user 
>list, if you think something is wrong and doesn't work as expected use the 
>dev list. Thank you.
>
>to get the username into the versioned file node structure I suggest you 
>create your own custom file node type, which extends from nt:file. e.g. 
>my:file and declare additional properties on that node type, like username. 
>Whenever a user checks in a file you then have to set that property and it 
>will be put into the version storage as well.
>
>regards
>  marcel
>
>Shanmugam Gopal wrote:
>>
>>>Hi,
>>>
>>>I have created a file node in repository. Different users can check out 
>>>and check in this file.
>>>At any point of time, I should get the version history like version name, 
>>>version created time and the user who has created that particular 
>>>version.
>>>
>>>>From VersionHistory and Version interfaces, I am able to get the version 
>>>name and created time
>>>for different versions.
>>>I am not sure how to maintain the username who has created the versions?
>>>
>>>Since the nt:file node doesn't accept any property, I couldn't attach the 
>>>user name as a property to the file node ?
>>>
>>>Any work around for this ??
>>>
>>>
>>>
>>>
>>>>From: "Shanmugam Gopal" <shanmugamg@hexaware.com>
>>>>To: <haishanmugam@hotmail.com>
>>>>Subject: file node
>>>>Date: Mon, 21 Aug 2006 18:59:20 +0530
>>>>
>>>>         File file = new File("C:\\gif\\bea.gif");
>>>>
>>>>         MimeTable mt = MimeTable.getDefaultTable();
>>>>
>>>>         String mimeType = mt.getContentTypeFor(file.getName());
>>>>
>>>>         if (mimeType == null) {
>>>>
>>>>           mimeType = "application/octet-stream";
>>>>
>>>>         }
>>>>
>>>>
>>>>
>>>>         //Adding Image 1
>>>>
>>>>         Node fileNode = images.addNode(file.getName(), "nt:file");
>>>>
>>>>         Node resourceNode = fileNode.addNode("jcr:content",
>>>>"nt:resource");
>>>>
>>>>         resourceNode.setProperty("jcr:mimeType", mimeType);
>>>>
>>>>         resourceNode.setProperty("jcr:encoding", "");
>>>>
>>>>         resourceNode.setProperty("jcr:data", new 
>>>>FileInputStream(file));
>>>>
>>>>         Calendar lastModified = Calendar.getInstance();
>>>>
>>>>         lastModified.setTimeInMillis(file.lastModified());
>>>>
>>>>         resourceNode.setProperty("jcr:lastModified", lastModified);
>>>>
>>>>
>>>>
>>>>
>>>>***************************************************************************************************************************
>>>>
>>>>This e-mail communication and any attachments may be privileged and 
>>>>confidential to Hexaware and are intended only for the
>>>>use of the recipients named above. If you are not the intended 
>>>>recipient, please do not review, disclose, disseminate,
>>>>distribute or copy this e-mail and attachments. If you have received 
>>>>this email in error, please delete the same alongwith
>>>>all attachments thereto and notify us immediately at 
>>>>mailadmin@hexaware.com .
>>>>***************************************************************************************************************************
>>>>
>>>>
>>>>
>>>
>>>_________________________________________________________________
>>>Tried the new MSN Messenger? Its cool! Download now. 
>>>http://messenger.msn.com/Download/Default.aspx?mkt=en-in
>>>
>>
>>_________________________________________________________________
>>Connect with your friends who use Yahoo! Messenger with Voice. Click! 
>>http://www.msnspecials.in/wlmyahoo/index.asp
>>
>>

_________________________________________________________________
Discover. Explore. Connect-Windows Live Spaces. Check out! 
http://www.msnspecials.in/windowslive/livespaces.asp


Mime
View raw message