cayenne-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From aadamc...@apache.org
Subject svn commit: r794661 - in /cayenne/main/trunk: docs/doc/src/main/resources/ framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/ framework/cayenne-jdk1.5-unpublished/src/test/java/org/apache/cayenne/
Date Thu, 16 Jul 2009 13:01:21 GMT
Author: aadamchik
Date: Thu Jul 16 13:01:20 2009
New Revision: 794661

URL: http://svn.apache.org/viewvc?rev=794661&view=rev
Log:
CAY-1177 Outer join syntax causes exception with Expression.filterObjects()

patch by Dima Loiko FilterObjects_1.1.txt

Modified:
    cayenne/main/trunk/docs/doc/src/main/resources/RELEASE-NOTES.txt
    cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/CayenneDataObject.java
    cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/test/java/org/apache/cayenne/CayenneDataObjectTest.java

Modified: cayenne/main/trunk/docs/doc/src/main/resources/RELEASE-NOTES.txt
URL: http://svn.apache.org/viewvc/cayenne/main/trunk/docs/doc/src/main/resources/RELEASE-NOTES.txt?rev=794661&r1=794660&r2=794661&view=diff
==============================================================================
--- cayenne/main/trunk/docs/doc/src/main/resources/RELEASE-NOTES.txt (original)
+++ cayenne/main/trunk/docs/doc/src/main/resources/RELEASE-NOTES.txt Thu Jul 16 13:01:20 2009
@@ -24,6 +24,7 @@
 Bug Fixes Since M6:
 
 CAY-1169 Weird behavior when adding entity via merging
+CAY-1177 Outer join syntax causes exception with Expression.filterObjects()
 CAY-1224 reverse engineering partially changed schema shows empty error messge window
 CAY-1229 Fixing DB2 Tests
 CAY-1232 Unit tests failing on Sybase

Modified: cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/CayenneDataObject.java
URL: http://svn.apache.org/viewvc/cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/CayenneDataObject.java?rev=794661&r1=794660&r2=794661&view=diff
==============================================================================
--- cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/CayenneDataObject.java
(original)
+++ cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/CayenneDataObject.java
Thu Jul 16 13:01:20 2009
@@ -175,9 +175,14 @@
         int length = tokens.countTokens();
         String[] tokenized = new String[length];
         for (int i = 0; i < length; i++) {
-            tokenized[i] = tokens.nextToken();
+            String temp = tokens.nextToken();
+            if(temp.endsWith("+")){
+                tokenized[i] = temp.substring(0, temp.length() - 1);
+            }
+            else{
+                tokenized[i] = temp;
+            }
         }
-
         return tokenized;
     }
 

Modified: cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/test/java/org/apache/cayenne/CayenneDataObjectTest.java
URL: http://svn.apache.org/viewvc/cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/test/java/org/apache/cayenne/CayenneDataObjectTest.java?rev=794661&r1=794660&r2=794661&view=diff
==============================================================================
--- cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/test/java/org/apache/cayenne/CayenneDataObjectTest.java
(original)
+++ cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/test/java/org/apache/cayenne/CayenneDataObjectTest.java
Thu Jul 16 13:01:20 2009
@@ -19,12 +19,15 @@
 
 package org.apache.cayenne;
 
+import java.util.ArrayList;
 import java.util.List;
 
 import org.apache.art.Artist;
 import org.apache.art.ArtistExhibit;
 import org.apache.art.Painting;
 import org.apache.cayenne.access.DataContext;
+import org.apache.cayenne.exp.Expression;
+import org.apache.cayenne.exp.ExpressionFactory;
 import org.apache.cayenne.unit.CayenneCase;
 import org.apache.cayenne.unit.util.TestBean;
 
@@ -117,4 +120,42 @@
             ex.readNestedProperty("toArtist.paintingArray.paintingTitle");
         assertEquals(names, names2);
     }
+    
+    public void testReadNestedPropertyToManyInMiddle1() throws Exception {
+        DataContext context = createDataContext();
+        
+        Artist a = context.newObject(Artist.class);
+        ArtistExhibit ex = context.newObject(ArtistExhibit.class);
+        Painting p1 = context.newObject(Painting.class);
+        Painting p2 = context.newObject(Painting.class);
+        p1.setPaintingTitle("p1");
+        p2.setPaintingTitle("p2");
+        a.addToPaintingArray(p1);
+        a.addToPaintingArray(p2);
+        ex.setToArtist(a);
+        
+        List<String> names = (List<String>) a.readNestedProperty("paintingArray+.paintingTitle");
+        assertEquals(names.size(), 2);
+        assertEquals(names.get(0), "p1");
+        assertEquals(names.get(1), "p2");
+        
+        List<String> names2 = (List<String>) 
+            ex.readNestedProperty("toArtist.paintingArray+.paintingTitle");
+        assertEquals(names, names2);
+    }
+    
+    public void testFilterObjects() {
+        DataContext context = createDataContext();
+        List paintingList = new ArrayList();
+        Painting p1 = (Painting) context.newObject(Painting.class);
+        Artist a1 = (Artist) context.newObject(Artist.class);
+        a1.setArtistName("dddAd");
+        p1.setToArtist(a1);
+
+        paintingList.add(p1);
+        Expression exp = ExpressionFactory.likeExp("toArtist+.artistName", "d%");
+
+        List<Painting> rezult = exp.filterObjects(paintingList);
+        assertEquals(a1,rezult.get(0).getToArtist());
+    }
 }



Mime
View raw message