cayenne-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From skolbac...@apache.org
Subject cayenne git commit: fix Code Generation for several datamaps
Date Thu, 04 Jun 2015 10:51:38 GMT
Repository: cayenne
Updated Branches:
  refs/heads/master 64a4171f1 -> b9f15e7fb


fix Code Generation for several datamaps


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

Branch: refs/heads/master
Commit: b9f15e7fb5e5b38aea7de29f4141a07a38667c07
Parents: 64a4171
Author: Savva Kolbachev <s.kolbachev@gmail.com>
Authored: Thu Jun 4 13:50:44 2015 +0300
Committer: Savva Kolbachev <s.kolbachev@gmail.com>
Committed: Thu Jun 4 13:50:44 2015 +0300

----------------------------------------------------------------------
 .../modeler/dialog/codegen/GeneratorController.java | 16 ++++++++++++----
 1 file changed, 12 insertions(+), 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cayenne/blob/b9f15e7f/modeler/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/dialog/codegen/GeneratorController.java
----------------------------------------------------------------------
diff --git a/modeler/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/dialog/codegen/GeneratorController.java
b/modeler/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/dialog/codegen/GeneratorController.java
index 90647b4..5bb5b45 100644
--- a/modeler/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/dialog/codegen/GeneratorController.java
+++ b/modeler/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/dialog/codegen/GeneratorController.java
@@ -50,6 +50,7 @@ import java.io.File;
 import java.util.ArrayList;
 import java.util.Collection;
 import java.util.Iterator;
+import java.util.LinkedList;
 import java.util.Map;
 import java.util.Set;
 import java.util.prefs.Preferences;
@@ -157,8 +158,8 @@ public abstract class GeneratorController extends CayenneController {
         }
 
         // remove generic entities...
-        Collection<ObjEntity> entities = new ArrayList<ObjEntity>(getParentController().getSelectedEntities());
-        Iterator<ObjEntity> it = entities.iterator();
+        Collection<ObjEntity> selectedEntities = new ArrayList<ObjEntity>(getParentController().getSelectedEntities());
+        Iterator<ObjEntity> it = selectedEntities.iterator();
         while (it.hasNext()) {
             if (it.next().isGeneric()) {
                 it.remove();
@@ -171,8 +172,15 @@ public abstract class GeneratorController extends CayenneController {
             ClassGenerationAction generator = newGenerator();
             generator.setArtifactsGenerationMode(mode);
             generator.setDataMap(map);
-            generator.addEntities(entities);
-            generator.addEmbeddables(getParentController().getSelectedEmbeddables());
+
+            LinkedList<ObjEntity> objEntities = new LinkedList<ObjEntity>(map.getObjEntities());
+            objEntities.retainAll(selectedEntities);
+            generator.addEntities(objEntities);
+
+            LinkedList<Embeddable> embeddables = new LinkedList<Embeddable>(map.getEmbeddables());
+            embeddables.retainAll(getParentController().getSelectedEmbeddables());
+            generator.addEmbeddables(embeddables);
+
             generator.addQueries(map.getQueries());
 
             Preferences preferences = application.getPreferencesNode(GeneralPreferences.class,
"");


Mime
View raw message