incubator-graffito-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From clomb...@apache.org
Subject svn commit: r390238 - in /incubator/graffito/trunk/jcr/jcr-mapping/src: java/org/apache/portals/graffito/jcr/mapper/impl/ java/org/apache/portals/graffito/jcr/mapper/model/ java/org/apache/portals/graffito/jcr/persistence/objectconverter/ java/org/apac...
Date Thu, 30 Mar 2006 21:03:21 GMT
Author: clombart
Date: Thu Mar 30 13:03:19 2006
New Revision: 390238

URL: http://svn.apache.org/viewcvs?rev=390238&view=rev
Log:
Implement node type per concrete class & unit tests. 

Added:
    incubator/graffito/trunk/jcr/jcr-mapping/src/java/org/apache/portals/graffito/jcr/persistence/objectconverter/impl/ParentBeanConverterImpl.java
    incubator/graffito/trunk/jcr/jcr-mapping/src/test/org/apache/portals/graffito/jcr/testmodel/inheritance/DocumentStream.java
      - copied, changed from r388968, incubator/graffito/trunk/jcr/jcr-mapping/src/test/org/apache/portals/graffito/jcr/testmodel/inheritance/Content.java
Modified:
    incubator/graffito/trunk/jcr/jcr-mapping/src/java/org/apache/portals/graffito/jcr/mapper/impl/DigesterMapperImpl.java
    incubator/graffito/trunk/jcr/jcr-mapping/src/java/org/apache/portals/graffito/jcr/mapper/model/ClassDescriptor.java
    incubator/graffito/trunk/jcr/jcr-mapping/src/java/org/apache/portals/graffito/jcr/persistence/objectconverter/BeanConverter.java
    incubator/graffito/trunk/jcr/jcr-mapping/src/java/org/apache/portals/graffito/jcr/persistence/objectconverter/impl/ObjectConverterImpl.java
    incubator/graffito/trunk/jcr/jcr-mapping/src/test-config/jcrmapping-inheritance.xml
    incubator/graffito/trunk/jcr/jcr-mapping/src/test-config/repository/repository/nodetypes/custom_nodetypes.xml
    incubator/graffito/trunk/jcr/jcr-mapping/src/test/org/apache/portals/graffito/jcr/TestBase.java
    incubator/graffito/trunk/jcr/jcr-mapping/src/test/org/apache/portals/graffito/jcr/mapper/DigesterMapperImplTest.java
    incubator/graffito/trunk/jcr/jcr-mapping/src/test/org/apache/portals/graffito/jcr/persistence/impl/PersistenceManagerNtConcreteClassTest.java
    incubator/graffito/trunk/jcr/jcr-mapping/src/test/org/apache/portals/graffito/jcr/testmodel/inheritance/CmsObject.java
    incubator/graffito/trunk/jcr/jcr-mapping/src/test/org/apache/portals/graffito/jcr/testmodel/inheritance/Content.java
    incubator/graffito/trunk/jcr/jcr-mapping/src/test/org/apache/portals/graffito/jcr/testmodel/inheritance/Document.java
    incubator/graffito/trunk/jcr/jcr-mapping/src/test/org/apache/portals/graffito/jcr/testmodel/inheritance/Folder.java

Modified: incubator/graffito/trunk/jcr/jcr-mapping/src/java/org/apache/portals/graffito/jcr/mapper/impl/DigesterMapperImpl.java
URL: http://svn.apache.org/viewcvs/incubator/graffito/trunk/jcr/jcr-mapping/src/java/org/apache/portals/graffito/jcr/mapper/impl/DigesterMapperImpl.java?rev=390238&r1=390237&r2=390238&view=diff
==============================================================================
--- incubator/graffito/trunk/jcr/jcr-mapping/src/java/org/apache/portals/graffito/jcr/mapper/impl/DigesterMapperImpl.java (original)
+++ incubator/graffito/trunk/jcr/jcr-mapping/src/java/org/apache/portals/graffito/jcr/mapper/impl/DigesterMapperImpl.java Thu Mar 30 13:03:19 2006
@@ -19,6 +19,7 @@
 
 import java.io.InputStream;
 import java.util.ArrayList;
+import java.util.Collection;
 import java.util.Iterator;
 import java.util.List;
 import java.util.Map;
@@ -41,6 +42,7 @@
     private static final Log log = LogFactory.getLog(DigesterMapperImpl.class);
 
     private MappingDescriptor mappingDescriptor;
+    private Collection rootClassDescriptors = new ArrayList(); // contains the class descriptor which have not ancestors 
 
     private String[] mappingFiles;
     private InputStream[] mappingStreams;
@@ -148,8 +150,8 @@
         }
         if (null != this.mappingDescriptor) {
             List errors = new ArrayList();
-            solveReferences(errors);
-            validateDescriptors(errors);
+            errors =  solveReferences(errors);            
+            errors = validateDescriptors(errors, rootClassDescriptors);
 
             if (!errors.isEmpty()) {
                 throw new InitMapperException("Mapping files contain errors."
@@ -163,31 +165,6 @@
         return this;
     }
 
-    private String getErrorMessage(List errors) {
-        final String lineSep = System.getProperty("line.separator");
-        StringBuffer buf = new StringBuffer();
-        for(Iterator it = errors.iterator(); it.hasNext();) {
-            buf.append(lineSep).append(it.next());
-        }
-
-        return buf.toString();
-    }
-
-    private void validateDescriptors(List errors) {
-        for(Iterator it = this.mappingDescriptor.getClassDescriptors().entrySet().iterator(); it.hasNext(); ) {
-            Map.Entry entry = (Map.Entry) it.next();
-            ClassDescriptor cd = (ClassDescriptor) entry.getValue();
-
-            try {
-                cd.afterPropertiesSet();
-            }
-            catch(JcrMappingException jme) {
-                log.warn("Mapping of class " + cd.getClassName() + " is invalid", jme);
-                errors.add(jme.getMessage());
-            }
-        }
-    }
-
     private List solveReferences(List errors) {
         for(Iterator it = this.mappingDescriptor.getClassDescriptors().entrySet().iterator(); it.hasNext(); ) {
             Map.Entry entry = (Map.Entry) it.next();
@@ -207,16 +184,56 @@
                     cd.setSuperClassDescriptor(superClassDescriptor);
                 }
             }
+            else
+            {
+                rootClassDescriptors.add(cd);	
+            }
         }
 
         return errors;
     }
     
     /**
-     *
-     * @see org.apache.portals.graffito.jcr.mapper.Mapper#getClassDescriptor(java.lang.Class)
-     */
-    public ClassDescriptor getClassDescriptor(Class clazz) {
-        return mappingDescriptor.getClassDescriptor(clazz.getName());
-    }
+     * Validate all class descriptors.
+     * This method validates the toplevel ancestors and after the descendants. 
+     * Otherwise, we can have invalid settings in the class descritpors
+     * @param errors all errors found during the validation process
+     * @param classDescriptors the ancestor classdescriptors
+     * @return
+     */
+    private List  validateDescriptors(List errors, Collection classDescriptors ) {
+        for(Iterator it = classDescriptors.iterator(); it.hasNext(); ) {
+             ClassDescriptor classDescriptor = (ClassDescriptor) it.next();
+            try {
+                classDescriptor.afterPropertiesSet();
+                if (classDescriptor.hasDescendants())
+                {
+                	     errors = validateDescriptors(errors, classDescriptor.getDescendantClassDescriptors());
+                }
+            }
+            catch(JcrMappingException jme) {
+                log.warn("Mapping of class " + classDescriptor.getClassName() + " is invalid", jme);
+                errors.add(jme.getMessage());
+            }
+        }
+        return errors;
+    }    
+    
+    private String getErrorMessage(List errors) {
+        final String lineSep = System.getProperty("line.separator");
+        StringBuffer buf = new StringBuffer();
+        for(Iterator it = errors.iterator(); it.hasNext();) {
+            buf.append(lineSep).append(it.next());
+        }
+
+        return buf.toString();
+    }    
+    
+    /**
+    *
+    * @see org.apache.portals.graffito.jcr.mapper.Mapper#getClassDescriptor(java.lang.Class)
+    */
+   public ClassDescriptor getClassDescriptor(Class clazz) {
+       return mappingDescriptor.getClassDescriptor(clazz.getName());
+   }      
 }

Modified: incubator/graffito/trunk/jcr/jcr-mapping/src/java/org/apache/portals/graffito/jcr/mapper/model/ClassDescriptor.java
URL: http://svn.apache.org/viewcvs/incubator/graffito/trunk/jcr/jcr-mapping/src/java/org/apache/portals/graffito/jcr/mapper/model/ClassDescriptor.java?rev=390238&r1=390237&r2=390238&view=diff
==============================================================================
--- incubator/graffito/trunk/jcr/jcr-mapping/src/java/org/apache/portals/graffito/jcr/mapper/model/ClassDescriptor.java (original)
+++ incubator/graffito/trunk/jcr/jcr-mapping/src/java/org/apache/portals/graffito/jcr/mapper/model/ClassDescriptor.java Thu Mar 30 13:03:19 2006
@@ -198,6 +198,7 @@
      * @return all {@link BeanDescriptor} defined in this ClassDescriptor
      */
     public Collection getCollectionDescriptors() {
+    	   
         return this.collectionDescriptors.values();
     }
 
@@ -339,10 +340,11 @@
 	}
 
 	private void lookupSuperDescriptor() {
-        if (null != this.superClassDescriptor) {
-            this.fieldDescriptors = merge(this.fieldDescriptors, this.superClassDescriptor.getFieldDescriptors());
-            this.beanDescriptors = merge(this.beanDescriptors, this.superClassDescriptor.getBeanDescriptors());
-            this.collectionDescriptors = merge(this.collectionDescriptors, this.superClassDescriptor.getCollectionDescriptors());
+		
+        if (null !=superClassDescriptor) {
+            this.fieldDescriptors = mergeFields(this.fieldDescriptors, this.superClassDescriptor.getFieldDescriptors());
+            this.beanDescriptors = mergeBeans(this.beanDescriptors, this.superClassDescriptor.getBeanDescriptors());
+            this.collectionDescriptors = mergeCollections(this.collectionDescriptors, this.superClassDescriptor.getCollectionDescriptors());
             this.fieldNames.putAll(this.superClassDescriptor.getFieldNames());
         }
     }
@@ -425,6 +427,15 @@
         	      {
         	    	     return descendantClassDescriptor;
         	      }
+        	      
+        	      if (descendantClassDescriptor.hasDescendants())
+        	      {
+        	    	      ClassDescriptor classDescriptor = descendantClassDescriptor.getDescendantClassDescriptor(nodeType);
+        	    	      if (classDescriptor != null)
+        	    	      {
+        	    	    	      return classDescriptor;
+        	    	      }
+        	      }
         }
         return null;
     }
@@ -449,26 +460,67 @@
         
     }
 
-    private Map merge(Map existing, Collection superSource) {
+    private Map mergeFields(Map existing, Collection superSource) {
         if (null == superSource) {
             return existing;
         }
 
         Map merged = new HashMap(existing);
         for(Iterator it = superSource.iterator(); it.hasNext();) {
-            FieldDescriptor fd = (FieldDescriptor) it.next();
-            if (!merged.containsKey(fd.getFieldName())) {
-                merged.put(fd.getFieldName(), fd);
+            FieldDescriptor fieldDescriptor = (FieldDescriptor) it.next();
+            if (!merged.containsKey(fieldDescriptor.getFieldName())) {
+                merged.put(fieldDescriptor.getFieldName(), fieldDescriptor);
             }
             else
             {
-            	    log.warn("Field name conflict in " + this.className + " - field : " +fd.getFieldName() + " -  this  field name is also defined  in the ancestor class : " + this.getSuperClass());
+            	    log.warn("Field name conflict in " + this.className + " - field : " +fieldDescriptor.getFieldName() + " -  this  field name is also defined  in the ancestor class : " + this.getSuperClass());
             }
         }
 
         return merged;
     }
 
+    
+    private Map mergeBeans(Map existing, Collection superSource) {
+        if (null == superSource) {
+            return existing;
+        }
+
+        Map merged = new HashMap(existing);
+        for(Iterator it = superSource.iterator(); it.hasNext();) {
+            BeanDescriptor beanDescriptor = (BeanDescriptor) it.next();
+            if (!merged.containsKey(beanDescriptor.getFieldName())) {
+                merged.put(beanDescriptor.getFieldName(), beanDescriptor);
+            }
+            else
+            {
+            	    log.warn("Bean name conflict in " + this.className + " - field : " +beanDescriptor.getFieldName() + " -  this  field name is also defined  in the ancestor class : " + this.getSuperClass());
+            }
+        }
+
+        return merged;
+    }
+    
+    private Map mergeCollections(Map existing, Collection superSource) {
+        if (null == superSource) {
+            return existing;
+        }
+
+        Map merged = new HashMap(existing);
+        for(Iterator it = superSource.iterator(); it.hasNext();) {
+            CollectionDescriptor collectionDescriptor = (CollectionDescriptor) it.next();
+            if (!merged.containsKey(collectionDescriptor.getFieldName())) {
+                merged.put(collectionDescriptor.getFieldName(), collectionDescriptor);
+            }
+            else
+            {
+            	    log.warn("Collection name conflict in " + this.className + " - field : " +collectionDescriptor.getFieldName() + " -  this  field name is also defined  in the ancestor class : " + this.getSuperClass());
+            }
+        }
+
+        return merged;
+    }    
+    
 	public String toString() {
 		
 		return "Class Descriptor : " +  this.getClassName();

Modified: incubator/graffito/trunk/jcr/jcr-mapping/src/java/org/apache/portals/graffito/jcr/persistence/objectconverter/BeanConverter.java
URL: http://svn.apache.org/viewcvs/incubator/graffito/trunk/jcr/jcr-mapping/src/java/org/apache/portals/graffito/jcr/persistence/objectconverter/BeanConverter.java?rev=390238&r1=390237&r2=390238&view=diff
==============================================================================
--- incubator/graffito/trunk/jcr/jcr-mapping/src/java/org/apache/portals/graffito/jcr/persistence/objectconverter/BeanConverter.java (original)
+++ incubator/graffito/trunk/jcr/jcr-mapping/src/java/org/apache/portals/graffito/jcr/persistence/objectconverter/BeanConverter.java Thu Mar 30 13:03:19 2006
@@ -22,7 +22,6 @@
 import org.apache.portals.graffito.jcr.exception.JcrMappingException;
 import org.apache.portals.graffito.jcr.exception.PersistenceException;
 import org.apache.portals.graffito.jcr.exception.RepositoryException;
-import org.apache.portals.graffito.jcr.mapper.Mapper;
 import org.apache.portals.graffito.jcr.mapper.model.BeanDescriptor;
 
 /**

Modified: incubator/graffito/trunk/jcr/jcr-mapping/src/java/org/apache/portals/graffito/jcr/persistence/objectconverter/impl/ObjectConverterImpl.java
URL: http://svn.apache.org/viewcvs/incubator/graffito/trunk/jcr/jcr-mapping/src/java/org/apache/portals/graffito/jcr/persistence/objectconverter/impl/ObjectConverterImpl.java?rev=390238&r1=390237&r2=390238&view=diff
==============================================================================
--- incubator/graffito/trunk/jcr/jcr-mapping/src/java/org/apache/portals/graffito/jcr/persistence/objectconverter/impl/ObjectConverterImpl.java (original)
+++ incubator/graffito/trunk/jcr/jcr-mapping/src/java/org/apache/portals/graffito/jcr/persistence/objectconverter/impl/ObjectConverterImpl.java Thu Mar 30 13:03:19 2006
@@ -142,6 +142,7 @@
         Node objectNode = null;
         try {
             objectNode = parentNode.addNode(nodeName, jcrNodeType);
+            
         } 
         catch (NoSuchNodeTypeException nsnte) {
             throw new JcrMappingException("Unknown node type " + jcrNodeType
@@ -696,7 +697,7 @@
                 }
 
                 if (classDescriptor.usesNodeTypePerHierarchyStrategy() && fieldDescriptor.isDiscriminator()) {
-                     objectNode.setProperty(fieldDescriptor.getJcrName(), classDescriptor.getClassName());
+                     objectNode.setProperty(fieldDescriptor.getJcrName(), classDescriptor.getClassName());                     
                     continue;
                 }
     

Added: incubator/graffito/trunk/jcr/jcr-mapping/src/java/org/apache/portals/graffito/jcr/persistence/objectconverter/impl/ParentBeanConverterImpl.java
URL: http://svn.apache.org/viewcvs/incubator/graffito/trunk/jcr/jcr-mapping/src/java/org/apache/portals/graffito/jcr/persistence/objectconverter/impl/ParentBeanConverterImpl.java?rev=390238&view=auto
==============================================================================
--- incubator/graffito/trunk/jcr/jcr-mapping/src/java/org/apache/portals/graffito/jcr/persistence/objectconverter/impl/ParentBeanConverterImpl.java (added)
+++ incubator/graffito/trunk/jcr/jcr-mapping/src/java/org/apache/portals/graffito/jcr/persistence/objectconverter/impl/ParentBeanConverterImpl.java Thu Mar 30 13:03:19 2006
@@ -0,0 +1,82 @@
+/*
+ * Copyright 2000-2005 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.portals.graffito.jcr.persistence.objectconverter.impl;
+
+import javax.jcr.Node;
+import javax.jcr.Session;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.apache.portals.graffito.jcr.exception.JcrMappingException;
+import org.apache.portals.graffito.jcr.exception.PersistenceException;
+import org.apache.portals.graffito.jcr.exception.RepositoryException;
+import org.apache.portals.graffito.jcr.mapper.model.BeanDescriptor;
+import org.apache.portals.graffito.jcr.persistence.objectconverter.BeanConverter;
+
+public class ParentBeanConverterImpl implements BeanConverter {
+
+	private final static Log log = LogFactory.getLog(ParentBeanConverterImpl.class);
+	
+	public void insert(Session session, Node parentNode, BeanDescriptor descriptor, Object object)
+			throws PersistenceException, RepositoryException, 	JcrMappingException {
+                  try {
+					log.debug("Reference Converter - path : " +parentNode.getPath());
+					log.debug("Reference Converter - descriptor : " + descriptor.getFieldName() + "-" + descriptor.getJcrName());
+					
+				} catch (javax.jcr.RepositoryException e) {
+					throw new RepositoryException(e);
+				} 
+	}
+
+	public void update(Session session, Node parentNode, 	BeanDescriptor descriptor, Object object)
+			throws PersistenceException, RepositoryException,	JcrMappingException {
+        try {
+			log.debug("Reference Converter - path : " +parentNode.getPath());
+			log.debug("Reference Converter - descriptor : " + descriptor.getFieldName() + "-" + descriptor.getJcrName());
+			
+		} catch (javax.jcr.RepositoryException e) {
+			throw new RepositoryException(e);
+		} 
+
+
+	}
+
+	public Object getObject(Session session, Node parentNode,BeanDescriptor descriptor, Class beanClass)
+			throws PersistenceException, RepositoryException,JcrMappingException {
+        try {
+			log.debug("Reference Converter - path : " +parentNode.getPath());
+			log.debug("Reference Converter - descriptor : " + descriptor.getFieldName() + "-" + descriptor.getJcrName());
+			
+		} catch (javax.jcr.RepositoryException e) {
+			throw new RepositoryException(e);
+		} 
+		return null;
+	}
+
+	public void remove(Session session, Node parentNode,	BeanDescriptor descriptor)
+	          throws PersistenceException,	RepositoryException, JcrMappingException {
+        try {
+			log.debug("Reference Converter - path : " +parentNode.getPath());
+			log.debug("Reference Converter - descriptor : " + descriptor.getFieldName() + "-" + descriptor.getJcrName());
+			
+		} catch (javax.jcr.RepositoryException e) {
+			throw new RepositoryException(e);
+		} 
+
+
+	}
+
+}

Modified: incubator/graffito/trunk/jcr/jcr-mapping/src/test-config/jcrmapping-inheritance.xml
URL: http://svn.apache.org/viewcvs/incubator/graffito/trunk/jcr/jcr-mapping/src/test-config/jcrmapping-inheritance.xml?rev=390238&r1=390237&r2=390238&view=diff
==============================================================================
--- incubator/graffito/trunk/jcr/jcr-mapping/src/test-config/jcrmapping-inheritance.xml (original)
+++ incubator/graffito/trunk/jcr/jcr-mapping/src/test-config/jcrmapping-inheritance.xml Thu Mar 30 13:03:19 2006
@@ -33,17 +33,31 @@
 	<class-descriptor className="org.apache.portals.graffito.jcr.testmodel.inheritance.CmsObject" jcrNodeType="graffito:cmsobject"  abstract="true" >
 		<field-descriptor fieldName="path" path="true" />
 		<field-descriptor fieldName="name" jcrName="graffito:name" />
+		<!--  bean-descriptor  fieldName="parentFolder" 						 
+						  converter="org.apache.portals.graffito.jcr.persistence.objectconverter.impl.ParentBeanConverterImpl" / -->
+
 	</class-descriptor>     
-	
-	<class-descriptor className="org.apache.portals.graffito.jcr.testmodel.inheritance.Document" jcrNodeType="graffito:document" 
+
+	<class-descriptor className="org.apache.portals.graffito.jcr.testmodel.inheritance.Folder" jcrNodeType="graffito:folder" 
+	                                   extends="org.apache.portals.graffito.jcr.testmodel.inheritance.CmsObject" >
+		<collection-descriptor fieldName="children" jcrName="graffito:children" proxy="false"
+                                                   elementClassName="org.apache.portals.graffito.jcr.testmodel.inheritance.CmsObject" />
+	                                   
+
+	</class-descriptor >	
+
+	<class-descriptor className="org.apache.portals.graffito.jcr.testmodel.inheritance.Content" jcrNodeType="graffito:content" abstract="true"
 	                                   extends="org.apache.portals.graffito.jcr.testmodel.inheritance.CmsObject" >
+	</class-descriptor>	
+		
+	<class-descriptor className="org.apache.portals.graffito.jcr.testmodel.inheritance.Document" jcrNodeType="graffito:document" 
+	                                   extends="org.apache.portals.graffito.jcr.testmodel.inheritance.Content" >
 		<field-descriptor fieldName="contentType" jcrName="graffito:contenttype" />  
 		<field-descriptor fieldName="size" jcrName="graffito:size" />  	
-		<bean-descriptor fieldName="content" jcrName="graffito:content"  />	
-		
+		<bean-descriptor fieldName="documentStream" jcrName="graffito:documentstream"  />			
 	</class-descriptor >	
 
-	<class-descriptor className="org.apache.portals.graffito.jcr.testmodel.inheritance.Content" jcrNodeType="graffito:content"  >
+	<class-descriptor className="org.apache.portals.graffito.jcr.testmodel.inheritance.DocumentStream" jcrNodeType="graffito:documentstream"  >
 		<field-descriptor fieldName="path" path="true" />
 		<field-descriptor fieldName="encoding" jcrName="graffito:encoding" />
 		<field-descriptor fieldName="content" jcrName="graffito:binarycontent" />

Modified: incubator/graffito/trunk/jcr/jcr-mapping/src/test-config/repository/repository/nodetypes/custom_nodetypes.xml
URL: http://svn.apache.org/viewcvs/incubator/graffito/trunk/jcr/jcr-mapping/src/test-config/repository/repository/nodetypes/custom_nodetypes.xml?rev=390238&r1=390237&r2=390238&view=diff
==============================================================================
--- incubator/graffito/trunk/jcr/jcr-mapping/src/test-config/repository/repository/nodetypes/custom_nodetypes.xml (original)
+++ incubator/graffito/trunk/jcr/jcr-mapping/src/test-config/repository/repository/nodetypes/custom_nodetypes.xml Thu Mar 30 13:03:19 2006
@@ -68,27 +68,46 @@
   
    <nodeType name="graffito:cmsobject" isMixin="false" hasOrderableChildNodes="false" primaryItemName="">
     <supertypes>
-      <supertype>mix:versionable</supertype>
       <supertype>nt:base</supertype>
     </supertypes>
     <propertyDefinition name="*" requiredType="undefined" autoCreated="false" mandatory="true" onParentVersion="COPY" protected="false" multiple="false" />
     <propertyDefinition name="graffito:name" requiredType="String" autoCreated="false" mandatory="true" onParentVersion="COPY" protected="false" multiple="false" />
+
   </nodeType>
 
-   <nodeType name="graffito:document" isMixin="false" hasOrderableChildNodes="false" primaryItemName="">
+   <nodeType name="graffito:content" isMixin="false" hasOrderableChildNodes="false" primaryItemName="">
     <supertypes>
       <supertype>graffito:cmsobject</supertype>
+    </supertypes>
+  </nodeType>
+
+
+   <nodeType name="graffito:document" isMixin="false" hasOrderableChildNodes="false" primaryItemName="">
+    <supertypes>
+      <supertype>graffito:content</supertype>
     </supertypes>    
     <propertyDefinition name="graffito:contenttype" requiredType="String" autoCreated="false" mandatory="true" onParentVersion="COPY" protected="false" multiple="false" />
     <propertyDefinition name="graffito:size" requiredType="Long" autoCreated="false" mandatory="true" onParentVersion="COPY" protected="false" multiple="false" />    
-    <childNodeDefinition name="*" defaultPrimaryType="graffito:content" autoCreated="false" mandatory="false" onParentVersion="COPY" protected="false" sameNameSiblings="false">
+    <childNodeDefinition name="*" defaultPrimaryType="graffito:documentstream" autoCreated="false" mandatory="false" onParentVersion="COPY" protected="false" sameNameSiblings="false">
       <requiredPrimaryTypes>
-        <requiredPrimaryType>graffito:content</requiredPrimaryType>
+        <requiredPrimaryType>graffito:documentstream</requiredPrimaryType>
+      </requiredPrimaryTypes>
+    </childNodeDefinition>        
+  </nodeType>
+  
+  <nodeType name="graffito:folder" isMixin="false" hasOrderableChildNodes="false" primaryItemName="">
+    <supertypes>
+      <supertype>graffito:cmsobject</supertype>
+       <supertype>mix:referenceable</supertype>
+    </supertypes>    
+    <childNodeDefinition name="*" defaultPrimaryType="graffito:cmsobject" autoCreated="false" mandatory="false" onParentVersion="COPY" protected="false" sameNameSiblings="false">
+      <requiredPrimaryTypes>
+        <requiredPrimaryType>graffito:cmsobject</requiredPrimaryType>
       </requiredPrimaryTypes>
     </childNodeDefinition>        
   </nodeType>
 
-   <nodeType name="graffito:content" isMixin="false" hasOrderableChildNodes="false" primaryItemName="">
+   <nodeType name="graffito:documentstream" isMixin="false" hasOrderableChildNodes="false" primaryItemName="">
     <supertypes>
       <supertype>mix:versionable</supertype>
       <supertype>nt:base</supertype>

Modified: incubator/graffito/trunk/jcr/jcr-mapping/src/test/org/apache/portals/graffito/jcr/TestBase.java
URL: http://svn.apache.org/viewcvs/incubator/graffito/trunk/jcr/jcr-mapping/src/test/org/apache/portals/graffito/jcr/TestBase.java?rev=390238&r1=390237&r2=390238&view=diff
==============================================================================
--- incubator/graffito/trunk/jcr/jcr-mapping/src/test/org/apache/portals/graffito/jcr/TestBase.java (original)
+++ incubator/graffito/trunk/jcr/jcr-mapping/src/test/org/apache/portals/graffito/jcr/TestBase.java Thu Mar 30 13:03:19 2006
@@ -266,7 +266,7 @@
             Iterator iterator = result.iterator();
             while (iterator.hasNext())
             {
-                Object  object = (Ancestor) iterator.next();
+                Object  object = iterator.next();
                 if (ReflectionUtils.getNestedProperty(object, "path").equals(path))
                 {
                     if (object.getClass() == objectClass)

Modified: incubator/graffito/trunk/jcr/jcr-mapping/src/test/org/apache/portals/graffito/jcr/mapper/DigesterMapperImplTest.java
URL: http://svn.apache.org/viewcvs/incubator/graffito/trunk/jcr/jcr-mapping/src/test/org/apache/portals/graffito/jcr/mapper/DigesterMapperImplTest.java?rev=390238&r1=390237&r2=390238&view=diff
==============================================================================
--- incubator/graffito/trunk/jcr/jcr-mapping/src/test/org/apache/portals/graffito/jcr/mapper/DigesterMapperImplTest.java (original)
+++ incubator/graffito/trunk/jcr/jcr-mapping/src/test/org/apache/portals/graffito/jcr/mapper/DigesterMapperImplTest.java Thu Mar 30 13:03:19 2006
@@ -28,7 +28,6 @@
 import org.apache.portals.graffito.jcr.mapper.model.ClassDescriptor;
 import org.apache.portals.graffito.jcr.mapper.model.CollectionDescriptor;
 import org.apache.portals.graffito.jcr.mapper.model.FieldDescriptor;
-import org.apache.portals.graffito.jcr.persistence.objectconverter.impl.ObjectConverterImpl;
 import org.apache.portals.graffito.jcr.testmodel.A;
 import org.apache.portals.graffito.jcr.testmodel.B;
 import org.apache.portals.graffito.jcr.testmodel.inheritance.Ancestor;
@@ -241,7 +240,7 @@
     
     /**
     *
-    * Test Node Type per hierarchy setting
+    * Test Node Type per concrete class  setting
     */
    public void testMapperNtConcreteClass()    
    {
@@ -251,6 +250,8 @@
                    "./src/test-config/jcrmapping-atomic.xml",
                    "./src/test-config/jcrmapping-beandescriptor.xml",
                    "./src/test-config/jcrmapping-inheritance.xml"};
+//      		String[] files = {  "./src/test-config/jcrmapping-inheritance.xml"};
+    	   
    		    Mapper mapper = new DigesterMapperImpl(files) .buildMapper();            	
           
            assertNotNull("Mapper is null", mapper);
@@ -265,7 +266,7 @@
            assertFalse("The cmsobject class  have a node type per hierarchy strategy", classDescriptor.usesNodeTypePerHierarchyStrategy());
            assertTrue("The cmsobject class  have not a node type per hierarchy strategy", classDescriptor.usesNodeTypePerConcreteClassStrategy());
            assertTrue ("The cmsobject class has no descendant ", classDescriptor.hasDescendants());
-           assertEquals("Invalid number of descendants", classDescriptor.getDescendantClassDescriptors().size(), 1);
+           assertEquals("Invalid number of descendants", classDescriptor.getDescendantClassDescriptors().size(), 2);
            
             classDescriptor = mapper.getClassDescriptor(Document.class);
            assertNotNull("Classdescriptor is null", classDescriptor);
@@ -274,7 +275,7 @@
            assertNull("The document has an discriminator field", classDescriptor.getDiscriminatorFieldDescriptor());
            assertFalse("The document class is abstract", classDescriptor.isAbstract());
            assertNotNull("The document class has not  an ancestor", classDescriptor.getSuperClassDescriptor());           
-           assertEquals("The document class has an invalid ancestor ancestor", classDescriptor.getSuperClassDescriptor().getClassName(), "org.apache.portals.graffito.jcr.testmodel.inheritance.CmsObject");
+           assertEquals("The document class has an invalid ancestor ancestor", classDescriptor.getSuperClassDescriptor().getClassName(), "org.apache.portals.graffito.jcr.testmodel.inheritance.Content");
            assertFalse("The document class  have a node type per hierarchy strategy", classDescriptor.usesNodeTypePerHierarchyStrategy());
            assertTrue("The document class  have not a node type per hierarchy strategy", classDescriptor.usesNodeTypePerConcreteClassStrategy());
            assertFalse ("The document class has no descendant ", classDescriptor.hasDescendants());

Modified: incubator/graffito/trunk/jcr/jcr-mapping/src/test/org/apache/portals/graffito/jcr/persistence/impl/PersistenceManagerNtConcreteClassTest.java
URL: http://svn.apache.org/viewcvs/incubator/graffito/trunk/jcr/jcr-mapping/src/test/org/apache/portals/graffito/jcr/persistence/impl/PersistenceManagerNtConcreteClassTest.java?rev=390238&r1=390237&r2=390238&view=diff
==============================================================================
--- incubator/graffito/trunk/jcr/jcr-mapping/src/test/org/apache/portals/graffito/jcr/persistence/impl/PersistenceManagerNtConcreteClassTest.java (original)
+++ incubator/graffito/trunk/jcr/jcr-mapping/src/test/org/apache/portals/graffito/jcr/persistence/impl/PersistenceManagerNtConcreteClassTest.java Thu Mar 30 13:03:19 2006
@@ -16,6 +16,8 @@
  */
 package org.apache.portals.graffito.jcr.persistence.impl;
 
+import java.util.Collection;
+
 import junit.framework.Test;
 import junit.framework.TestSuite;
 
@@ -24,9 +26,15 @@
 import org.apache.portals.graffito.jcr.RepositoryLifecycleTestSetup;
 import org.apache.portals.graffito.jcr.TestBase;
 import org.apache.portals.graffito.jcr.persistence.PersistenceManager;
+import org.apache.portals.graffito.jcr.query.Filter;
+import org.apache.portals.graffito.jcr.query.Query;
+import org.apache.portals.graffito.jcr.query.QueryManager;
+import org.apache.portals.graffito.jcr.testmodel.Atomic;
 import org.apache.portals.graffito.jcr.testmodel.inheritance.CmsObject;
 import org.apache.portals.graffito.jcr.testmodel.inheritance.Content;
+import org.apache.portals.graffito.jcr.testmodel.inheritance.DocumentStream;
 import org.apache.portals.graffito.jcr.testmodel.inheritance.Document;
+import org.apache.portals.graffito.jcr.testmodel.inheritance.Folder;
 
 /**
  * Test inheritance with node type per concrete class (without  discreminator field)
@@ -71,10 +79,10 @@
             document.setPath("/document1");
             document.setName("document name");
             document.setContentType("plain/text"); 
-            Content content = new Content();
-            content.setEncoding("utf-8");
-            content.setContent("Test Content".getBytes());
-            document.setContent(content);
+            DocumentStream documentStream = new DocumentStream();
+            documentStream.setEncoding("utf-8");
+            documentStream.setContent("Test Content".getBytes());
+            document.setDocumentStream(documentStream);
             
             persistenceManager.insert(document);
 			persistenceManager.save();
@@ -87,8 +95,8 @@
 			document = (Document) persistenceManager.getObject(Document.class, "/document1");
 			assertEquals("Document path is invalid", document.getPath(), "/document1");
 			assertEquals("Content type  is invalid", document.getContentType(), "plain/text");
-			assertNotNull("Content is null", document.getContent());
-			assertTrue("Invalid content", document.getContent().getEncoding().equals("utf-8"));
+			assertNotNull("document stream is null", document.getDocumentStream());
+			assertTrue("Invalid document stream ", document.getDocumentStream().getEncoding().equals("utf-8"));
 			
 			
 			//---------------------------------------------------------------------------------------------------------
@@ -105,8 +113,8 @@
 			assertEquals("document name is incorrect", document.getName(), "anotherName");
 			assertEquals("Document path is invalid", document.getPath(), "/document1");
 			assertEquals("Content type  is invalid", document.getContentType(), "plain/text");
-			assertNotNull("Content is null", document.getContent());
-			assertTrue("Invalid content", document.getContent().getEncoding().equals("utf-8"));
+			assertNotNull("document stream is null", document.getDocumentStream());
+			assertTrue("Invalid document stream", document.getDocumentStream().getEncoding().equals("utf-8"));
 
 			CmsObject cmsObject = (CmsObject) persistenceManager.getObject(CmsObject.class, "/document1");
 			assertEquals("cmsObject name is incorrect", cmsObject.getName(), "anotherName");
@@ -123,56 +131,50 @@
 	
 	public void testRetrieveCollection() {
 		PersistenceManager persistenceManager = this.getPersistenceManager();
-/*
-		//---------------------------------------------------------------------------------------------------------	
-		// Insert  descendant objects
+
+		//---------------------------------------------------------------------------------------------------------
+		// Insert descendant objects
 		//---------------------------------------------------------------------------------------------------------			
-		Descendant descendant = new Descendant();
-		descendant.setDescendantField("descendantValue");
-		descendant.setAncestorField("ancestorValue");
-		descendant.setPath("/descendant1");
-		persistenceManager.insert(descendant);
-
-		descendant = new Descendant();
-		descendant.setDescendantField("descendantValue2");
-		descendant.setAncestorField("ancestorValue2");
-		descendant.setPath("/descendant2");
-		persistenceManager.insert(descendant);
-
-		SubDescendant subDescendant = new SubDescendant();
-		subDescendant.setDescendantField("descendantValue2");
-		subDescendant.setAncestorField("ancestorValue2");
-		subDescendant.setPath("/subdescendant");
-		subDescendant.setSubDescendantField("subdescendantvalue");
-		persistenceManager.insert(subDescendant);		
-
-		 subDescendant = new SubDescendant();
-		subDescendant.setDescendantField("descendantValue3");
-		subDescendant.setAncestorField("ancestorValue2");
-		subDescendant.setPath("/subdescendant2");
-		subDescendant.setSubDescendantField("subdescendantvalue1");
-		persistenceManager.insert(subDescendant);		
-		
-		
-		AnotherDescendant anotherDescendant = new AnotherDescendant();
-		anotherDescendant.setAnotherDescendantField("anotherDescendantValue");
-		anotherDescendant.setAncestorField("ancestorValue3");
-		anotherDescendant.setPath("/anotherdescendant1");
-		persistenceManager.insert(anotherDescendant);
-
-		anotherDescendant = new AnotherDescendant();
-		anotherDescendant.setAnotherDescendantField("anotherDescendantValue");
-		anotherDescendant.setAncestorField("ancestorValue4");
-		anotherDescendant.setPath("/anotherdescendant2");
-		persistenceManager.insert(anotherDescendant);
-
-		anotherDescendant = new AnotherDescendant();
-		anotherDescendant.setAnotherDescendantField("anotherDescendantValue2");
-		anotherDescendant.setAncestorField("ancestorValue5");
-		anotherDescendant.setPath("/anotherdescendant3");
-		persistenceManager.insert(anotherDescendant);
+        Document document = new Document();
+        document.setPath("/document1");
+        document.setName("document name 1");
+        document.setContentType("plain/text"); 
+        DocumentStream documentStream = new DocumentStream();
+        documentStream.setEncoding("utf-8");
+        documentStream.setContent("Test Content".getBytes());
+        document.setDocumentStream(documentStream);        
+        persistenceManager.insert(document);
+        
+        document = new Document();
+        document.setPath("/document2");        
+        document.setName("document name 2");
+        document.setContentType("plain/text"); 
+        documentStream = new DocumentStream();
+        documentStream.setEncoding("utf-8");
+        documentStream.setContent("Test Content".getBytes());
+        document.setDocumentStream(documentStream);       
+        persistenceManager.insert(document);
+
+        document = new Document();
+        document.setPath("/document3");        
+        document.setName("document 3");
+        document.setContentType("plain/text"); 
+        documentStream = new DocumentStream();
+        documentStream.setEncoding("utf-8");
+        documentStream.setContent("Test Content 3".getBytes());
+        document.setDocumentStream(documentStream);       
+        persistenceManager.insert(document);
+        
+        Folder folder = new Folder();
+        folder.setPath("/folder1");
+        folder.setName("folder1");
+        persistenceManager.insert(folder);
+ 
+         folder = new Folder();
+        folder.setPath("/folder2");
+        folder.setName("folder2");
+        persistenceManager.insert(folder);               		
 
-		
 		Atomic a = new Atomic();
 		a.setPath("/atomic");
 		a.setBooleanPrimitive(true);
@@ -181,64 +183,60 @@
 		persistenceManager.save();
 
 		//---------------------------------------------------------------------------------------------------------	
-		// Retrieve Descendant class
+		// Retrieve Folders
 		//---------------------------------------------------------------------------------------------------------			
 		QueryManager queryManager = persistenceManager.getQueryManager();
-		Filter filter = queryManager.createFilter(Descendant.class);
+		Filter filter = queryManager.createFilter(Folder.class);
 		Query query = queryManager.createQuery(filter);
 
 		Collection result = persistenceManager.getObjects(query);
-		assertEquals("Invalid number of Descendant found", result.size(), 4);
-		assertTrue("Invalid item in the collection", this.contains(result, "/descendant1", Descendant.class));
-		assertTrue("Invalid item in the collection", this.contains(result, "/descendant2", Descendant.class));
-		assertTrue("Invalid item in the collection", this.contains(result, "/subdescendant", SubDescendant.class));
-		assertTrue("Invalid item in the collection", this.contains(result, "/subdescendant2", SubDescendant.class));
+		assertEquals("Invalid number of folders found", result.size(), 2);
+		assertTrue("Invalid item in the collection", this.contains(result, "/folder1",Folder.class));
+		assertTrue("Invalid item in the collection", this.contains(result, "/folder2", Folder.class));		
 		
-
+	
 		//---------------------------------------------------------------------------------------------------------	
-		// Retrieve AnotherDescendant class
+		// Retrieve Documents 
 		//---------------------------------------------------------------------------------------------------------			
 		queryManager = persistenceManager.getQueryManager();
-		filter = queryManager.createFilter(AnotherDescendant.class);
-		filter.addEqualTo("anotherDescendantField", "anotherDescendantValue");
+		filter = queryManager.createFilter(Document.class);
+		filter.addLike("name", "document name%");
 		query = queryManager.createQuery(filter);
 
 		result = persistenceManager.getObjects(query);
-		assertEquals("Invalid number of AnotherDescendant found", result.size(),2);
-		assertTrue("Invalid item in the collection", this.contains(result, "/anotherdescendant1", AnotherDescendant.class));
-		assertTrue("Invalid item in the collection", this.contains(result, "/anotherdescendant2", AnotherDescendant.class));
+		assertEquals("Invalid number of documents  found", result.size(),2);
+		assertTrue("Invalid item in the collection", this.contains(result, "/document1", Document.class));
+		assertTrue("Invalid item in the collection", this.contains(result, "/document2", Document.class));
 
 		//---------------------------------------------------------------------------------------------------------	
-		// Retrieve some descendants & subdescendants
+		// Retrieve Contents (ancestor of Documents) 
 		//---------------------------------------------------------------------------------------------------------			
 		queryManager = persistenceManager.getQueryManager();
-		filter = queryManager.createFilter(Descendant.class);		
-		filter.addEqualTo("descendantField","descendantValue2");
+		filter = queryManager.createFilter(Content.class);
+		filter.addLike("name", "document name%");
 		query = queryManager.createQuery(filter);
 
 		result = persistenceManager.getObjects(query);
-		assertEquals("Invalid ancestor object found", result.size(),2);
-		assertTrue("Invalid item in the collection", this.contains(result, "/descendant2", Descendant.class));
-		assertTrue("Invalid item in the collection", this.contains(result, "/subdescendant", SubDescendant.class));
+		assertEquals("Invalid number of documents  found", result.size(),2);
+		assertTrue("Invalid item in the collection", this.contains(result, "/document1", Document.class));
+		assertTrue("Invalid item in the collection", this.contains(result, "/document2", Document.class));
 		
+				
 		//---------------------------------------------------------------------------------------------------------	
-		// Retrieve all class
-		//---------------------------------------------------------------------------------------------------------			
+		// Retrieve all cmsobjects
+		//---------------------------------------------------------------------------------------------------------					
 		queryManager = persistenceManager.getQueryManager();
-		filter = queryManager.createFilter(Ancestor.class);		
+		filter = queryManager.createFilter(CmsObject.class);		
 		query = queryManager.createQuery(filter);
 
 		result = persistenceManager.getObjects(query);
-		assertEquals("Invalid ancestor object found", result.size(),7);
-		assertTrue("Invalid item in the collection", this.contains(result, "/descendant1", Descendant.class));
-		assertTrue("Invalid item in the collection", this.contains(result, "/descendant2", Descendant.class));
-		assertTrue("Invalid item in the collection", this.contains(result, "/subdescendant", SubDescendant.class));
-		assertTrue("Invalid item in the collection", this.contains(result, "/subdescendant2", SubDescendant.class));
-		assertTrue("Invalid item in the collection", this.contains(result, "/anotherdescendant1", AnotherDescendant.class));
-		assertTrue("Invalid item in the collection", this.contains(result, "/anotherdescendant2", AnotherDescendant.class));
-		assertTrue("Invalid item in the collection", this.contains(result, "/anotherdescendant3", AnotherDescendant.class));		
-
- */
+		assertEquals("Invalid ancestor object found", result.size(),5);
+		assertTrue("Invalid item in the collection", this.contains(result, "/document1", Document.class));
+		assertTrue("Invalid item in the collection", this.contains(result, "/document2", Document.class));	
+		assertTrue("Invalid item in the collection", this.contains(result, "/document3", Document.class));
+		assertTrue("Invalid item in the collection", this.contains(result, "/folder1",Folder.class));	
+		assertTrue("Invalid item in the collection", this.contains(result, "/folder2",Folder.class));
+	
 	}
 	    
 }

Modified: incubator/graffito/trunk/jcr/jcr-mapping/src/test/org/apache/portals/graffito/jcr/testmodel/inheritance/CmsObject.java
URL: http://svn.apache.org/viewcvs/incubator/graffito/trunk/jcr/jcr-mapping/src/test/org/apache/portals/graffito/jcr/testmodel/inheritance/CmsObject.java?rev=390238&r1=390237&r2=390238&view=diff
==============================================================================
--- incubator/graffito/trunk/jcr/jcr-mapping/src/test/org/apache/portals/graffito/jcr/testmodel/inheritance/CmsObject.java (original)
+++ incubator/graffito/trunk/jcr/jcr-mapping/src/test/org/apache/portals/graffito/jcr/testmodel/inheritance/CmsObject.java Thu Mar 30 13:03:19 2006
@@ -29,6 +29,7 @@
     
     protected String path;        
     protected String name;
+    protected Folder parentFolder;
     
 	public String getName() {
 		return name;
@@ -42,6 +43,14 @@
 	public void setPath(String path) {
 		this.path = path;
 	}
+	public Folder getParentFolder() {
+		return parentFolder;
+	}
+	public void setParentFolder(Folder parentFolder) {
+		this.parentFolder = parentFolder;
+	}
+	
+	
         
         
 }

Modified: incubator/graffito/trunk/jcr/jcr-mapping/src/test/org/apache/portals/graffito/jcr/testmodel/inheritance/Content.java
URL: http://svn.apache.org/viewcvs/incubator/graffito/trunk/jcr/jcr-mapping/src/test/org/apache/portals/graffito/jcr/testmodel/inheritance/Content.java?rev=390238&r1=390237&r2=390238&view=diff
==============================================================================
--- incubator/graffito/trunk/jcr/jcr-mapping/src/test/org/apache/portals/graffito/jcr/testmodel/inheritance/Content.java (original)
+++ incubator/graffito/trunk/jcr/jcr-mapping/src/test/org/apache/portals/graffito/jcr/testmodel/inheritance/Content.java Thu Mar 30 13:03:19 2006
@@ -16,84 +16,17 @@
 package org.apache.portals.graffito.jcr.testmodel.inheritance;
 
 
-import java.io.ByteArrayInputStream;
-import java.io.InputStream;
-
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
 
 
 
 /**
  * Content object
  *
- * @author <a href="mailto:christophe.lombart@sword-technologies.com">Christophe Lombart</a>
+ * @author <a href="mailto:christophe.lombart@gmail.com">Christophe Lombart</a>
  * 
  */
-public class Content 
+public abstract class Content  extends CmsObject
 {
-    protected final static Log log = LogFactory.getLog(Content.class);
-      
-    protected byte[] content;
-    
-    protected String encoding;
-    
-    protected String path;
-
-
-    /**
-     * @return Returns the content.
-     */
-    public InputStream getContentStream()
-    {
-        return new ByteArrayInputStream(content);        
-    }
-
-    /**
-     * @return Returns the content.
-     */
-    public byte[] getContent()
-    {
-        
-        return content;
-    }
-
-
-    /**
-     * @param stream The content to set.
-     */
-    public void setContent(byte[] stream)
-    {
-        
-        content = stream;
-
-    }
-        
-    /**
-     * @return Returns the encoding.
-     */
-    public String getEncoding()
-    {
-        return encoding;
-    }
-    
-    /**
-     * @param encoding The encoding to set.
-     */
-    public void setEncoding(String encoding)
-    {
-        this.encoding = encoding;
-    }
-
-	public String getPath() {
-		return path;
-	}
-
-	public void setPath(String path) {
-		this.path = path;
-	}
-    
-    
 }
 
 

Modified: incubator/graffito/trunk/jcr/jcr-mapping/src/test/org/apache/portals/graffito/jcr/testmodel/inheritance/Document.java
URL: http://svn.apache.org/viewcvs/incubator/graffito/trunk/jcr/jcr-mapping/src/test/org/apache/portals/graffito/jcr/testmodel/inheritance/Document.java?rev=390238&r1=390237&r2=390238&view=diff
==============================================================================
--- incubator/graffito/trunk/jcr/jcr-mapping/src/test/org/apache/portals/graffito/jcr/testmodel/inheritance/Document.java (original)
+++ incubator/graffito/trunk/jcr/jcr-mapping/src/test/org/apache/portals/graffito/jcr/testmodel/inheritance/Document.java Thu Mar 30 13:03:19 2006
@@ -25,14 +25,14 @@
  * @author <a href="mailto:christophe.lombart@sword-technologies.com">Christophe Lombart</a>
  * 
  */
-public class Document extends CmsObject
+public class Document extends Content
 {
     protected final static Log log =  LogFactory.getLog(Document.class);
     
     protected long size;
     protected String contentType;   
         
-    protected Content content;
+    protected DocumentStream documentStream;
 
 
     /** 
@@ -70,15 +70,14 @@
         this.size = size;
     }
 
+	public DocumentStream getDocumentStream() {
+		return documentStream;
+	}
+
+	public void setDocumentStream(DocumentStream documentStream) {
+		this.documentStream = documentStream;
+	}
+
     
-    public Content getContent()
-    {
-        return content;
-    }
-    
-    public void setContent(Content content)
-    {
-        this.content = content;
-    }
 }
 

Copied: incubator/graffito/trunk/jcr/jcr-mapping/src/test/org/apache/portals/graffito/jcr/testmodel/inheritance/DocumentStream.java (from r388968, incubator/graffito/trunk/jcr/jcr-mapping/src/test/org/apache/portals/graffito/jcr/testmodel/inheritance/Content.java)
URL: http://svn.apache.org/viewcvs/incubator/graffito/trunk/jcr/jcr-mapping/src/test/org/apache/portals/graffito/jcr/testmodel/inheritance/DocumentStream.java?p2=incubator/graffito/trunk/jcr/jcr-mapping/src/test/org/apache/portals/graffito/jcr/testmodel/inheritance/DocumentStream.java&p1=incubator/graffito/trunk/jcr/jcr-mapping/src/test/org/apache/portals/graffito/jcr/testmodel/inheritance/Content.java&r1=388968&r2=390238&rev=390238&view=diff
==============================================================================
--- incubator/graffito/trunk/jcr/jcr-mapping/src/test/org/apache/portals/graffito/jcr/testmodel/inheritance/Content.java (original)
+++ incubator/graffito/trunk/jcr/jcr-mapping/src/test/org/apache/portals/graffito/jcr/testmodel/inheritance/DocumentStream.java Thu Mar 30 13:03:19 2006
@@ -30,9 +30,9 @@
  * @author <a href="mailto:christophe.lombart@sword-technologies.com">Christophe Lombart</a>
  * 
  */
-public class Content 
+public class DocumentStream 
 {
-    protected final static Log log = LogFactory.getLog(Content.class);
+    protected final static Log log = LogFactory.getLog(DocumentStream.class);
       
     protected byte[] content;
     

Modified: incubator/graffito/trunk/jcr/jcr-mapping/src/test/org/apache/portals/graffito/jcr/testmodel/inheritance/Folder.java
URL: http://svn.apache.org/viewcvs/incubator/graffito/trunk/jcr/jcr-mapping/src/test/org/apache/portals/graffito/jcr/testmodel/inheritance/Folder.java?rev=390238&r1=390237&r2=390238&view=diff
==============================================================================
--- incubator/graffito/trunk/jcr/jcr-mapping/src/test/org/apache/portals/graffito/jcr/testmodel/inheritance/Folder.java (original)
+++ incubator/graffito/trunk/jcr/jcr-mapping/src/test/org/apache/portals/graffito/jcr/testmodel/inheritance/Folder.java Thu Mar 30 13:03:19 2006
@@ -23,30 +23,25 @@
 /**
  * CMS Folder Test
  *
- * @author <a href="mailto:christophe.lombart@sword-technologies.com">Christophe Lombart</a>
+ * @author <a href="mailto:christophe.lombart@gmail.com">Christophe Lombart</a>
  * @version $Id: Folder.java,v 1.1 2004/12/22 20:36:59 christophe Exp $
  */
 public class Folder extends CmsObject 
 {
 
-    protected List folders;
-    protected List documents;
-    
-    /**
-     * @see org.apache.portals.graffito.model.Folder#getDocuments()
-     */
-    public List getDocuments()
-    {
-        return documents;
-    }
+    protected List children;
 
-    /**
-     * @see org.apache.portals.graffito.model.Folder#getFolders()
-     */
-    public List getFolders()
+	public List getChildren() {
+		return children;
+	}
+
+	public void setChildren(List children) {
+		this.children = children;
+	}
+    
+    public void addChild(CmsObject child)
     {
-        return folders;
+    	    children.add(child);
     }
-    
 }
 



Mime
View raw message