You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cayenne.apache.org by aa...@apache.org on 2007/12/23 16:53:52 UTC

svn commit: r606568 - in /cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src: main/resources/dotemplates/v1_2/ test/java/org/apache/art/auto/ test/java/org/apache/cayenne/access/ test/resources/

Author: aadamchik
Date: Sun Dec 23 07:53:51 2007
New Revision: 606568

URL: http://svn.apache.org/viewvc?rev=606568&view=rev
Log:
under certain circumstances null collection type results in invalid class generation results... fixing velocity expression
(now really fixed)

Added:
    cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/test/java/org/apache/cayenne/access/DataContextFlattenedAttributesTest.java
      - copied, changed from r606550, cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/test/java/org/apache/cayenne/access/DataContextCompoundOETest.java
Removed:
    cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/test/java/org/apache/cayenne/access/DataContextCompoundOETest.java
Modified:
    cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/resources/dotemplates/v1_2/client-superclass.vm
    cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/resources/dotemplates/v1_2/singleclass.vm
    cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/resources/dotemplates/v1_2/superclass.vm
    cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/test/java/org/apache/art/auto/_Artist.java
    cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/test/java/org/apache/art/auto/_CompoundPainting.java
    cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/test/resources/testmap.map.xml

Modified: cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/resources/dotemplates/v1_2/client-superclass.vm
URL: http://svn.apache.org/viewvc/cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/resources/dotemplates/v1_2/client-superclass.vm?rev=606568&r1=606567&r2=606568&view=diff
==============================================================================
--- cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/resources/dotemplates/v1_2/client-superclass.vm (original)
+++ cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/resources/dotemplates/v1_2/client-superclass.vm Sun Dec 23 07:53:51 2007
@@ -41,7 +41,9 @@
 #end
 #foreach( $rel in ${object.DeclaredRelationships} )
 $importUtils.addType(${rel.TargetEntity.ClientClassName})##
+#if(${rel.CollectionType}) 
 $importUtils.addType(${rel.CollectionType})##
+#end
 #end
 #if( ${entityUtils.hasToOneDeclaredRelationships()} )
 ${importUtils.addType('org.apache.cayenne.ValueHolder')}##

Modified: cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/resources/dotemplates/v1_2/singleclass.vm
URL: http://svn.apache.org/viewvc/cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/resources/dotemplates/v1_2/singleclass.vm?rev=606568&r1=606567&r2=606568&view=diff
==============================================================================
--- cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/resources/dotemplates/v1_2/singleclass.vm (original)
+++ cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/resources/dotemplates/v1_2/singleclass.vm Sun Dec 23 07:53:51 2007
@@ -41,7 +41,9 @@
 #end
 #foreach( $rel in ${object.DeclaredRelationships} )
 $importUtils.addType(${rel.TargetEntity.ClassName})##
+#if(${rel.CollectionType}) 
 $importUtils.addType(${rel.CollectionType})##
+#end
 #end
 ${importUtils.generate()}
 

Modified: cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/resources/dotemplates/v1_2/superclass.vm
URL: http://svn.apache.org/viewvc/cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/resources/dotemplates/v1_2/superclass.vm?rev=606568&r1=606567&r2=606568&view=diff
==============================================================================
--- cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/resources/dotemplates/v1_2/superclass.vm (original)
+++ cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/resources/dotemplates/v1_2/superclass.vm Sun Dec 23 07:53:51 2007
@@ -40,7 +40,9 @@
 #end
 #foreach( $rel in ${object.DeclaredRelationships} )
 $importUtils.addType(${rel.TargetEntity.ClassName})##
-${importUtils.addType($rel.CollectionType)}##
+#if(${rel.CollectionType}) 
+$importUtils.addType(${rel.CollectionType})##
+#end
 #end
 ${importUtils.generate()}
 

Modified: cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/test/java/org/apache/art/auto/_Artist.java
URL: http://svn.apache.org/viewvc/cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/test/java/org/apache/art/auto/_Artist.java?rev=606568&r1=606567&r2=606568&view=diff
==============================================================================
--- cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/test/java/org/apache/art/auto/_Artist.java (original)
+++ cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/test/java/org/apache/art/auto/_Artist.java Sun Dec 23 07:53:51 2007
@@ -1,11 +1,20 @@
 package org.apache.art.auto;
 
-/** Class _Artist was generated by Cayenne.
-  * It is probably a good idea to avoid changing this class manually, 
-  * since it may be overwritten next time code is regenerated. 
-  * If you need to make any customizations, please use subclass. 
-  */
-public abstract class _Artist extends org.apache.cayenne.CayenneDataObject {
+import java.util.Date;
+import java.util.List;
+
+import org.apache.art.ArtGroup;
+import org.apache.art.ArtistExhibit;
+import org.apache.art.Painting;
+import org.apache.cayenne.CayenneDataObject;
+
+/**
+ * Class _Artist was generated by Cayenne.
+ * It is probably a good idea to avoid changing this class manually,
+ * since it may be overwritten next time code is regenerated.
+ * If you need to make any customizations, please use subclass.
+ */
+public abstract class _Artist extends CayenneDataObject {
 
     public static final String ARTIST_NAME_PROPERTY = "artistName";
     public static final String DATE_OF_BIRTH_PROPERTY = "dateOfBirth";
@@ -21,47 +30,48 @@
     public String getArtistName() {
         return (String)readProperty("artistName");
     }
-    
-    
-    public void setDateOfBirth(java.util.Date dateOfBirth) {
+
+    public void setDateOfBirth(Date dateOfBirth) {
         writeProperty("dateOfBirth", dateOfBirth);
     }
-    public java.util.Date getDateOfBirth() {
-        return (java.util.Date)readProperty("dateOfBirth");
+    public Date getDateOfBirth() {
+        return (Date)readProperty("dateOfBirth");
     }
-    
-    
-    public void addToArtistExhibitArray(org.apache.art.ArtistExhibit obj) {
+
+    public void addToArtistExhibitArray(ArtistExhibit obj) {
         addToManyTarget("artistExhibitArray", obj, true);
     }
-    public void removeFromArtistExhibitArray(org.apache.art.ArtistExhibit obj) {
+    public void removeFromArtistExhibitArray(ArtistExhibit obj) {
         removeToManyTarget("artistExhibitArray", obj, true);
     }
-    public java.util.List getArtistExhibitArray() {
-        return (java.util.List)readProperty("artistExhibitArray");
+    @SuppressWarnings("unchecked")
+    public List<ArtistExhibit> getArtistExhibitArray() {
+        return (List<ArtistExhibit>)readProperty("artistExhibitArray");
     }
-    
-    
-    public void addToGroupArray(org.apache.art.ArtGroup obj) {
+
+
+    public void addToGroupArray(ArtGroup obj) {
         addToManyTarget("groupArray", obj, true);
     }
-    public void removeFromGroupArray(org.apache.art.ArtGroup obj) {
+    public void removeFromGroupArray(ArtGroup obj) {
         removeToManyTarget("groupArray", obj, true);
     }
-    public java.util.List getGroupArray() {
-        return (java.util.List)readProperty("groupArray");
+    @SuppressWarnings("unchecked")
+    public List<ArtGroup> getGroupArray() {
+        return (List<ArtGroup>)readProperty("groupArray");
     }
-    
-    
-    public void addToPaintingArray(org.apache.art.Painting obj) {
+
+
+    public void addToPaintingArray(Painting obj) {
         addToManyTarget("paintingArray", obj, true);
     }
-    public void removeFromPaintingArray(org.apache.art.Painting obj) {
+    public void removeFromPaintingArray(Painting obj) {
         removeToManyTarget("paintingArray", obj, true);
     }
-    public java.util.List getPaintingArray() {
-        return (java.util.List)readProperty("paintingArray");
+    @SuppressWarnings("unchecked")
+    public List<Painting> getPaintingArray() {
+        return (List<Painting>)readProperty("paintingArray");
     }
-    
-    
+
+
 }

Modified: cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/test/java/org/apache/art/auto/_CompoundPainting.java
URL: http://svn.apache.org/viewvc/cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/test/java/org/apache/art/auto/_CompoundPainting.java?rev=606568&r1=606567&r2=606568&view=diff
==============================================================================
--- cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/test/java/org/apache/art/auto/_CompoundPainting.java (original)
+++ cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/test/java/org/apache/art/auto/_CompoundPainting.java Sun Dec 23 07:53:51 2007
@@ -1,11 +1,19 @@
 package org.apache.art.auto;
 
-/** Class _CompoundPainting was generated by Cayenne.
-  * It is probably a good idea to avoid changing this class manually, 
-  * since it may be overwritten next time code is regenerated. 
-  * If you need to make any customizations, please use subclass. 
-  */
-public abstract class _CompoundPainting extends org.apache.cayenne.CayenneDataObject {
+import java.math.BigDecimal;
+
+import org.apache.art.Artist;
+import org.apache.art.Gallery;
+import org.apache.art.PaintingInfo;
+import org.apache.cayenne.CayenneDataObject;
+
+/**
+ * Class _CompoundPainting was generated by Cayenne.
+ * It is probably a good idea to avoid changing this class manually,
+ * since it may be overwritten next time code is regenerated.
+ * If you need to make any customizations, please use subclass.
+ */
+public abstract class _CompoundPainting extends CayenneDataObject {
 
     public static final String ARTIST_NAME_PROPERTY = "artistName";
     public static final String ESTIMATED_PRICE_PROPERTY = "estimatedPrice";
@@ -18,47 +26,66 @@
 
     public static final String PAINTING_ID_PK_COLUMN = "PAINTING_ID";
 
+    public void setArtistName(String artistName) {
+        writeProperty("artistName", artistName);
+    }
     public String getArtistName() {
         return (String)readProperty("artistName");
     }
-    
-    
-    public java.math.BigDecimal getEstimatedPrice() {
-        return (java.math.BigDecimal)readProperty("estimatedPrice");
+
+    public void setEstimatedPrice(BigDecimal estimatedPrice) {
+        writeProperty("estimatedPrice", estimatedPrice);
+    }
+    public BigDecimal getEstimatedPrice() {
+        return (BigDecimal)readProperty("estimatedPrice");
+    }
+
+    public void setGalleryName(String galleryName) {
+        writeProperty("galleryName", galleryName);
     }
-    
-    
     public String getGalleryName() {
         return (String)readProperty("galleryName");
     }
-    
-    
+
+    public void setPaintingTitle(String paintingTitle) {
+        writeProperty("paintingTitle", paintingTitle);
+    }
     public String getPaintingTitle() {
         return (String)readProperty("paintingTitle");
     }
-    
-    
+
+    public void setTextReview(String textReview) {
+        writeProperty("textReview", textReview);
+    }
     public String getTextReview() {
         return (String)readProperty("textReview");
     }
-    
-    
 
-    public org.apache.art.Artist getToArtist() {
-        return (org.apache.art.Artist)readProperty("toArtist");
-    } 
-    
-    
-
-    public org.apache.art.Gallery getToGallery() {
-        return (org.apache.art.Gallery)readProperty("toGallery");
-    } 
-    
-    
-
-    public org.apache.art.PaintingInfo getToPaintingInfo() {
-        return (org.apache.art.PaintingInfo)readProperty("toPaintingInfo");
-    } 
-    
-    
+    public void setToArtist(Artist toArtist) {
+        setToOneTarget("toArtist", toArtist, true);
+    }
+
+    public Artist getToArtist() {
+        return (Artist)readProperty("toArtist");
+    }
+
+
+    public void setToGallery(Gallery toGallery) {
+        setToOneTarget("toGallery", toGallery, true);
+    }
+
+    public Gallery getToGallery() {
+        return (Gallery)readProperty("toGallery");
+    }
+
+
+    public void setToPaintingInfo(PaintingInfo toPaintingInfo) {
+        setToOneTarget("toPaintingInfo", toPaintingInfo, true);
+    }
+
+    public PaintingInfo getToPaintingInfo() {
+        return (PaintingInfo)readProperty("toPaintingInfo");
+    }
+
+
 }

Copied: cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/test/java/org/apache/cayenne/access/DataContextFlattenedAttributesTest.java (from r606550, cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/test/java/org/apache/cayenne/access/DataContextCompoundOETest.java)
URL: http://svn.apache.org/viewvc/cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/test/java/org/apache/cayenne/access/DataContextFlattenedAttributesTest.java?p2=cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/test/java/org/apache/cayenne/access/DataContextFlattenedAttributesTest.java&p1=cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/test/java/org/apache/cayenne/access/DataContextCompoundOETest.java&r1=606550&r2=606568&rev=606568&view=diff
==============================================================================
--- cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/test/java/org/apache/cayenne/access/DataContextCompoundOETest.java (original)
+++ cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/test/java/org/apache/cayenne/access/DataContextFlattenedAttributesTest.java Sun Dec 23 07:53:51 2007
@@ -34,19 +34,19 @@
 /**
  * @author Andrus Adamchik
  */
-public class DataContextCompoundOETest extends CayenneCase {
+public class DataContextFlattenedAttributesTest extends CayenneCase {
 
     final int artistCount = 4;
     final int galleryCount = 2;
     final int paintCount = 8;
 
-    protected DataContext ctxt;
+    protected DataContext context;
 
     protected void setUp() throws Exception {
         super.setUp();
 
         deleteTestData();
-        ctxt = createDataContext();
+        context = createDataContext();
     }
 
     private void populateTables() throws Exception {
@@ -110,7 +110,7 @@
     public void testSelectCompound1() throws Exception {
         populateTables();
         SelectQuery query = new SelectQuery(CompoundPainting.class);
-        List<?> objects = ctxt.performQuery(query);
+        List<?> objects = context.performQuery(query);
 
         assertNotNull(objects);
         assertEquals(3, objects.size());
@@ -145,7 +145,7 @@
         populateTables();
         SelectQuery query = new SelectQuery(CompoundPainting.class, ExpressionFactory
                 .matchExp("artistName", "artist2"));
-        List<?> objects = ctxt.performQuery(query);
+        List<?> objects = context.performQuery(query);
 
         assertNotNull(objects);
         assertEquals(1, objects.size());

Modified: cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/test/resources/testmap.map.xml
URL: http://svn.apache.org/viewvc/cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/test/resources/testmap.map.xml?rev=606568&r1=606567&r2=606568&view=diff
==============================================================================
--- cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/test/resources/testmap.map.xml (original)
+++ cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/test/resources/testmap.map.xml Sun Dec 23 07:53:51 2007
@@ -296,7 +296,7 @@
 	<obj-entity name="CompoundFkTestEntity" className="org.apache.art.CompoundFkTestEntity" dbEntityName="COMPOUND_FK_TEST">
 		<obj-attribute name="name" type="java.lang.String" db-attribute-path="NAME"/>
 	</obj-entity>
-	<obj-entity name="CompoundPainting" className="org.apache.art.CompoundPainting" readOnly="true" dbEntityName="PAINTING">
+	<obj-entity name="CompoundPainting" className="org.apache.art.CompoundPainting" dbEntityName="PAINTING">
 		<obj-attribute name="artistName" type="java.lang.String" db-attribute-path="toArtist.ARTIST_NAME"/>
 		<obj-attribute name="estimatedPrice" type="java.math.BigDecimal" db-attribute-path="ESTIMATED_PRICE"/>
 		<obj-attribute name="galleryName" type="java.lang.String" db-attribute-path="toGallery.GALLERY_NAME"/>