cayenne-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From aadamc...@apache.org
Subject [1/5] cayenne git commit: CAY-2116 Split schema synchronization code in a separate module
Date Fri, 30 Sep 2016 18:04:57 GMT
Repository: cayenne
Updated Branches:
  refs/heads/master fc27ef7ae -> ad9447556


CAY-2116 Split schema synchronization code in a separate module


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

Branch: refs/heads/master
Commit: 3e03bc1155555a364b3acec06442442d760c1048
Parents: fc27ef7
Author: Andrus Adamchik <andrus@objectstyle.com>
Authored: Fri Sep 30 17:34:49 2016 +0300
Committer: Andrus Adamchik <andrus@objectstyle.com>
Committed: Fri Sep 30 17:53:47 2016 +0300

----------------------------------------------------------------------
 .../cayenne/dbsync/reverse/db/DbLoader.java     |   1 -
 .../cayenne/dbsync/reverse/db/ExportedKey.java  | 270 +++++++++++++++++++
 .../reverse/db/ManyToManyCandidateEntity.java   |   1 -
 .../naming/DefaultObjectNameGenerator.java      |   2 +-
 .../naming/LegacyObjectNameGenerator.java       |   2 +-
 .../reverse/naming/ObjectNameGenerator.java     |   2 +-
 .../naming/DefaultObjectNameGeneratorTest.java  |   2 +-
 .../naming/LegacyObjectNameGeneratorTest.java   |   3 +-
 .../apache/cayenne/map/naming/ExportedKey.java  | 270 -------------------
 .../InferRelationshipsControllerBase.java       |   2 +-
 .../dialog/objentity/ObjRelationshipInfo.java   |   2 +-
 11 files changed, 277 insertions(+), 280 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cayenne/blob/3e03bc11/cayenne-dbsync/src/main/java/org/apache/cayenne/dbsync/reverse/db/DbLoader.java
----------------------------------------------------------------------
diff --git a/cayenne-dbsync/src/main/java/org/apache/cayenne/dbsync/reverse/db/DbLoader.java
b/cayenne-dbsync/src/main/java/org/apache/cayenne/dbsync/reverse/db/DbLoader.java
index a522ab2..2811981 100644
--- a/cayenne-dbsync/src/main/java/org/apache/cayenne/dbsync/reverse/db/DbLoader.java
+++ b/cayenne-dbsync/src/main/java/org/apache/cayenne/dbsync/reverse/db/DbLoader.java
@@ -35,7 +35,6 @@ import org.apache.cayenne.map.ObjEntity;
 import org.apache.cayenne.map.Procedure;
 import org.apache.cayenne.map.ProcedureParameter;
 import org.apache.cayenne.map.naming.DefaultUniqueNameGenerator;
-import org.apache.cayenne.map.naming.ExportedKey;
 import org.apache.cayenne.dbsync.reverse.naming.LegacyObjectNameGenerator;
 import org.apache.cayenne.map.naming.NameCheckers;
 import org.apache.cayenne.dbsync.reverse.naming.ObjectNameGenerator;

http://git-wip-us.apache.org/repos/asf/cayenne/blob/3e03bc11/cayenne-dbsync/src/main/java/org/apache/cayenne/dbsync/reverse/db/ExportedKey.java
----------------------------------------------------------------------
diff --git a/cayenne-dbsync/src/main/java/org/apache/cayenne/dbsync/reverse/db/ExportedKey.java
b/cayenne-dbsync/src/main/java/org/apache/cayenne/dbsync/reverse/db/ExportedKey.java
new file mode 100644
index 0000000..080d6c4
--- /dev/null
+++ b/cayenne-dbsync/src/main/java/org/apache/cayenne/dbsync/reverse/db/ExportedKey.java
@@ -0,0 +1,270 @@
+/*****************************************************************
+ *   Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you under the Apache License, Version 2.0 (the
+ *  "License"); you may not use this file except in compliance
+ *  with the License.  You may obtain a copy of the License at
+ *
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing,
+ *  software distributed under the License is distributed on an
+ *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ *  KIND, either express or implied.  See the License for the
+ *  specific language governing permissions and limitations
+ *  under the License.
+ ****************************************************************/
+package org.apache.cayenne.dbsync.reverse.db;
+
+import org.apache.cayenne.util.EqualsBuilder;
+import org.apache.cayenne.util.HashCodeBuilder;
+import org.apache.commons.lang.builder.CompareToBuilder;
+
+import java.sql.ResultSet;
+import java.sql.SQLException;
+
+/**
+ * ExportedKey is an representation of relationship between two tables 
+ * in database. It can be used for creating names for relationships
+ *
+ * Example:
+ *  Table A with primary key ID
+ *  Table B with primary key ID and foreign key A_ID
+ *
+ *  In that case ExportedKey will be:
+ *      pkTable:  A
+ *      pkColumn: A.ID
+ *      fkTable:  B
+ *      fkColumn: B.A_ID
+ *      fkName:   name of foreign key
+ *      pkName:
+ *      keySeq: TODO
+ * 
+ */
+public class ExportedKey implements Comparable {
+
+    public final String pkCatalog;
+    public final String pkSchema;
+    /**
+     * Name of source table
+     */
+    public final String pkTable;
+
+    /**
+     * Name of source column
+     */
+    public final String pkColumn;
+
+    public final String fkCatalog;
+    public final String fkSchema;
+    /**
+     * Name of destination table
+     */
+    public final String fkTable;
+    
+    /**
+     * Name of destination column
+     */
+    public final String fkColumn;
+    
+    /**
+     * Name of foreign key (might be null)
+     */
+    public final String fkName;
+
+    /**
+     * Name of primary key (might be null)
+     */
+    public final String pkName;
+
+
+    public final short keySeq;
+
+    public ExportedKey(String pkTable, String pkColumn, String pkName,
+                       String fkTable, String fkColumn, String fkName, short keySeq) {
+        this(null, null, pkTable, pkColumn, pkName, null, null, fkTable, fkColumn, fkName,
keySeq);
+    }
+
+    public ExportedKey(String pkCatalog, String pkSchema, String pkTable, String pkColumn,
String pkName,
+                       String fkCatalog, String fkSchema, String fkTable, String fkColumn,
String fkName, short keySeq) {
+       this.pkCatalog  = pkCatalog;
+       this.pkSchema  = pkSchema;
+       this.pkTable  = pkTable;
+       this.pkColumn = pkColumn;
+       this.pkName   = pkName;
+       this.fkCatalog  = fkCatalog;
+       this.fkSchema  = fkSchema;
+       this.fkTable  = fkTable;
+       this.fkColumn = fkColumn;
+       this.fkName   = fkName;
+       this.keySeq = keySeq;
+    }
+    
+    /**
+     * Extracts data from a resultset pointing to a exported key to
+     * ExportedKey class instance
+     * 
+     * @param rs ResultSet pointing to a exported key, fetched using
+     * DataBaseMetaData.getExportedKeys(...) 
+     */
+    public static ExportedKey extractData(ResultSet rs) throws SQLException {
+        return new ExportedKey(
+                rs.getString("PKTABLE_CAT"),
+                rs.getString("PKTABLE_SCHEM"),
+                rs.getString("PKTABLE_NAME"),
+                rs.getString("PKCOLUMN_NAME"),
+                rs.getString("PK_NAME"),
+                rs.getString("FKTABLE_CAT"),
+                rs.getString("FKTABLE_SCHEM"),
+                rs.getString("FKTABLE_NAME"),
+                rs.getString("FKCOLUMN_NAME"),
+                rs.getString("FK_NAME"),
+                rs.getShort("KEY_SEQ")
+        );
+    }
+
+
+    public String getPkCatalog() {
+        return pkCatalog;
+    }
+
+    public String getPkSchema() {
+        return pkSchema;
+    }
+
+    public String getFkCatalog() {
+        return fkCatalog;
+    }
+
+    public String getFkSchema() {
+        return fkSchema;
+    }
+
+    /**
+     * @return source table name
+     */
+    public String getPKTableName() {
+        return pkTable;
+    }
+    
+    /**
+     * @return destination table name
+     */
+    public String getFKTableName() {
+        return fkTable;
+    }
+    
+    /**
+     * @return source column name
+     */
+    public String getPKColumnName() {
+        return pkColumn;
+    }
+    
+    /**
+     * @return destination column name
+     */
+    public String getFKColumnName() {
+        return fkColumn;
+    }
+    
+    /**
+     * @return PK name
+     */
+    public String getPKName() {
+        return pkName;
+    }
+    
+    /**
+     * @return FK name
+     */
+    public String getFKName() {
+        return fkName;
+    }
+
+    public short getKeySeq() {
+        return keySeq;
+    }
+
+
+    @Override
+    public boolean equals(Object obj) {
+        if (obj == null) {
+            return false;
+        }
+        if (obj == this) {
+            return true;
+        }
+        if (obj.getClass() != getClass()) {
+            return false;
+        }
+        ExportedKey rhs = (ExportedKey) obj;
+        return new EqualsBuilder()
+                .append(this.pkCatalog, rhs.pkCatalog)
+                .append(this.pkSchema, rhs.pkSchema)
+                .append(this.pkTable, rhs.pkTable)
+                .append(this.pkColumn, rhs.pkColumn)
+                .append(this.fkCatalog, rhs.fkCatalog)
+                .append(this.fkSchema, rhs.fkSchema)
+                .append(this.fkTable, rhs.fkTable)
+                .append(this.fkColumn, rhs.fkColumn)
+                .append(this.fkName, rhs.fkName)
+                .append(this.pkName, rhs.pkName)
+                .append(this.keySeq, rhs.keySeq)
+                .isEquals();
+    }
+
+    @Override
+    public int hashCode() {
+        return new HashCodeBuilder()
+                .append(pkCatalog)
+                .append(pkSchema)
+                .append(pkTable)
+                .append(pkColumn)
+                .append(fkCatalog)
+                .append(fkSchema)
+                .append(fkTable)
+                .append(fkColumn)
+                .append(fkName)
+                .append(pkName)
+                .append(keySeq)
+                .toHashCode();
+    }
+
+    @Override
+    public int compareTo(Object obj) {
+        if (obj == null || !obj.getClass().equals(getClass())) {
+            throw new IllegalArgumentException();
+        }
+        if (obj == this) {
+            return 0;
+        }
+
+        ExportedKey rhs = (ExportedKey) obj;
+        return new CompareToBuilder()
+                .append(pkCatalog, rhs.pkCatalog)
+                .append(pkSchema, rhs.pkSchema)
+                .append(pkTable, rhs.pkTable)
+                .append(pkName, rhs.pkName)
+                .append(fkCatalog, rhs.fkCatalog)
+                .append(fkSchema, rhs.fkSchema)
+                .append(fkTable, rhs.fkTable)
+                .append(fkName, rhs.fkName)
+                .append(keySeq, rhs.keySeq)
+                .append(pkColumn, rhs.pkColumn)
+                .append(fkColumn, rhs.fkColumn)
+                .toComparison();
+    }
+
+    @Override
+    public String toString() {
+        return getStrKey() + " # " + keySeq;
+    }
+
+    public String getStrKey() {
+        return pkCatalog + "." + pkSchema + "." + pkTable + "." + pkColumn
+                + " <- " + fkCatalog + "." + fkSchema + "." + fkTable + "." + fkColumn;
+    }
+}

http://git-wip-us.apache.org/repos/asf/cayenne/blob/3e03bc11/cayenne-dbsync/src/main/java/org/apache/cayenne/dbsync/reverse/db/ManyToManyCandidateEntity.java
----------------------------------------------------------------------
diff --git a/cayenne-dbsync/src/main/java/org/apache/cayenne/dbsync/reverse/db/ManyToManyCandidateEntity.java
b/cayenne-dbsync/src/main/java/org/apache/cayenne/dbsync/reverse/db/ManyToManyCandidateEntity.java
index e912ab1..718015b 100644
--- a/cayenne-dbsync/src/main/java/org/apache/cayenne/dbsync/reverse/db/ManyToManyCandidateEntity.java
+++ b/cayenne-dbsync/src/main/java/org/apache/cayenne/dbsync/reverse/db/ManyToManyCandidateEntity.java
@@ -22,7 +22,6 @@ import org.apache.cayenne.map.DbRelationship;
 import org.apache.cayenne.map.ObjEntity;
 import org.apache.cayenne.map.ObjRelationship;
 import org.apache.cayenne.map.naming.DefaultUniqueNameGenerator;
-import org.apache.cayenne.map.naming.ExportedKey;
 import org.apache.cayenne.map.naming.NameCheckers;
 import org.apache.cayenne.dbsync.reverse.naming.ObjectNameGenerator;
 import org.apache.commons.logging.Log;

http://git-wip-us.apache.org/repos/asf/cayenne/blob/3e03bc11/cayenne-dbsync/src/main/java/org/apache/cayenne/dbsync/reverse/naming/DefaultObjectNameGenerator.java
----------------------------------------------------------------------
diff --git a/cayenne-dbsync/src/main/java/org/apache/cayenne/dbsync/reverse/naming/DefaultObjectNameGenerator.java
b/cayenne-dbsync/src/main/java/org/apache/cayenne/dbsync/reverse/naming/DefaultObjectNameGenerator.java
index a2ec096..8cb59db 100644
--- a/cayenne-dbsync/src/main/java/org/apache/cayenne/dbsync/reverse/naming/DefaultObjectNameGenerator.java
+++ b/cayenne-dbsync/src/main/java/org/apache/cayenne/dbsync/reverse/naming/DefaultObjectNameGenerator.java
@@ -21,7 +21,7 @@ package org.apache.cayenne.dbsync.reverse.naming;
 import org.apache.cayenne.map.DbAttribute;
 import org.apache.cayenne.map.DbEntity;
 import org.apache.cayenne.map.DbRelationship;
-import org.apache.cayenne.map.naming.ExportedKey;
+import org.apache.cayenne.dbsync.reverse.db.ExportedKey;
 import org.apache.cayenne.map.naming.NameConverter;
 import org.jvnet.inflector.Noun;
 

http://git-wip-us.apache.org/repos/asf/cayenne/blob/3e03bc11/cayenne-dbsync/src/main/java/org/apache/cayenne/dbsync/reverse/naming/LegacyObjectNameGenerator.java
----------------------------------------------------------------------
diff --git a/cayenne-dbsync/src/main/java/org/apache/cayenne/dbsync/reverse/naming/LegacyObjectNameGenerator.java
b/cayenne-dbsync/src/main/java/org/apache/cayenne/dbsync/reverse/naming/LegacyObjectNameGenerator.java
index 11ac007..47e7ea5 100644
--- a/cayenne-dbsync/src/main/java/org/apache/cayenne/dbsync/reverse/naming/LegacyObjectNameGenerator.java
+++ b/cayenne-dbsync/src/main/java/org/apache/cayenne/dbsync/reverse/naming/LegacyObjectNameGenerator.java
@@ -21,7 +21,7 @@ package org.apache.cayenne.dbsync.reverse.naming;
 import org.apache.cayenne.map.DbAttribute;
 import org.apache.cayenne.map.DbEntity;
 import org.apache.cayenne.map.DbRelationship;
-import org.apache.cayenne.map.naming.ExportedKey;
+import org.apache.cayenne.dbsync.reverse.db.ExportedKey;
 import org.apache.cayenne.map.naming.NameConverter;
 
 /**

http://git-wip-us.apache.org/repos/asf/cayenne/blob/3e03bc11/cayenne-dbsync/src/main/java/org/apache/cayenne/dbsync/reverse/naming/ObjectNameGenerator.java
----------------------------------------------------------------------
diff --git a/cayenne-dbsync/src/main/java/org/apache/cayenne/dbsync/reverse/naming/ObjectNameGenerator.java
b/cayenne-dbsync/src/main/java/org/apache/cayenne/dbsync/reverse/naming/ObjectNameGenerator.java
index 8922190..da45ab3 100644
--- a/cayenne-dbsync/src/main/java/org/apache/cayenne/dbsync/reverse/naming/ObjectNameGenerator.java
+++ b/cayenne-dbsync/src/main/java/org/apache/cayenne/dbsync/reverse/naming/ObjectNameGenerator.java
@@ -21,7 +21,7 @@ package org.apache.cayenne.dbsync.reverse.naming;
 import org.apache.cayenne.map.DbAttribute;
 import org.apache.cayenne.map.DbEntity;
 import org.apache.cayenne.map.DbRelationship;
-import org.apache.cayenne.map.naming.ExportedKey;
+import org.apache.cayenne.dbsync.reverse.db.ExportedKey;
 
 /**
  * ObjectNameGenerator is a strategy for creating names for entities,

http://git-wip-us.apache.org/repos/asf/cayenne/blob/3e03bc11/cayenne-dbsync/src/test/java/org/apache/cayenne/dbsync/reverse/naming/DefaultObjectNameGeneratorTest.java
----------------------------------------------------------------------
diff --git a/cayenne-dbsync/src/test/java/org/apache/cayenne/dbsync/reverse/naming/DefaultObjectNameGeneratorTest.java
b/cayenne-dbsync/src/test/java/org/apache/cayenne/dbsync/reverse/naming/DefaultObjectNameGeneratorTest.java
index 0a70fdb..a29c786 100644
--- a/cayenne-dbsync/src/test/java/org/apache/cayenne/dbsync/reverse/naming/DefaultObjectNameGeneratorTest.java
+++ b/cayenne-dbsync/src/test/java/org/apache/cayenne/dbsync/reverse/naming/DefaultObjectNameGeneratorTest.java
@@ -21,7 +21,7 @@ package org.apache.cayenne.dbsync.reverse.naming;
 import org.apache.cayenne.map.DbAttribute;
 import org.apache.cayenne.map.DbEntity;
 import org.apache.cayenne.map.DbRelationship;
-import org.apache.cayenne.map.naming.ExportedKey;
+import org.apache.cayenne.dbsync.reverse.db.ExportedKey;
 import org.junit.Test;
 
 import static org.junit.Assert.assertEquals;

http://git-wip-us.apache.org/repos/asf/cayenne/blob/3e03bc11/cayenne-dbsync/src/test/java/org/apache/cayenne/dbsync/reverse/naming/LegacyObjectNameGeneratorTest.java
----------------------------------------------------------------------
diff --git a/cayenne-dbsync/src/test/java/org/apache/cayenne/dbsync/reverse/naming/LegacyObjectNameGeneratorTest.java
b/cayenne-dbsync/src/test/java/org/apache/cayenne/dbsync/reverse/naming/LegacyObjectNameGeneratorTest.java
index 750dcd2..ea4902d 100644
--- a/cayenne-dbsync/src/test/java/org/apache/cayenne/dbsync/reverse/naming/LegacyObjectNameGeneratorTest.java
+++ b/cayenne-dbsync/src/test/java/org/apache/cayenne/dbsync/reverse/naming/LegacyObjectNameGeneratorTest.java
@@ -18,11 +18,10 @@
  ****************************************************************/
 package org.apache.cayenne.dbsync.reverse.naming;
 
-import org.apache.cayenne.dbsync.reverse.naming.LegacyObjectNameGenerator;
 import org.apache.cayenne.map.DbAttribute;
 import org.apache.cayenne.map.DbEntity;
 import org.apache.cayenne.map.DbRelationship;
-import org.apache.cayenne.map.naming.ExportedKey;
+import org.apache.cayenne.dbsync.reverse.db.ExportedKey;
 import org.junit.Test;
 
 import static org.junit.Assert.assertEquals;

http://git-wip-us.apache.org/repos/asf/cayenne/blob/3e03bc11/cayenne-server/src/main/java/org/apache/cayenne/map/naming/ExportedKey.java
----------------------------------------------------------------------
diff --git a/cayenne-server/src/main/java/org/apache/cayenne/map/naming/ExportedKey.java b/cayenne-server/src/main/java/org/apache/cayenne/map/naming/ExportedKey.java
deleted file mode 100644
index 9a415d8..0000000
--- a/cayenne-server/src/main/java/org/apache/cayenne/map/naming/ExportedKey.java
+++ /dev/null
@@ -1,270 +0,0 @@
-/*****************************************************************
- *   Licensed to the Apache Software Foundation (ASF) under one
- *  or more contributor license agreements.  See the NOTICE file
- *  distributed with this work for additional information
- *  regarding copyright ownership.  The ASF licenses this file
- *  to you under the Apache License, Version 2.0 (the
- *  "License"); you may not use this file except in compliance
- *  with the License.  You may obtain a copy of the License at
- *
- *    http://www.apache.org/licenses/LICENSE-2.0
- *
- *  Unless required by applicable law or agreed to in writing,
- *  software distributed under the License is distributed on an
- *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- *  KIND, either express or implied.  See the License for the
- *  specific language governing permissions and limitations
- *  under the License.
- ****************************************************************/
-package org.apache.cayenne.map.naming;
-
-import org.apache.cayenne.util.EqualsBuilder;
-import org.apache.cayenne.util.HashCodeBuilder;
-import org.apache.commons.lang.builder.CompareToBuilder;
-
-import java.sql.ResultSet;
-import java.sql.SQLException;
-
-/**
- * ExportedKey is an representation of relationship between two tables 
- * in database. It can be used for creating names for relationships
- *
- * Example:
- *  Table A with primary key ID
- *  Table B with primary key ID and foreign key A_ID
- *
- *  In that case ExportedKey will be:
- *      pkTable:  A
- *      pkColumn: A.ID
- *      fkTable:  B
- *      fkColumn: B.A_ID
- *      fkName:   name of foreign key
- *      pkName:
- *      keySeq: TODO
- * 
- */
-public class ExportedKey implements Comparable {
-
-    public final String pkCatalog;
-    public final String pkSchema;
-    /**
-     * Name of source table
-     */
-    public final String pkTable;
-
-    /**
-     * Name of source column
-     */
-    public final String pkColumn;
-
-    public final String fkCatalog;
-    public final String fkSchema;
-    /**
-     * Name of destination table
-     */
-    public final String fkTable;
-    
-    /**
-     * Name of destination column
-     */
-    public final String fkColumn;
-    
-    /**
-     * Name of foreign key (might be null)
-     */
-    public final String fkName;
-
-    /**
-     * Name of primary key (might be null)
-     */
-    public final String pkName;
-
-
-    public final short keySeq;
-
-    public ExportedKey(String pkTable, String pkColumn, String pkName,
-                       String fkTable, String fkColumn, String fkName, short keySeq) {
-        this(null, null, pkTable, pkColumn, pkName, null, null, fkTable, fkColumn, fkName,
keySeq);
-    }
-
-    public ExportedKey(String pkCatalog, String pkSchema, String pkTable, String pkColumn,
String pkName,
-                       String fkCatalog, String fkSchema, String fkTable, String fkColumn,
String fkName, short keySeq) {
-       this.pkCatalog  = pkCatalog;
-       this.pkSchema  = pkSchema;
-       this.pkTable  = pkTable;
-       this.pkColumn = pkColumn;
-       this.pkName   = pkName;
-       this.fkCatalog  = fkCatalog;
-       this.fkSchema  = fkSchema;
-       this.fkTable  = fkTable;
-       this.fkColumn = fkColumn;
-       this.fkName   = fkName;
-       this.keySeq = keySeq;
-    }
-    
-    /**
-     * Extracts data from a resultset pointing to a exported key to
-     * ExportedKey class instance
-     * 
-     * @param rs ResultSet pointing to a exported key, fetched using
-     * DataBaseMetaData.getExportedKeys(...) 
-     */
-    public static ExportedKey extractData(ResultSet rs) throws SQLException {
-        return new ExportedKey(
-                rs.getString("PKTABLE_CAT"),
-                rs.getString("PKTABLE_SCHEM"),
-                rs.getString("PKTABLE_NAME"),
-                rs.getString("PKCOLUMN_NAME"),
-                rs.getString("PK_NAME"),
-                rs.getString("FKTABLE_CAT"),
-                rs.getString("FKTABLE_SCHEM"),
-                rs.getString("FKTABLE_NAME"),
-                rs.getString("FKCOLUMN_NAME"),
-                rs.getString("FK_NAME"),
-                rs.getShort("KEY_SEQ")
-        );
-    }
-
-
-    public String getPkCatalog() {
-        return pkCatalog;
-    }
-
-    public String getPkSchema() {
-        return pkSchema;
-    }
-
-    public String getFkCatalog() {
-        return fkCatalog;
-    }
-
-    public String getFkSchema() {
-        return fkSchema;
-    }
-
-    /**
-     * @return source table name
-     */
-    public String getPKTableName() {
-        return pkTable;
-    }
-    
-    /**
-     * @return destination table name
-     */
-    public String getFKTableName() {
-        return fkTable;
-    }
-    
-    /**
-     * @return source column name
-     */
-    public String getPKColumnName() {
-        return pkColumn;
-    }
-    
-    /**
-     * @return destination column name
-     */
-    public String getFKColumnName() {
-        return fkColumn;
-    }
-    
-    /**
-     * @return PK name
-     */
-    public String getPKName() {
-        return pkName;
-    }
-    
-    /**
-     * @return FK name
-     */
-    public String getFKName() {
-        return fkName;
-    }
-
-    public short getKeySeq() {
-        return keySeq;
-    }
-
-
-    @Override
-    public boolean equals(Object obj) {
-        if (obj == null) {
-            return false;
-        }
-        if (obj == this) {
-            return true;
-        }
-        if (obj.getClass() != getClass()) {
-            return false;
-        }
-        ExportedKey rhs = (ExportedKey) obj;
-        return new EqualsBuilder()
-                .append(this.pkCatalog, rhs.pkCatalog)
-                .append(this.pkSchema, rhs.pkSchema)
-                .append(this.pkTable, rhs.pkTable)
-                .append(this.pkColumn, rhs.pkColumn)
-                .append(this.fkCatalog, rhs.fkCatalog)
-                .append(this.fkSchema, rhs.fkSchema)
-                .append(this.fkTable, rhs.fkTable)
-                .append(this.fkColumn, rhs.fkColumn)
-                .append(this.fkName, rhs.fkName)
-                .append(this.pkName, rhs.pkName)
-                .append(this.keySeq, rhs.keySeq)
-                .isEquals();
-    }
-
-    @Override
-    public int hashCode() {
-        return new HashCodeBuilder()
-                .append(pkCatalog)
-                .append(pkSchema)
-                .append(pkTable)
-                .append(pkColumn)
-                .append(fkCatalog)
-                .append(fkSchema)
-                .append(fkTable)
-                .append(fkColumn)
-                .append(fkName)
-                .append(pkName)
-                .append(keySeq)
-                .toHashCode();
-    }
-
-    @Override
-    public int compareTo(Object obj) {
-        if (obj == null || !obj.getClass().equals(getClass())) {
-            throw new IllegalArgumentException();
-        }
-        if (obj == this) {
-            return 0;
-        }
-
-        ExportedKey rhs = (ExportedKey) obj;
-        return new CompareToBuilder()
-                .append(pkCatalog, rhs.pkCatalog)
-                .append(pkSchema, rhs.pkSchema)
-                .append(pkTable, rhs.pkTable)
-                .append(pkName, rhs.pkName)
-                .append(fkCatalog, rhs.fkCatalog)
-                .append(fkSchema, rhs.fkSchema)
-                .append(fkTable, rhs.fkTable)
-                .append(fkName, rhs.fkName)
-                .append(keySeq, rhs.keySeq)
-                .append(pkColumn, rhs.pkColumn)
-                .append(fkColumn, rhs.fkColumn)
-                .toComparison();
-    }
-
-    @Override
-    public String toString() {
-        return getStrKey() + " # " + keySeq;
-    }
-
-    public String getStrKey() {
-        return pkCatalog + "." + pkSchema + "." + pkTable + "." + pkColumn
-                + " <- " + fkCatalog + "." + fkSchema + "." + fkTable + "." + fkColumn;
-    }
-}

http://git-wip-us.apache.org/repos/asf/cayenne/blob/3e03bc11/modeler/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/dialog/autorelationship/InferRelationshipsControllerBase.java
----------------------------------------------------------------------
diff --git a/modeler/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/dialog/autorelationship/InferRelationshipsControllerBase.java
b/modeler/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/dialog/autorelationship/InferRelationshipsControllerBase.java
index badde44..3d3ab37 100644
--- a/modeler/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/dialog/autorelationship/InferRelationshipsControllerBase.java
+++ b/modeler/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/dialog/autorelationship/InferRelationshipsControllerBase.java
@@ -30,7 +30,7 @@ import org.apache.cayenne.map.DbAttribute;
 import org.apache.cayenne.map.DbEntity;
 import org.apache.cayenne.map.DbJoin;
 import org.apache.cayenne.map.DbRelationship;
-import org.apache.cayenne.map.naming.ExportedKey;
+import org.apache.cayenne.dbsync.reverse.db.ExportedKey;
 import org.apache.cayenne.dbsync.reverse.naming.ObjectNameGenerator;
 import org.apache.cayenne.modeler.util.CayenneController;
 import org.apache.commons.collections.Predicate;

http://git-wip-us.apache.org/repos/asf/cayenne/blob/3e03bc11/modeler/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/dialog/objentity/ObjRelationshipInfo.java
----------------------------------------------------------------------
diff --git a/modeler/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/dialog/objentity/ObjRelationshipInfo.java
b/modeler/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/dialog/objentity/ObjRelationshipInfo.java
index 2b01ce3..11172fb 100644
--- a/modeler/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/dialog/objentity/ObjRelationshipInfo.java
+++ b/modeler/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/dialog/objentity/ObjRelationshipInfo.java
@@ -27,7 +27,7 @@ import org.apache.cayenne.map.ObjEntity;
 import org.apache.cayenne.map.ObjRelationship;
 import org.apache.cayenne.map.Relationship;
 import org.apache.cayenne.map.event.RelationshipEvent;
-import org.apache.cayenne.map.naming.ExportedKey;
+import org.apache.cayenne.dbsync.reverse.db.ExportedKey;
 import org.apache.cayenne.dbsync.reverse.naming.ObjectNameGenerator;
 import org.apache.cayenne.modeler.Application;
 import org.apache.cayenne.modeler.ClassLoadingService;


Mime
View raw message