cayenne-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From aadamc...@apache.org
Subject svn commit: r570021 - in /cayenne/main/trunk/framework/cayenne-jdk1.4-unpublished/src: main/java/org/apache/cayenne/map/ObjEntity.java test/java/org/apache/cayenne/map/ObjEntityTest.java
Date Mon, 27 Aug 2007 07:34:01 GMT
Author: aadamchik
Date: Mon Aug 27 00:34:00 2007
New Revision: 570021

URL: http://svn.apache.org/viewvc?rev=570021&view=rev
Log:
CAY-854 the relationships to entities which are "not for client use" are being returned by
${objEntity.DeclaredRelationships} tag in superclass template

Modified:
    cayenne/main/trunk/framework/cayenne-jdk1.4-unpublished/src/main/java/org/apache/cayenne/map/ObjEntity.java
    cayenne/main/trunk/framework/cayenne-jdk1.4-unpublished/src/test/java/org/apache/cayenne/map/ObjEntityTest.java

Modified: cayenne/main/trunk/framework/cayenne-jdk1.4-unpublished/src/main/java/org/apache/cayenne/map/ObjEntity.java
URL: http://svn.apache.org/viewvc/cayenne/main/trunk/framework/cayenne-jdk1.4-unpublished/src/main/java/org/apache/cayenne/map/ObjEntity.java?rev=570021&r1=570020&r2=570021&view=diff
==============================================================================
--- cayenne/main/trunk/framework/cayenne-jdk1.4-unpublished/src/main/java/org/apache/cayenne/map/ObjEntity.java
(original)
+++ cayenne/main/trunk/framework/cayenne-jdk1.4-unpublished/src/main/java/org/apache/cayenne/map/ObjEntity.java
Mon Aug 27 00:34:00 2007
@@ -193,9 +193,16 @@
         while (relationships.hasNext()) {
             ObjRelationship relationship = (ObjRelationship) relationships.next();
 
-            if (!relationship.isRuntime()) {
-                entity.addRelationship(relationship.getClientRelationship());
+            if (relationship.isRuntime()) {
+                continue;
             }
+            
+            ObjEntity targetEntity = (ObjEntity) relationship.getTargetEntity();
+            if(targetEntity == null || !targetEntity.isClientAllowed()) {
+                continue;
+            }
+
+            entity.addRelationship(relationship.getClientRelationship());
         }
 
         // TODO: andrus 2/5/2007 - copy embeddables

Modified: cayenne/main/trunk/framework/cayenne-jdk1.4-unpublished/src/test/java/org/apache/cayenne/map/ObjEntityTest.java
URL: http://svn.apache.org/viewvc/cayenne/main/trunk/framework/cayenne-jdk1.4-unpublished/src/test/java/org/apache/cayenne/map/ObjEntityTest.java?rev=570021&r1=570020&r2=570021&view=diff
==============================================================================
--- cayenne/main/trunk/framework/cayenne-jdk1.4-unpublished/src/test/java/org/apache/cayenne/map/ObjEntityTest.java
(original)
+++ cayenne/main/trunk/framework/cayenne-jdk1.4-unpublished/src/test/java/org/apache/cayenne/map/ObjEntityTest.java
Mon Aug 27 00:34:00 2007
@@ -75,13 +75,19 @@
     }
 
     public void testGetClientEntity() {
+        
+        DataMap map = new DataMap();
+        map.setClientSupported(true);
+        
         final ObjEntity target = new ObjEntity("te1");
+        map.addObjEntity(target);
 
         ObjEntity e1 = new ObjEntity("entity");
         e1.setClassName("x.y.z");
         e1.setClientClassName("a.b.c");
         e1.addAttribute(new ObjAttribute("A1"));
         e1.addAttribute(new ObjAttribute("A2"));
+        map.addObjEntity(e1);
 
         ObjRelationship r1 = new ObjRelationship("r1") {
 



Mime
View raw message