Revision: 3641
Author: [email protected]
Date: Fri Jun 25 12:13:50 2010
Log: NEW - bug 2458: Create Critic Manager
http://trillian.sqlpower.ca/bugzilla/show_bug.cgi?id=2458
Corrected the physical name critic to not criticize column mappings or
SQLIndex.Columns as suggested by Thomas Kellerer on the developer mailing
list as they are not used in the actual DDL and are generated not user
defined.
http://code.google.com/p/power-architect/source/detail?r=3641
Modified:
/trunk/src/main/java/ca/sqlpower/architect/ddl/critic/impl/PhysicalNameCritic.java
=======================================
---
/trunk/src/main/java/ca/sqlpower/architect/ddl/critic/impl/PhysicalNameCritic.java
Tue Jun 22 14:02:38 2010
+++
/trunk/src/main/java/ca/sqlpower/architect/ddl/critic/impl/PhysicalNameCritic.java
Fri Jun 25 12:13:50 2010
@@ -32,6 +32,8 @@
import ca.sqlpower.object.annotation.Constructor;
import ca.sqlpower.object.annotation.ConstructorParameter;
import ca.sqlpower.sqlobject.SQLObject;
+import ca.sqlpower.sqlobject.SQLIndex.Column;
+import ca.sqlpower.sqlobject.SQLRelationship.ColumnMapping;
/**
* Criticizes the physical name of all SQLObjects based on the parameters
given
@@ -72,6 +74,10 @@
public List<Criticism> criticize(final Object subject) {
if (!(subject instanceof SQLObject)) return
Collections.emptyList();
+ //Column mappings and the columns in SQLIndex do not get written in
+ //a DDL statement so we can ignore criticizing them.
+ if (subject instanceof ColumnMapping || subject instanceof Column)
return Collections.emptyList();
+
final SQLObject so = (SQLObject) subject;
String physName = so.getPhysicalName();