From graffito-dev-return-1574-apmail-incubator-graffito-dev-archive=www.apache.org@incubator.apache.org Thu Feb 08 12:41:00 2007 Return-Path: Delivered-To: apmail-incubator-graffito-dev-archive@www.apache.org Received: (qmail 70086 invoked from network); 8 Feb 2007 12:40:59 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 8 Feb 2007 12:40:59 -0000 Received: (qmail 68515 invoked by uid 500); 8 Feb 2007 12:41:06 -0000 Mailing-List: contact graffito-dev-help@incubator.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: graffito-dev@incubator.apache.org Delivered-To: mailing list graffito-dev@incubator.apache.org Received: (qmail 68504 invoked by uid 99); 8 Feb 2007 12:41:06 -0000 Received: from herse.apache.org (HELO herse.apache.org) (140.211.11.133) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 08 Feb 2007 04:41:06 -0800 X-ASF-Spam-Status: No, hits=3.2 required=10.0 tests=RCVD_IN_BL_SPAMCOP_NET,RCVD_IN_SORBS_WEB,UNPARSEABLE_RELAY X-Spam-Check-By: apache.org Received-SPF: pass (herse.apache.org: local policy) Received: from [192.18.19.7] (HELO sineb-mail-2.sun.com) (192.18.19.7) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 08 Feb 2007 04:40:56 -0800 Received: from fe-apac-05.sun.com (fe-apac-05.sun.com [192.18.19.176] (may be forged)) by sineb-mail-2.sun.com (8.13.6+Sun/8.12.9) with ESMTP id l18CeXT7026952 for ; Thu, 8 Feb 2007 20:40:33 +0800 (SGT) Received: from conversion-daemon.mail-apac.sun.com by mail-apac.sun.com (Sun Java System Messaging Server 6.2-6.01 (built Apr 3 2006)) id <0JD5009019Q9HZ00@mail-apac.sun.com> (original mail from Ruchi.Goel@Sun.COM) for graffito-dev@incubator.apache.org; Thu, 08 Feb 2007 20:40:33 +0800 (SGT) Received: from [192.168.1.100] ([202.62.95.250]) by mail-apac.sun.com (Sun Java System Messaging Server 6.2-6.01 (built Apr 3 2006)) with ESMTPSA id <0JD500H6N9VJPJGA@mail-apac.sun.com> for graffito-dev@incubator.apache.org; Thu, 08 Feb 2007 20:40:33 +0800 (SGT) Date: Thu, 08 Feb 2007 18:10:33 +0530 From: ruchi goel Subject: [Fwd: Re: creating custom node types inheriting from nt:folder using jcr mapping] Sender: Ruchi.Goel@Sun.COM To: graffito-dev@incubator.apache.org Message-id: <45CB1A41.1000600@sun.com> MIME-version: 1.0 Content-type: multipart/mixed; boundary="Boundary_(ID_aVybqu5KmFehrCrTCt90+Q)" User-Agent: Thunderbird 1.5.0.9 (Windows/20061207) X-Virus-Checked: Checked by ClamAV on apache.org --Boundary_(ID_aVybqu5KmFehrCrTCt90+Q) Content-type: text/plain; format=flowed; charset=ISO-8859-1 Content-transfer-encoding: 7BIT --Boundary_(ID_aVybqu5KmFehrCrTCt90+Q) Content-type: message/rfc822; name*0="Re: creating custom node types inheriting from nt:folder using j"; name*1="cr mapping" Date: Thu, 08 Feb 2007 14:38:50 +0530 From: ruchi goel Subject: Re: creating custom node types inheriting from nt:folder using jcr mapping In-reply-to: <3b728ee90702080043u46a70162y331aafbcbb69bfae@mail.gmail.com> To: christophe.lombart@gmail.com Cc: graffito-dev@incubator.apache.org Message-id: <45CAE8A2.8040100@sun.com> MIME-version: 1.0 Content-type: multipart/mixed; boundary="Boundary_(ID_KfNbInV7nX3TfK+6OhfeUw)" References: <45CAB03E.8010005@sun.com> <3b728ee90702080043u46a70162y331aafbcbb69bfae@mail.gmail.com> User-Agent: Thunderbird 1.5.0.9 (Windows/20061207) This is a multi-part message in MIME format. --Boundary_(ID_KfNbInV7nX3TfK+6OhfeUw) Content-type: text/plain; format=flowed; charset=ISO-8859-1 Content-transfer-encoding: 7BIT Thanks. Please find attached model classes . I do not have a clearly isolated unit test case, since I have created a netbeans project where I am using this. But these are the two functionalities I am trying to achieve : public void testSaveFolder(FolderModelService folderService){ //Test Save //insert an Ad in repository Folder folder = new Folder(); folder.setPath("/cms/folder2"); Collection content = new ArrayList(); content.add(new Folder("subfolder2")); folder.setChildren(content); folderService.saveFolder(folder); } public void testReadFolder(FolderModelService folderService){ Folder folder = (Folder)folderService.getFolder("/cms/folder2"); System.out.print("folder Info : " + folder.getCreationDate()); } Thanks, Ruchi Christophe Lombart wrote: > Hi Ruchi, > e > It seems to be ok. Send me your unit tests and you model classes. > It is a good exemple to add and I will have time to help you this > afternoon. > > > br, > Christophe > > > > > On 2/8/07, ruchi goel wrote: >> >> Hi, >> I want to use jcr mapping layer for creating custom node type "folder" >> which should inherit from "nt:folder" >> >> I have following custom_nodetype.xml >> > xmlns:jcr="http://www.jcp.org/jcr/1.0" xmlns:rep="internal" >> xmlns:mix="http://www.jcp.org/jcr/mix/1.0"> >> > hasOrderableChildNodes="false" primaryItemName=""> >> >> nt:folder >> >> >> >> >> >> I have following jcrmapping descriptor >> >> > jcrNodeType="nt:hierarchyNode" discriminator="false" > >> >> >> >> /> >> >> >> > jcrNodeType="folder" >> extend="com.sun.portal.cms.model.HeirarchyContent" >> discriminator="false" >> > >> >> >> /> >> > jcrNodeType="nt:hierarchyNode" >> >> elementClassName="com.sun.portal.cms.model.HeirarchyContent" >> >> collectionConverter=" >> org.apache.portals.graffito.jcr.persistence.collectionconverter.impl.NTCollectionConverterImpl >> >> " >> /> >> >> >> >> >> The problem is I am able to retrieve the items which are properties but >> I do not see any child node definitions in folder. Ideally since folder >> is inheriting from nt:folder , it should get a childnode definition of >> type nt:heirrarchynodeType >> >> Is there anything I am missing ? >> Checked out PersistenceAutoTest.java but it uses all custom nodetypes >> which are inherited from nt:base and so , it has childnodedefintions in >> custom node type definition. >> >> Help appreciated. >> Thanks, >> Ruchi >> > --Boundary_(ID_KfNbInV7nX3TfK+6OhfeUw) Content-type: text/plain; name=HeirarchyContent.java Content-transfer-encoding: 7BIT Content-disposition: inline; filename=HeirarchyContent.java /* * HeirarchyContent.java * * Created on February 7, 2007, 2:10 PM * * To change this template, choose Tools | Template Manager * and open the template in the editor. */ package com.sun.portal.cms.model; import java.util.Date; /** * * @author ruchi goel */ public class HeirarchyContent { String path; Date creationDate; /** Creates a new instance of HeirarchyContent */ public HeirarchyContent() { } public Date getCreationDate(){ return creationDate; } public void setPath(String path){ this.path = path; } public void setCreationDate(Date creationDate){ this.creationDate = creationDate; } public String getPath(){ return path; } } --Boundary_(ID_KfNbInV7nX3TfK+6OhfeUw) Content-type: text/plain; name=Folder.java Content-transfer-encoding: 7BIT Content-disposition: inline; filename=Folder.java /* * Folder.java * * Created on February 7, 2007, 10:45 AM * * To change this template, choose Tools | Template Manager * and open the template in the editor. */ package com.sun.portal.cms.model; import java.util.Collection; import java.util.ArrayList; /** * * @author ruchi goel */ public class Folder extends HeirarchyContent { Collection children; /** Creates a new instance of Folder */ public Folder() { } ; public Folder(String path) { this.path = path; } public void setChildren(Collection children){ this.children = children; } public Collection getChildren(){ return children; } public void addChild(HeirarchyContent child) { if (children == null) { children = new ArrayList(); } children.add(child); } } --Boundary_(ID_KfNbInV7nX3TfK+6OhfeUw)-- --Boundary_(ID_aVybqu5KmFehrCrTCt90+Q)--