CAY-2416
Fixed build errors - added sorting of db entities in SchemaBuilder.


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

Branch: refs/heads/master
Commit: 587997fe4a0ba94325c3ecb90f1a86708f61a826
Parents: 8462e6f
Author: kkomyak <const1...@gmail.com>
Authored: Wed Mar 28 11:26:44 2018 +0300
Committer: kkomyak <const1...@gmail.com>
Committed: Wed Mar 28 17:55:12 2018 +0300

----------------------------------------------------------------------
 .../main/java/org/apache/cayenne/map/Embeddable.java  |  4 ++--
 .../org/apache/cayenne/map/SQLTemplateDescriptor.java |  5 -----
 .../apache/cayenne/unit/di/server/SchemaBuilder.java  | 14 ++++++++------
 .../dialog/datamap/PackageUpdateController.java       |  7 +++++--
 4 files changed, 15 insertions(+), 15 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cayenne/blob/587997fe/cayenne-server/src/main/java/org/apache/cayenne/map/Embeddable.java
----------------------------------------------------------------------
diff --git 
a/cayenne-server/src/main/java/org/apache/cayenne/map/Embeddable.java 
b/cayenne-server/src/main/java/org/apache/cayenne/map/Embeddable.java
index f696880..bc14f35 100644
--- a/cayenne-server/src/main/java/org/apache/cayenne/map/Embeddable.java
+++ b/cayenne-server/src/main/java/org/apache/cayenne/map/Embeddable.java
@@ -21,8 +21,8 @@ package org.apache.cayenne.map;
 import java.io.Serializable;
 import java.util.Collection;
 import java.util.Collections;
+import java.util.HashMap;
 import java.util.Map;
-import java.util.TreeMap;
 
 import org.apache.cayenne.configuration.ConfigurationNode;
 import org.apache.cayenne.configuration.ConfigurationNodeVisitor;
@@ -51,7 +51,7 @@ public class Embeddable implements ConfigurationNode, 
XMLSerializable, Serializa
        }
 
        public Embeddable(String className) {
-               this.attributes = new TreeMap<String, EmbeddableAttribute>();
+               this.attributes = new HashMap<>();
                this.className = className;
        }
 

http://git-wip-us.apache.org/repos/asf/cayenne/blob/587997fe/cayenne-server/src/main/java/org/apache/cayenne/map/SQLTemplateDescriptor.java
----------------------------------------------------------------------
diff --git 
a/cayenne-server/src/main/java/org/apache/cayenne/map/SQLTemplateDescriptor.java
 
b/cayenne-server/src/main/java/org/apache/cayenne/map/SQLTemplateDescriptor.java
index 63608a0..5f8f25c 100644
--- 
a/cayenne-server/src/main/java/org/apache/cayenne/map/SQLTemplateDescriptor.java
+++ 
b/cayenne-server/src/main/java/org/apache/cayenne/map/SQLTemplateDescriptor.java
@@ -69,11 +69,6 @@ public class SQLTemplateDescriptor extends QueryDescriptor {
         this.adapterSql = adapterSql;
     }
 
-    @Override
-    public Map<String, String> getProperties() {
-        return super.getProperties();
-    }
-
     /**
      * Returns map of prefetch paths with semantics for this query.
      * @since 4.1

http://git-wip-us.apache.org/repos/asf/cayenne/blob/587997fe/cayenne-server/src/test/java/org/apache/cayenne/unit/di/server/SchemaBuilder.java
----------------------------------------------------------------------
diff --git 
a/cayenne-server/src/test/java/org/apache/cayenne/unit/di/server/SchemaBuilder.java
 
b/cayenne-server/src/test/java/org/apache/cayenne/unit/di/server/SchemaBuilder.java
index ebd018d..1d6ae86 100644
--- 
a/cayenne-server/src/test/java/org/apache/cayenne/unit/di/server/SchemaBuilder.java
+++ 
b/cayenne-server/src/test/java/org/apache/cayenne/unit/di/server/SchemaBuilder.java
@@ -29,8 +29,6 @@ import 
org.apache.cayenne.access.translator.select.DefaultSelectTranslatorFactor
 import org.apache.cayenne.ashwood.AshwoodEntitySorter;
 import org.apache.cayenne.cache.MapQueryCache;
 import org.apache.cayenne.configuration.DataMapLoader;
-import org.apache.cayenne.configuration.xml.DefaultHandlerFactory;
-import org.apache.cayenne.configuration.xml.XMLDataMapLoader;
 import org.apache.cayenne.dba.DbAdapter;
 import org.apache.cayenne.di.Inject;
 import org.apache.cayenne.event.DefaultEventManager;
@@ -57,6 +55,8 @@ import java.util.Arrays;
 import java.util.Collection;
 import java.util.List;
 import java.util.ListIterator;
+import java.util.Map;
+import java.util.TreeMap;
 
 /**
  * Default implementation of the AccessStack that has a single DataNode per
@@ -240,7 +240,8 @@ public class SchemaBuilder {
         * and returns an ordered list.
         */
        private List<DbEntity> dbEntitiesInInsertOrder(DataNode node, DataMap 
map) {
-               List<DbEntity> entities = new 
ArrayList<DbEntity>(map.getDbEntities());
+               TreeMap<String, DbEntity> dbEntityMap = new 
TreeMap<>(map.getDbEntityMap());
+               List<DbEntity> entities = new ArrayList<>(dbEntityMap.values());
 
                dbEntitiesFilter(entities);
 
@@ -250,7 +251,8 @@ public class SchemaBuilder {
 
        protected List<DbEntity> dbEntitiesInDeleteOrder(DataMap dataMap) {
                DataMap map = domain.getDataMap(dataMap.getName());
-               List<DbEntity> entities = new ArrayList<>(map.getDbEntities());
+               Map<String, DbEntity> dbEntityMap = new 
TreeMap<>(map.getDbEntityMap());
+               List<DbEntity> entities = new ArrayList<>(dbEntityMap.values());
 
                dbEntitiesFilter(entities);
 
@@ -323,7 +325,7 @@ public class SchemaBuilder {
                try (Connection conn = 
dataSourceFactory.getSharedDataSource().getConnection();) {
 
                        DatabaseMetaData md = conn.getMetaData();
-                       List<String> allTables = new ArrayList<String>();
+                       List<String> allTables = new ArrayList<>();
 
                        try (ResultSet tables = md.getTables(null, null, "%", 
null)) {
                                while (tables.next()) {
@@ -341,7 +343,7 @@ public class SchemaBuilder {
                        unitDbAdapter.willDropTables(conn, map, allTables);
 
                        // drop all tables in the map
-                       try (Statement stmt = conn.createStatement();) {
+                       try (Statement stmt = conn.createStatement()) {
 
                                ListIterator<DbEntity> it = 
list.listIterator(list.size());
                                while (it.hasPrevious()) {

http://git-wip-us.apache.org/repos/asf/cayenne/blob/587997fe/modeler/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/dialog/datamap/PackageUpdateController.java
----------------------------------------------------------------------
diff --git 
a/modeler/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/dialog/datamap/PackageUpdateController.java
 
b/modeler/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/dialog/datamap/PackageUpdateController.java
index e843cf0..23c2249 100644
--- 
a/modeler/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/dialog/datamap/PackageUpdateController.java
+++ 
b/modeler/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/dialog/datamap/PackageUpdateController.java
@@ -30,12 +30,15 @@ import java.util.regex.Pattern;
 
 import javax.swing.WindowConstants;
 
-import org.apache.cayenne.map.*;
+import org.apache.cayenne.map.DataMap;
+import org.apache.cayenne.map.Embeddable;
+import org.apache.cayenne.map.EmbeddedAttribute;
+import org.apache.cayenne.map.ObjAttribute;
+import org.apache.cayenne.map.ObjEntity;
 import org.apache.cayenne.map.event.AttributeEvent;
 import org.apache.cayenne.map.event.EmbeddableEvent;
 import org.apache.cayenne.map.event.EntityEvent;
 import org.apache.cayenne.modeler.ProjectController;
-import org.apache.cayenne.modeler.util.Comparators;
 import org.apache.cayenne.util.Util;
 
 /**

Reply via email to