cayenne-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dkazimirc...@apache.org
Subject svn commit: r1181678 - in /cayenne/main/trunk: docs/doc/src/main/resources/ framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/map/ framework/cayenne-project/src/main/java/org/apache/cayenne/project/validation/ modeler/cayenne-modele...
Date Tue, 11 Oct 2011 09:56:28 GMT
Author: dkazimirchyk
Date: Tue Oct 11 09:56:28 2011
New Revision: 1181678

URL: http://svn.apache.org/viewvc?rev=1181678&view=rev
Log:
CAY-1477 Modeler: Better validation for erroneous horizontal inheritance mapping

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/map/ObjEntity.java
    cayenne/main/trunk/framework/cayenne-project/src/main/java/org/apache/cayenne/project/validation/ObjEntityValidator.java
    cayenne/main/trunk/modeler/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/editor/ObjEntityTab.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=1181678&r1=1181677&r2=1181678&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 Tue Oct 11 09:56:28 2011
@@ -19,6 +19,7 @@ CAY-1618 Create database adapters instan
 
 Bug Fixes Since 3.1M3:
 
+CAY-1477 Modeler: Better validation for erroneous horizontal inheritance mapping
 CAY-1513 Deadlock in PoolManager
 CAY-1627 CayenneModeler: collection types for to-many relationships are not saved
 CAY-1628 ClassCastException when using java.util.Set or java.util.Map as collection type
for to-many relationship

Modified: cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/map/ObjEntity.java
URL: http://svn.apache.org/viewvc/cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/map/ObjEntity.java?rev=1181678&r1=1181677&r2=1181678&view=diff
==============================================================================
--- cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/map/ObjEntity.java
(original)
+++ cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/map/ObjEntity.java
Tue Oct 11 09:56:28 2011
@@ -145,8 +145,14 @@ public class ObjEntity extends Entity im
         }
 
         if (getDbEntityName() != null && getDbEntity() != null) {
-            encoder.print("\" dbEntityName=\"");
-            encoder.print(Util.encodeXmlAttribute(getDbEntityName()));
+            
+            // not writing DbEntity name if sub entity has same DbEntity 
+            // as super entity, see CAY-1477
+            if (!(getSuperEntity() != null 
+                    && getSuperEntity().getDbEntity() == getDbEntity())) {
+                encoder.print("\" dbEntityName=\"");
+                encoder.print(Util.encodeXmlAttribute(getDbEntityName()));
+            }
         }
 
         if (getSuperEntityName() == null && getSuperClassName() != null) {

Modified: cayenne/main/trunk/framework/cayenne-project/src/main/java/org/apache/cayenne/project/validation/ObjEntityValidator.java
URL: http://svn.apache.org/viewvc/cayenne/main/trunk/framework/cayenne-project/src/main/java/org/apache/cayenne/project/validation/ObjEntityValidator.java?rev=1181678&r1=1181677&r2=1181678&view=diff
==============================================================================
--- cayenne/main/trunk/framework/cayenne-project/src/main/java/org/apache/cayenne/project/validation/ObjEntityValidator.java
(original)
+++ cayenne/main/trunk/framework/cayenne-project/src/main/java/org/apache/cayenne/project/validation/ObjEntityValidator.java
Tue Oct 11 09:56:28 2011
@@ -108,6 +108,15 @@ class ObjEntityValidator extends Configu
                     entity.getName(),
                     superClassName);
         }
+        
+        if (entity.getDbEntityName() != null && entity.getSuperEntityName() != null)
{
+            addFailure(
+                    validationResult,
+                    entity,
+                    "Sub ObjEntity '%s' has database table declaration different from super
ObjEntity '%s'",
+                    entity.getName(),
+                    entity.getSuperEntityName());
+        }
 
         DataMap map = entity.getDataMap();
         if (map == null) {

Modified: cayenne/main/trunk/modeler/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/editor/ObjEntityTab.java
URL: http://svn.apache.org/viewvc/cayenne/main/trunk/modeler/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/editor/ObjEntityTab.java?rev=1181678&r1=1181677&r2=1181678&view=diff
==============================================================================
--- cayenne/main/trunk/modeler/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/editor/ObjEntityTab.java
(original)
+++ cayenne/main/trunk/modeler/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/editor/ObjEntityTab.java
Tue Oct 11 09:56:28 2011
@@ -301,6 +301,14 @@ public class ObjEntityTab extends JPanel
 
                     }
                     entity.setSuperEntityName(name);
+                    
+                    if (name == null) {
+                        dbEntityCombo.setEnabled(true);
+                    }
+                    else {
+                        dbEntityCombo.setEnabled(false);
+                        dbEntityCombo.getModel().setSelectedItem(null);
+                    }
 
                     // if a super-entity selected, disable table selection
                     // and also update parent DbEntity selection...
@@ -459,6 +467,7 @@ public class ObjEntityTab extends JPanel
         dbModel.setSelectedItem(entity.getDbEntity());
         dbEntityCombo.setRenderer(CellRenderers.entityListRendererWithIcons(map));
         dbEntityCombo.setModel(dbModel);
+        dbEntityCombo.setEnabled(entity.getSuperClassName() == null);
 
         // toggle visibilty and editability rules
 



Mime
View raw message