Revision: 3618
Author: [email protected]
Date: Mon Jun 14 09:32:54 2010
Log: Fixed the testSaveCoversAllColumnProperties test in TestSwingUIProject
to ignore the variableResolver property in SQLColumn.
Also, added type safety to a few classes.
http://code.google.com/p/power-architect/source/detail?r=3618
Modified:
/trunk/regress/ca/sqlpower/architect/swingui/TestSwingUIProject.java
/trunk/src/main/java/ca/sqlpower/architect/ddl/ConflictResolver.java
/trunk/src/main/java/ca/sqlpower/architect/swingui/DDLExportPanel.java
/trunk/src/main/java/ca/sqlpower/architect/swingui/SwingUIProjectLoader.java
/trunk/src/main/java/ca/sqlpower/architect/swingui/action/ExportDDLAction.java
=======================================
--- /trunk/regress/ca/sqlpower/architect/swingui/TestSwingUIProject.java
Mon Jun 14 09:11:26 2010
+++ /trunk/regress/ca/sqlpower/architect/swingui/TestSwingUIProject.java
Mon Jun 14 09:32:54 2010
@@ -671,6 +671,7 @@
propertiesToIgnore.add("platform");
propertiesToIgnore.add("childrenWithoutPopulating");
+ propertiesToIgnore.add("variableResolver");
session.getUndoManager().setLoading(true);
Map<String,Object> oldDescription =
@@ -1209,8 +1210,8 @@
*/
private void recursiveCheckParenting(SQLObject o, String path) throws
Exception {
System.out.println("Checking children of " + path);
- for (Iterator it = o.getChildren().iterator(); it.hasNext();) {
- SQLObject child = (SQLObject) it.next();
+ for (Iterator<? extends SQLObject> it =
o.getChildren().iterator(); it.hasNext();) {
+ SQLObject child = it.next();
if (o instanceof SQLObjectRoot) {
// skip, because database parent pointers are null
} else if (child instanceof SQLRelationship &&
((SQLRelationship) child).getFkTable().equals(o)) {
=======================================
--- /trunk/src/main/java/ca/sqlpower/architect/ddl/ConflictResolver.java
Thu Jan 29 12:02:55 2009
+++ /trunk/src/main/java/ca/sqlpower/architect/ddl/ConflictResolver.java
Mon Jun 14 09:32:54 2010
@@ -33,10 +33,10 @@
import org.apache.log4j.Logger;
import ca.sqlpower.architect.ArchitectUtils;
-import ca.sqlpower.sqlobject.SQLObjectException;
import ca.sqlpower.sqlobject.SQLDatabase;
import ca.sqlpower.sqlobject.SQLIndex;
import ca.sqlpower.sqlobject.SQLObject;
+import ca.sqlpower.sqlobject.SQLObjectException;
import ca.sqlpower.sqlobject.SQLRelationship;
import ca.sqlpower.sqlobject.SQLSequence;
import ca.sqlpower.sqlobject.SQLTable;
@@ -67,7 +67,7 @@
private String catalog;
private String schema;
private String name;
- private List dependants;
+ private List<Conflict> dependants;
private String sqlDropStatement;
/**
@@ -82,7 +82,7 @@
this.catalog = catalog;
this.schema = schema;
this.name = name;
- this.dependants = new ArrayList();
+ this.dependants = new ArrayList<Conflict>();
}
public String getQualifiedName() {
@@ -133,10 +133,10 @@
public String toString() {
return getType()+" "+getQualifiedName();
}
- public void setDependants(List v) {
+ public void setDependants(List<Conflict> v) {
this.dependants = v;
}
- public List getDependants() {
+ public List<Conflict> getDependants() {
return dependants;
}
public String getName() {
@@ -187,8 +187,8 @@
}
private SQLDatabase targetDatabase;
- private List ddlStatements;
- private List conflicts;
+ private List<DDLStatement> ddlStatements;
+ private List<Conflict> conflicts;
private String lastSQLStatement;
private DDLGenerator ddlg;
private int monitorableProgress;
@@ -202,7 +202,7 @@
* Creates a new ConflictResolver. You should call findConflicting()
after you get
* this new object.
*/
- public ConflictResolver(SQLDatabase target, DDLGenerator ddlg, List
ddlStatements) {
+ public ConflictResolver(SQLDatabase target, DDLGenerator ddlg,
List<DDLStatement> ddlStatements) {
this.targetDatabase = target;
this.ddlg = ddlg;
this.ddlStatements = ddlStatements;
@@ -224,7 +224,7 @@
doingFindConflicting = true;
Connection con = null;
try {
- conflicts = new ArrayList();
+ conflicts = new ArrayList<Conflict>();
monitorableProgress = 0;
if (logger.isDebugEnabled()) {
@@ -234,13 +234,13 @@
con = targetDatabase.getConnection();
DatabaseMetaData dbmd = con.getMetaData();
- Iterator it = ddlStatements.iterator();
+ Iterator<DDLStatement> it = ddlStatements.iterator();
while (it.hasNext()) {
DDLStatement ddlStmt = (DDLStatement) it.next();
monitorableProgress += 1;
if (ddlStmt.getType() != DDLStatement.StatementType.CREATE)
continue;
SQLObject so = ddlStmt.getObject();
- Class clazz = so.getClass();
+ Class<? extends SQLObject> clazz = so.getClass();
if (clazz.equals(SQLTable.class)) {
SQLTable t = (SQLTable) so;
@@ -309,13 +309,13 @@
monitorableProgress = 0;
dropConflictingStarted = true;
doingDropConflicting = true;
- Iterator it = conflicts.iterator();
+ Iterator<Conflict> it = conflicts.iterator();
Connection con = null;
Statement stmt = null;
try {
con = targetDatabase.getConnection();
stmt = con.createStatement();
- Set alreadyDropped = new HashSet();
+ Set<Conflict> alreadyDropped = new HashSet<Conflict>();
while (it.hasNext()) {
Conflict c = (Conflict) it.next();
monitorableProgress++;
@@ -343,9 +343,9 @@
* @param c
* @param stmt
*/
- private void dropConflict(Conflict c, Statement stmt, Set
alreadyDropped) throws SQLException {
-
- Iterator it = c.getDependants().iterator();
+ private void dropConflict(Conflict c, Statement stmt, Set<Conflict>
alreadyDropped) throws SQLException {
+
+ Iterator<Conflict> it = c.getDependants().iterator();
while (it.hasNext()) {
Conflict c2 = (Conflict) it.next();
dropConflict(c2, stmt, alreadyDropped);
@@ -377,7 +377,7 @@
*/
public String toConflictTree() {
StringBuffer tree = new StringBuffer();
- Iterator it = conflicts.iterator();
+ Iterator<Conflict> it = conflicts.iterator();
while (it.hasNext()) {
Conflict c = (Conflict) it.next();
appendToConflictTree(tree, 1, c);
@@ -398,7 +398,7 @@
}
tree.append(c.getType()).append(" ").append(c.getQualifiedName());
tree.append("\n");
- Iterator it = c.getDependants().iterator();
+ Iterator<Conflict> it = c.getDependants().iterator();
while (it.hasNext()) {
appendToConflictTree(tree, indent+1, (Conflict) it.next());
}
=======================================
--- /trunk/src/main/java/ca/sqlpower/architect/swingui/DDLExportPanel.java
Sat May 22 08:44:54 2010
+++ /trunk/src/main/java/ca/sqlpower/architect/swingui/DDLExportPanel.java
Mon Jun 14 09:32:54 2010
@@ -123,10 +123,10 @@
newTargetDB = new
JButton(Messages.getString("DDLExportPanel.propertiesButton"));
//$NON-NLS-1$
newTargetDB.addActionListener(new ActionListener() {
- public void actionPerformed(ActionEvent e) {
-
ASUtils.showTargetDbcsDialog(session.getArchitectFrame(), session,
targetDB);
- }
- });
+ public void actionPerformed(ActionEvent e) {
+ ASUtils.showTargetDbcsDialog(session.getArchitectFrame(),
session, targetDB);
+ }
+ });
panelProperties.add(new
JLabel(Messages.getString("DDLExportPanel.generateDDLForDbType")));
//$NON-NLS-1$
DDLGenerator ddlg = session.getDDLGenerator();
@@ -139,11 +139,11 @@
}
panelProperties.add(dbType = new JComboBox(ddlTypes));
dbType.setRenderer(new DDLGeneratorListCellRenderer());
- dbType.addActionListener(new ActionListener() {
- public void actionPerformed(ActionEvent e) {
- setUpCatalogAndSchemaFields();
- }
- });
+ dbType.addActionListener(new ActionListener() {
+ public void actionPerformed(ActionEvent e) {
+ setUpCatalogAndSchemaFields();
+ }
+ });
panelProperties.add(catalogLabel = new
JLabel(Messages.getString("DDLExportPanel.targetCatalog"))); //$NON-NLS-1$
panelProperties.add(catalogField = new
JTextField(ddlg.getTargetCatalog()));
=======================================
---
/trunk/src/main/java/ca/sqlpower/architect/swingui/SwingUIProjectLoader.java
Sat May 22 08:44:54 2010
+++
/trunk/src/main/java/ca/sqlpower/architect/swingui/SwingUIProjectLoader.java
Mon Jun 14 09:32:54 2010
@@ -166,7 +166,7 @@
// ------------- READING THE PROJECT FILE ---------------
- public void load(InputStream in, DataSourceCollection dataSources)
throws IOException, SQLObjectException {
+ public void load(InputStream in, DataSourceCollection<? extends
SPDataSource> dataSources) throws IOException, SQLObjectException {
olapPaneLoadIdMap = new HashMap<String, OLAPPane<?, ?>>();
UnclosableInputStream uin = new UnclosableInputStream(in);
@@ -868,9 +868,9 @@
ioo.indent++;
int dsNum = 0;
SQLObject dbTreeRoot = (SQLObject)
getSession().getSourceDatabases().getModel().getRoot();
- Iterator it = dbTreeRoot.getChildren().iterator();
+ Iterator<? extends SQLObject> it =
dbTreeRoot.getChildren().iterator();
while (it.hasNext()) {
- SQLObject o = (SQLObject) it.next();
+ SQLObject o = it.next();
SPDataSource ds = ((SQLDatabase) o).getDataSource();
if (ds != null) {
String id = dbcsSaveIdMap.get(ds);
@@ -880,9 +880,9 @@
}
ioo.println(out, "<data-source
id=\""+SQLPowerUtils.escapeXML(id)+"\">"); //$NON-NLS-1$ //$NON-NLS-2$
ioo.indent++;
- Iterator pit = ds.getPropertiesMap().entrySet().iterator();
+ Iterator<Map.Entry<String, String>> pit =
ds.getPropertiesMap().entrySet().iterator();
while (pit.hasNext()) {
- Map.Entry ent = (Map.Entry) pit.next();
+ Map.Entry<String, String> ent = pit.next();
if (ent.getValue() != null) {
ioo.println(out, "<property key="+quote((String)
ent.getKey())+" value="+quote((String) ent.getValue())+" />");
//$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
}
@@ -993,9 +993,9 @@
ioo.println(out, "<source-databases>"); //$NON-NLS-1$
ioo.indent++;
SQLObject dbTreeRoot = (SQLObject)
getSession().getSourceDatabases().getModel().getRoot();
- Iterator it = dbTreeRoot.getChildren().iterator();
+ Iterator<? extends SQLObject> it =
dbTreeRoot.getChildren().iterator();
while (it.hasNext()) {
- SQLObject o = (SQLObject) it.next();
+ SQLObject o = it.next();
if (o != getSession().getTargetDatabase()) {
saveSQLObject(out, o);
}
@@ -1011,9 +1011,9 @@
private void saveRelationships(PrintWriter out, SQLDatabase db) throws
SQLObjectException, IOException {
ioo.println(out, "<relationships>"); //$NON-NLS-1$
ioo.indent++;
- Iterator it = db.getChildren().iterator();
+ Iterator<? extends SQLObject> it = db.getChildren().iterator();
while (it.hasNext()) {
- saveRelationshipsRecurse(out, (SQLObject) it.next());
+ saveRelationshipsRecurse(out, it.next());
}
ioo.indent--;
ioo.println(out, "</relationships>"); //$NON-NLS-1$
@@ -1028,9 +1028,9 @@
} else if (o instanceof SQLRelationship) {
saveSQLObject(out, o);
} else if (o.allowsChildren()) {
- Iterator it = o.getChildren().iterator();
+ Iterator<? extends SQLObject> it = o.getChildren().iterator();
while (it.hasNext()) {
- saveRelationshipsRecurse(out, (SQLObject) it.next());
+ saveRelationshipsRecurse(out, it.next());
}
}
}
@@ -1041,9 +1041,9 @@
quote(dbcsSaveIdMap.get(db.getDataSource()))+ ">");
//$NON-NLS-1$
sqlObjectSaveIdMap.put(db, "ppdb"); //$NON-NLS-1$
ioo.indent++;
- Iterator it = db.getChildren().iterator();
+ Iterator<? extends SQLObject> it = db.getChildren().iterator();
while (it.hasNext()) {
- saveSQLObject(out, (SQLObject) it.next());
+ saveSQLObject(out, it.next());
}
saveRelationships(out, db);
ioo.indent--;
@@ -1135,7 +1135,7 @@
ioo.println(out, "<virtual-cube-pane id=" + quote(paneId)
+ " model-ref=" + quote(modelId) //$NON-NLS-1$ //$NON-NLS-2$
+ " x=\"" + p.x + "\" y=\"" + p.y + "\"/>");
//$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
olapPaneSaveIdMap.put(vcp, paneId);
- } else if (ppc instanceof ContainerPane) {
+ } else if (ppc instanceof ContainerPane<?, ?>) {
logger.warn("Skipping unhandled playpen component: " +
ppc); //$NON-NLS-1$
}
}
@@ -1165,7 +1165,7 @@
ioo.println(out, "<usage-comp model-ref=" + quote(modelId)
+ //$NON-NLS-1$
" pane1-ref=" + quote(pane1Id) + " pane2-ref=" +
quote(pane2Id) + "/>"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
- } else if (ppc instanceof ContainerPane) {
+ } else if (ppc instanceof ContainerPane<?, ?>) {
// do nothing, already handled.
} else {
logger.warn("Skipping unhandled playpen component: " +
ppc); //$NON-NLS-1$
@@ -1262,7 +1262,7 @@
ioo.indent--;
}
- private void printCommonItems(PrintWriter out, ProfileResult
profileResult, String profiledObjectId) {
+ private void printCommonItems(PrintWriter out, ProfileResult<?>
profileResult, String profiledObjectId) {
ioo.print(out, "<profile-result ref-id=\"" + profiledObjectId
+ "\"" + //$NON-NLS-1$ //$NON-NLS-2$
" type=\"" + profileResult.getClass().getName() + "\"" +
//$NON-NLS-1$ //$NON-NLS-2$
"
createStartTime=\""+profileResult.getCreateStartTime()+"\"" + //$NON-NLS-1$
//$NON-NLS-2$
@@ -1417,7 +1417,7 @@
ioo.niprint(out, "populated=\"true\" "); //$NON-NLS-1$
}
- Iterator props = propNames.keySet().iterator();
+ Iterator<String> props = propNames.keySet().iterator();
while (props.hasNext()) {
Object key = props.next();
Object value = propNames.get(key);
@@ -1427,7 +1427,7 @@
}
if (o.allowsChildren()) {
ioo.niprintln(out, ">"); //$NON-NLS-1$
- Iterator children;
+ Iterator<? extends SQLObject> children;
if (getSession().isSavingEntireSource()) {
children = o.getChildren().iterator();
} else {
=======================================
---
/trunk/src/main/java/ca/sqlpower/architect/swingui/action/ExportDDLAction.java
Sun Feb 21 04:10:12 2010
+++
/trunk/src/main/java/ca/sqlpower/architect/swingui/action/ExportDDLAction.java
Mon Jun 14 09:32:54 2010
@@ -44,6 +44,7 @@
import ca.sqlpower.architect.ddl.ConflictResolver;
import ca.sqlpower.architect.ddl.DDLGenerator;
+import ca.sqlpower.architect.ddl.DDLStatement;
import ca.sqlpower.architect.ddl.DDLWarning;
import ca.sqlpower.architect.ddl.DDLWarningComponent;
import ca.sqlpower.architect.ddl.ObjectPropertyModificationDDLComponent;
@@ -255,7 +256,7 @@
JDialog parentDialog;
SQLDatabase target;
DDLGenerator ddlg;
- List statements;
+ List<DDLStatement> statements;
/**
@@ -284,7 +285,7 @@
* @throws SQLException If the conflict resolver chokes
*/
public ConflictFinderProcess(JDialog parentDialog, SQLDatabase
target,
- DDLGenerator ddlg, List statements,
ArchitectSwingSession session)
+ DDLGenerator ddlg, List<DDLStatement> statements,
ArchitectSwingSession session)
throws SQLObjectException {
super(session);
this.parentDialog = parentDialog;