cayenne-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ntimof...@apache.org
Subject [1/4] cayenne git commit: CAY-1891 Add To-Many / To-One Warnings to Cayenne Modeler
Date Tue, 18 Apr 2017 15:35:29 GMT
Repository: cayenne
Updated Branches:
  refs/heads/master 8f2e886cd -> 11154a873


CAY-1891 Add To-Many / To-One Warnings to Cayenne Modeler


Project: http://git-wip-us.apache.org/repos/asf/cayenne/repo
Commit: http://git-wip-us.apache.org/repos/asf/cayenne/commit/5a42815c
Tree: http://git-wip-us.apache.org/repos/asf/cayenne/tree/5a42815c
Diff: http://git-wip-us.apache.org/repos/asf/cayenne/diff/5a42815c

Branch: refs/heads/master
Commit: 5a42815c653a83559ff5d720b2e165f77f9304e4
Parents: 8f3ac8b
Author: Anton Dreka <drekoas@gmail.com>
Authored: Tue Apr 18 17:49:54 2017 +0300
Committer: Anton Dreka <drekoas@gmail.com>
Committed: Tue Apr 18 17:49:54 2017 +0300

----------------------------------------------------------------------
 .../project/validation/DbRelationshipValidator.java   | 14 ++++++++++++++
 1 file changed, 14 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cayenne/blob/5a42815c/cayenne-project/src/main/java/org/apache/cayenne/project/validation/DbRelationshipValidator.java
----------------------------------------------------------------------
diff --git a/cayenne-project/src/main/java/org/apache/cayenne/project/validation/DbRelationshipValidator.java
b/cayenne-project/src/main/java/org/apache/cayenne/project/validation/DbRelationshipValidator.java
index 5bf6d49..03caada 100644
--- a/cayenne-project/src/main/java/org/apache/cayenne/project/validation/DbRelationshipValidator.java
+++ b/cayenne-project/src/main/java/org/apache/cayenne/project/validation/DbRelationshipValidator.java
@@ -95,6 +95,20 @@ class DbRelationshipValidator extends ConfigurationNodeValidator {
 
         checkForDuplicates(relationship, validationResult);
         checkOnGeneratedStrategyConflict(relationship, validationResult);
+        checkToMany(relationship, validationResult);
+}
+
+
+    private void checkToMany(DbRelationship relationship, ValidationResult validationResult)
{
+        if (relationship != null && relationship.getReverseRelationship() != null)
{
+            if (relationship.isToMany() && relationship.getReverseRelationship().isToMany())
{
+                addFailure(
+                        validationResult,
+                        relationship,
+                        "Relationship '%s' and '%s' ManyToMany is impossible",
+                        relationship.getName(), relationship.getReverseRelationship().getName());
+            }
+        }
     }
 
     private void checkOnGeneratedStrategyConflict(DbRelationship relationship, ValidationResult
validationResult) {


Mime
View raw message