Revision: 3216
Author: [email protected]
Date: Thu Dec 17 08:20:48 2009
Log: Fixed a bug in PlayPen where it was using SQLRelationships and SQLImportedKeys interchangably as Objects.
http://code.google.com/p/power-architect/source/detail?r=3216

Modified:
/branches/sqlobject-spobject-model/src/ca/sqlpower/architect/swingui/PlayPen.java

=======================================
--- /branches/sqlobject-spobject-model/src/ca/sqlpower/architect/swingui/PlayPen.java Wed Dec 16 11:17:59 2009 +++ /branches/sqlobject-spobject-model/src/ca/sqlpower/architect/swingui/PlayPen.java Thu Dec 17 08:20:48 2009
@@ -1312,16 +1312,14 @@
      */
private void createRelationshipsFromPP(SQLTable source, SQLTable newTable, boolean isPrimaryKeyTableNew, boolean isAlreadyOnPlaypen, int suffix) throws SQLObjectException { // create exported relationships if the importing tables exist in pp
-               Iterator sourceKeys = null;
+               Iterator<SQLRelationship> sourceKeys = null;
         if (isPrimaryKeyTableNew) {
             sourceKeys = source.getExportedKeys().iterator();
         } else {
-            sourceKeys = source.getImportedKeys().iterator();
+ sourceKeys = SQLRelationship.getExportedKeys(source.getImportedKeys()).iterator();
         }
                while (sourceKeys.hasNext()) {
-                   Object next = sourceKeys.next();
- if ( !(next instanceof SQLRelationship) ) continue; // there could be SQLExceptionNodes here
-                       SQLRelationship r = (SQLRelationship) next;
+                       SQLRelationship r = sourceKeys.next();

                        // If relationship is self-referencing, then don't add 
it twice.
if (r.getFkTable().equals(r.getPkTable()) && !isPrimaryKeyTableNew) continue;

Reply via email to