Revision: 3225
Author: [email protected]
Date: Tue Jan 5 08:48:08 2010
Log: Update due to changes in the library. There is no more getSQLParent
method as it made the API more complicated. Now either the getAncestor in
SPObjectUtils can be used to find a specific ancestor, or other utility
methods can be used to walk the SQLObject parent chain. If necessary
instanceof checks can be used to find SQLObjects.
http://code.google.com/p/power-architect/source/detail?r=3225
Modified:
/trunk/regress/ca/sqlpower/architect/ArchitectUtilsTest.java
/trunk/regress/ca/sqlpower/architect/ArchitectValueMaker.java
/trunk/regress/ca/sqlpower/architect/TestUtils.java
/trunk/regress/ca/sqlpower/architect/swingui/ArchitectSwingSessionImplTest.java
/trunk/src/ca/sqlpower/architect/ddl/GenericDDLGenerator.java
/trunk/src/ca/sqlpower/architect/etl/ExportCSV.java
/trunk/src/ca/sqlpower/architect/profile/AbstractProfileResult.java
/trunk/src/ca/sqlpower/architect/swingui/ASUtils.java
/trunk/src/ca/sqlpower/architect/swingui/DBTree.java
/trunk/src/ca/sqlpower/architect/swingui/DataMoverPanel.java
/trunk/src/ca/sqlpower/architect/swingui/action/DeleteSelectedAction.java
/trunk/src/ca/sqlpower/architect/swingui/action/ProfileAction.java
/trunk/src/ca/sqlpower/architect/swingui/action/RefreshAction.java
/trunk/src/ca/sqlpower/architect/swingui/table/ProfileTableModel.java
=======================================
--- /trunk/regress/ca/sqlpower/architect/ArchitectUtilsTest.java Mon Dec 21
08:27:43 2009
+++ /trunk/regress/ca/sqlpower/architect/ArchitectUtilsTest.java Tue Jan 5
08:48:08 2010
@@ -21,6 +21,7 @@
import junit.framework.TestCase;
import ca.sqlpower.object.ObjectDependentException;
import ca.sqlpower.object.SPListener;
+import ca.sqlpower.object.SPObjectUtils;
import ca.sqlpower.sqlobject.CountingSQLObjectListener;
import ca.sqlpower.sqlobject.SQLCatalog;
import ca.sqlpower.sqlobject.SQLDatabase;
@@ -178,13 +179,13 @@
parentdb.addChild(sch);
sch.addChild(t);
- assertEquals(parentdb, SQLObjectUtils.getAncestor(t,
SQLDatabase.class));
- assertEquals(sch, SQLObjectUtils.getAncestor(t, SQLSchema.class));
- assertEquals(t, SQLObjectUtils.getAncestor(t, SQLTable.class));
- assertNull(SQLObjectUtils.getAncestor(t, SQLCatalog.class));
+ assertEquals(parentdb, SPObjectUtils.getAncestor(t,
SQLDatabase.class));
+ assertEquals(sch, SPObjectUtils.getAncestor(t, SQLSchema.class));
+ assertEquals(t, SPObjectUtils.getAncestor(t, SQLTable.class));
+ assertNull(SPObjectUtils.getAncestor(t, SQLCatalog.class));
parentdb.removeChild(sch);
- assertNull(SQLObjectUtils.getAncestor(t, SQLDatabase.class));
+ assertNull(SPObjectUtils.getAncestor(t, SQLDatabase.class));
}
public void testCreateTableWhenExisting() throws Exception {
=======================================
--- /trunk/regress/ca/sqlpower/architect/ArchitectValueMaker.java Tue Feb
10 15:41:03 2009
+++ /trunk/regress/ca/sqlpower/architect/ArchitectValueMaker.java Tue Jan
5 08:48:08 2010
@@ -21,12 +21,17 @@
import ca.sqlpower.architect.etl.kettle.KettleRepositoryDirectoryChooser;
import ca.sqlpower.architect.etl.kettle.RootRepositoryDirectoryChooser;
+import ca.sqlpower.object.SPObject;
import ca.sqlpower.sqlobject.SQLColumn;
import ca.sqlpower.sqlobject.SQLIndex;
import ca.sqlpower.sqlobject.SQLObjectException;
import ca.sqlpower.testutil.GenericNewValueMaker;
public class ArchitectValueMaker extends GenericNewValueMaker {
+
+ public ArchitectValueMaker(SPObject root) {
+ super(root);
+ }
public Object makeNewValue(Class<?> valueType, Object oldVal, String
propName) {
Object newVal; // don't init here so compiler can warn if the
following code doesn't always give it a value
=======================================
--- /trunk/regress/ca/sqlpower/architect/TestUtils.java Thu Jan 29 12:02:55
2009
+++ /trunk/regress/ca/sqlpower/architect/TestUtils.java Tue Jan 5 08:48:08
2010
@@ -26,6 +26,7 @@
import org.apache.commons.beanutils.PropertyUtils;
import ca.sqlpower.testutil.NewValueMaker;
+import ca.sqlpower.testutil.SPObjectRoot;
/**
* Container class for utility methods useful to testing.
@@ -56,7 +57,7 @@
props[i].getWriteMethod() != null &&
!propertiesToIgnore.contains(props[i].getName())) {
- NewValueMaker valueMaker = new ArchitectValueMaker();
+ NewValueMaker valueMaker = new ArchitectValueMaker(new
SPObjectRoot());
Object newVal =
valueMaker.makeNewValue(props[i].getPropertyType(), oldVal,
props[i].getName());
System.out.println("Changing property \""+props[i].getName()+"\"
to \""+newVal+"\"");
=======================================
---
/trunk/regress/ca/sqlpower/architect/swingui/ArchitectSwingSessionImplTest.java
Mon Dec 21 08:27:43 2009
+++
/trunk/regress/ca/sqlpower/architect/swingui/ArchitectSwingSessionImplTest.java
Tue Jan 5 08:48:08 2010
@@ -283,12 +283,14 @@
SQLObject o1Parent = column;
while (o1Parent.getParent() != null) {
- o1Parent = o1Parent.getParent();
+ if (!(o1Parent.getParent() instanceof SQLObject)) break;
+ o1Parent = (SQLObject) o1Parent.getParent();
System.out.println("Columns ancestor is " + o1Parent);
}
SQLObject o2Parent = sourceColumn;
while (o2Parent.getParent() != null) {
- o2Parent = o2Parent.getParent();
+ if (!(o2Parent.getParent() instanceof SQLObject)) break;
+ o2Parent = (SQLObject) o2Parent.getParent();
System.out.println("Source Column ancestor is " + o2Parent);
}
=======================================
--- /trunk/src/ca/sqlpower/architect/ddl/GenericDDLGenerator.java Mon Dec
21 08:27:43 2009
+++ /trunk/src/ca/sqlpower/architect/ddl/GenericDDLGenerator.java Tue Jan
5 08:48:08 2010
@@ -36,12 +36,12 @@
import ca.sqlpower.architect.ArchitectUtils;
import ca.sqlpower.architect.DepthFirstSearch;
import ca.sqlpower.architect.profile.ProfileFunctionDescriptor;
+import ca.sqlpower.object.SPObjectUtils;
import ca.sqlpower.sqlobject.SQLColumn;
import ca.sqlpower.sqlobject.SQLDatabase;
import ca.sqlpower.sqlobject.SQLIndex;
import ca.sqlpower.sqlobject.SQLObject;
import ca.sqlpower.sqlobject.SQLObjectException;
-import ca.sqlpower.sqlobject.SQLObjectUtils;
import ca.sqlpower.sqlobject.SQLRelationship;
import ca.sqlpower.sqlobject.SQLSequence;
import ca.sqlpower.sqlobject.SQLTable;
@@ -214,7 +214,7 @@
try {
if (allowConnection && tableList.size() > 0) {
- SQLDatabase parentDb =
SQLObjectUtils.getAncestor(tableList.get(0), SQLDatabase.class);
+ SQLDatabase parentDb =
SPObjectUtils.getAncestor(tableList.get(0), SQLDatabase.class);
con = parentDb.getConnection();
} else {
con = null;
=======================================
--- /trunk/src/ca/sqlpower/architect/etl/ExportCSV.java Mon Dec 21 08:27:43
2009
+++ /trunk/src/ca/sqlpower/architect/etl/ExportCSV.java Tue Jan 5 08:48:08
2010
@@ -103,7 +103,9 @@
"Unexpected ancestor type " +
parent.getClass().getName() +
" for object " + c + ".");
}
- parent = parent.getParent();
+ if (!(parent.getParent() instanceof SQLObject)) break;
+
+ parent = (SQLObject) parent.getParent();
}
}
if (connection.length() == 0) {
=======================================
--- /trunk/src/ca/sqlpower/architect/profile/AbstractProfileResult.java Tue
Feb 17 15:52:57 2009
+++ /trunk/src/ca/sqlpower/architect/profile/AbstractProfileResult.java Tue
Jan 5 08:48:08 2010
@@ -25,11 +25,11 @@
import ca.sqlpower.architect.profile.event.ProfileResultEvent;
import ca.sqlpower.architect.profile.event.ProfileResultListener;
+import ca.sqlpower.object.SPObjectUtils;
import ca.sqlpower.sqlobject.SQLCatalog;
import ca.sqlpower.sqlobject.SQLColumn;
import ca.sqlpower.sqlobject.SQLDatabase;
import ca.sqlpower.sqlobject.SQLObject;
-import ca.sqlpower.sqlobject.SQLObjectUtils;
import ca.sqlpower.sqlobject.SQLSchema;
import ca.sqlpower.sqlobject.SQLTable;
@@ -157,8 +157,8 @@
SQLObject so1, so2;
// database name
- so1 = SQLObjectUtils.getAncestor(po, SQLDatabase.class);
- so2 = SQLObjectUtils.getAncestor(opo, SQLDatabase.class);
+ so1 = SPObjectUtils.getAncestor(po, SQLDatabase.class);
+ so2 = SPObjectUtils.getAncestor(opo, SQLDatabase.class);
if (so1 == null && so2 != null) diff = -1;
else if (so1 != null && so2 == null) diff = 1;
else if (so1 != null && so2 != null) diff =
so1.getName().compareTo(so2.getName());
@@ -166,8 +166,8 @@
if (diff != 0) return diff;
// catalog name
- so1 = SQLObjectUtils.getAncestor(po, SQLCatalog.class);
- so2 = SQLObjectUtils.getAncestor(opo, SQLCatalog.class);
+ so1 = SPObjectUtils.getAncestor(po, SQLCatalog.class);
+ so2 = SPObjectUtils.getAncestor(opo, SQLCatalog.class);
if (so1 == null && so2 != null) diff = -1;
else if (so1 != null && so2 == null) diff = 1;
else if (so1 != null && so2 != null) diff =
so1.getName().compareTo(so2.getName());
@@ -175,8 +175,8 @@
if (diff != 0) return diff;
// schema name
- so1 = SQLObjectUtils.getAncestor(po, SQLSchema.class);
- so2 = SQLObjectUtils.getAncestor(opo, SQLSchema.class);
+ so1 = SPObjectUtils.getAncestor(po, SQLSchema.class);
+ so2 = SPObjectUtils.getAncestor(opo, SQLSchema.class);
if (so1 == null && so2 != null) diff = -1;
else if (so1 != null && so2 == null) diff = 1;
else if (so1 != null && so2 != null) diff =
so1.getName().compareTo(so2.getName());
@@ -184,8 +184,8 @@
if (diff != 0) return diff;
// table name
- so1 = SQLObjectUtils.getAncestor(po, SQLTable.class);
- so2 = SQLObjectUtils.getAncestor(opo, SQLTable.class);
+ so1 = SPObjectUtils.getAncestor(po, SQLTable.class);
+ so2 = SPObjectUtils.getAncestor(opo, SQLTable.class);
if (so1 == null && so2 != null) diff = -1;
else if (so1 != null && so2 == null) diff = 1;
else if (so1 != null && so2 != null) diff =
so1.getName().compareTo(so2.getName());
@@ -193,8 +193,8 @@
if (diff != 0) return diff;
// column name
- so1 = SQLObjectUtils.getAncestor(po, SQLColumn.class);
- so2 = SQLObjectUtils.getAncestor(opo, SQLColumn.class);
+ so1 = SPObjectUtils.getAncestor(po, SQLColumn.class);
+ so2 = SPObjectUtils.getAncestor(opo, SQLColumn.class);
if (so1 == null && so2 != null) diff = -1;
else if (so1 != null && so2 == null) diff = 1;
else if (so1 != null && so2 != null) diff =
so1.getName().compareTo(so2.getName());
@@ -232,19 +232,19 @@
SQLObject po = getProfiledObject();
SQLObject so;
- so = SQLObjectUtils.getAncestor(po, SQLDatabase.class);
+ so = SPObjectUtils.getAncestor(po, SQLDatabase.class);
if (so != null) hash *= so.getName().hashCode();
- so = SQLObjectUtils.getAncestor(po, SQLCatalog.class);
+ so = SPObjectUtils.getAncestor(po, SQLCatalog.class);
if (so != null) hash *= so.getName().hashCode();
- so = SQLObjectUtils.getAncestor(po, SQLSchema.class);
+ so = SPObjectUtils.getAncestor(po, SQLSchema.class);
if (so != null) hash *= so.getName().hashCode();
- so = SQLObjectUtils.getAncestor(po, SQLTable.class);
+ so = SPObjectUtils.getAncestor(po, SQLTable.class);
if (so != null) hash *= so.getName().hashCode();
- so = SQLObjectUtils.getAncestor(po, SQLColumn.class);
+ so = SPObjectUtils.getAncestor(po, SQLColumn.class);
if (so != null) hash *= so.getName().hashCode();
hash *= createEndTime;
=======================================
--- /trunk/src/ca/sqlpower/architect/swingui/ASUtils.java Fri Jun 12
09:49:22 2009
+++ /trunk/src/ca/sqlpower/architect/swingui/ASUtils.java Tue Jan 5
08:48:08 2010
@@ -46,6 +46,7 @@
import ca.sqlpower.architect.ArchitectSession;
import ca.sqlpower.architect.ArchitectVersion;
import ca.sqlpower.architect.UserSettings;
+import ca.sqlpower.object.SPObjectUtils;
import ca.sqlpower.sql.JDBCDataSource;
import ca.sqlpower.sql.JDBCDataSourceType;
import ca.sqlpower.sql.SPDataSource;
@@ -589,7 +590,7 @@
if (sourceColumn != null
&& !SQLObjectUtils.isInSameSession(column, sourceColumn)) {
//The source database of the source column ETL lineage from
the source column from the import/copy (if you can understand that)
- SQLDatabase sourceSourceDatabase =
SQLObjectUtils.getAncestor(sourceColumn, SQLDatabase.class);
+ SQLDatabase sourceSourceDatabase =
SPObjectUtils.getAncestor(sourceColumn, SQLDatabase.class);
//The source data source of the target of this import/copy if
it exists (less confusing than above thankfully)
SPDataSource targetSourceSPDataSource =
dbTree.getDuplicateDbcs(sourceSourceDatabase.getDataSource());
=======================================
--- /trunk/src/ca/sqlpower/architect/swingui/DBTree.java Tue Dec 22
13:57:05 2009
+++ /trunk/src/ca/sqlpower/architect/swingui/DBTree.java Tue Jan 5
08:48:08 2010
@@ -962,7 +962,8 @@
SQLObject parent = childObject;
logger.debug("Initial Object before
recursively go to parent is: " + parent);
for (int k = 0; k < sortedLengths.get(j) -
pathCount; k++) {
- parent = parent.getParent();
+ if (!(parent.getParent() instanceof
SQLObject)) break;
+ parent = (SQLObject) parent.getParent();
}
objectsToTransfer.add(parent);
logger.debug("Final Object after recursively
go to parent is: " + parent);
@@ -978,7 +979,8 @@
for (SQLObject childObject :
pathLengthsToSelectedObjectsMap.get(sortedLengths.get(j))) {
SQLObject parent = childObject;
for (int k = 0; k < sortedLengths.get(j) -
pathCount; k++) {
- parent = parent.getParent();
+ if (!(parent.getParent() instanceof
SQLObject)) break;
+ parent = (SQLObject) parent.getParent();
}
if (parent != singleParent) {
isParentOfAllSelected = false;
@@ -998,7 +1000,8 @@
for (SQLObject childObject :
pathLengthsToSelectedObjectsMap.get(sortedLengths.get(j))) {
SQLObject parent = childObject;
for (int k = 0; k < sortedLengths.get(j) -
pathCount; k++) {
- parent = parent.getParent();
+ if (!(parent.getParent() instanceof
SQLObject)) break;
+ parent = (SQLObject)
parent.getParent();
}
objectsToTransfer.add(parent);
}
=======================================
--- /trunk/src/ca/sqlpower/architect/swingui/DataMoverPanel.java Mon Dec 21
08:27:43 2009
+++ /trunk/src/ca/sqlpower/architect/swingui/DataMoverPanel.java Tue Jan 5
08:48:08 2010
@@ -47,6 +47,7 @@
import ca.sqlpower.architect.swingui.dbtree.DBTreeCellRenderer;
import ca.sqlpower.architect.swingui.dbtree.DBTreeModel;
import ca.sqlpower.object.ObjectDependentException;
+import ca.sqlpower.object.SPObjectUtils;
import ca.sqlpower.sql.DataMover;
import ca.sqlpower.sql.DatabaseListChangeEvent;
import ca.sqlpower.sql.DatabaseListChangeListener;
@@ -249,22 +250,22 @@
* @throws SQLObjectException
*/
private int moveSingleTable(final SQLTable sourceTable) throws
SQLException, SQLObjectException {
- final SQLDatabase sourceDB = getParentDatabase(sourceTable);
+ final SQLDatabase sourceDB =
SPObjectUtils.getAncestor(sourceTable, SQLDatabase.class);
final TreePath destPath = destTree.getSelectionPath();
final SQLObject destObject = (SQLObject)
destPath.getLastPathComponent();
- final SQLDatabase destDB = getParentDatabase(destObject);
+ final SQLDatabase destDB = SPObjectUtils.getAncestor(destObject,
SQLDatabase.class);
String destCatalogName = null;
String destSchemaName = null;
String destTableName = sourceTable.getName();
SQLObject tmpSqlObj = destObject;
- while (tmpSqlObj != null) {
+ List<SQLObject> ancestorList =
SQLObjectUtils.ancestorList(tmpSqlObj);
+ for (SQLObject ancestor : ancestorList) {
// walk up the ancestors and set table, catalog, and schema
name as appropriate
- if (tmpSqlObj instanceof SQLTable) destTableName =
tmpSqlObj.getName();
- if (tmpSqlObj instanceof SQLCatalog) destCatalogName =
tmpSqlObj.getName();
- if (tmpSqlObj instanceof SQLSchema) destSchemaName =
tmpSqlObj.getName();
- tmpSqlObj = tmpSqlObj.getParent();
+ if (tmpSqlObj instanceof SQLTable) destTableName =
ancestor.getName();
+ if (tmpSqlObj instanceof SQLCatalog) destCatalogName =
ancestor.getName();
+ if (tmpSqlObj instanceof SQLSchema) destSchemaName =
ancestor.getName();
}
boolean needToCreate = false;
@@ -386,22 +387,4 @@
destCon.close();
}
}
-
- /**
- * Returns the nearest parent of obj that is an instance of
SQLDatabase,
- * or null if there is no SQLDatabase ancestor of obj.
- *
- * @param obj The object to find the parent database of.
- * @return The nearest SQLDatabase ancestor of obj, or null if there
is no
- * such ancestor.
- */
- private static SQLDatabase getParentDatabase(SQLObject obj) {
- while (obj != null) {
- if (obj instanceof SQLDatabase) {
- return (SQLDatabase) obj;
- }
- obj = obj.getParent();
- }
- return null;
- }
-}
+}
=======================================
---
/trunk/src/ca/sqlpower/architect/swingui/action/DeleteSelectedAction.java
Mon Dec 21 08:27:43 2009
+++
/trunk/src/ca/sqlpower/architect/swingui/action/DeleteSelectedAction.java
Tue Jan 5 08:48:08 2010
@@ -149,8 +149,8 @@
} else {
//Side effect of removing a relationship's parent
table is to remove the relationship
//causing this to fail if the relationship is
removed immediately after.
- if (o.getParent() != null &&
-
o.getParent().getChildrenWithoutPopulating().contains(o)) {
+ if (o.getParent() != null && o.getParent()
instanceof SQLObject &&
+ ((SQLObject)
o.getParent()).getChildrenWithoutPopulating().contains(o)) {
o.getParent().removeChild(o);
}
}
=======================================
--- /trunk/src/ca/sqlpower/architect/swingui/action/ProfileAction.java Mon
Dec 21 08:27:43 2009
+++ /trunk/src/ca/sqlpower/architect/swingui/action/ProfileAction.java Tue
Jan 5 08:48:08 2010
@@ -33,6 +33,7 @@
import ca.sqlpower.architect.swingui.ASUtils;
import ca.sqlpower.architect.swingui.ArchitectSwingSession;
import ca.sqlpower.architect.swingui.DBTree;
+import ca.sqlpower.object.SPObjectUtils;
import ca.sqlpower.sqlobject.SQLCatalog;
import ca.sqlpower.sqlobject.SQLColumn;
import ca.sqlpower.sqlobject.SQLDatabase;
@@ -95,43 +96,43 @@
else if ( tp.getLastPathComponent() instanceof SQLCatalog
) {
SQLCatalog cat = (SQLCatalog)tp.getLastPathComponent();
sqlObject.add(cat);
- SQLDatabase db =
SQLObjectUtils.getAncestor(cat,SQLDatabase.class);
+ SQLDatabase db =
SPObjectUtils.getAncestor(cat,SQLDatabase.class);
if ( db != null && sqlObject.contains(db))
sqlObject.remove(db);
} else if ( tp.getLastPathComponent() instanceof SQLSchema
) {
SQLSchema sch = (SQLSchema)tp.getLastPathComponent();
sqlObject.add(sch);
- SQLCatalog cat =
SQLObjectUtils.getAncestor(sch,SQLCatalog.class);
+ SQLCatalog cat =
SPObjectUtils.getAncestor(sch,SQLCatalog.class);
if ( cat != null && sqlObject.contains(cat))
sqlObject.remove(cat);
- SQLDatabase db =
SQLObjectUtils.getAncestor(sch,SQLDatabase.class);
+ SQLDatabase db =
SPObjectUtils.getAncestor(sch,SQLDatabase.class);
if ( db != null && sqlObject.contains(db))
sqlObject.remove(db);
} else if ( tp.getLastPathComponent() instanceof SQLTable
) {
SQLTable tab = (SQLTable)tp.getLastPathComponent();
sqlObject.add(tab);
- SQLSchema sch =
SQLObjectUtils.getAncestor(tab,SQLSchema.class);
+ SQLSchema sch =
SPObjectUtils.getAncestor(tab,SQLSchema.class);
if ( sch != null && sqlObject.contains(sch))
sqlObject.remove(sch);
- SQLCatalog cat =
SQLObjectUtils.getAncestor(sch,SQLCatalog.class);
+ SQLCatalog cat =
SPObjectUtils.getAncestor(sch,SQLCatalog.class);
if ( cat != null && sqlObject.contains(cat))
sqlObject.remove(cat);
- SQLDatabase db =
SQLObjectUtils.getAncestor(sch,SQLDatabase.class);
+ SQLDatabase db =
SPObjectUtils.getAncestor(sch,SQLDatabase.class);
if ( db != null && sqlObject.contains(db))
sqlObject.remove(db);
} else if ( tp.getLastPathComponent() instanceof SQLColumn
) {
SQLTable tab =
((SQLColumn)tp.getLastPathComponent()).getParent();
sqlObject.add((SQLColumn)tp.getLastPathComponent());
- SQLSchema sch =
SQLObjectUtils.getAncestor(tab,SQLSchema.class);
+ SQLSchema sch =
SPObjectUtils.getAncestor(tab,SQLSchema.class);
if ( sch != null && sqlObject.contains(sch))
sqlObject.remove(sch);
- SQLCatalog cat =
SQLObjectUtils.getAncestor(sch,SQLCatalog.class);
+ SQLCatalog cat =
SPObjectUtils.getAncestor(sch,SQLCatalog.class);
if ( cat != null && sqlObject.contains(cat))
sqlObject.remove(cat);
- SQLDatabase db =
SQLObjectUtils.getAncestor(sch,SQLDatabase.class);
+ SQLDatabase db =
SPObjectUtils.getAncestor(sch,SQLDatabase.class);
if ( db != null && sqlObject.contains(db))
sqlObject.remove(db);
=======================================
--- /trunk/src/ca/sqlpower/architect/swingui/action/RefreshAction.java Fri
May 22 04:52:34 2009
+++ /trunk/src/ca/sqlpower/architect/swingui/action/RefreshAction.java Tue
Jan 5 08:48:08 2010
@@ -37,10 +37,10 @@
import ca.sqlpower.architect.swingui.ArchitectSwingSession;
import ca.sqlpower.architect.swingui.DBTree;
import ca.sqlpower.architect.swingui.dbtree.DBTreeModel;
+import ca.sqlpower.object.SPObjectUtils;
import ca.sqlpower.sqlobject.SQLDatabase;
import ca.sqlpower.sqlobject.SQLObject;
import ca.sqlpower.sqlobject.SQLObjectException;
-import ca.sqlpower.sqlobject.SQLObjectUtils;
import ca.sqlpower.swingui.ProgressWatcher;
import ca.sqlpower.swingui.SPSwingWorker;
import ca.sqlpower.swingui.SwingWorkerRegistry;
@@ -135,7 +135,7 @@
Set<SQLDatabase> databasesToRefresh = new HashSet<SQLDatabase>();
for (TreePath tp : dbTree.getSelectionPaths()) {
SQLObject so = (SQLObject) tp.getLastPathComponent();
- SQLDatabase db = SQLObjectUtils.getAncestor(so,
SQLDatabase.class);
+ SQLDatabase db = SPObjectUtils.getAncestor(so,
SQLDatabase.class);
if (db != null && !db.isPlayPenDatabase()) {
databasesToRefresh.add(db);
}
=======================================
--- /trunk/src/ca/sqlpower/architect/swingui/table/ProfileTableModel.java
Mon Dec 21 08:27:43 2009
+++ /trunk/src/ca/sqlpower/architect/swingui/table/ProfileTableModel.java
Tue Jan 5 08:48:08 2010
@@ -36,12 +36,12 @@
import ca.sqlpower.architect.profile.event.ProfileChangeEvent;
import ca.sqlpower.architect.profile.event.ProfileChangeListener;
import ca.sqlpower.architect.profile.output.ProfileColumn;
+import ca.sqlpower.object.SPObjectUtils;
import ca.sqlpower.sqlobject.SQLCatalog;
import ca.sqlpower.sqlobject.SQLColumn;
import ca.sqlpower.sqlobject.SQLDatabase;
import ca.sqlpower.sqlobject.SQLObjectException;
import ca.sqlpower.sqlobject.SQLObjectRuntimeException;
-import ca.sqlpower.sqlobject.SQLObjectUtils;
import ca.sqlpower.sqlobject.SQLSchema;
import ca.sqlpower.sqlobject.SQLTable;
import ca.sqlpower.swingui.table.CleanupTableModel;
@@ -145,13 +145,13 @@
switch(column) {
case DATABASE:
- return SQLObjectUtils.getAncestor(col,SQLDatabase.class);
+ return SPObjectUtils.getAncestor(col,SQLDatabase.class);
case CATALOG:
- return SQLObjectUtils.getAncestor(col,SQLCatalog.class);
+ return SPObjectUtils.getAncestor(col,SQLCatalog.class);
case SCHEMA:
- return SQLObjectUtils.getAncestor(col,SQLSchema.class);
+ return SPObjectUtils.getAncestor(col,SQLSchema.class);
case TABLE:
- return SQLObjectUtils.getAncestor(col,SQLTable.class);
+ return SPObjectUtils.getAncestor(col,SQLTable.class);
case COLUMN:
return col;
case RUNDATE: