Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPaul Fullbright2013-05-24 17:44:25 +0000
committerPaul Fullbright2013-05-24 17:44:25 +0000
commit121a58a84f4c5d0a3b791e283ca3f4a7d00bd70e (patch)
tree70b856762359e1d54f6c72ee14fefac294ef4b1c
parent48cfd417c0803315180ab010cebdf4ebd6a8cdb1 (diff)
downloadwebtools.dali-121a58a84f4c5d0a3b791e283ca3f4a7d00bd70e.tar.gz
webtools.dali-121a58a84f4c5d0a3b791e283ca3f4a7d00bd70e.tar.xz
webtools.dali-121a58a84f4c5d0a3b791e283ca3f4a7d00bd70e.zip
Changed default table validator to check for db table existence (Bugv201305242055
408900)
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/AbstractNamedColumnValidator.java27
1 files changed, 22 insertions, 5 deletions
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/AbstractNamedColumnValidator.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/AbstractNamedColumnValidator.java
index 35d1fb8615..8bd462640c 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/AbstractNamedColumnValidator.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/AbstractNamedColumnValidator.java
@@ -10,7 +10,7 @@
package org.eclipse.jpt.jpa.core.internal.jpa1.context;
import java.util.List;
-
+import org.eclipse.jpt.common.core.internal.utility.ValidationMessageTools;
import org.eclipse.jpt.common.core.utility.TextRange;
import org.eclipse.jpt.common.core.utility.ValidationMessage;
import org.eclipse.jpt.common.utility.internal.ObjectTools;
@@ -18,8 +18,6 @@ import org.eclipse.jpt.jpa.core.context.NamedColumn;
import org.eclipse.jpt.jpa.core.context.PersistentAttribute;
import org.eclipse.jpt.jpa.core.context.TableColumn;
import org.eclipse.jpt.jpa.core.internal.context.JpaValidator;
-import org.eclipse.jpt.jpa.core.internal.context.NullJpaValidator;
-import org.eclipse.jpt.common.core.internal.utility.ValidationMessageTools;
import org.eclipse.jpt.jpa.core.validation.JptJpaCoreValidationMessages;
import org.eclipse.jpt.jpa.db.Table;
import org.eclipse.wst.validation.internal.provisional.core.IMessage;
@@ -66,7 +64,7 @@ public abstract class AbstractNamedColumnValidator<C extends NamedColumn>
}
protected JpaValidator buildTableValidator() {
- return NullJpaValidator.instance();
+ return new ExistenceTableValidator();
}
public final boolean validate(List<IMessage> messages, IReporter reporter) {
@@ -149,7 +147,26 @@ public abstract class AbstractNamedColumnValidator<C extends NamedColumn>
}
}
}
-
+
+
+ // ***** existence table validator *****
+
+ /**
+ * Simply checks if the db table exists. If it doesn't then will return false,
+ * effectively short-circuiting the column validation.
+ * The default table validator.
+ */
+ protected class ExistenceTableValidator
+ implements JpaValidator {
+
+ protected ExistenceTableValidator() {
+ super();
+ }
+
+ public boolean validate(List<IMessage> messages, IReporter reporter) {
+ return AbstractNamedColumnValidator.this.column.getDbTable() != null;
+ }
+ }
// ********** base column table validator **********

Back to the top