Revision: 3923
Author: [email protected]
Date: Wed Aug 25 11:55:47 2010
Log: Second attempt at having the relationships not cause excessive loading
to occur when populating one table. The idea is relationships of the table
that are exported keys will populate partially. Instead of causing the
child table to populate with columns the relationship will store the table
and column name and listen for the column to be added when the child table
is actually populated.
http://code.google.com/p/power-architect/source/detail?r=3923
Modified:
/trunk/src/main/java/ca/sqlpower/architect/ProjectLoader.java
/trunk/src/main/java/ca/sqlpower/architect/swingui/SwingUIProjectLoader.java
=======================================
--- /trunk/src/main/java/ca/sqlpower/architect/ProjectLoader.java Fri Aug
20 13:27:42 2010
+++ /trunk/src/main/java/ca/sqlpower/architect/ProjectLoader.java Wed Aug
25 11:55:47 2010
@@ -842,7 +842,17 @@
if (pkColumnId != null) {
cmap.setPkColumn((SQLColumn)
sqlObjectLoadIdMap.get(pkColumnId));
}
-
+
+ String fkTableId = attributes.getValue("fk-table");
+ if (fkTableId != null) {
+ cmap.setFkTable((SQLTable)
sqlObjectLoadIdMap.get(fkTableId));
+ }
+
+ String fkColName = attributes.getValue("fk-col-name");
+ if (fkColName != null) {
+ cmap.setFkColName(fkColName);
+ }
+
return cmap;
}
}
=======================================
---
/trunk/src/main/java/ca/sqlpower/architect/swingui/SwingUIProjectLoader.java
Fri Aug 20 13:27:42 2010
+++
/trunk/src/main/java/ca/sqlpower/architect/swingui/SwingUIProjectLoader.java
Wed Aug 25 11:55:47 2010
@@ -1481,6 +1481,8 @@
type = "column-mapping"; //$NON-NLS-1$
propNames.put("pk-column-ref",
sqlObjectSaveIdMap.get(((SQLRelationship.ColumnMapping) o).getPkColumn()));
//$NON-NLS-1$
propNames.put("fk-column-ref",
sqlObjectSaveIdMap.get(((SQLRelationship.ColumnMapping) o).getFkColumn()));
//$NON-NLS-1$
+ propNames.put("fk-col-name", ((SQLRelationship.ColumnMapping)
o).getFkColName()); //$NON-NLS-1$
+ propNames.put("fk-table",
sqlObjectSaveIdMap.get(((SQLRelationship.ColumnMapping) o).getFkTable()));
//$NON-NLS-1$
} else if (o instanceof SQLIndex) {
id = "IDX"+sqlObjectSaveIdMap.size(); //$NON-NLS-1$
type = "index"; //$NON-NLS-1$