Revision: 3979
Author: [email protected]
Date: Mon Nov 8 11:05:46 2010
Log: Fixed bug 1777: Comments/remarks now save newlines. In the community
edition, the xml tag for tables and columns no longer has an attribute
called remarks="..." but has a child tag <remarks>...</remarks> so that it
saves newline data. In the enterprise edition, this wasn't possible, so I
escaped the character with "&crfl;".
http://code.google.com/p/power-architect/source/detail?r=3979
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 Wed Sep
8 08:39:58 2010
+++ /trunk/src/main/java/ca/sqlpower/architect/ProjectLoader.java Mon Nov
8 11:05:46 2010
@@ -413,6 +413,7 @@
SQLTableFactory tableFactory = new SQLTableFactory();
d.addFactoryCreate("*/table", tableFactory);
d.addSetProperties("*/table");
+ d.addCallMethod("*/remarks", "setRemarks", 0);
d.addSetNext("*/table", "addChild");
d.addFactoryCreate("*/folder", new SQLFolderFactory());
@@ -420,6 +421,7 @@
SQLColumnFactory columnFactory = new SQLColumnFactory();
d.addFactoryCreate("*/column", columnFactory);
d.addSetProperties("*/column");
+ d.addCallMethod("*/remarks", "setRemarks", 0);
// this needs to be manually set last to prevent generic types
// from overwriting database specific types
@@ -654,6 +656,8 @@
if (populated != null && populated.equals("false")) {
tab.initFolders(false);
}
+
+
currentTable = tab;
=======================================
---
/trunk/src/main/java/ca/sqlpower/architect/swingui/SwingUIProjectLoader.java
Wed Nov 3 13:56:26 2010
+++
/trunk/src/main/java/ca/sqlpower/architect/swingui/SwingUIProjectLoader.java
Mon Nov 8 11:05:46 2010
@@ -1446,7 +1446,6 @@
} else if (o instanceof SQLTable) {
id = "TAB"+sqlObjectSaveIdMap.size(); //$NON-NLS-1$
type = "table"; //$NON-NLS-1$
- propNames.put("remarks", ((SQLTable) o).getRemarks());
//$NON-NLS-1$
propNames.put("objectType", ((SQLTable) o).getObjectType());
//$NON-NLS-1$
// don't save primary key name. It is a propery of the PK
index, not the table.
if (pm != null) {
@@ -1468,7 +1467,6 @@
propNames.put("scale", new Integer(((SQLColumn)
o).getScale())); //$NON-NLS-1$
propNames.put("precision", new Integer(((SQLColumn)
o).getPrecision())); //$NON-NLS-1$
propNames.put("nullable", new Integer(((SQLColumn)
o).getNullable())); //$NON-NLS-1$
- propNames.put("remarks", ((SQLColumn) o).getRemarks());
//$NON-NLS-1$
propNames.put("defaultValue", ((SQLColumn)
o).getDefaultValue()); //$NON-NLS-1$
propNames.put("primaryKeySeq", ((SQLColumn)
o).isPrimaryKey() ? ((SQLColumn)
o).getParent().getChildrenWithoutPopulating(SQLColumn.class).indexOf(o) :
null); //$NON-NLS-1$
propNames.put("autoIncrement", Boolean.valueOf(((SQLColumn)
o).isAutoIncrement())); //$NON-NLS-1$
@@ -1524,9 +1522,12 @@
}
sqlObjectSaveIdMap.put(o, id);
-
- //ioo.print("<"+type+" hashCode=\""+o.hashCode()+"\"
id=\""+id+"\" "); // use this for debugging duplicate object problems
- ioo.print(out, "<"+type+" id="+quote(id)+" "); //$NON-NLS-1$
//$NON-NLS-2$ //$NON-NLS-3$
+ if(logger.isDebugEnabled()) {
+ // use this for debugging duplicate object problems
+ ioo.print(out, "<"+type+" hashCode=\""+o.hashCode()+"\"
id=\""+quote(id)+"\" ");
+ } else {
+ ioo.print(out, "<"+type+" id="+quote(id)+" "); //$NON-NLS-1$
//$NON-NLS-2$ //$NON-NLS-3$
+ }
if ( (!getSession().isSavingEntireSource()) && (!o.isPopulated())
) {
ioo.niprint(out, "populated=\"false\" "); //$NON-NLS-1$
@@ -1562,6 +1563,7 @@
String indicesFolder = null;
if (o instanceof SQLTable) {
SQLTable table = (SQLTable) o;
+ ioo.println(out, "<remarks>" + table.getRemarks()
+ "</remarks>");
String exception;
if
(table.getChildrenInaccessibleReason(SQLColumn.class) != null) {
exception = "sql-exception=\"" +
@@ -1603,6 +1605,8 @@
indicesFolder = "<folder id=\"FOL" + id + "4\"
populated=\"" +
table.isIndicesPopulated() + "\" name=\"Indices\" " +
"physicalName=\"Indices\" " + exception
+ "type=\"4\">";
+ } else if (o instanceof SQLColumn) {
+ ioo.println(out, "<remarks>" + ((SQLColumn)
o).getRemarks() + "</remarks>");
}
while (children.hasNext()) {
SQLObject child = (SQLObject) children.next();