Revision: 3668
Author: [email protected]
Date: Mon Jul 5 08:54:12 2010
Log: NEW - bug 2458: Create Critic Manager
http://trillian.sqlpower.ca/bugzilla/show_bug.cgi?id=2458
Removed the DDLWarnings classes. These classes were part of the old quick
fix system and created warnings about the model before forward engineering.
The current critics system now handles these warnings and more.
http://code.google.com/p/power-architect/source/detail?r=3668
Deleted:
/trunk/src/main/java/ca/sqlpower/architect/ddl/AbstractDDLWarning.java
/trunk/src/main/java/ca/sqlpower/architect/ddl/DDLWarning.java
/trunk/src/main/java/ca/sqlpower/architect/ddl/DDLWarningComponent.java
/trunk/src/main/java/ca/sqlpower/architect/ddl/GenericDDLWarningComponent.java
/trunk/src/main/java/ca/sqlpower/architect/ddl/InvalidNameDDLWarning.java
/trunk/src/main/java/ca/sqlpower/architect/ddl/InvalidSeqNameDDLWarning.java
/trunk/src/main/java/ca/sqlpower/architect/ddl/ObjectPropertyModificationDDLComponent.java
/trunk/src/main/java/ca/sqlpower/architect/ddl/RelationshipColumnsTypesMismatchDDLWarning.java
/trunk/src/main/java/ca/sqlpower/architect/ddl/RelationshipMapsNoColumnsDDLWarning.java
/trunk/src/main/java/ca/sqlpower/architect/ddl/SetDefaultOnColumnWithNoDefaultWarning.java
/trunk/src/main/java/ca/sqlpower/architect/ddl/SetNullOnNonNullableColumnWarning.java
/trunk/src/main/java/ca/sqlpower/architect/ddl/TypeMapDDLWarning.java
/trunk/src/main/java/ca/sqlpower/architect/ddl/UnsupportedFeatureDDLWarning.java
=======================================
--- /trunk/src/main/java/ca/sqlpower/architect/ddl/AbstractDDLWarning.java
Thu Jan 29 12:02:55 2009
+++ /dev/null
@@ -1,102 +0,0 @@
-/*
- * Copyright (c) 2008, SQL Power Group Inc.
- *
- * This file is part of Power*Architect.
- *
- * Power*Architect is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 3 of the License, or
- * (at your option) any later version.
- *
- * Power*Architect is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
- */
-package ca.sqlpower.architect.ddl;
-
-import java.util.List;
-
-import ca.sqlpower.sqlobject.SQLObject;
-
-public abstract class AbstractDDLWarning implements DDLWarning {
-
- protected List<? extends SQLObject> involvedObjects;
- protected String message;
- protected boolean fixed;
- protected boolean isQuickFixable;
- protected String quickFixMesssage;
- protected SQLObject whichObjectQuickFixFixes;
-
- /**
- * The name of the Beans property of the object(s) involved in this
warning
- * that can be modified to fix the problem. For example, if the
warning is
- * about a duplicate or illegal name, this would be "name". If the
warning
- * is about an illegal type, it would be "type". If the warning does
not
- * pertain to a problem that can be fixed by fiddling with a particular
- * property value, this will be null.
- */
- protected String quickFixPropertyName;
-
- public AbstractDDLWarning(
- List<? extends SQLObject> involvedObjects,
- String message,
- boolean isQuickFixable,
- String quickFixMesssage,
- SQLObject whichObjectQuickFixFixes,
- String quickFixPropertyName) {
- super();
- for (SQLObject so : involvedObjects) {
- if (so == null) {
- throw new NullPointerException("None of the objects in the
involvedObjects list can be null!");
- }
- }
- this.involvedObjects = involvedObjects;
- this.message = message;
- this.isQuickFixable = isQuickFixable;
- this.quickFixMesssage = quickFixMesssage;
- this.whichObjectQuickFixFixes = whichObjectQuickFixFixes;
- this.quickFixPropertyName = quickFixPropertyName;
- }
-
-
- public List<? extends SQLObject> getInvolvedObjects() {
- return involvedObjects;
- }
-
- public String getMessage() {
- return message;
- }
-
- public String getQuickFixMessage() {
- return quickFixMesssage;
- }
-
- public boolean isFixed() {
- return fixed;
- }
-
- public void setFixed(boolean fixed) {
- this.fixed = fixed;
- }
-
- public boolean isQuickFixable() {
- return isQuickFixable;
- }
-
- /** Dummy version for subclasses that are not quickfixable */
- public boolean quickFix() {
- throw new IllegalStateException("Called generic version of
quickFix");
- }
-
- /**
- * Returns the value of {...@link #quickFixPropertyName}. Subclasses
that support QuickFix
- * should initialize that value to the appropriate property name.
- */
- public String getQuickFixPropertyName() {
- return quickFixPropertyName;
- }
-}
=======================================
--- /trunk/src/main/java/ca/sqlpower/architect/ddl/DDLWarning.java Thu Jan
29 12:02:55 2009
+++ /dev/null
@@ -1,69 +0,0 @@
-/*
- * Copyright (c) 2008, SQL Power Group Inc.
- *
- * This file is part of Power*Architect.
- *
- * Power*Architect is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 3 of the License, or
- * (at your option) any later version.
- *
- * Power*Architect is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
- */
-package ca.sqlpower.architect.ddl;
-
-import java.util.List;
-
-import ca.sqlpower.sqlobject.SQLObject;
-
-/**
- * A DDLWarning object encapsulates the details of a single warning
- * message issued by a DDL generator.
- */
-public interface DDLWarning {
-
- /**
- * Get the message associated with this warning, e.g., a string
- * like "Primary Key Name is already in use"
- */
- public String getMessage();
-
- /**
- * The subject(s) of this warning. For instance, if there is a
- * duplicate table names, the SQLTable objects with the duplicate
- * names will be the "involved objects".
- */
- public List<? extends SQLObject> getInvolvedObjects();
-
- /** Return true if the user has repaired or quickfixed the problem */
- public boolean isFixed();
-
- public void setFixed(boolean fixed);
-
- /** Tell whether the user can "quick fix" this problem */
- public boolean isQuickFixable();
-
- /** If isQuickFixable(), then this gives the message about what
- * will be done.
- */
- public String getQuickFixMessage();
-
- /** If isQuickFixable(), then this applies the quick fix */
- public boolean quickFix();
-
- /**
- * Returns the name of the Beans property of the involved object(s)
that
- * can be modified to fix the problem. For example, if the warning is
- * about a duplicate or illegal name, this method would return "name".
- * If the warning is about an illegal type, this method would
return "type".
- * If the warning does not pertain to a problem that can be fixed by
- * fiddling with a particular property value, this method will return
null.
- */
- public String getQuickFixPropertyName();
-}
=======================================
--- /trunk/src/main/java/ca/sqlpower/architect/ddl/DDLWarningComponent.java
Tue Mar 25 07:38:28 2008
+++ /dev/null
@@ -1,44 +0,0 @@
-/*
- * Copyright (c) 2008, SQL Power Group Inc.
- *
- * This file is part of Power*Architect.
- *
- * Power*Architect is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 3 of the License, or
- * (at your option) any later version.
- *
- * Power*Architect is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
- */
-package ca.sqlpower.architect.ddl;
-
-import javax.swing.JComponent;
-
-/**
- * A UI component that will display a DDLWarning and provide
- * the user with a GUI of some type to correct the error.
- */
-public interface DDLWarningComponent {
-
- /**
- * Return the Runnable that will apply the changes.
- */
- public Runnable getChangeApplicator();
- /**
- * Return the associated visual component
- */
- public JComponent getComponent();
- /**
- * Return the DDLWarning object
- */
- public DDLWarning getWarning();
-
- /** Do something - apply the user's changes */
- public void applyChanges();
-}
=======================================
---
/trunk/src/main/java/ca/sqlpower/architect/ddl/GenericDDLWarningComponent.java
Tue Mar 25 07:38:28 2008
+++ /dev/null
@@ -1,56 +0,0 @@
-/*
- * Copyright (c) 2008, SQL Power Group Inc.
- *
- * This file is part of Power*Architect.
- *
- * Power*Architect is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 3 of the License, or
- * (at your option) any later version.
- *
- * Power*Architect is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
- */
-package ca.sqlpower.architect.ddl;
-
-import java.awt.event.ActionEvent;
-import java.awt.event.ActionListener;
-
-import javax.swing.JButton;
-
-public abstract class GenericDDLWarningComponent implements
DDLWarningComponent {
-
- private JButton quickFixButton = new JButton("Quick fix");
-
- private DDLWarning warning;
-
- public GenericDDLWarningComponent(final DDLWarning warning) {
- this.warning = warning;
-
- if (warning.isQuickFixable()) {
- quickFixButton.setToolTipText(warning.getQuickFixMessage());
- quickFixButton.addActionListener(new ActionListener() {
-
- public void actionPerformed(ActionEvent e) {
- boolean fixed = warning.quickFix();
- warning.setFixed(fixed);
- quickFixButton.setEnabled(false);
- }
- });
- } else {
- quickFixButton.setEnabled(false);
- }
- }
- public DDLWarning getWarning() {
- return warning;
- }
-
- public JButton getQuickFixButton() {
- return quickFixButton;
- }
-}
=======================================
---
/trunk/src/main/java/ca/sqlpower/architect/ddl/InvalidNameDDLWarning.java
Tue Apr 7 10:03:13 2009
+++ /dev/null
@@ -1,53 +0,0 @@
-/*
- * Copyright (c) 2008, SQL Power Group Inc.
- *
- * This file is part of Power*Architect.
- *
- * Power*Architect is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 3 of the License, or
- * (at your option) any later version.
- *
- * Power*Architect is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
- */
-package ca.sqlpower.architect.ddl;
-
-import java.util.List;
-
-import ca.sqlpower.sqlobject.SQLObject;
-
-/**
- * A DDLWarning for invalid name that can be fixed by calling setName() on
- * one of the involved objects
- */
-public class InvalidNameDDLWarning extends AbstractDDLWarning {
-
- protected String whatQuickFixShouldCallIt;
-
- public InvalidNameDDLWarning(String message,
- List<SQLObject> involvedObjects,
- String quickFixMesssage,
- SQLObject whichObjectQuickFixRenames,
- String whatQuickFixShouldCallIt)
- {
- super(involvedObjects,
- message,
- true,
- quickFixMesssage,
- whichObjectQuickFixRenames,
- "physicalName");
- this.whatQuickFixShouldCallIt = whatQuickFixShouldCallIt;
- }
-
- public boolean quickFix() {
- // XXX need differentiator for setName() vs setPhysicalName()
- whichObjectQuickFixFixes.setPhysicalName(whatQuickFixShouldCallIt);
- return true;
- }
-}
=======================================
---
/trunk/src/main/java/ca/sqlpower/architect/ddl/InvalidSeqNameDDLWarning.java
Thu Jan 29 12:02:55 2009
+++ /dev/null
@@ -1,56 +0,0 @@
-/*
- * Copyright (c) 2008, SQL Power Group Inc.
- *
- * This file is part of Power*Architect.
- *
- * Power*Architect is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 3 of the License, or
- * (at your option) any later version.
- *
- * Power*Architect is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
- */
-package ca.sqlpower.architect.ddl;
-
-import java.util.Arrays;
-
-import ca.sqlpower.sqlobject.SQLColumn;
-import ca.sqlpower.sqlobject.SQLObject;
-import ca.sqlpower.sqlobject.SQLSequence;
-
-/**
- * A DDLWarning for invalid name of a SQLSequence that can be
- * fixed by calling setName() on one of the involved objects.
- * It has a side effect of setting the given SQLColumn's
- * autoIncrementSequenceName as well.
- */
-public class InvalidSeqNameDDLWarning extends AbstractDDLWarning {
-
- protected String whatQuickFixShouldCallIt;
- private final SQLColumn col;
-
- public InvalidSeqNameDDLWarning(String message,
- SQLSequence seq, SQLColumn col,
- String quickFixMesssage,
- String whatQuickFixShouldCallIt)
- {
- super(Arrays.asList(new SQLObject[]{seq}),
- message, true, quickFixMesssage,
- seq, "name");
- this.col = col;
- this.whatQuickFixShouldCallIt = whatQuickFixShouldCallIt;
- }
-
- public boolean quickFix() {
- // XXX need differentiator for setName() vs setPhysicalName()
- whichObjectQuickFixFixes.setName(whatQuickFixShouldCallIt);
- col.setAutoIncrementSequenceName(whatQuickFixShouldCallIt);
- return true;
- }
-}
=======================================
---
/trunk/src/main/java/ca/sqlpower/architect/ddl/ObjectPropertyModificationDDLComponent.java
Thu Jan 29 12:02:55 2009
+++ /dev/null
@@ -1,142 +0,0 @@
-/*
- * Copyright (c) 2008, SQL Power Group Inc.
- *
- * This file is part of Power*Architect.
- *
- * Power*Architect is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 3 of the License, or
- * (at your option) any later version.
- *
- * Power*Architect is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
- */
-package ca.sqlpower.architect.ddl;
-
-import java.awt.event.ActionEvent;
-import java.awt.event.ActionListener;
-import java.lang.reflect.Method;
-import java.util.Hashtable;
-import java.util.List;
-import java.util.Map;
-
-import javax.swing.JButton;
-import javax.swing.JComponent;
-import javax.swing.JLabel;
-import javax.swing.JPanel;
-import javax.swing.JTextField;
-
-import org.apache.commons.beanutils.PropertyUtils;
-import org.apache.log4j.Logger;
-
-import ca.sqlpower.architect.swingui.Messages;
-import ca.sqlpower.sqlobject.SQLObject;
-
-/**
- * An instance of this class displays the warning message associated with
an
- * object's property, and allows user to actively modify the value of the
- * property to avoid possible SQL failures.
- * <p>
- * By default, if not specified by the warning. An instance would modify
the
- * name of the object.
- */
-public class ObjectPropertyModificationDDLComponent extends
GenericDDLWarningComponent {
-
- private static final Logger logger =
Logger.getLogger(ObjectPropertyModificationDDLComponent.class);
-
- /**
- * This DDL warning specifies the property to be modified by this
- * component.
- */
- private final DDLWarning warning;
-
- private String propertyName;
-
- private JComponent component;
-
- /**
- * List of text fields that correspond to the property of each
- * SQLObject in the list of involved objects for the warning
- * this component holds. The property is determined by the warning
- * type an instance of this class carries.
- */
- final Map<JTextField, SQLObject> textFields = new
Hashtable<JTextField, SQLObject>();
-
- private Runnable changeApplicator;
-
- public ObjectPropertyModificationDDLComponent(DDLWarning warning) {
- super(warning);
-
- logger.debug("Creating warning component for " + warning);
//$NON-NLS-1$
-
- this.warning = warning;
- propertyName = warning.getQuickFixPropertyName();
-
- this.changeApplicator = new Runnable() {
- public void run() {
- logger.debug("Now attempt to modify object property");
//$NON-NLS-1$
- for (Map.Entry<JTextField, SQLObject> entry :
textFields.entrySet()) {
- try {
- Method setter =
PropertyUtils.getWriteMethod(PropertyUtils.getPropertyDescriptor(entry.getValue(),
propertyName));
- setter.invoke(entry.getValue(),
entry.getKey().getText());
- } catch (Exception e) {
- throw new RuntimeException("Failed to update
property:" + propertyName + " on " + entry.getValue(), e); //$NON-NLS-1$
//$NON-NLS-2$
- }
- }
- }
- };
- component = new JPanel();
- if (propertyName != null) {
- JButton updateProperty = new
JButton(Messages.getString("ObjectPropertyModificationDDLComponent.UpdateProperty"));
//$NON-NLS-1$
- updateProperty.addActionListener(new ActionListener() {
- public void actionPerformed(ActionEvent e) {
- applyChanges();
- }
- });
- component.add(updateProperty);
- } else {
- component.add(getQuickFixButton());
- }
-
- component.add(new JLabel(warning.getMessage()));
-
- if (propertyName != null) {
- component.add(new
JLabel(Messages.getString("ObjectPropertyModificationDDLComponent.Change",
warning.getQuickFixPropertyName()))); //$NON-NLS-1$ //$NON-NLS-2$
- List<? extends SQLObject> list = warning.getInvolvedObjects();
- for (SQLObject obj : list) {
- JTextField jtf = new JTextField();
- jtf.setColumns(5);
- try {
- Method getter =
PropertyUtils.getReadMethod(PropertyUtils.getPropertyDescriptor(obj,
propertyName));
- jtf.setText((String)(getter.invoke(obj)));
- logger.debug("Successfully modified object's
property."); //$NON-NLS-1$
- } catch (Exception e) {
- throw new RuntimeException("Failed to update
property:" + propertyName + " on " + obj, e); //$NON-NLS-1$ //$NON-NLS-2$
- }
- component.add(jtf);
- textFields.put(jtf, obj);
- }
- }
- }
-
- public void applyChanges() {
- changeApplicator.run();
- }
-
- public Runnable getChangeApplicator() {
- return changeApplicator;
- }
-
- public JComponent getComponent() {
- return component;
- }
-
- public DDLWarning getWarning() {
- return warning;
- }
-}
=======================================
---
/trunk/src/main/java/ca/sqlpower/architect/ddl/RelationshipColumnsTypesMismatchDDLWarning.java
Thu Jan 29 12:02:55 2009
+++ /dev/null
@@ -1,48 +0,0 @@
-/*
- * Copyright (c) 2008, SQL Power Group Inc.
- *
- * This file is part of Power*Architect.
- *
- * Power*Architect is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 3 of the License, or
- * (at your option) any later version.
- *
- * Power*Architect is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
- */
-package ca.sqlpower.architect.ddl;
-
-import java.util.Arrays;
-
-import ca.sqlpower.sqlobject.SQLColumn;
-import ca.sqlpower.sqlobject.SQLObject;
-
-/**
- * A DDLWarning for when the types of two columns in a relationship do not
match.
- * There is no quick fix as simply changing one column type could
recursively
- * cause other errors, thus the relationship is just not created and the
relationship
- * sql statement is commented out.
- */
-public class RelationshipColumnsTypesMismatchDDLWarning extends
AbstractDDLWarning {
-
- /**
- * Creates a DDLWarning with a the given pk and fk columns as involved
objects
- * and a message identifying the error and the involved columns' names.
- * @param pkColumn The pk column that is involved in the types mismatch.
- * @param fkColumn The fk column that is involved in the types mismatch.
- */
- public RelationshipColumnsTypesMismatchDDLWarning(SQLColumn pkColumn,
- SQLColumn fkColumn) {
- super(Arrays.asList(new SQLObject[] {pkColumn, fkColumn}),
- "Column types mismatch in mapping for " +
- pkColumn.getName() + " to " + fkColumn.getName(),
- false, null, null, null);
- }
-}
-
=======================================
---
/trunk/src/main/java/ca/sqlpower/architect/ddl/RelationshipMapsNoColumnsDDLWarning.java
Thu Jan 29 12:02:55 2009
+++ /dev/null
@@ -1,37 +0,0 @@
-/*
- * Copyright (c) 2008, SQL Power Group Inc.
- *
- * This file is part of Power*Architect.
- *
- * Power*Architect is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 3 of the License, or
- * (at your option) any later version.
- *
- * Power*Architect is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
- */
-
-package ca.sqlpower.architect.ddl;
-
-import java.util.Arrays;
-
-import ca.sqlpower.sqlobject.SQLObject;
-import ca.sqlpower.sqlobject.SQLTable;
-
-/**
- * A DDL warning for when a relationship does not map any columns. There
is no
- * quick fix as the user will need to create columns.
- */
-public class RelationshipMapsNoColumnsDDLWarning extends
AbstractDDLWarning {
-
- public RelationshipMapsNoColumnsDDLWarning(SQLTable pkTable, SQLTable
fkTable) {
- super(Arrays.asList(new SQLObject[] { pkTable, fkTable }), "No
columns mapped in relationship between tables " +
- pkTable.getName() + " and " + fkTable.getName(), false,
null, null, null);
- }
-}
=======================================
---
/trunk/src/main/java/ca/sqlpower/architect/ddl/SetDefaultOnColumnWithNoDefaultWarning.java
Thu Jan 29 12:02:55 2009
+++ /dev/null
@@ -1,46 +0,0 @@
-/*
- * Copyright (c) 2008, SQL Power Group Inc.
- *
- * This file is part of Power*Architect.
- *
- * Power*Architect is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 3 of the License, or
- * (at your option) any later version.
- *
- * Power*Architect is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
- */
-
-package ca.sqlpower.architect.ddl;
-
-import java.util.Collections;
-
-import ca.sqlpower.sqlobject.SQLColumn;
-
-/**
- * A DDL warning about relationship update or delete rule that tries to
set default
- * on a column with no default value. Some database platforms consider
this an error,
- * and others ignore it. In either case, we treat it as a mistake in the
data model
- * that the user should rectify.
- * <p>
- * There is no quick fix for this one, because we can't guess what a
suitable default
- * value would be.
- */
-public class SetDefaultOnColumnWithNoDefaultWarning extends
AbstractDDLWarning {
-
- public SetDefaultOnColumnWithNoDefaultWarning(SQLColumn fkcol) {
- super(Collections.singletonList(fkcol),
- "SET DEFAULT action in relationship references column " +
fkcol.getName() + " with no default value",
- false,
- null,
- fkcol,
- "defaultValue");
- }
-
-}
=======================================
---
/trunk/src/main/java/ca/sqlpower/architect/ddl/SetNullOnNonNullableColumnWarning.java
Thu Jan 29 12:02:55 2009
+++ /dev/null
@@ -1,56 +0,0 @@
-/*
- * Copyright (c) 2008, SQL Power Group Inc.
- *
- * This file is part of Power*Architect.
- *
- * Power*Architect is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 3 of the License, or
- * (at your option) any later version.
- *
- * Power*Architect is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
- */
-
-package ca.sqlpower.architect.ddl;
-
-import java.sql.DatabaseMetaData;
-import java.util.Collections;
-
-import ca.sqlpower.sqlobject.SQLColumn;
-
-/**
- * A DDL warning about relationship update or delete rule that tries to
set a
- * non-nullable column to null. Some database platforms consider this an
error,
- * and others ignore it. In either case, we treat it as a mistake in the
data
- * model that the user should rectify.
- */
-public class SetNullOnNonNullableColumnWarning extends AbstractDDLWarning {
-
- /**
- * The column this warning pertains to.
- */
- private final SQLColumn fkcol;
-
- public SetNullOnNonNullableColumnWarning(SQLColumn fkcol) {
- super(Collections.singletonList(fkcol),
- "SET NULL action in relationship references non-nullable
column " + fkcol.getName(),
- true,
- "Make " + fkcol.getName() + " nullable",
- fkcol,
- null);
- this.fkcol = fkcol;
- }
-
- @Override
- public boolean quickFix() {
- fkcol.setNullable(DatabaseMetaData.columnNullable);
- return true; // XXX meaning of returned value not documented in
interface
- }
-
-}
=======================================
--- /trunk/src/main/java/ca/sqlpower/architect/ddl/TypeMapDDLWarning.java
Thu Jan 29 12:02:55 2009
+++ /dev/null
@@ -1,54 +0,0 @@
-/*
- * Copyright (c) 2008, SQL Power Group Inc.
- *
- * This file is part of Power*Architect.
- *
- * Power*Architect is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 3 of the License, or
- * (at your option) any later version.
- *
- * Power*Architect is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
- */
-package ca.sqlpower.architect.ddl;
-
-import java.util.Arrays;
-
-import ca.sqlpower.sqlobject.SQLColumn;
-import ca.sqlpower.sqlobject.SQLObject;
-
-/**
- * A class of warning that means some column's data type cannot be
- * accurately represented in the target database.
- */
-public class TypeMapDDLWarning extends AbstractDDLWarning {
-
- /**
- * Creates a new warning about type mapping problems which have
already been
- * resolved.
- * <p>
- * XXX: This is inconsistent with the current QuickFix system; we
should
- * instead mark this problem as quickfixable and only when quickFix()
is called
- * should the column's type be updated.
- *
- * @param column The column whose type had to be modified.
- * @param message The message to display to the user about this
problem.
- * @param oldType The original generic data type that the column had.
- * @param td The new data type that the column will have in the target
database.
- */
- public TypeMapDDLWarning(
- SQLColumn column,
- String message,
- GenericTypeDescriptor oldType,
- GenericTypeDescriptor td) {
- super(Arrays.asList(new SQLObject[] { column }), message, false,
null, null, null);
- // TODO do something to hook in the old type and new type with the
quickfix system
- }
-
-}
=======================================
---
/trunk/src/main/java/ca/sqlpower/architect/ddl/UnsupportedFeatureDDLWarning.java
Thu Jan 29 12:02:55 2009
+++ /dev/null
@@ -1,49 +0,0 @@
-/*
- * Copyright (c) 2008, SQL Power Group Inc.
- *
- * This file is part of Power*Architect.
- *
- * Power*Architect is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 3 of the License, or
- * (at your option) any later version.
- *
- * Power*Architect is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
- */
-
-package ca.sqlpower.architect.ddl;
-
-import java.util.Arrays;
-
-import ca.sqlpower.sqlobject.SQLObject;
-
-/**
- * A warning class to let the user know their data model cannot be
faithfully
- * represented in the target database due to feature limitations. For
example,
- * SQL Server doesn't support deferrable constraints and Oracle doesn't
support
- * auto-increment columns.
- * <p>
- * Warnings of this type are not quick-fixable, and should be considered
non-fatal.
- * To that end, instances of this class will always claim that they are
already fixed.
- */
-public class UnsupportedFeatureDDLWarning extends AbstractDDLWarning {
-
- /**
- * Creates a new warning about a feature of the data model that is not
supported
- * in the target platform.
- *
- * @param involvedObjects The object or objects that would need
features not available
- * in the target database.
- * @param message The message to show the user which explains the
limitation.
- */
- public UnsupportedFeatureDDLWarning(String message, SQLObject ...
involvedObjects) {
- super(Arrays.asList(involvedObjects), message, false, null, null,
null);
- setFixed(true);
- }
-}