Re: [Fwd: Re: creating custom node types inheriting from nt:folder using jcr mapping]

2007-02-09 Thread ruchi goel

Christophe Lombart wrote:

Hi Ruchi,

I just commited a new unit test. it contains a mapping for nt:folder & 
nt:file.

This is the first draft :-) . I'm going to work on it. I will add more
unit tests.
See the mapping file : jcrmapping-jcrnodetypes.xml
See the unit test : PersistenceManagerJcrNodeTypeTest

The current ocm implementation forces to use an extra class for the
jcr:resource.
This should be nice to map directly into the file class attributes.

Let me know if you need more help

br,
Christophe


Thanks I will try this. This requires new updated source code , right. 
So, I need to checkout the entire graffito source and build the jcr 
mapping layer.


-Ruchi


On 2/8/07, ruchi goel <[EMAIL PROTECTED]> wrote:




-- Forwarded message --
From: ruchi goel <[EMAIL PROTECTED]>
To: [EMAIL PROTECTED]
Date: Thu, 08 Feb 2007 14:38:50 +0530
Subject: Re: creating custom node types inheriting from nt:folder 
using jcr mapping

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 <[EMAIL PROTECTED]> 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
>> http://www.jcp.org/jcr/nt/1.0";
>>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
>>
>> className="com.sun.portal.cms.model.HeirarchyContent"

>> jcrNodeType="nt:hierarchyNode" discriminator="false" >
>> 
>>
>>jcrName="jcr:created" />

>> />
>> 
>>
>> > 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
>>
>


/*
 * 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(){

Re: [Fwd: Re: creating custom node types inheriting from nt:folder using jcr mapping]

2007-02-08 Thread Christophe Lombart

Hi Ruchi,

I just commited a new unit test. it contains a mapping for nt:folder & nt:file.
This is the first draft :-) . I'm going to work on it. I will add more
unit tests.
See the mapping file : jcrmapping-jcrnodetypes.xml
See the unit test : PersistenceManagerJcrNodeTypeTest

The current ocm implementation forces to use an extra class for the
jcr:resource.
This should be nice to map directly into the file class attributes.

Let me know if you need more help

br,
Christophe

On 2/8/07, ruchi goel <[EMAIL PROTECTED]> wrote:




-- Forwarded message --
From: ruchi goel <[EMAIL PROTECTED]>
To: [EMAIL PROTECTED]
Date: Thu, 08 Feb 2007 14:38:50 +0530
Subject: Re: creating custom node types inheriting from nt:folder using jcr 
mapping
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 <[EMAIL PROTECTED]> 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
>> http://www.jcp.org/jcr/nt/1.0";
>>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
>>
>


/*
 * 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;
}

}

/*
 * 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);
}

}




[Fwd: Re: creating custom node types inheriting from nt:folder using jcr mapping]

2007-02-08 Thread ruchi goel


--- Begin Message ---
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 <[EMAIL PROTECTED]> 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
http://www.jcp.org/jcr/nt/1.0";
   xmlns:jcr="http://www.jcp.org/jcr/1.0"; xmlns:rep="internal"
   xmlns:mix="http://www.jcp.org/jcr/mix/1.0";>

   
 nt:folder
   




I have following jcrmapping descriptor




   
   
/>


extend="com.sun.portal.cms.model.HeirarchyContent"  
discriminator="false"

>



/>

"
/>




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





/*
 * 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;
}

}
/*
 * 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);
}
   
}
--- End Message ---


Re: creating custom node types inheriting from nt:folder using jcr mapping

2007-02-08 Thread ruchi goel
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 <[EMAIL PROTECTED]> 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
http://www.jcp.org/jcr/nt/1.0";
   xmlns:jcr="http://www.jcp.org/jcr/1.0"; xmlns:rep="internal"
   xmlns:mix="http://www.jcp.org/jcr/mix/1.0";>

   
 nt:folder
   




I have following jcrmapping descriptor




   
   
/>


extend="com.sun.portal.cms.model.HeirarchyContent"  
discriminator="false"

>



/>

"
/>




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





/*
 * 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;
}

}
/*
 * 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);
}
   
}


Re: creating custom node types inheriting from nt:folder using jcr mapping

2007-02-08 Thread Christophe Lombart

Hi Ruchi,

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 <[EMAIL PROTECTED]> 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
http://www.jcp.org/jcr/nt/1.0";
   xmlns:jcr="http://www.jcp.org/jcr/1.0"; xmlns:rep="internal"
   xmlns:mix="http://www.jcp.org/jcr/mix/1.0";>

   
 nt:folder
   




I have following jcrmapping descriptor



   
   
/>





/>





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



creating custom node types inheriting from nt:folder using jcr mapping

2007-02-07 Thread ruchi goel
/*Sorry, writing to you directly since I don't see mails reaching the 
alias.*/


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
http://www.jcp.org/jcr/nt/1.0";
 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


creating custom node types inheriting from nt:folder using jcr mapping

2007-02-07 Thread ruchi goel

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
http://www.jcp.org/jcr/nt/1.0";
  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