Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorkmoore2010-09-01 16:51:22 -0400
committerkmoore2010-09-01 16:51:22 -0400
commit52cc1cba8b816086b6e4b8c7940bf7c6362cc3fb (patch)
tree6171d6718a9e1d87f4e18e255b05db2d86417788
parent9f0829f69e7f044c0d1d0d7379b3194a7d743d35 (diff)
downloadwebtools.dali-52cc1cba8b816086b6e4b8c7940bf7c6362cc3fb.tar.gz
webtools.dali-52cc1cba8b816086b6e4b8c7940bf7c6362cc3fb.tar.xz
webtools.dali-52cc1cba8b816086b6e4b8c7940bf7c6362cc3fb.zip
refactored column validation
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/context/AssociationOverride.java26
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/context/AssociationOverrideContainer.java23
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/context/BaseColumn.java12
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/context/BaseJoinColumn.java21
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/context/BaseOverride.java17
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/context/NamedColumn.java12
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/context/OverrideContainer.java18
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/BaseColumnTextRangeResolver.java21
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/BaseJoinColumnTextRangeResolver.java21
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/JoinColumnTextRangeResolver.java24
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/NamedColumnTextRangeResolver.java21
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/PersistentAttributeTextRangeResolver.java2
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/AbstractJavaBaseColumn.java24
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/AbstractJavaBaseEmbeddedMapping.java59
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/AbstractJavaBasicMapping.java32
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/AbstractJavaEntity.java214
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/AbstractJavaIdMapping.java32
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/AbstractJavaJoinColumnInRelationshipMappingJoiningStrategy.java63
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/AbstractJavaMultiRelationshipMapping.java75
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/AbstractJavaNamedColumn.java15
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/AbstractJavaVersionMapping.java32
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/GenericJavaJoinColumnInAssociationOverrideJoiningStrategy.java24
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/GenericJavaPrimaryKeyJoinColumnJoiningStrategy.java20
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/JavaBaseColumnTextRangeResolver.java34
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/JavaJoinColumnTextRangeResolver.java42
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/JavaNamedColumnTextRangeResolver.java37
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/JavaPrimaryKeyJoinColumnTextRangeResolver.java36
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/AbstractOrmBaseColumn.java24
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/AbstractOrmBaseEmbeddedMapping.java96
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/AbstractOrmBasicMapping.java62
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/AbstractOrmEntity.java211
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/AbstractOrmIdMapping.java60
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/AbstractOrmJoinColumnInRelationshipMappingJoiningStrategy.java135
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/AbstractOrmMultiRelationshipMapping.java148
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/AbstractOrmNamedColumn.java16
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/AbstractOrmVersionMapping.java62
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/GenericOrmJoinColumnInAssociationOverrideJoiningStrategy.java24
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/GenericOrmPrimaryKeyJoinColumnJoiningStrategy.java20
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/OrmBaseColumnTextRangeResolver.java34
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/OrmJoinColumnTextRangeResolver.java41
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/OrmNamedColumnTextRangeResolver.java33
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/OrmPrimaryKeyJoinColumnTextRangeResolver.java35
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/AbstractNamedColumnValidator.java150
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/AssociationOverrideJoinColumnValidator.java235
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/AttributeOverrideColumnValidator.java134
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/BaseColumnTableValidator.java119
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/BaseJoinColumnValidator.java172
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/CollectionTableTableDescriptionProvider.java12
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/DiscriminatorColumnValidator.java34
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/EntityTableDescriptionProvider.java12
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/InverseJoinColumnValidator.java110
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/JoinColumnValidator.java110
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/JoinTableTableDescriptionProvider.java12
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/JoiningStrategyTableDescriptionProvider.java20
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/MapKeyAttributeOverrideColumnValidator.java76
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/MapKeyColumnValidator.java82
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/NamedColumnValidator.java61
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/PrimaryKeyJoinColumnValidator.java91
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/SecondaryTablePrimaryKeyJoinColumnValidator.java112
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/java/GenericJavaAssociationOverrideContainer.java25
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/java/GenericJavaAttributeOverride.java12
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/java/GenericJavaAttributeOverrideContainer.java11
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/java/GenericJavaEmbeddedMapping.java133
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/java/GenericJavaJoinColumn.java47
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/java/GenericJavaJoinTable.java122
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/java/GenericJavaOrderable.java14
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/java/GenericJavaPrimaryKeyJoinColumn.java49
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/java/GenericJavaSecondaryTable.java63
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/orm/GenericOrmAssociationOverrideContainer.java24
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/orm/GenericOrmAttributeOverride.java12
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/orm/GenericOrmAttributeOverrideContainer.java11
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/orm/GenericOrmEmbeddedMapping.java219
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/orm/GenericOrmJoinColumn.java52
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/orm/GenericOrmJoinTable.java253
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/orm/GenericOrmOrderable.java36
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/orm/GenericOrmPrimaryKeyJoinColumn.java51
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/orm/GenericOrmSecondaryTable.java115
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/context/OrderColumnValidator.java43
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/context/java/AbstractJavaElementCollectionMapping2_0.java292
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/context/java/GenericJavaCollectionTable2_0.java63
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/context/orm/AbstractOrmElementCollectionMapping2_0.java518
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/context/orm/GenericOrmCollectionTable2_0.java139
82 files changed, 2315 insertions, 3489 deletions
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/context/AssociationOverride.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/context/AssociationOverride.java
index 51aefb7a70..11b83e0c88 100644
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/context/AssociationOverride.java
+++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/context/AssociationOverride.java
@@ -9,9 +9,6 @@
******************************************************************************/
package org.eclipse.jpt.core.context;
-import org.eclipse.jpt.core.utility.TextRange;
-import org.eclipse.wst.validation.internal.provisional.core.IMessage;
-
/**
*
*
@@ -21,7 +18,7 @@ import org.eclipse.wst.validation.internal.provisional.core.IMessage;
* pioneering adopters on the understanding that any code that uses this API
* will almost certainly be broken (repeatedly) as the API evolves.
*
- * @version 2.3
+ * @version 3.0
* @since 2.0
*/
public interface AssociationOverride
@@ -43,26 +40,5 @@ public interface AssociationOverride
* will be found in the mapped superclass, not in the owning entity
*/
RelationshipMapping getRelationshipMapping(String attributeName);
-
-
- /**
- * Return a validation message for the join column referenced column name
- * not resolving to the table. The given text range is for the referenced
- * column name if it is specified or for the relevant owning object.
- */
- IMessage buildColumnUnresolvedReferencedColumnNameMessage(AssociationOverride override, BaseJoinColumn column, TextRange textRange);
-
- /**
- * Return a validation message for multiple join columns and the name
- * is unspecified on the given join column. Use the given text range in the message.
- */
- IMessage buildUnspecifiedNameMultipleJoinColumnsMessage(AssociationOverride override, BaseJoinColumn column, TextRange textRange);
-
- /**
- * Return a validation message for multiple join columns and the
- * referenced column name is unspecified on the given join column.
- * Use the given text range in the message.
- */
- IMessage buildUnspecifiedReferencedColumnNameMultipleJoinColumnsMessage(AssociationOverride override, BaseJoinColumn column, TextRange textRange);
}
} \ No newline at end of file
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/context/AssociationOverrideContainer.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/context/AssociationOverrideContainer.java
index a8f9030c69..2910f46f20 100644
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/context/AssociationOverrideContainer.java
+++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/context/AssociationOverrideContainer.java
@@ -10,8 +10,6 @@
package org.eclipse.jpt.core.context;
import java.util.ListIterator;
-import org.eclipse.jpt.core.utility.TextRange;
-import org.eclipse.wst.validation.internal.provisional.core.IMessage;
/**
* Provisional API: This interface is part of an interim API that is still
@@ -20,7 +18,7 @@ import org.eclipse.wst.validation.internal.provisional.core.IMessage;
* pioneering adopters on the understanding that any code that uses this API
* will almost certainly be broken (repeatedly) as the API evolves.
*
- * @version 2.3
+ * @version 3.0
* @since 2.3
*/
public interface AssociationOverrideContainer
@@ -81,25 +79,6 @@ public interface AssociationOverrideContainer
{
RelationshipReference resolveRelationshipReference(String associationOverrideName);
-
- /**
- * Return a validation message for the join column's referenced column name not resolving on the
- * table either specified or default. Use the given text range in the message
- */
- IMessage buildColumnUnresolvedReferencedColumnNameMessage(AssociationOverride override, BaseJoinColumn column, TextRange textRange);
-
- /**
- * Return a validation message for multiple join columns and the name
- * is unspecified on the given join column. Use the given text range in the message.
- */
- IMessage buildUnspecifiedNameMultipleJoinColumnsMessage(AssociationOverride override, BaseJoinColumn column, TextRange textRange);
-
- /**
- * Return a validation message for multiple join columns and the
- * referenced column name is unspecified on the given join column.
- * Use the given text range in the message.
- */
- IMessage buildUnspecifiedReferencedColumnNameMultipleJoinColumnsMessage(AssociationOverride override, BaseJoinColumn column, TextRange textRange);
}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/context/BaseColumn.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/context/BaseColumn.java
index 057248addd..4a2d3f5574 100644
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/context/BaseColumn.java
+++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/context/BaseColumn.java
@@ -10,8 +10,6 @@
package org.eclipse.jpt.core.context;
import java.util.Iterator;
-import org.eclipse.jpt.core.utility.TextRange;
-import org.eclipse.wst.validation.internal.provisional.core.IMessage;
/**
*
@@ -22,7 +20,7 @@ import org.eclipse.wst.validation.internal.provisional.core.IMessage;
* pioneering adopters on the understanding that any code that uses this API
* will almost certainly be broken (repeatedly) as the API evolves.
*
- * @version 2.3
+ * @version 3.0
* @since 2.0
*/
public interface BaseColumn
@@ -105,13 +103,5 @@ public interface BaseColumn
* Return a list of table names that are valid for this column
*/
Iterator<String> candidateTableNames();
-
- /**
- * Return a validation message for when the specified table is not valid in this context.
- * An example is a basic mapping column where a table is specified that is
- * not included as table or secondary tables of the owning entity.
- */
- IMessage buildTableNotValidMessage(BaseColumn column, TextRange textRange);
-
}
}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/context/BaseJoinColumn.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/context/BaseJoinColumn.java
index 7481041ab1..590f8eca9c 100644
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/context/BaseJoinColumn.java
+++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/context/BaseJoinColumn.java
@@ -9,10 +9,8 @@
******************************************************************************/
package org.eclipse.jpt.core.context;
-import org.eclipse.jpt.core.utility.TextRange;
import org.eclipse.jpt.db.Column;
import org.eclipse.jpt.db.Table;
-import org.eclipse.wst.validation.internal.provisional.core.IMessage;
/**
*
@@ -23,7 +21,7 @@ import org.eclipse.wst.validation.internal.provisional.core.IMessage;
* pioneering adopters on the understanding that any code that uses this API
* will almost certainly be broken (repeatedly) as the API evolves.
*
- * @version 2.3
+ * @version 3.0
* @since 2.0
*/
public interface BaseJoinColumn
@@ -67,22 +65,5 @@ public interface BaseJoinColumn
* return the size of the joinColumns collection this join column is a part of
*/
int joinColumnsSize();
-
- /**
- * On a virtual object validation message for when the column name does not resolve on the table
- */
- IMessage buildUnresolvedReferencedColumnNameMessage(BaseJoinColumn column, TextRange textRange);
-
- /**
- * Validation message for when multiple join columns exist and the
- * name is not specified and the owner is virtual
- */
- IMessage buildUnspecifiedNameMultipleJoinColumnsMessage(BaseJoinColumn column, TextRange textRange);
-
- /**
- * Validation message for when multiple join columns exist and the
- * referenced column name is not specified and the owner is virtual
- */
- IMessage buildUnspecifiedReferencedColumnNameMultipleJoinColumnsMessage(BaseJoinColumn column, TextRange textRange);
}
}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/context/BaseOverride.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/context/BaseOverride.java
index 3963a1fbb6..d6264bd428 100644
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/context/BaseOverride.java
+++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/context/BaseOverride.java
@@ -10,9 +10,9 @@
package org.eclipse.jpt.core.context;
import java.util.Iterator;
-import org.eclipse.jpt.core.utility.TextRange;
+import org.eclipse.jpt.core.internal.context.BaseColumnTextRangeResolver;
+import org.eclipse.jpt.core.internal.context.JptValidator;
import org.eclipse.jpt.db.Table;
-import org.eclipse.wst.validation.internal.provisional.core.IMessage;
/**
*
@@ -23,7 +23,7 @@ import org.eclipse.wst.validation.internal.provisional.core.IMessage;
* pioneering adopters on the understanding that any code that uses this API
* will almost certainly be broken (repeatedly) as the API evolves.
*
- * @version 2.3
+ * @version 3.0
* @since 2.0
*/
public interface BaseOverride
@@ -97,15 +97,6 @@ public interface BaseOverride
*/
String getDefaultTableName();
- /**
- *
- */
- IMessage buildColumnTableNotValidMessage(BaseOverride override, BaseColumn column, TextRange textRange);
-
- /**
- * Return a validation message for the column's name not resolving on the
- * table either specified or default. Use the given text range in the message
- */
- IMessage buildColumnUnresolvedNameMessage(BaseOverride override, NamedColumn column, TextRange textRange);
+ JptValidator buildColumnValidator(BaseOverride override, BaseColumn column, BaseColumn.Owner owner, BaseColumnTextRangeResolver textRangeResolver);
}
} \ No newline at end of file
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/context/NamedColumn.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/context/NamedColumn.java
index 67cb0419e7..61bf3a6967 100644
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/context/NamedColumn.java
+++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/context/NamedColumn.java
@@ -9,10 +9,10 @@
******************************************************************************/
package org.eclipse.jpt.core.context;
-import org.eclipse.jpt.core.utility.TextRange;
+import org.eclipse.jpt.core.internal.context.JptValidator;
+import org.eclipse.jpt.core.internal.context.NamedColumnTextRangeResolver;
import org.eclipse.jpt.db.Column;
import org.eclipse.jpt.db.Table;
-import org.eclipse.wst.validation.internal.provisional.core.IMessage;
/**
*
@@ -23,7 +23,7 @@ import org.eclipse.wst.validation.internal.provisional.core.IMessage;
* pioneering adopters on the understanding that any code that uses this API
* will almost certainly be broken (repeatedly) as the API evolves.
*
- * @version 2.3
+ * @version 3.0
* @since 2.0
*/
public interface NamedColumn
@@ -90,10 +90,6 @@ public interface NamedColumn
*/
String getDefaultColumnName();
- /**
- * Return a validation message for the column's name not resolving on the
- * table either specified or default. Use the given text range in the message
- */
- IMessage buildUnresolvedNameMessage(NamedColumn column, TextRange textRange);
+ JptValidator buildColumnValidator(NamedColumn column, NamedColumnTextRangeResolver textRangeResolver);
}
}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/context/OverrideContainer.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/context/OverrideContainer.java
index 947346a3d8..4b92020982 100644
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/context/OverrideContainer.java
+++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/context/OverrideContainer.java
@@ -10,8 +10,8 @@
package org.eclipse.jpt.core.context;
import java.util.Iterator;
-import org.eclipse.jpt.core.utility.TextRange;
-import org.eclipse.wst.validation.internal.provisional.core.IMessage;
+import org.eclipse.jpt.core.internal.context.BaseColumnTextRangeResolver;
+import org.eclipse.jpt.core.internal.context.JptValidator;
/**
* Provisional API: This interface is part of an interim API that is still
@@ -20,7 +20,7 @@ import org.eclipse.wst.validation.internal.provisional.core.IMessage;
* pioneering adopters on the understanding that any code that uses this API
* will almost certainly be broken (repeatedly) as the API evolves.
*
- * @version 2.3
+ * @version 3.0
* @since 2.3
*/
public interface OverrideContainer
@@ -73,17 +73,7 @@ public interface OverrideContainer
*/
Iterator<String> candidateTableNames();
- /**
- * Return a validation message for the column's table not being valid in the context.
- * Use the given text range in the message
- */
- IMessage buildColumnTableNotValidMessage(BaseOverride override, BaseColumn column, TextRange textRange);
-
- /**
- * Return a validation message for the column's name not resolving on the
- * table either specified or default. Use the given text range in the message
- */
- IMessage buildColumnUnresolvedNameMessage(BaseOverride override, NamedColumn column, TextRange textRange);
+ JptValidator buildColumnValidator(BaseOverride override, BaseColumn column, BaseColumn.Owner columnOwner, BaseColumnTextRangeResolver textRangeResolver);
}
}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/BaseColumnTextRangeResolver.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/BaseColumnTextRangeResolver.java
new file mode 100644
index 0000000000..e00ff01f66
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/BaseColumnTextRangeResolver.java
@@ -0,0 +1,21 @@
+/*******************************************************************************
+ * Copyright (c) 2010 Oracle.
+ * All rights reserved. This program and the accompanying materials are
+ * made available under the terms of the Eclipse Public License v1.0 which
+ * accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.jpt.core.internal.context;
+
+import org.eclipse.jpt.core.utility.TextRange;
+
+/**
+ * Interface to resolve text ranges on named columns
+ */
+public interface BaseColumnTextRangeResolver extends NamedColumnTextRangeResolver
+{
+ TextRange getTableTextRange();
+}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/BaseJoinColumnTextRangeResolver.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/BaseJoinColumnTextRangeResolver.java
new file mode 100644
index 0000000000..1fad1cdf83
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/BaseJoinColumnTextRangeResolver.java
@@ -0,0 +1,21 @@
+/*******************************************************************************
+ * Copyright (c) 2010 Oracle.
+ * All rights reserved. This program and the accompanying materials are
+ * made available under the terms of the Eclipse Public License v1.0 which
+ * accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.jpt.core.internal.context;
+
+import org.eclipse.jpt.core.utility.TextRange;
+
+/**
+ * Interface to resolve text ranges on join columns
+ */
+public interface BaseJoinColumnTextRangeResolver extends NamedColumnTextRangeResolver
+{
+ TextRange getReferencedColumnNameTextRange();
+}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/JoinColumnTextRangeResolver.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/JoinColumnTextRangeResolver.java
new file mode 100644
index 0000000000..e7bfae421c
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/JoinColumnTextRangeResolver.java
@@ -0,0 +1,24 @@
+/*******************************************************************************
+ * Copyright (c) 2010 Oracle.
+ * All rights reserved. This program and the accompanying materials are
+ * made available under the terms of the Eclipse Public License v1.0 which
+ * accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.jpt.core.internal.context;
+
+import org.eclipse.jpt.core.utility.TextRange;
+
+/**
+ * Interface to resolve text ranges on join columns
+ */
+public interface JoinColumnTextRangeResolver
+ extends
+ BaseJoinColumnTextRangeResolver,
+ BaseColumnTextRangeResolver
+{
+ TextRange getReferencedColumnNameTextRange();
+}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/NamedColumnTextRangeResolver.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/NamedColumnTextRangeResolver.java
new file mode 100644
index 0000000000..286c6d7e2a
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/NamedColumnTextRangeResolver.java
@@ -0,0 +1,21 @@
+/*******************************************************************************
+ * Copyright (c) 2010 Oracle.
+ * All rights reserved. This program and the accompanying materials are
+ * made available under the terms of the Eclipse Public License v1.0 which
+ * accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.jpt.core.internal.context;
+
+import org.eclipse.jpt.core.utility.TextRange;
+
+/**
+ * Interface to resolve text ranges on named columns
+ */
+public interface NamedColumnTextRangeResolver
+{
+ TextRange getNameTextRange();
+}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/PersistentAttributeTextRangeResolver.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/PersistentAttributeTextRangeResolver.java
index d8cd272018..bd2a663dc0 100644
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/PersistentAttributeTextRangeResolver.java
+++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/PersistentAttributeTextRangeResolver.java
@@ -13,7 +13,7 @@ package org.eclipse.jpt.core.internal.context;
import org.eclipse.jpt.core.utility.TextRange;
/**
- * Interface to resolve text ranges on persistent type mappings that can define primary keys
+ * Interface to resolve text ranges on persistent attributes
*/
public interface PersistentAttributeTextRangeResolver
{
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/AbstractJavaBaseColumn.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/AbstractJavaBaseColumn.java
index 4557566d07..cae35d5535 100644
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/AbstractJavaBaseColumn.java
+++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/AbstractJavaBaseColumn.java
@@ -10,18 +10,16 @@
package org.eclipse.jpt.core.internal.context.java;
import java.util.Iterator;
-import java.util.List;
import org.eclipse.jdt.core.dom.CompilationUnit;
import org.eclipse.jpt.core.context.BaseColumn;
import org.eclipse.jpt.core.context.java.JavaBaseColumn;
import org.eclipse.jpt.core.context.java.JavaJpaContextNode;
+import org.eclipse.jpt.core.internal.context.NamedColumnTextRangeResolver;
import org.eclipse.jpt.core.resource.java.BaseColumnAnnotation;
import org.eclipse.jpt.core.utility.TextRange;
import org.eclipse.jpt.utility.Filter;
import org.eclipse.jpt.utility.internal.StringTools;
import org.eclipse.jpt.utility.internal.iterators.FilteringIterator;
-import org.eclipse.wst.validation.internal.provisional.core.IMessage;
-import org.eclipse.wst.validation.internal.provisional.core.IReporter;
public abstract class AbstractJavaBaseColumn<T extends BaseColumnAnnotation> extends AbstractJavaNamedColumn<T>
implements JavaBaseColumn
@@ -305,24 +303,8 @@ public abstract class AbstractJavaBaseColumn<T extends BaseColumnAnnotation> ext
return this.getOwner().getDefaultTableName();
}
-
- // ****************** validation ****************
-
@Override
- public void validate(List<IMessage> messages, IReporter reporter, CompilationUnit astRoot) {
- if (this.validateTable(messages, astRoot)) {
- super.validate(messages, reporter, astRoot);
- }
- }
-
- /**
- * Return true if the table is valid and no messages are logged
- */
- protected boolean validateTable(List<IMessage> messages, CompilationUnit astRoot) {
- if (this.tableNameIsInvalid()) {
- messages.add(this.getOwner().buildTableNotValidMessage(this, this.getTableTextRange(astRoot)));
- return false;
- }
- return true;
+ protected NamedColumnTextRangeResolver buildTextRangeResolver(CompilationUnit astRoot) {
+ return new JavaBaseColumnTextRangeResolver(this, astRoot);
}
}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/AbstractJavaBaseEmbeddedMapping.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/AbstractJavaBaseEmbeddedMapping.java
index e50c6e21b5..9aaf1d6a49 100644
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/AbstractJavaBaseEmbeddedMapping.java
+++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/AbstractJavaBaseEmbeddedMapping.java
@@ -19,14 +19,16 @@ import org.eclipse.jpt.core.context.BaseColumn;
import org.eclipse.jpt.core.context.BaseOverride;
import org.eclipse.jpt.core.context.Column;
import org.eclipse.jpt.core.context.Embeddable;
-import org.eclipse.jpt.core.context.NamedColumn;
import org.eclipse.jpt.core.context.TypeMapping;
import org.eclipse.jpt.core.context.java.JavaAttributeOverrideContainer;
import org.eclipse.jpt.core.context.java.JavaBaseEmbeddedMapping;
import org.eclipse.jpt.core.context.java.JavaPersistentAttribute;
+import org.eclipse.jpt.core.internal.context.BaseColumnTextRangeResolver;
+import org.eclipse.jpt.core.internal.context.JptValidator;
import org.eclipse.jpt.core.internal.context.MappingTools;
+import org.eclipse.jpt.core.internal.jpa1.context.AttributeOverrideColumnValidator;
+import org.eclipse.jpt.core.internal.jpa1.context.EntityTableDescriptionProvider;
import org.eclipse.jpt.core.internal.validation.DefaultJpaValidationMessages;
-import org.eclipse.jpt.core.internal.validation.JpaValidationDescriptionMessages;
import org.eclipse.jpt.core.internal.validation.JpaValidationMessages;
import org.eclipse.jpt.core.resource.java.Annotation;
import org.eclipse.jpt.core.resource.java.JPA;
@@ -288,57 +290,8 @@ public abstract class AbstractJavaBaseEmbeddedMapping<T extends Annotation>
return AbstractJavaBaseEmbeddedMapping.this.getValidationTextRange(astRoot);
}
- public IMessage buildColumnTableNotValidMessage(BaseOverride override, BaseColumn column, TextRange textRange) {
- if (override.isVirtual()) {
- return this.buildVirtualColumnTableNotValidMessage(override.getName(), column, textRange);
- }
- return DefaultJpaValidationMessages.buildMessage(
- IMessage.HIGH_SEVERITY,
- JpaValidationMessages.COLUMN_TABLE_NOT_VALID,
- new String[] {
- column.getTable(),
- column.getName(),
- JpaValidationDescriptionMessages.NOT_VALID_FOR_THIS_ENTITY},
- column,
- textRange
- );
- }
-
- protected IMessage buildVirtualColumnTableNotValidMessage(String overrideName, BaseColumn column, TextRange textRange) {
- return DefaultJpaValidationMessages.buildMessage(
- IMessage.HIGH_SEVERITY,
- JpaValidationMessages.VIRTUAL_ATTRIBUTE_OVERRIDE_COLUMN_TABLE_NOT_VALID,
- new String[] {
- overrideName,
- column.getTable(),
- column.getName(),
- JpaValidationDescriptionMessages.NOT_VALID_FOR_THIS_ENTITY},
- column,
- textRange
- );
- }
-
- public IMessage buildColumnUnresolvedNameMessage(BaseOverride override, NamedColumn column, TextRange textRange) {
- if (override.isVirtual()) {
- return this.buildVirtualColumnUnresolvedNameMessage(override.getName(), column, textRange);
- }
- return DefaultJpaValidationMessages.buildMessage(
- IMessage.HIGH_SEVERITY,
- JpaValidationMessages.COLUMN_UNRESOLVED_NAME,
- new String[] {column.getName(), column.getDbTable().getName()},
- column,
- textRange
- );
- }
-
- protected IMessage buildVirtualColumnUnresolvedNameMessage(String overrideName, NamedColumn column, TextRange textRange) {
- return DefaultJpaValidationMessages.buildMessage(
- IMessage.HIGH_SEVERITY,
- JpaValidationMessages.VIRTUAL_ATTRIBUTE_OVERRIDE_COLUMN_UNRESOLVED_NAME,
- new String[] {overrideName, column.getName(), column.getDbTable().getName()},
- column,
- textRange
- );
+ public JptValidator buildColumnValidator(BaseOverride override, BaseColumn column, BaseColumn.Owner owner, BaseColumnTextRangeResolver textRangeResolver) {
+ return new AttributeOverrideColumnValidator((AttributeOverride) override, column, textRangeResolver, new EntityTableDescriptionProvider());
}
}
}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/AbstractJavaBasicMapping.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/AbstractJavaBasicMapping.java
index a0d62b63c1..3e27e83e3a 100644
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/AbstractJavaBasicMapping.java
+++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/AbstractJavaBasicMapping.java
@@ -25,16 +25,17 @@ import org.eclipse.jpt.core.context.java.JavaBasicMapping;
import org.eclipse.jpt.core.context.java.JavaColumn;
import org.eclipse.jpt.core.context.java.JavaConverter;
import org.eclipse.jpt.core.context.java.JavaPersistentAttribute;
-import org.eclipse.jpt.core.internal.validation.DefaultJpaValidationMessages;
-import org.eclipse.jpt.core.internal.validation.JpaValidationDescriptionMessages;
-import org.eclipse.jpt.core.internal.validation.JpaValidationMessages;
+import org.eclipse.jpt.core.internal.context.BaseColumnTextRangeResolver;
+import org.eclipse.jpt.core.internal.context.JptValidator;
+import org.eclipse.jpt.core.internal.context.NamedColumnTextRangeResolver;
+import org.eclipse.jpt.core.internal.jpa1.context.EntityTableDescriptionProvider;
+import org.eclipse.jpt.core.internal.jpa1.context.NamedColumnValidator;
import org.eclipse.jpt.core.resource.java.BasicAnnotation;
import org.eclipse.jpt.core.resource.java.ColumnAnnotation;
import org.eclipse.jpt.core.resource.java.EnumeratedAnnotation;
import org.eclipse.jpt.core.resource.java.JPA;
import org.eclipse.jpt.core.resource.java.LobAnnotation;
import org.eclipse.jpt.core.resource.java.TemporalAnnotation;
-import org.eclipse.jpt.core.utility.TextRange;
import org.eclipse.jpt.utility.Filter;
import org.eclipse.wst.validation.internal.provisional.core.IMessage;
import org.eclipse.wst.validation.internal.provisional.core.IReporter;
@@ -286,26 +287,7 @@ public abstract class AbstractJavaBasicMapping
this.getConverter().validate(messages, reporter, astRoot);
}
- public IMessage buildTableNotValidMessage(BaseColumn column, TextRange textRange) {
- return DefaultJpaValidationMessages.buildMessage(
- IMessage.HIGH_SEVERITY,
- JpaValidationMessages.COLUMN_TABLE_NOT_VALID,
- new String[] {
- column.getTable(),
- column.getName(),
- JpaValidationDescriptionMessages.NOT_VALID_FOR_THIS_ENTITY},
- column,
- textRange
- );
- }
-
- public IMessage buildUnresolvedNameMessage(NamedColumn column, TextRange textRange) {
- return DefaultJpaValidationMessages.buildMessage(
- IMessage.HIGH_SEVERITY,
- JpaValidationMessages.COLUMN_UNRESOLVED_NAME,
- new String[] {column.getName(), column.getDbTable().getName()},
- column,
- textRange
- );
+ public JptValidator buildColumnValidator(NamedColumn column, NamedColumnTextRangeResolver textRangeResolver) {
+ return new NamedColumnValidator((BaseColumn) column, (BaseColumnTextRangeResolver) textRangeResolver, new EntityTableDescriptionProvider());
}
}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/AbstractJavaEntity.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/AbstractJavaEntity.java
index eca14755fc..6d8e87ae70 100644
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/AbstractJavaEntity.java
+++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/AbstractJavaEntity.java
@@ -15,8 +15,8 @@ import java.util.Iterator;
import java.util.List;
import java.util.ListIterator;
import org.eclipse.jdt.core.dom.CompilationUnit;
-import org.eclipse.jpt.core.MappingKeys;
import org.eclipse.jpt.core.JpaPlatformVariation.Supported;
+import org.eclipse.jpt.core.MappingKeys;
import org.eclipse.jpt.core.context.AssociationOverride;
import org.eclipse.jpt.core.context.AttributeMapping;
import org.eclipse.jpt.core.context.AttributeOverride;
@@ -28,6 +28,7 @@ import org.eclipse.jpt.core.context.DiscriminatorColumn;
import org.eclipse.jpt.core.context.DiscriminatorType;
import org.eclipse.jpt.core.context.Entity;
import org.eclipse.jpt.core.context.InheritanceType;
+import org.eclipse.jpt.core.context.JoinColumn;
import org.eclipse.jpt.core.context.NamedColumn;
import org.eclipse.jpt.core.context.PersistentAttribute;
import org.eclipse.jpt.core.context.PersistentType;
@@ -48,13 +49,19 @@ import org.eclipse.jpt.core.context.java.JavaPrimaryKeyJoinColumn;
import org.eclipse.jpt.core.context.java.JavaQueryContainer;
import org.eclipse.jpt.core.context.java.JavaSecondaryTable;
import org.eclipse.jpt.core.context.java.JavaTable;
+import org.eclipse.jpt.core.internal.context.BaseColumnTextRangeResolver;
import org.eclipse.jpt.core.internal.context.EntityTextRangeResolver;
-import org.eclipse.jpt.core.internal.context.MappingTools;
+import org.eclipse.jpt.core.internal.context.JoinColumnTextRangeResolver;
import org.eclipse.jpt.core.internal.context.JptValidator;
+import org.eclipse.jpt.core.internal.context.MappingTools;
+import org.eclipse.jpt.core.internal.context.NamedColumnTextRangeResolver;
+import org.eclipse.jpt.core.internal.jpa1.context.AssociationOverrideJoinColumnValidator;
+import org.eclipse.jpt.core.internal.jpa1.context.AttributeOverrideColumnValidator;
+import org.eclipse.jpt.core.internal.jpa1.context.DiscriminatorColumnValidator;
+import org.eclipse.jpt.core.internal.jpa1.context.EntityTableDescriptionProvider;
import org.eclipse.jpt.core.internal.jpa1.context.GenericEntityPrimaryKeyValidator;
import org.eclipse.jpt.core.internal.resource.java.NullPrimaryKeyJoinColumnAnnotation;
import org.eclipse.jpt.core.internal.validation.DefaultJpaValidationMessages;
-import org.eclipse.jpt.core.internal.validation.JpaValidationDescriptionMessages;
import org.eclipse.jpt.core.internal.validation.JpaValidationMessages;
import org.eclipse.jpt.core.jpa2.context.SingleRelationshipMapping2_0;
import org.eclipse.jpt.core.jpa2.context.java.JavaCacheableHolder2_0;
@@ -215,14 +222,8 @@ public abstract class AbstractJavaEntity
DiscriminatorColumn.DEFAULT_DISCRIMINATOR_TYPE;
}
- public IMessage buildUnresolvedNameMessage(NamedColumn column, TextRange textRange) {
- return DefaultJpaValidationMessages.buildMessage(
- IMessage.HIGH_SEVERITY,
- JpaValidationMessages.DISCRIMINATOR_COLUMN_UNRESOLVED_NAME,
- new String[] {column.getName(), column.getDbTable().getName()},
- column,
- textRange
- );
+ public JptValidator buildColumnValidator(NamedColumn column, NamedColumnTextRangeResolver textRangeResolver) {
+ return new DiscriminatorColumnValidator(column, textRangeResolver);
}
};
}
@@ -1570,127 +1571,9 @@ public abstract class AbstractJavaEntity
public TextRange getValidationTextRange(CompilationUnit astRoot) {
return AbstractJavaEntity.this.getValidationTextRange(astRoot);
}
-
- public IMessage buildColumnTableNotValidMessage(BaseOverride override, BaseColumn column, TextRange textRange) {
- if (override.isVirtual()) {
- return this.buildVirtualOverrideColumnTableNotValidMessage(override.getName(), column, textRange);
- }
- return DefaultJpaValidationMessages.buildMessage(
- IMessage.HIGH_SEVERITY,
- JpaValidationMessages.JOIN_COLUMN_TABLE_NOT_VALID,
- new String[] {
- column.getTable(),
- column.getName(),
- JpaValidationDescriptionMessages.NOT_VALID_FOR_THIS_ENTITY},
- column,
- textRange
- );
- }
-
- protected IMessage buildVirtualOverrideColumnTableNotValidMessage(String overrideName, BaseColumn column, TextRange textRange) {
- return DefaultJpaValidationMessages.buildMessage(
- IMessage.HIGH_SEVERITY,
- JpaValidationMessages.VIRTUAL_ASSOCIATION_OVERRIDE_JOIN_COLUMN_TABLE_NOT_VALID,
- new String[] {
- overrideName,
- column.getTable(),
- column.getName(),
- JpaValidationDescriptionMessages.NOT_VALID_FOR_THIS_ENTITY},
- column,
- textRange
- );
- }
-
- public IMessage buildColumnUnresolvedNameMessage(BaseOverride override, NamedColumn column, TextRange textRange) {
- if (override.isVirtual()) {
- return this.buildVirtualColumnUnresolvedNameMessage(override.getName(), column, textRange);
- }
- return DefaultJpaValidationMessages.buildMessage(
- IMessage.HIGH_SEVERITY,
- JpaValidationMessages.JOIN_COLUMN_UNRESOLVED_NAME,
- new String[] {column.getName(), column.getDbTable().getName()},
- column,
- textRange
- );
- }
-
- protected IMessage buildVirtualColumnUnresolvedNameMessage(String overrideName, NamedColumn column, TextRange textRange) {
- return DefaultJpaValidationMessages.buildMessage(
- IMessage.HIGH_SEVERITY,
- JpaValidationMessages.VIRTUAL_ASSOCIATION_OVERRIDE_JOIN_COLUMN_UNRESOLVED_NAME,
- new String[] {overrideName, column.getName(), column.getDbTable().getName()},
- column,
- textRange
- );
- }
-
- public IMessage buildColumnUnresolvedReferencedColumnNameMessage(AssociationOverride override, BaseJoinColumn column, TextRange textRange) {
- if (override.isVirtual()) {
- return this.buildVirtualColumnUnresolvedReferencedColumnNameMessage(override.getName(), column, textRange);
- }
- return DefaultJpaValidationMessages.buildMessage(
- IMessage.HIGH_SEVERITY,
- JpaValidationMessages.JOIN_COLUMN_UNRESOLVED_REFERENCED_COLUMN_NAME,
- new String[] {column.getReferencedColumnName(), column.getReferencedColumnDbTable().getName()},
- column,
- textRange
- );
- }
-
- protected IMessage buildVirtualColumnUnresolvedReferencedColumnNameMessage(String overrideName, BaseJoinColumn column, TextRange textRange) {
- return DefaultJpaValidationMessages.buildMessage(
- IMessage.HIGH_SEVERITY,
- JpaValidationMessages.VIRTUAL_ASSOCIATION_OVERRIDE_JOIN_COLUMN_UNRESOLVED_REFERENCED_COLUMN_NAME,
- new String[] {overrideName, column.getReferencedColumnName(), column.getReferencedColumnDbTable().getName()},
- column,
- textRange
- );
- }
-
- public IMessage buildUnspecifiedNameMultipleJoinColumnsMessage(AssociationOverride override, BaseJoinColumn column, TextRange textRange) {
- if (override.isVirtual()) {
- return this.buildVirtualUnspecifiedNameMultipleJoinColumnsMessage(override.getName(), column, textRange);
- }
- return DefaultJpaValidationMessages.buildMessage(
- IMessage.HIGH_SEVERITY,
- JpaValidationMessages.JOIN_COLUMN_NAME_MUST_BE_SPECIFIED_MULTIPLE_JOIN_COLUMNS,
- new String[0],
- column,
- textRange
- );
- }
-
- protected IMessage buildVirtualUnspecifiedNameMultipleJoinColumnsMessage(String overrideName, BaseJoinColumn column, TextRange textRange) {
- return DefaultJpaValidationMessages.buildMessage(
- IMessage.HIGH_SEVERITY,
- JpaValidationMessages.VIRTUAL_ASSOCIATION_OVERRIDE_JOIN_COLUMN_NAME_MUST_BE_SPECIFIED_MULTIPLE_JOIN_COLUMNS,
- new String[] {overrideName},
- column,
- textRange
- );
- }
-
- public IMessage buildUnspecifiedReferencedColumnNameMultipleJoinColumnsMessage(AssociationOverride override, BaseJoinColumn column, TextRange textRange) {
- if (override.isVirtual()) {
- return this.buildVirtualUnspecifiedReferencedColumnNameMultipleJoinColumnsMessage(override.getName(), column, textRange);
- }
- return DefaultJpaValidationMessages.buildMessage(
- IMessage.HIGH_SEVERITY,
- JpaValidationMessages.JOIN_COLUMN_REFERENCED_COLUMN_NAME_MUST_BE_SPECIFIED_MULTIPLE_JOIN_COLUMNS,
- new String[0],
- column,
- textRange
- );
- }
-
- protected IMessage buildVirtualUnspecifiedReferencedColumnNameMultipleJoinColumnsMessage(String overrideName, BaseJoinColumn column, TextRange textRange) {
- return DefaultJpaValidationMessages.buildMessage(
- IMessage.HIGH_SEVERITY,
- JpaValidationMessages.VIRTUAL_ASSOCIATION_OVERRIDE_JOIN_COLUMN_REFERENCED_COLUMN_NAME_MUST_BE_SPECIFIED_MULTIPLE_JOIN_COLUMNS,
- new String[] {overrideName},
- column,
- textRange
- );
+
+ public JptValidator buildColumnValidator(BaseOverride override, BaseColumn column, BaseColumn.Owner owner, BaseColumnTextRangeResolver textRangeResolver) {
+ return new AssociationOverrideJoinColumnValidator((AssociationOverride) override, (JoinColumn) column, (JoinColumn.Owner) owner, (JoinColumnTextRangeResolver) textRangeResolver, new EntityTableDescriptionProvider());
}
}
@@ -1790,57 +1673,8 @@ public abstract class AbstractJavaEntity
return AbstractJavaEntity.this.getValidationTextRange(astRoot);
}
- public IMessage buildColumnUnresolvedNameMessage(BaseOverride override, NamedColumn column, TextRange textRange) {
- if (override.isVirtual()) {
- return this.buildVirtualColumnUnresolvedNameMessage(override.getName(), column, textRange);
- }
- return DefaultJpaValidationMessages.buildMessage(
- IMessage.HIGH_SEVERITY,
- JpaValidationMessages.COLUMN_UNRESOLVED_NAME,
- new String[] {column.getName(), column.getDbTable().getName()},
- column,
- textRange
- );
- }
-
- protected IMessage buildVirtualColumnUnresolvedNameMessage(String overrideName, NamedColumn column, TextRange textRange) {
- return DefaultJpaValidationMessages.buildMessage(
- IMessage.HIGH_SEVERITY,
- JpaValidationMessages.VIRTUAL_ATTRIBUTE_OVERRIDE_COLUMN_UNRESOLVED_NAME,
- new String[] {overrideName, column.getName(), column.getDbTable().getName()},
- column,
- textRange
- );
- }
-
- public IMessage buildColumnTableNotValidMessage(BaseOverride override, BaseColumn column, TextRange textRange) {
- if (override.isVirtual()) {
- return this.buildVirtualColumnTableNotValidMessage(override.getName(), column, textRange);
- }
- return DefaultJpaValidationMessages.buildMessage(
- IMessage.HIGH_SEVERITY,
- JpaValidationMessages.COLUMN_TABLE_NOT_VALID,
- new String[] {
- column.getTable(),
- column.getName(),
- JpaValidationDescriptionMessages.NOT_VALID_FOR_THIS_ENTITY},
- column,
- textRange
- );
- }
-
- protected IMessage buildVirtualColumnTableNotValidMessage(String overrideName, BaseColumn column, TextRange textRange) {
- return DefaultJpaValidationMessages.buildMessage(
- IMessage.HIGH_SEVERITY,
- JpaValidationMessages.VIRTUAL_ATTRIBUTE_OVERRIDE_COLUMN_TABLE_NOT_VALID,
- new String[] {
- overrideName,
- column.getTable(),
- column.getName(),
- JpaValidationDescriptionMessages.NOT_VALID_FOR_THIS_ENTITY},
- column,
- textRange
- );
+ public JptValidator buildColumnValidator(BaseOverride override, BaseColumn column, BaseColumn.Owner owner, BaseColumnTextRangeResolver textRangeResolver) {
+ return new AttributeOverrideColumnValidator((AttributeOverride) override, column, textRangeResolver, new EntityTableDescriptionProvider());
}
}
@@ -1886,19 +1720,7 @@ public abstract class AbstractJavaEntity
return (parentEntity == null) ? getPrimaryKeyColumnName() : parentEntity.getPrimaryKeyColumnName();
}
- public IMessage buildUnresolvedNameMessage(NamedColumn column, TextRange textRange) {
- throw new UnsupportedOperationException("validation not supported yet: bug 148262"); //$NON-NLS-1$
- }
-
- public IMessage buildUnresolvedReferencedColumnNameMessage(BaseJoinColumn column, TextRange textRange) {
- throw new UnsupportedOperationException("validation not supported yet: bug 148262"); //$NON-NLS-1$
- }
-
- public IMessage buildUnspecifiedNameMultipleJoinColumnsMessage(BaseJoinColumn column, TextRange textRange) {
- throw new UnsupportedOperationException("validation not supported yet: bug 148262"); //$NON-NLS-1$
- }
-
- public IMessage buildUnspecifiedReferencedColumnNameMultipleJoinColumnsMessage(BaseJoinColumn column, TextRange textRange) {
+ public JptValidator buildColumnValidator(NamedColumn column, NamedColumnTextRangeResolver textRangeResolver) {
throw new UnsupportedOperationException("validation not supported yet: bug 148262"); //$NON-NLS-1$
}
}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/AbstractJavaIdMapping.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/AbstractJavaIdMapping.java
index 68f52fe35e..a89c3dcd82 100644
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/AbstractJavaIdMapping.java
+++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/AbstractJavaIdMapping.java
@@ -25,6 +25,11 @@ import org.eclipse.jpt.core.context.java.JavaGeneratedValue;
import org.eclipse.jpt.core.context.java.JavaGeneratorContainer;
import org.eclipse.jpt.core.context.java.JavaIdMapping;
import org.eclipse.jpt.core.context.java.JavaPersistentAttribute;
+import org.eclipse.jpt.core.internal.context.BaseColumnTextRangeResolver;
+import org.eclipse.jpt.core.internal.context.JptValidator;
+import org.eclipse.jpt.core.internal.context.NamedColumnTextRangeResolver;
+import org.eclipse.jpt.core.internal.jpa1.context.EntityTableDescriptionProvider;
+import org.eclipse.jpt.core.internal.jpa1.context.NamedColumnValidator;
import org.eclipse.jpt.core.internal.validation.DefaultJpaValidationMessages;
import org.eclipse.jpt.core.internal.validation.JpaValidationDescriptionMessages;
import org.eclipse.jpt.core.internal.validation.JpaValidationMessages;
@@ -433,30 +438,11 @@ public abstract class AbstractJavaIdMapping
this.getGeneratorContainer().validate(messages, reporter, astRoot);
this.getConverter().validate(messages, reporter, astRoot);
}
-
- public IMessage buildTableNotValidMessage(BaseColumn column, TextRange textRange) {
- return DefaultJpaValidationMessages.buildMessage(
- IMessage.HIGH_SEVERITY,
- JpaValidationMessages.COLUMN_TABLE_NOT_VALID,
- new String[] {
- column.getTable(),
- column.getName(),
- JpaValidationDescriptionMessages.NOT_VALID_FOR_THIS_ENTITY},
- column,
- textRange
- );
- }
-
- public IMessage buildUnresolvedNameMessage(NamedColumn column, TextRange textRange) {
- return DefaultJpaValidationMessages.buildMessage(
- IMessage.HIGH_SEVERITY,
- JpaValidationMessages.COLUMN_UNRESOLVED_NAME,
- new String[] {column.getName(), column.getDbTable().getName()},
- column,
- textRange
- );
+
+ public JptValidator buildColumnValidator(NamedColumn column, NamedColumnTextRangeResolver textRangeResolver) {
+ return new NamedColumnValidator((BaseColumn) column, (BaseColumnTextRangeResolver) textRangeResolver, new EntityTableDescriptionProvider());
}
-
+
/* TODO - move to AbstractOrmAttributeMapping? */
protected IMessage buildMessage(String msgID, String[] params, TextRange textRange) {
PersistentAttribute attribute = getPersistentAttribute();
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/AbstractJavaJoinColumnInRelationshipMappingJoiningStrategy.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/AbstractJavaJoinColumnInRelationshipMappingJoiningStrategy.java
index 2b5c4f6017..0e1e64b65f 100644
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/AbstractJavaJoinColumnInRelationshipMappingJoiningStrategy.java
+++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/AbstractJavaJoinColumnInRelationshipMappingJoiningStrategy.java
@@ -11,19 +11,22 @@ package org.eclipse.jpt.core.internal.context.java;
import java.util.Iterator;
import org.eclipse.jdt.core.dom.CompilationUnit;
-import org.eclipse.jpt.core.context.BaseColumn;
import org.eclipse.jpt.core.context.BaseJoinColumn;
import org.eclipse.jpt.core.context.Entity;
+import org.eclipse.jpt.core.context.JoinColumn;
import org.eclipse.jpt.core.context.NamedColumn;
import org.eclipse.jpt.core.context.PersistentAttribute;
import org.eclipse.jpt.core.context.TypeMapping;
import org.eclipse.jpt.core.context.java.JavaJoinColumn;
import org.eclipse.jpt.core.context.java.JavaJoinColumnEnabledRelationshipReference;
import org.eclipse.jpt.core.context.java.JavaRelationshipMapping;
+import org.eclipse.jpt.core.internal.context.JoinColumnTextRangeResolver;
+import org.eclipse.jpt.core.internal.context.JptValidator;
+import org.eclipse.jpt.core.internal.context.NamedColumnTextRangeResolver;
+import org.eclipse.jpt.core.internal.jpa1.context.EntityTableDescriptionProvider;
+import org.eclipse.jpt.core.internal.jpa1.context.JoinColumnValidator;
import org.eclipse.jpt.core.internal.resource.java.NullJoinColumnAnnotation;
-import org.eclipse.jpt.core.internal.validation.DefaultJpaValidationMessages;
import org.eclipse.jpt.core.internal.validation.JpaValidationDescriptionMessages;
-import org.eclipse.jpt.core.internal.validation.JpaValidationMessages;
import org.eclipse.jpt.core.resource.java.JavaResourcePersistentAttribute;
import org.eclipse.jpt.core.resource.java.JoinColumnAnnotation;
import org.eclipse.jpt.core.resource.java.JoinColumnsAnnotation;
@@ -31,7 +34,6 @@ import org.eclipse.jpt.core.resource.java.NestableAnnotation;
import org.eclipse.jpt.core.utility.TextRange;
import org.eclipse.jpt.db.Table;
import org.eclipse.jpt.utility.internal.iterators.TransformationIterator;
-import org.eclipse.wst.validation.internal.provisional.core.IMessage;
public abstract class AbstractJavaJoinColumnInRelationshipMappingJoiningStrategy
extends AbstractJavaJoinColumnJoiningStrategy
@@ -186,57 +188,8 @@ public abstract class AbstractJavaJoinColumnInRelationshipMappingJoiningStrategy
return AbstractJavaJoinColumnInRelationshipMappingJoiningStrategy.this.getValidationTextRange(astRoot);
}
- public IMessage buildTableNotValidMessage(BaseColumn column, TextRange textRange) {
- return DefaultJpaValidationMessages.buildMessage(
- IMessage.HIGH_SEVERITY,
- JpaValidationMessages.JOIN_COLUMN_TABLE_NOT_VALID,
- new String[] {
- column.getTable(),
- column.getName(),
- JpaValidationDescriptionMessages.NOT_VALID_FOR_THIS_ENTITY},
- column,
- textRange
- );
- }
-
- public IMessage buildUnresolvedNameMessage(NamedColumn column, TextRange textRange) {
- return DefaultJpaValidationMessages.buildMessage(
- IMessage.HIGH_SEVERITY,
- JpaValidationMessages.JOIN_COLUMN_UNRESOLVED_NAME,
- new String[] {column.getName(), column.getDbTable().getName()},
- column,
- textRange
- );
- }
-
- public IMessage buildUnresolvedReferencedColumnNameMessage(BaseJoinColumn column, TextRange textRange) {
- return DefaultJpaValidationMessages.buildMessage(
- IMessage.HIGH_SEVERITY,
- JpaValidationMessages.JOIN_COLUMN_UNRESOLVED_REFERENCED_COLUMN_NAME,
- new String[] {column.getReferencedColumnName(), column.getReferencedColumnDbTable().getName()},
- column,
- textRange
- );
- }
-
- public IMessage buildUnspecifiedNameMultipleJoinColumnsMessage(BaseJoinColumn column, TextRange textRange) {
- return DefaultJpaValidationMessages.buildMessage(
- IMessage.HIGH_SEVERITY,
- JpaValidationMessages.JOIN_COLUMN_NAME_MUST_BE_SPECIFIED_MULTIPLE_JOIN_COLUMNS,
- new String[0],
- column,
- textRange
- );
- }
-
- public IMessage buildUnspecifiedReferencedColumnNameMultipleJoinColumnsMessage(BaseJoinColumn column, TextRange textRange) {
- return DefaultJpaValidationMessages.buildMessage(
- IMessage.HIGH_SEVERITY,
- JpaValidationMessages.JOIN_COLUMN_REFERENCED_COLUMN_NAME_MUST_BE_SPECIFIED_MULTIPLE_JOIN_COLUMNS,
- new String[0],
- column,
- textRange
- );
+ public JptValidator buildColumnValidator(NamedColumn column, NamedColumnTextRangeResolver textRangeResolver) {
+ return new JoinColumnValidator((JoinColumn) column, this, (JoinColumnTextRangeResolver) textRangeResolver, new EntityTableDescriptionProvider());
}
}
}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/AbstractJavaMultiRelationshipMapping.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/AbstractJavaMultiRelationshipMapping.java
index 9715f819df..3902147207 100644
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/AbstractJavaMultiRelationshipMapping.java
+++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/AbstractJavaMultiRelationshipMapping.java
@@ -14,6 +14,7 @@ import java.util.Iterator;
import java.util.List;
import java.util.Vector;
import org.eclipse.jdt.core.dom.CompilationUnit;
+import org.eclipse.jpt.core.context.AttributeOverride;
import org.eclipse.jpt.core.context.BaseColumn;
import org.eclipse.jpt.core.context.BaseOverride;
import org.eclipse.jpt.core.context.Column;
@@ -32,10 +33,14 @@ import org.eclipse.jpt.core.context.java.JavaMultiRelationshipMapping;
import org.eclipse.jpt.core.context.java.JavaOrderable;
import org.eclipse.jpt.core.context.java.JavaOverrideContainer;
import org.eclipse.jpt.core.context.java.JavaPersistentAttribute;
+import org.eclipse.jpt.core.internal.context.BaseColumnTextRangeResolver;
+import org.eclipse.jpt.core.internal.context.JptValidator;
import org.eclipse.jpt.core.internal.context.MappingTools;
+import org.eclipse.jpt.core.internal.context.NamedColumnTextRangeResolver;
+import org.eclipse.jpt.core.internal.jpa1.context.JoiningStrategyTableDescriptionProvider;
+import org.eclipse.jpt.core.internal.jpa1.context.MapKeyAttributeOverrideColumnValidator;
+import org.eclipse.jpt.core.internal.jpa1.context.MapKeyColumnValidator;
import org.eclipse.jpt.core.internal.jpa2.context.java.NullJavaMapKeyColumn2_0;
-import org.eclipse.jpt.core.internal.validation.DefaultJpaValidationMessages;
-import org.eclipse.jpt.core.internal.validation.JpaValidationMessages;
import org.eclipse.jpt.core.jpa2.JpaFactory2_0;
import org.eclipse.jpt.core.jpa2.context.Orderable2_0;
import org.eclipse.jpt.core.jpa2.context.java.JavaCollectionMapping2_0;
@@ -724,24 +729,8 @@ public abstract class AbstractJavaMultiRelationshipMapping<T extends Relationshi
return AbstractJavaMultiRelationshipMapping.this.getValidationTextRange(astRoot);
}
- public IMessage buildTableNotValidMessage(BaseColumn column, TextRange textRange) {
- return DefaultJpaValidationMessages.buildMessage(
- IMessage.HIGH_SEVERITY,
- JpaValidationMessages.MAP_KEY_COLUMN_TABLE_NOT_VALID,
- new String[] {column.getTable(), column.getName(), getPredominantJoiningStrategy().getColumnTableNotValidDescription()},
- column,
- textRange
- );
- }
-
- public IMessage buildUnresolvedNameMessage(NamedColumn column, TextRange textRange) {
- return DefaultJpaValidationMessages.buildMessage(
- IMessage.HIGH_SEVERITY,
- JpaValidationMessages.MAP_KEY_COLUMN_UNRESOLVED_NAME,
- new String[] {column.getName(), column.getDbTable().getName()},
- column,
- textRange
- );
+ public JptValidator buildColumnValidator(NamedColumn column, NamedColumnTextRangeResolver textRangeResolver) {
+ return new MapKeyColumnValidator((BaseColumn) column, (BaseColumnTextRangeResolver) textRangeResolver, new JoiningStrategyTableDescriptionProvider(getPredominantJoiningStrategy()));
}
}
@@ -811,50 +800,8 @@ public abstract class AbstractJavaMultiRelationshipMapping<T extends Relationshi
return MappingTools.resolveOverridenColumn(getOverridableTypeMapping(), attributeOverrideName);
}
- public IMessage buildColumnUnresolvedNameMessage(BaseOverride override, NamedColumn column, TextRange textRange) {
- if (override.isVirtual()) {
- return this.buildVirtualColumnUnresolvedNameMessage(override.getName(), column, textRange);
- }
- return DefaultJpaValidationMessages.buildMessage(
- IMessage.HIGH_SEVERITY,
- JpaValidationMessages.COLUMN_UNRESOLVED_NAME,
- new String[] {column.getName(), column.getDbTable().getName()},
- column,
- textRange
- );
- }
-
- protected IMessage buildVirtualColumnUnresolvedNameMessage(String overrideName, NamedColumn column, TextRange textRange) {
- return DefaultJpaValidationMessages.buildMessage(
- IMessage.HIGH_SEVERITY,
- JpaValidationMessages.VIRTUAL_MAP_KEY_ATTRIBUTE_OVERRIDE_COLUMN_UNRESOLVED_NAME,
- new String[] {overrideName, column.getName(), column.getDbTable().getName()},
- column,
- textRange
- );
- }
-
- public IMessage buildColumnTableNotValidMessage(BaseOverride override, BaseColumn column, TextRange textRange) {
- if (override.isVirtual()) {
- return this.buildVirtualColumnTableNotValidMessage(override.getName(), column, textRange);
- }
- return DefaultJpaValidationMessages.buildMessage(
- IMessage.HIGH_SEVERITY,
- JpaValidationMessages.COLUMN_TABLE_NOT_VALID,
- new String[] {column.getTable(), column.getName(), getPredominantJoiningStrategy().getColumnTableNotValidDescription()},
- column,
- textRange
- );
- }
-
- protected IMessage buildVirtualColumnTableNotValidMessage(String overrideName, BaseColumn column, TextRange textRange) {
- return DefaultJpaValidationMessages.buildMessage(
- IMessage.HIGH_SEVERITY,
- JpaValidationMessages.VIRTUAL_MAP_KEY_ATTRIBUTE_OVERRIDE_COLUMN_TABLE_NOT_VALID,
- new String[] {overrideName, column.getTable(), column.getName(), getPredominantJoiningStrategy().getColumnTableNotValidDescription()},
- column,
- textRange
- );
+ public JptValidator buildColumnValidator(BaseOverride override, BaseColumn column, BaseColumn.Owner owner, BaseColumnTextRangeResolver textRangeResolver) {
+ return new MapKeyAttributeOverrideColumnValidator((AttributeOverride) override, column, textRangeResolver, new JoiningStrategyTableDescriptionProvider(getPredominantJoiningStrategy()));
}
}
}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/AbstractJavaNamedColumn.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/AbstractJavaNamedColumn.java
index b3e9604d08..82e5419297 100644
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/AbstractJavaNamedColumn.java
+++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/AbstractJavaNamedColumn.java
@@ -15,6 +15,8 @@ import org.eclipse.jdt.core.dom.CompilationUnit;
import org.eclipse.jpt.core.context.NamedColumn;
import org.eclipse.jpt.core.context.java.JavaJpaContextNode;
import org.eclipse.jpt.core.context.java.JavaNamedColumn;
+import org.eclipse.jpt.core.internal.context.JptValidator;
+import org.eclipse.jpt.core.internal.context.NamedColumnTextRangeResolver;
import org.eclipse.jpt.core.resource.java.NamedColumnAnnotation;
import org.eclipse.jpt.core.utility.TextRange;
import org.eclipse.jpt.db.Column;
@@ -211,13 +213,14 @@ public abstract class AbstractJavaNamedColumn<T extends NamedColumnAnnotation>
@Override
public void validate(List<IMessage> messages, IReporter reporter, CompilationUnit astRoot) {
super.validate(messages, reporter, astRoot);
- this.validateName(messages, astRoot);
+ this.buildColumnValidator(astRoot).validate(messages, reporter);
}
- protected void validateName(List<IMessage> messages, CompilationUnit astRoot) {
- Table dbTable = this.getDbTable();
- if (dbTable != null && !this.isResolved()) {
- messages.add(this.getOwner().buildUnresolvedNameMessage(this, this.getNameTextRange(astRoot)));
- }
+ protected JptValidator buildColumnValidator(CompilationUnit astRoot) {
+ return this.getOwner().buildColumnValidator(this, buildTextRangeResolver(astRoot));
+ }
+
+ protected NamedColumnTextRangeResolver buildTextRangeResolver(CompilationUnit astRoot) {
+ return new JavaNamedColumnTextRangeResolver(this, astRoot);
}
}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/AbstractJavaVersionMapping.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/AbstractJavaVersionMapping.java
index 7605471688..0f1f2760db 100644
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/AbstractJavaVersionMapping.java
+++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/AbstractJavaVersionMapping.java
@@ -22,14 +22,15 @@ import org.eclipse.jpt.core.context.java.JavaColumn;
import org.eclipse.jpt.core.context.java.JavaConverter;
import org.eclipse.jpt.core.context.java.JavaPersistentAttribute;
import org.eclipse.jpt.core.context.java.JavaVersionMapping;
-import org.eclipse.jpt.core.internal.validation.DefaultJpaValidationMessages;
-import org.eclipse.jpt.core.internal.validation.JpaValidationDescriptionMessages;
-import org.eclipse.jpt.core.internal.validation.JpaValidationMessages;
+import org.eclipse.jpt.core.internal.context.BaseColumnTextRangeResolver;
+import org.eclipse.jpt.core.internal.context.JptValidator;
+import org.eclipse.jpt.core.internal.context.NamedColumnTextRangeResolver;
+import org.eclipse.jpt.core.internal.jpa1.context.EntityTableDescriptionProvider;
+import org.eclipse.jpt.core.internal.jpa1.context.NamedColumnValidator;
import org.eclipse.jpt.core.resource.java.ColumnAnnotation;
import org.eclipse.jpt.core.resource.java.JPA;
import org.eclipse.jpt.core.resource.java.TemporalAnnotation;
import org.eclipse.jpt.core.resource.java.VersionAnnotation;
-import org.eclipse.jpt.core.utility.TextRange;
import org.eclipse.jpt.utility.Filter;
import org.eclipse.wst.validation.internal.provisional.core.IMessage;
import org.eclipse.wst.validation.internal.provisional.core.IReporter;
@@ -196,26 +197,7 @@ public abstract class AbstractJavaVersionMapping
this.getConverter().validate(messages, reporter, astRoot);
}
- public IMessage buildTableNotValidMessage(BaseColumn column, TextRange textRange) {
- return DefaultJpaValidationMessages.buildMessage(
- IMessage.HIGH_SEVERITY,
- JpaValidationMessages.COLUMN_TABLE_NOT_VALID,
- new String[] {
- column.getTable(),
- column.getName(),
- JpaValidationDescriptionMessages.NOT_VALID_FOR_THIS_ENTITY},
- column,
- textRange
- );
- }
-
- public IMessage buildUnresolvedNameMessage(NamedColumn column, TextRange textRange) {
- return DefaultJpaValidationMessages.buildMessage(
- IMessage.HIGH_SEVERITY,
- JpaValidationMessages.COLUMN_UNRESOLVED_NAME,
- new String[] {column.getName(), column.getDbTable().getName()},
- column,
- textRange
- );
+ public JptValidator buildColumnValidator(NamedColumn column, NamedColumnTextRangeResolver textRangeResolver) {
+ return new NamedColumnValidator((BaseColumn) column, (BaseColumnTextRangeResolver) textRangeResolver, new EntityTableDescriptionProvider());
}
}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/GenericJavaJoinColumnInAssociationOverrideJoiningStrategy.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/GenericJavaJoinColumnInAssociationOverrideJoiningStrategy.java
index 9af9cdb1bf..f671423307 100644
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/GenericJavaJoinColumnInAssociationOverrideJoiningStrategy.java
+++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/GenericJavaJoinColumnInAssociationOverrideJoiningStrategy.java
@@ -25,12 +25,14 @@ import org.eclipse.jpt.core.context.java.JavaAssociationOverrideRelationshipRefe
import org.eclipse.jpt.core.context.java.JavaJoinColumn;
import org.eclipse.jpt.core.context.java.JavaJoinColumnInAssociationOverrideJoiningStrategy;
import org.eclipse.jpt.core.context.java.JavaJoinColumn.Owner;
+import org.eclipse.jpt.core.internal.context.BaseColumnTextRangeResolver;
+import org.eclipse.jpt.core.internal.context.JptValidator;
+import org.eclipse.jpt.core.internal.context.NamedColumnTextRangeResolver;
import org.eclipse.jpt.core.internal.resource.java.NullJoinColumnAnnotation;
import org.eclipse.jpt.core.resource.java.AssociationOverrideAnnotation;
import org.eclipse.jpt.core.resource.java.JoinColumnAnnotation;
import org.eclipse.jpt.core.utility.TextRange;
import org.eclipse.jpt.db.Table;
-import org.eclipse.wst.validation.internal.provisional.core.IMessage;
public class GenericJavaJoinColumnInAssociationOverrideJoiningStrategy
extends AbstractJavaJoinColumnJoiningStrategy
@@ -240,24 +242,8 @@ public class GenericJavaJoinColumnInAssociationOverrideJoiningStrategy
return GenericJavaJoinColumnInAssociationOverrideJoiningStrategy.this.getValidationTextRange(astRoot);
}
- public IMessage buildUnresolvedNameMessage(NamedColumn column, TextRange textRange) {
- return getAssociationOverrideOwner().buildColumnUnresolvedNameMessage(getAssociationOverride(), column, textRange);
- }
-
- public IMessage buildTableNotValidMessage(BaseColumn column, TextRange textRange) {
- return getAssociationOverrideOwner().buildColumnTableNotValidMessage(getAssociationOverride(), column, textRange);
- }
-
- public IMessage buildUnresolvedReferencedColumnNameMessage(BaseJoinColumn column, TextRange textRange) {
- return getAssociationOverrideOwner().buildColumnUnresolvedReferencedColumnNameMessage(getAssociationOverride(), column, textRange);
- }
-
- public IMessage buildUnspecifiedNameMultipleJoinColumnsMessage(BaseJoinColumn column, TextRange textRange) {
- return getAssociationOverrideOwner().buildUnspecifiedNameMultipleJoinColumnsMessage(getAssociationOverride(), column, textRange);
- }
-
- public IMessage buildUnspecifiedReferencedColumnNameMultipleJoinColumnsMessage(BaseJoinColumn column, TextRange textRange) {
- return getAssociationOverrideOwner().buildUnspecifiedReferencedColumnNameMultipleJoinColumnsMessage(getAssociationOverride(), column, textRange);
+ public JptValidator buildColumnValidator(NamedColumn column, NamedColumnTextRangeResolver textRangeResolver) {
+ return getAssociationOverrideOwner().buildColumnValidator(getAssociationOverride(), (BaseColumn) column, this, (BaseColumnTextRangeResolver) textRangeResolver);
}
}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/GenericJavaPrimaryKeyJoinColumnJoiningStrategy.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/GenericJavaPrimaryKeyJoinColumnJoiningStrategy.java
index cf3cb4a94d..634ff4ae29 100644
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/GenericJavaPrimaryKeyJoinColumnJoiningStrategy.java
+++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/GenericJavaPrimaryKeyJoinColumnJoiningStrategy.java
@@ -25,6 +25,8 @@ import org.eclipse.jpt.core.context.java.JavaPrimaryKeyJoinColumn;
import org.eclipse.jpt.core.context.java.JavaPrimaryKeyJoinColumnEnabledRelationshipReference;
import org.eclipse.jpt.core.context.java.JavaPrimaryKeyJoinColumnJoiningStrategy;
import org.eclipse.jpt.core.context.java.JavaRelationshipMapping;
+import org.eclipse.jpt.core.internal.context.JptValidator;
+import org.eclipse.jpt.core.internal.context.NamedColumnTextRangeResolver;
import org.eclipse.jpt.core.internal.validation.JpaValidationDescriptionMessages;
import org.eclipse.jpt.core.resource.java.JavaResourcePersistentAttribute;
import org.eclipse.jpt.core.resource.java.NestableAnnotation;
@@ -340,23 +342,7 @@ public class GenericJavaPrimaryKeyJoinColumnJoiningStrategy
return GenericJavaPrimaryKeyJoinColumnJoiningStrategy.this.primaryKeyJoinColumnsSize();
}
- public IMessage buildTableNotValidMessage(BaseColumn column, TextRange textRange) {
- throw new UnsupportedOperationException("validation not supported yet"); //$NON-NLS-1$
- }
-
- public IMessage buildUnresolvedNameMessage(NamedColumn column, TextRange textRange) {
- throw new UnsupportedOperationException("validation not supported yet"); //$NON-NLS-1$
- }
-
- public IMessage buildUnresolvedReferencedColumnNameMessage(BaseJoinColumn column, TextRange textRange) {
- throw new UnsupportedOperationException("validation not supported yet"); //$NON-NLS-1$
- }
-
- public IMessage buildUnspecifiedNameMultipleJoinColumnsMessage(BaseJoinColumn column, TextRange textRange) {
- throw new UnsupportedOperationException("validation not supported yet"); //$NON-NLS-1$
- }
-
- public IMessage buildUnspecifiedReferencedColumnNameMultipleJoinColumnsMessage(BaseJoinColumn column, TextRange textRange) {
+ public JptValidator buildColumnValidator(NamedColumn column, NamedColumnTextRangeResolver textRangeResolver) {
throw new UnsupportedOperationException("validation not supported yet"); //$NON-NLS-1$
}
}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/JavaBaseColumnTextRangeResolver.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/JavaBaseColumnTextRangeResolver.java
new file mode 100644
index 0000000000..9b989cf72b
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/JavaBaseColumnTextRangeResolver.java
@@ -0,0 +1,34 @@
+/*******************************************************************************
+ * Copyright (c) 2010 Oracle.
+ * All rights reserved. This program and the accompanying materials are
+ * made available under the terms of the Eclipse Public License v1.0 which
+ * accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.jpt.core.internal.context.java;
+
+import org.eclipse.jdt.core.dom.CompilationUnit;
+import org.eclipse.jpt.core.context.java.JavaBaseColumn;
+import org.eclipse.jpt.core.internal.context.BaseColumnTextRangeResolver;
+import org.eclipse.jpt.core.utility.TextRange;
+
+public class JavaBaseColumnTextRangeResolver
+ extends JavaNamedColumnTextRangeResolver
+ implements BaseColumnTextRangeResolver
+{
+
+ public JavaBaseColumnTextRangeResolver(JavaBaseColumn column, CompilationUnit astRoot) {
+ super(column, astRoot);
+ }
+
+ @Override
+ protected JavaBaseColumn getColumn() {
+ return (JavaBaseColumn) super.getColumn();
+ }
+ public TextRange getTableTextRange() {
+ return this.getColumn().getTableTextRange(this.astRoot);
+ }
+}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/JavaJoinColumnTextRangeResolver.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/JavaJoinColumnTextRangeResolver.java
new file mode 100644
index 0000000000..86843504fd
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/JavaJoinColumnTextRangeResolver.java
@@ -0,0 +1,42 @@
+/*******************************************************************************
+ * Copyright (c) 2010 Oracle.
+ * All rights reserved. This program and the accompanying materials are
+ * made available under the terms of the Eclipse Public License v1.0 which
+ * accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.jpt.core.internal.context.java;
+
+import org.eclipse.jdt.core.dom.CompilationUnit;
+import org.eclipse.jpt.core.context.java.JavaJoinColumn;
+import org.eclipse.jpt.core.internal.context.BaseColumnTextRangeResolver;
+import org.eclipse.jpt.core.internal.context.JoinColumnTextRangeResolver;
+import org.eclipse.jpt.core.utility.TextRange;
+
+public class JavaJoinColumnTextRangeResolver
+ extends JavaNamedColumnTextRangeResolver
+ implements
+ BaseColumnTextRangeResolver,
+ JoinColumnTextRangeResolver
+{
+
+ public JavaJoinColumnTextRangeResolver(JavaJoinColumn column, CompilationUnit astRoot) {
+ super(column, astRoot);
+ }
+
+ @Override
+ protected JavaJoinColumn getColumn() {
+ return (JavaJoinColumn) super.getColumn();
+ }
+
+ public TextRange getTableTextRange() {
+ return this.getColumn().getTableTextRange(this.astRoot);
+ }
+
+ public TextRange getReferencedColumnNameTextRange() {
+ return this.getColumn().getReferencedColumnNameTextRange(this.astRoot);
+ }
+}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/JavaNamedColumnTextRangeResolver.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/JavaNamedColumnTextRangeResolver.java
new file mode 100644
index 0000000000..4c10481f0f
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/JavaNamedColumnTextRangeResolver.java
@@ -0,0 +1,37 @@
+/*******************************************************************************
+ * Copyright (c) 2010 Oracle.
+ * All rights reserved. This program and the accompanying materials are
+ * made available under the terms of the Eclipse Public License v1.0 which
+ * accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.jpt.core.internal.context.java;
+
+import org.eclipse.jdt.core.dom.CompilationUnit;
+import org.eclipse.jpt.core.context.java.JavaNamedColumn;
+import org.eclipse.jpt.core.internal.context.NamedColumnTextRangeResolver;
+import org.eclipse.jpt.core.utility.TextRange;
+
+public class JavaNamedColumnTextRangeResolver
+ implements NamedColumnTextRangeResolver
+{
+ protected final JavaNamedColumn javaNamedColumn;
+
+ protected final CompilationUnit astRoot;
+
+ public JavaNamedColumnTextRangeResolver(JavaNamedColumn javaNamedColumn, CompilationUnit astRoot) {
+ this.javaNamedColumn = javaNamedColumn;
+ this.astRoot = astRoot;
+ }
+
+ protected JavaNamedColumn getColumn() {
+ return this.javaNamedColumn;
+ }
+
+ public TextRange getNameTextRange() {
+ return this.javaNamedColumn.getNameTextRange(this.astRoot);
+ }
+}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/JavaPrimaryKeyJoinColumnTextRangeResolver.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/JavaPrimaryKeyJoinColumnTextRangeResolver.java
new file mode 100644
index 0000000000..1c7d6eafe6
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/JavaPrimaryKeyJoinColumnTextRangeResolver.java
@@ -0,0 +1,36 @@
+/*******************************************************************************
+ * Copyright (c) 2010 Oracle.
+ * All rights reserved. This program and the accompanying materials are
+ * made available under the terms of the Eclipse Public License v1.0 which
+ * accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.jpt.core.internal.context.java;
+
+import org.eclipse.jdt.core.dom.CompilationUnit;
+import org.eclipse.jpt.core.context.java.JavaPrimaryKeyJoinColumn;
+import org.eclipse.jpt.core.internal.context.BaseJoinColumnTextRangeResolver;
+import org.eclipse.jpt.core.utility.TextRange;
+
+public class JavaPrimaryKeyJoinColumnTextRangeResolver
+ extends JavaNamedColumnTextRangeResolver
+ implements
+ BaseJoinColumnTextRangeResolver
+{
+
+ public JavaPrimaryKeyJoinColumnTextRangeResolver(JavaPrimaryKeyJoinColumn column, CompilationUnit astRoot) {
+ super(column, astRoot);
+ }
+
+ @Override
+ protected JavaPrimaryKeyJoinColumn getColumn() {
+ return (JavaPrimaryKeyJoinColumn) super.getColumn();
+ }
+
+ public TextRange getReferencedColumnNameTextRange() {
+ return this.getColumn().getReferencedColumnNameTextRange(this.astRoot);
+ }
+}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/AbstractOrmBaseColumn.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/AbstractOrmBaseColumn.java
index fe0fc25c4e..f059e95f93 100644
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/AbstractOrmBaseColumn.java
+++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/AbstractOrmBaseColumn.java
@@ -10,14 +10,12 @@
package org.eclipse.jpt.core.internal.context.orm;
import java.util.Iterator;
-import java.util.List;
import org.eclipse.jpt.core.context.BaseColumn;
import org.eclipse.jpt.core.context.XmlContextNode;
import org.eclipse.jpt.core.context.orm.OrmBaseColumn;
+import org.eclipse.jpt.core.internal.context.NamedColumnTextRangeResolver;
import org.eclipse.jpt.core.resource.orm.AbstractXmlColumn;
import org.eclipse.jpt.core.utility.TextRange;
-import org.eclipse.wst.validation.internal.provisional.core.IMessage;
-import org.eclipse.wst.validation.internal.provisional.core.IReporter;
public abstract class AbstractOrmBaseColumn<T extends AbstractXmlColumn> extends AbstractOrmNamedColumn<T>
@@ -306,24 +304,8 @@ public abstract class AbstractOrmBaseColumn<T extends AbstractXmlColumn> extends
return getOwner().getDefaultTableName();
}
-
- // ****************** validation ****************
-
@Override
- public void validate(List<IMessage> messages, IReporter reporter) {
- if (this.validateTable(messages)) {
- super.validate(messages, reporter);
- }
- }
-
- /**
- * Return true if the table is valid and no messages are logged
- */
- protected boolean validateTable(List<IMessage> messages) {
- if (this.tableNameIsInvalid()) {
- messages.add(this.getOwner().buildTableNotValidMessage(this, this.getTableTextRange()));
- return false;
- }
- return true;
+ protected NamedColumnTextRangeResolver buildTextRangeResolver() {
+ return new OrmBaseColumnTextRangeResolver(this);
}
}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/AbstractOrmBaseEmbeddedMapping.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/AbstractOrmBaseEmbeddedMapping.java
index eb17fbafee..7ad004ba19 100644
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/AbstractOrmBaseEmbeddedMapping.java
+++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/AbstractOrmBaseEmbeddedMapping.java
@@ -18,7 +18,6 @@ import org.eclipse.jpt.core.context.BaseColumn;
import org.eclipse.jpt.core.context.BaseOverride;
import org.eclipse.jpt.core.context.Column;
import org.eclipse.jpt.core.context.Embeddable;
-import org.eclipse.jpt.core.context.NamedColumn;
import org.eclipse.jpt.core.context.TypeMapping;
import org.eclipse.jpt.core.context.java.JavaAttributeOverride;
import org.eclipse.jpt.core.context.java.JavaBaseEmbeddedMapping;
@@ -27,7 +26,11 @@ import org.eclipse.jpt.core.context.orm.OrmAttributeOverrideContainer;
import org.eclipse.jpt.core.context.orm.OrmBaseEmbeddedMapping;
import org.eclipse.jpt.core.context.orm.OrmPersistentAttribute;
import org.eclipse.jpt.core.context.orm.OrmTypeMapping;
+import org.eclipse.jpt.core.internal.context.BaseColumnTextRangeResolver;
+import org.eclipse.jpt.core.internal.context.JptValidator;
import org.eclipse.jpt.core.internal.context.MappingTools;
+import org.eclipse.jpt.core.internal.jpa1.context.AttributeOverrideColumnValidator;
+import org.eclipse.jpt.core.internal.jpa1.context.EntityTableDescriptionProvider;
import org.eclipse.jpt.core.internal.validation.DefaultJpaValidationMessages;
import org.eclipse.jpt.core.internal.validation.JpaValidationDescriptionMessages;
import org.eclipse.jpt.core.internal.validation.JpaValidationMessages;
@@ -286,95 +289,8 @@ public abstract class AbstractOrmBaseEmbeddedMapping<T extends AbstractXmlEmbedd
return getTypeMapping().getPrimaryTableName();
}
- public IMessage buildColumnUnresolvedNameMessage(BaseOverride override, NamedColumn column, TextRange textRange) {
- if (isVirtual()) {
- return this.buildVirtualAttributeUnresolvedColumnTableNotValidMessage(override.getName(), column, textRange);
- }
- if (override.isVirtual()) {
- return this.buildVirtualOverrideUnresolvedColumnNameMessage(override.getName(), column, textRange);
- }
- return DefaultJpaValidationMessages.buildMessage(
- IMessage.HIGH_SEVERITY,
- JpaValidationMessages.COLUMN_UNRESOLVED_NAME,
- new String[] {column.getName(), column.getDbTable().getName()},
- column,
- textRange
- );
- }
-
- protected IMessage buildVirtualAttributeUnresolvedColumnTableNotValidMessage(String overrideName, NamedColumn column, TextRange textRange) {
- return DefaultJpaValidationMessages.buildMessage(
- IMessage.HIGH_SEVERITY,
- JpaValidationMessages.VIRTUAL_ATTRIBUTE_ATTRIBUTE_OVERRIDE_COLUMN_UNRESOLVED_NAME,
- new String[] {
- AbstractOrmBaseEmbeddedMapping.this.getName(),
- overrideName,
- column.getName(),
- column.getDbTable().getName()},
- column,
- textRange
- );
- }
-
- protected IMessage buildVirtualOverrideUnresolvedColumnNameMessage(String overrideName, NamedColumn column, TextRange textRange) {
- return DefaultJpaValidationMessages.buildMessage(
- IMessage.HIGH_SEVERITY,
- JpaValidationMessages.VIRTUAL_ATTRIBUTE_OVERRIDE_COLUMN_UNRESOLVED_NAME,
- new String[] {
- overrideName,
- column.getName(),
- column.getDbTable().getName()},
- column,
- textRange
- );
- }
-
- public IMessage buildColumnTableNotValidMessage(BaseOverride override, BaseColumn column, TextRange textRange) {
- if (isVirtual()) {
- return this.buildVirtualAttributeColumnTableNotValidMessage(override.getName(), column, textRange);
- }
- if (override.isVirtual()) {
- return this.buildVirtualOverrideColumnTableNotValidMessage(override.getName(), column, textRange);
- }
- return DefaultJpaValidationMessages.buildMessage(
- IMessage.HIGH_SEVERITY,
- JpaValidationMessages.COLUMN_TABLE_NOT_VALID,
- new String[] {
- column.getTable(),
- column.getName(),
- JpaValidationDescriptionMessages.NOT_VALID_FOR_THIS_ENTITY},
- column,
- textRange
- );
- }
-
- protected IMessage buildVirtualAttributeColumnTableNotValidMessage(String overrideName, BaseColumn column, TextRange textRange) {
- return DefaultJpaValidationMessages.buildMessage(
- IMessage.HIGH_SEVERITY,
- JpaValidationMessages.VIRTUAL_ATTRIBUTE_ATTRIBUTE_OVERRIDE_COLUMN_TABLE_NOT_VALID,
- new String[] {
- AbstractOrmBaseEmbeddedMapping.this.getName(),
- overrideName,
- column.getTable(),
- column.getName(),
- JpaValidationDescriptionMessages.NOT_VALID_FOR_THIS_ENTITY},
- column,
- textRange
- );
- }
-
- protected IMessage buildVirtualOverrideColumnTableNotValidMessage(String overrideName, BaseColumn column, TextRange textRange) {
- return DefaultJpaValidationMessages.buildMessage(
- IMessage.HIGH_SEVERITY,
- JpaValidationMessages.VIRTUAL_ATTRIBUTE_OVERRIDE_COLUMN_TABLE_NOT_VALID,
- new String[] {
- overrideName,
- column.getTable(),
- column.getName(),
- JpaValidationDescriptionMessages.NOT_VALID_FOR_THIS_ENTITY},
- column,
- textRange
- );
+ public JptValidator buildColumnValidator(BaseOverride override, BaseColumn column, BaseColumn.Owner owner, BaseColumnTextRangeResolver textRangeResolver) {
+ return new AttributeOverrideColumnValidator(getPersistentAttribute(), (AttributeOverride) override, column, textRangeResolver, new EntityTableDescriptionProvider());
}
public TextRange getValidationTextRange() {
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/AbstractOrmBasicMapping.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/AbstractOrmBasicMapping.java
index 9e16e77fd1..9b8c362169 100644
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/AbstractOrmBasicMapping.java
+++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/AbstractOrmBasicMapping.java
@@ -28,14 +28,15 @@ import org.eclipse.jpt.core.context.orm.OrmColumn;
import org.eclipse.jpt.core.context.orm.OrmColumnMapping;
import org.eclipse.jpt.core.context.orm.OrmConverter;
import org.eclipse.jpt.core.context.orm.OrmPersistentAttribute;
-import org.eclipse.jpt.core.internal.validation.DefaultJpaValidationMessages;
-import org.eclipse.jpt.core.internal.validation.JpaValidationDescriptionMessages;
-import org.eclipse.jpt.core.internal.validation.JpaValidationMessages;
+import org.eclipse.jpt.core.internal.context.BaseColumnTextRangeResolver;
+import org.eclipse.jpt.core.internal.context.JptValidator;
+import org.eclipse.jpt.core.internal.context.NamedColumnTextRangeResolver;
+import org.eclipse.jpt.core.internal.jpa1.context.EntityTableDescriptionProvider;
+import org.eclipse.jpt.core.internal.jpa1.context.NamedColumnValidator;
import org.eclipse.jpt.core.resource.orm.Attributes;
import org.eclipse.jpt.core.resource.orm.OrmFactory;
import org.eclipse.jpt.core.resource.orm.XmlBasic;
import org.eclipse.jpt.core.resource.orm.XmlColumn;
-import org.eclipse.jpt.core.utility.TextRange;
import org.eclipse.jpt.db.Table;
import org.eclipse.jpt.utility.internal.iterables.CompositeIterable;
import org.eclipse.jpt.utility.internal.iterables.EmptyIterable;
@@ -327,57 +328,8 @@ public abstract class AbstractOrmBasicMapping<T extends XmlBasic>
super.validate(messages, reporter);
getColumn().validate(messages, reporter);
}
-
- public IMessage buildUnresolvedNameMessage(NamedColumn column, TextRange textRange) {
- if (isVirtual()) {
- return this.buildVirtualUnresolvedNameMessage(column, textRange);
- }
- return DefaultJpaValidationMessages.buildMessage(
- IMessage.HIGH_SEVERITY,
- JpaValidationMessages.COLUMN_UNRESOLVED_NAME,
- new String[] {column.getName(), column.getDbTable().getName()},
- column,
- textRange
- );
- }
-
- protected IMessage buildVirtualUnresolvedNameMessage(NamedColumn column, TextRange textRange) {
- return DefaultJpaValidationMessages.buildMessage(
- IMessage.HIGH_SEVERITY,
- JpaValidationMessages.VIRTUAL_ATTRIBUTE_COLUMN_UNRESOLVED_NAME,
- new String[] {getName(), column.getName(), column.getDbTable().getName()},
- column,
- textRange
- );
- }
-
- public IMessage buildTableNotValidMessage(BaseColumn column, TextRange textRange) {
- if (isVirtual()) {
- return this.buildVirtualTableNotValidMessage(column, textRange);
- }
- return DefaultJpaValidationMessages.buildMessage(
- IMessage.HIGH_SEVERITY,
- JpaValidationMessages.COLUMN_TABLE_NOT_VALID,
- new String[] {
- column.getTable(),
- column.getName(),
- JpaValidationDescriptionMessages.NOT_VALID_FOR_THIS_ENTITY},
- column,
- textRange
- );
- }
- public IMessage buildVirtualTableNotValidMessage(BaseColumn column, TextRange textRange) {
- return DefaultJpaValidationMessages.buildMessage(
- IMessage.HIGH_SEVERITY,
- JpaValidationMessages.VIRTUAL_ATTRIBUTE_COLUMN_TABLE_NOT_VALID,
- new String[] {
- getName(),
- column.getTable(),
- column.getName(),
- JpaValidationDescriptionMessages.NOT_VALID_FOR_THIS_ENTITY},
- column,
- textRange
- );
+ public JptValidator buildColumnValidator(NamedColumn column, NamedColumnTextRangeResolver textRangeResolver) {
+ return new NamedColumnValidator(getPersistentAttribute(), (BaseColumn) column, (BaseColumnTextRangeResolver) textRangeResolver, new EntityTableDescriptionProvider());
}
}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/AbstractOrmEntity.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/AbstractOrmEntity.java
index 2527e54927..4c2cc22d83 100644
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/AbstractOrmEntity.java
+++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/AbstractOrmEntity.java
@@ -17,8 +17,8 @@ import java.util.ListIterator;
import org.eclipse.emf.common.util.EList;
import org.eclipse.jdt.core.IPackageFragment;
import org.eclipse.jdt.core.IType;
-import org.eclipse.jpt.core.MappingKeys;
import org.eclipse.jpt.core.JpaPlatformVariation.Supported;
+import org.eclipse.jpt.core.MappingKeys;
import org.eclipse.jpt.core.context.AssociationOverride;
import org.eclipse.jpt.core.context.AttributeMapping;
import org.eclipse.jpt.core.context.AttributeOverride;
@@ -30,6 +30,7 @@ import org.eclipse.jpt.core.context.DiscriminatorColumn;
import org.eclipse.jpt.core.context.DiscriminatorType;
import org.eclipse.jpt.core.context.Entity;
import org.eclipse.jpt.core.context.InheritanceType;
+import org.eclipse.jpt.core.context.JoinColumn;
import org.eclipse.jpt.core.context.NamedColumn;
import org.eclipse.jpt.core.context.PersistentAttribute;
import org.eclipse.jpt.core.context.PersistentType;
@@ -60,13 +61,19 @@ import org.eclipse.jpt.core.context.orm.OrmQueryContainer;
import org.eclipse.jpt.core.context.orm.OrmSecondaryTable;
import org.eclipse.jpt.core.context.orm.OrmTable;
import org.eclipse.jpt.core.context.orm.OrmTypeMapping;
+import org.eclipse.jpt.core.internal.context.BaseColumnTextRangeResolver;
import org.eclipse.jpt.core.internal.context.EntityTextRangeResolver;
-import org.eclipse.jpt.core.internal.context.MappingTools;
+import org.eclipse.jpt.core.internal.context.JoinColumnTextRangeResolver;
import org.eclipse.jpt.core.internal.context.JptValidator;
+import org.eclipse.jpt.core.internal.context.MappingTools;
+import org.eclipse.jpt.core.internal.context.NamedColumnTextRangeResolver;
import org.eclipse.jpt.core.internal.context.java.AbstractJavaEntity;
+import org.eclipse.jpt.core.internal.jpa1.context.AssociationOverrideJoinColumnValidator;
+import org.eclipse.jpt.core.internal.jpa1.context.AttributeOverrideColumnValidator;
+import org.eclipse.jpt.core.internal.jpa1.context.DiscriminatorColumnValidator;
+import org.eclipse.jpt.core.internal.jpa1.context.EntityTableDescriptionProvider;
import org.eclipse.jpt.core.internal.jpa1.context.GenericEntityPrimaryKeyValidator;
import org.eclipse.jpt.core.internal.validation.DefaultJpaValidationMessages;
-import org.eclipse.jpt.core.internal.validation.JpaValidationDescriptionMessages;
import org.eclipse.jpt.core.internal.validation.JpaValidationMessages;
import org.eclipse.jpt.core.jpa2.context.SingleRelationshipMapping2_0;
import org.eclipse.jpt.core.jpa2.context.orm.OrmCacheableHolder2_0;
@@ -258,14 +265,8 @@ public abstract class AbstractOrmEntity
DiscriminatorColumn.DEFAULT_DISCRIMINATOR_TYPE;
}
- public IMessage buildUnresolvedNameMessage(NamedColumn column, TextRange textRange) {
- return DefaultJpaValidationMessages.buildMessage(
- IMessage.HIGH_SEVERITY,
- JpaValidationMessages.DISCRIMINATOR_COLUMN_UNRESOLVED_NAME,
- new String[] {column.getName(), column.getDbTable().getName()},
- column,
- textRange
- );
+ public JptValidator buildColumnValidator(NamedColumn column, NamedColumnTextRangeResolver textRangeResolver) {
+ return new DiscriminatorColumnValidator(column, textRangeResolver);
}
public TextRange getValidationTextRange() {
@@ -1844,126 +1845,8 @@ public abstract class AbstractOrmEntity
return AbstractOrmEntity.this.getPrimaryTableName();
}
- public IMessage buildColumnTableNotValidMessage(BaseOverride override, BaseColumn column, TextRange textRange) {
- if (override.isVirtual()) {
- return this.buildVirtualOverrideColumnTableNotValidMessage(override.getName(), column, textRange);
- }
- return DefaultJpaValidationMessages.buildMessage(
- IMessage.HIGH_SEVERITY,
- JpaValidationMessages.JOIN_COLUMN_TABLE_NOT_VALID,
- new String[] {
- column.getTable(),
- column.getName(),
- JpaValidationDescriptionMessages.NOT_VALID_FOR_THIS_ENTITY},
- column,
- textRange
- );
- }
-
- protected IMessage buildVirtualOverrideColumnTableNotValidMessage(String overrideName, BaseColumn column, TextRange textRange) {
- return DefaultJpaValidationMessages.buildMessage(
- IMessage.HIGH_SEVERITY,
- JpaValidationMessages.VIRTUAL_ASSOCIATION_OVERRIDE_JOIN_COLUMN_TABLE_NOT_VALID,
- new String[] {
- overrideName,
- column.getTable(),
- column.getName(),
- JpaValidationDescriptionMessages.NOT_VALID_FOR_THIS_ENTITY},
- column,
- textRange
- );
- }
-
- public IMessage buildColumnUnresolvedNameMessage(BaseOverride override, NamedColumn column, TextRange textRange) {
- if (override.isVirtual()) {
- return this.buildVirtualColumnUnresolvedNameMessage(override.getName(), column, textRange);
- }
- return DefaultJpaValidationMessages.buildMessage(
- IMessage.HIGH_SEVERITY,
- JpaValidationMessages.JOIN_COLUMN_UNRESOLVED_NAME,
- new String[] {column.getName(), column.getDbTable().getName()},
- column,
- textRange
- );
- }
-
- protected IMessage buildVirtualColumnUnresolvedNameMessage(String overrideName, NamedColumn column, TextRange textRange) {
- return DefaultJpaValidationMessages.buildMessage(
- IMessage.HIGH_SEVERITY,
- JpaValidationMessages.VIRTUAL_ASSOCIATION_OVERRIDE_JOIN_COLUMN_UNRESOLVED_NAME,
- new String[] {overrideName, column.getName(), column.getDbTable().getName()},
- column,
- textRange
- );
- }
-
- public IMessage buildColumnUnresolvedReferencedColumnNameMessage(AssociationOverride override, BaseJoinColumn column, TextRange textRange) {
- if (override.isVirtual()) {
- return this.buildVirtualColumnUnresolvedReferencedColumnNameMessage(override.getName(), column, textRange);
- }
- return DefaultJpaValidationMessages.buildMessage(
- IMessage.HIGH_SEVERITY,
- JpaValidationMessages.JOIN_COLUMN_UNRESOLVED_REFERENCED_COLUMN_NAME,
- new String[] {column.getReferencedColumnName(), column.getReferencedColumnDbTable().getName()},
- column,
- textRange
- );
- }
-
- protected IMessage buildVirtualColumnUnresolvedReferencedColumnNameMessage(String overrideName, BaseJoinColumn column, TextRange textRange) {
- return DefaultJpaValidationMessages.buildMessage(
- IMessage.HIGH_SEVERITY,
- JpaValidationMessages.VIRTUAL_ASSOCIATION_OVERRIDE_JOIN_COLUMN_UNRESOLVED_REFERENCED_COLUMN_NAME,
- new String[] {overrideName, column.getReferencedColumnName(), column.getReferencedColumnDbTable().getName()},
- column,
- textRange
- );
- }
-
- public IMessage buildUnspecifiedNameMultipleJoinColumnsMessage(AssociationOverride override, BaseJoinColumn column, TextRange textRange) {
- if (override.isVirtual()) {
- return this.buildVirtualUnspecifiedNameMultipleJoinColumnsMessage(override.getName(), column, textRange);
- }
- return DefaultJpaValidationMessages.buildMessage(
- IMessage.HIGH_SEVERITY,
- JpaValidationMessages.JOIN_COLUMN_NAME_MUST_BE_SPECIFIED_MULTIPLE_JOIN_COLUMNS,
- new String[0],
- column,
- textRange
- );
- }
-
- protected IMessage buildVirtualUnspecifiedNameMultipleJoinColumnsMessage(String overrideName, BaseJoinColumn column, TextRange textRange) {
- return DefaultJpaValidationMessages.buildMessage(
- IMessage.HIGH_SEVERITY,
- JpaValidationMessages.VIRTUAL_ASSOCIATION_OVERRIDE_JOIN_COLUMN_NAME_MUST_BE_SPECIFIED_MULTIPLE_JOIN_COLUMNS,
- new String[] {overrideName},
- column,
- textRange
- );
- }
-
- public IMessage buildUnspecifiedReferencedColumnNameMultipleJoinColumnsMessage(AssociationOverride override, BaseJoinColumn column, TextRange textRange) {
- if (override.isVirtual()) {
- return this.buildVirtualUnspecifiedReferencedColumnNameMultipleJoinColumnsMessage(override.getName(), column, textRange);
- }
- return DefaultJpaValidationMessages.buildMessage(
- IMessage.HIGH_SEVERITY,
- JpaValidationMessages.JOIN_COLUMN_REFERENCED_COLUMN_NAME_MUST_BE_SPECIFIED_MULTIPLE_JOIN_COLUMNS,
- new String[0],
- column,
- textRange
- );
- }
-
- protected IMessage buildVirtualUnspecifiedReferencedColumnNameMultipleJoinColumnsMessage(String overrideName, BaseJoinColumn column, TextRange textRange) {
- return DefaultJpaValidationMessages.buildMessage(
- IMessage.HIGH_SEVERITY,
- JpaValidationMessages.VIRTUAL_ASSOCIATION_OVERRIDE_JOIN_COLUMN_REFERENCED_COLUMN_NAME_MUST_BE_SPECIFIED_MULTIPLE_JOIN_COLUMNS,
- new String[] {overrideName},
- column,
- textRange
- );
+ public JptValidator buildColumnValidator(BaseOverride override, BaseColumn column, BaseColumn.Owner owner, BaseColumnTextRangeResolver textRangeResolver) {
+ return new AssociationOverrideJoinColumnValidator((AssociationOverride) override, (JoinColumn) column, (JoinColumn.Owner) owner, (JoinColumnTextRangeResolver) textRangeResolver, new EntityTableDescriptionProvider());
}
public TextRange getValidationTextRange() {
@@ -2079,56 +1962,8 @@ public abstract class AbstractOrmEntity
return AbstractOrmEntity.this.getPrimaryTableName();
}
- public IMessage buildColumnUnresolvedNameMessage(BaseOverride override, NamedColumn column, TextRange textRange) {
- if (override.isVirtual()) {
- return this.buildVirtualColumnUnresolvedNameMessage(override.getName(), column, textRange);
- }
- return DefaultJpaValidationMessages.buildMessage(
- IMessage.HIGH_SEVERITY,
- JpaValidationMessages.COLUMN_UNRESOLVED_NAME,
- new String[] {column.getName(), column.getDbTable().getName()},
- column,
- textRange
- );
- }
-
- public IMessage buildVirtualColumnUnresolvedNameMessage(String overrideName, NamedColumn column, TextRange textRange) {
- return DefaultJpaValidationMessages.buildMessage(
- IMessage.HIGH_SEVERITY,
- JpaValidationMessages.VIRTUAL_ATTRIBUTE_OVERRIDE_COLUMN_UNRESOLVED_NAME,
- new String[] {overrideName, column.getName(), column.getDbTable().getName()},
- column,
- textRange
- );
- }
-
- public IMessage buildColumnTableNotValidMessage(BaseOverride override, BaseColumn column, TextRange textRange) {
- if (override.isVirtual()) {
- return this.buildVirtualOverrideColumnTableNotValidMessage(override.getName(), column, textRange);
- }
- return DefaultJpaValidationMessages.buildMessage(
- IMessage.HIGH_SEVERITY,
- JpaValidationMessages.COLUMN_TABLE_NOT_VALID,
- new String[] {
- column.getTable(),
- column.getName(),
- JpaValidationDescriptionMessages.NOT_VALID_FOR_THIS_ENTITY},
- column,
- textRange
- );
- }
-
- protected IMessage buildVirtualOverrideColumnTableNotValidMessage(String overrideName, BaseColumn column, TextRange textRange) {
- return DefaultJpaValidationMessages.buildMessage(
- IMessage.HIGH_SEVERITY,
- JpaValidationMessages.VIRTUAL_ATTRIBUTE_OVERRIDE_COLUMN_TABLE_NOT_VALID,
- new String[] {overrideName,
- column.getTable(),
- column.getName(),
- JpaValidationDescriptionMessages.NOT_VALID_FOR_THIS_ENTITY},
- column,
- textRange
- );
+ public JptValidator buildColumnValidator(BaseOverride override, BaseColumn column, BaseColumn.Owner owner, BaseColumnTextRangeResolver textRangeResolver) {
+ return new AttributeOverrideColumnValidator((AttributeOverride) override, column, textRangeResolver, new EntityTableDescriptionProvider());
}
public TextRange getValidationTextRange() {
@@ -2176,19 +2011,7 @@ public abstract class AbstractOrmEntity
return null;
}
- public IMessage buildUnresolvedNameMessage(NamedColumn column, TextRange textRange) {
- throw new UnsupportedOperationException("validation not supported yet: bug 148262"); //$NON-NLS-1$
- }
-
- public IMessage buildUnresolvedReferencedColumnNameMessage(BaseJoinColumn column, TextRange textRange) {
- throw new UnsupportedOperationException("validation not supported yet: bug 148262"); //$NON-NLS-1$
- }
-
- public IMessage buildUnspecifiedNameMultipleJoinColumnsMessage(BaseJoinColumn column, TextRange textRange) {
- throw new UnsupportedOperationException("validation not supported yet: bug 148262"); //$NON-NLS-1$
- }
-
- public IMessage buildUnspecifiedReferencedColumnNameMultipleJoinColumnsMessage(BaseJoinColumn column, TextRange textRange) {
+ public JptValidator buildColumnValidator(NamedColumn column, NamedColumnTextRangeResolver textRangeResolver) {
throw new UnsupportedOperationException("validation not supported yet: bug 148262"); //$NON-NLS-1$
}
}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/AbstractOrmIdMapping.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/AbstractOrmIdMapping.java
index 04451b213b..53fd40cc92 100644
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/AbstractOrmIdMapping.java
+++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/AbstractOrmIdMapping.java
@@ -27,6 +27,11 @@ import org.eclipse.jpt.core.context.orm.OrmGeneratedValue;
import org.eclipse.jpt.core.context.orm.OrmGeneratorContainer;
import org.eclipse.jpt.core.context.orm.OrmIdMapping;
import org.eclipse.jpt.core.context.orm.OrmPersistentAttribute;
+import org.eclipse.jpt.core.internal.context.BaseColumnTextRangeResolver;
+import org.eclipse.jpt.core.internal.context.JptValidator;
+import org.eclipse.jpt.core.internal.context.NamedColumnTextRangeResolver;
+import org.eclipse.jpt.core.internal.jpa1.context.EntityTableDescriptionProvider;
+import org.eclipse.jpt.core.internal.jpa1.context.NamedColumnValidator;
import org.eclipse.jpt.core.internal.validation.DefaultJpaValidationMessages;
import org.eclipse.jpt.core.internal.validation.JpaValidationDescriptionMessages;
import org.eclipse.jpt.core.internal.validation.JpaValidationMessages;
@@ -413,58 +418,9 @@ public abstract class AbstractOrmIdMapping<T extends XmlId>
}
this.generatorContainer.validate(messages, reporter);
}
-
- public IMessage buildUnresolvedNameMessage(NamedColumn column, TextRange textRange) {
- if (isVirtual()) {
- return this.buildVirtualUnresolvedNameMessage(column, textRange);
- }
- return DefaultJpaValidationMessages.buildMessage(
- IMessage.HIGH_SEVERITY,
- JpaValidationMessages.COLUMN_UNRESOLVED_NAME,
- new String[] {column.getName(), column.getDbTable().getName()},
- column,
- textRange
- );
- }
-
- protected IMessage buildVirtualUnresolvedNameMessage(NamedColumn column, TextRange textRange) {
- return DefaultJpaValidationMessages.buildMessage(
- IMessage.HIGH_SEVERITY,
- JpaValidationMessages.VIRTUAL_ATTRIBUTE_COLUMN_UNRESOLVED_NAME,
- new String[] {getName(), column.getName(), column.getDbTable().getName()},
- column,
- textRange
- );
- }
-
- public IMessage buildTableNotValidMessage(BaseColumn column, TextRange textRange) {
- if (isVirtual()) {
- return this.buildVirtualTableNotValidMessage(column, textRange);
- }
- return DefaultJpaValidationMessages.buildMessage(
- IMessage.HIGH_SEVERITY,
- JpaValidationMessages.COLUMN_TABLE_NOT_VALID,
- new String[] {
- column.getTable(),
- column.getName(),
- JpaValidationDescriptionMessages.NOT_VALID_FOR_THIS_ENTITY},
- column,
- textRange
- );
- }
-
- public IMessage buildVirtualTableNotValidMessage(BaseColumn column, TextRange textRange) {
- return DefaultJpaValidationMessages.buildMessage(
- IMessage.HIGH_SEVERITY,
- JpaValidationMessages.VIRTUAL_ATTRIBUTE_COLUMN_TABLE_NOT_VALID,
- new String[] {
- getName(),
- column.getTable(),
- column.getName(),
- JpaValidationDescriptionMessages.NOT_VALID_FOR_THIS_ENTITY},
- column,
- textRange
- );
+
+ public JptValidator buildColumnValidator(NamedColumn column, NamedColumnTextRangeResolver textRangeResolver) {
+ return new NamedColumnValidator(getPersistentAttribute(), (BaseColumn) column, (BaseColumnTextRangeResolver) textRangeResolver, new EntityTableDescriptionProvider());
}
/* TODO - move to AbstractOrmAttributeMapping? */
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/AbstractOrmJoinColumnInRelationshipMappingJoiningStrategy.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/AbstractOrmJoinColumnInRelationshipMappingJoiningStrategy.java
index 670a504acd..cb82854790 100644
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/AbstractOrmJoinColumnInRelationshipMappingJoiningStrategy.java
+++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/AbstractOrmJoinColumnInRelationshipMappingJoiningStrategy.java
@@ -10,22 +10,24 @@
package org.eclipse.jpt.core.internal.context.orm;
import java.util.Iterator;
-import org.eclipse.jpt.core.context.BaseColumn;
import org.eclipse.jpt.core.context.BaseJoinColumn;
import org.eclipse.jpt.core.context.Entity;
+import org.eclipse.jpt.core.context.JoinColumn;
import org.eclipse.jpt.core.context.NamedColumn;
import org.eclipse.jpt.core.context.PersistentAttribute;
import org.eclipse.jpt.core.context.TypeMapping;
import org.eclipse.jpt.core.context.orm.OrmJoinColumn;
import org.eclipse.jpt.core.context.orm.OrmJoinColumnEnabledRelationshipReference;
import org.eclipse.jpt.core.context.orm.OrmJoinColumn.Owner;
-import org.eclipse.jpt.core.internal.validation.DefaultJpaValidationMessages;
+import org.eclipse.jpt.core.internal.context.JoinColumnTextRangeResolver;
+import org.eclipse.jpt.core.internal.context.JptValidator;
+import org.eclipse.jpt.core.internal.context.NamedColumnTextRangeResolver;
+import org.eclipse.jpt.core.internal.jpa1.context.EntityTableDescriptionProvider;
+import org.eclipse.jpt.core.internal.jpa1.context.JoinColumnValidator;
import org.eclipse.jpt.core.internal.validation.JpaValidationDescriptionMessages;
-import org.eclipse.jpt.core.internal.validation.JpaValidationMessages;
import org.eclipse.jpt.core.resource.orm.XmlJoinColumnsMapping;
import org.eclipse.jpt.core.utility.TextRange;
import org.eclipse.jpt.db.Table;
-import org.eclipse.wst.validation.internal.provisional.core.IMessage;
public abstract class AbstractOrmJoinColumnInRelationshipMappingJoiningStrategy
extends AbstractOrmJoinColumnJoiningStrategy
@@ -125,130 +127,9 @@ public abstract class AbstractOrmJoinColumnInRelationshipMappingJoiningStrategy
public TextRange getValidationTextRange() {
return AbstractOrmJoinColumnInRelationshipMappingJoiningStrategy.this.getValidationTextRange();
}
-
- protected boolean isPersistentAttributeVirtual() {
- return getPersistentAttribute().isVirtual();
- }
-
- public IMessage buildTableNotValidMessage(BaseColumn column, TextRange textRange) {
- if (this.isPersistentAttributeVirtual()) {
- return this.buildVirtualTableNotValidMessage(column, textRange);
- }
- return DefaultJpaValidationMessages.buildMessage(
- IMessage.HIGH_SEVERITY,
- JpaValidationMessages.JOIN_COLUMN_TABLE_NOT_VALID,
- new String[] {
- column.getTable(),
- column.getName(),
- JpaValidationDescriptionMessages.NOT_VALID_FOR_THIS_ENTITY},
- column,
- textRange
- );
- }
-
- protected IMessage buildVirtualTableNotValidMessage(BaseColumn column, TextRange textRange) {
- return DefaultJpaValidationMessages.buildMessage(
- IMessage.HIGH_SEVERITY,
- JpaValidationMessages.VIRTUAL_ATTRIBUTE_JOIN_COLUMN_TABLE_NOT_VALID,
- new String[] {
- this.getAttributeName(),
- column.getTable(), column.getName(),
- JpaValidationDescriptionMessages.NOT_VALID_FOR_THIS_ENTITY},
- column,
- textRange
- );
- }
-
- public IMessage buildUnresolvedNameMessage(NamedColumn column, TextRange textRange) {
- if (this.isPersistentAttributeVirtual()) {
- return this.buildVirtualUnresolvedNameMessage(column, textRange);
- }
- return DefaultJpaValidationMessages.buildMessage(
- IMessage.HIGH_SEVERITY,
- JpaValidationMessages.JOIN_COLUMN_UNRESOLVED_NAME,
- new String[] {column.getName(), column.getDbTable().getName()},
- column,
- textRange
- );
- }
-
- protected IMessage buildVirtualUnresolvedNameMessage(NamedColumn column, TextRange textRange) {
- return DefaultJpaValidationMessages.buildMessage(
- IMessage.HIGH_SEVERITY,
- JpaValidationMessages.VIRTUAL_ATTRIBUTE_JOIN_COLUMN_UNRESOLVED_NAME,
- new String[] {this.getAttributeName(), column.getName(), column.getDbTable().getName()},
- column,
- textRange
- );
- }
-
- public IMessage buildUnresolvedReferencedColumnNameMessage(BaseJoinColumn column, TextRange textRange) {
- if (this.isPersistentAttributeVirtual()) {
- return this.buildVirtualUnresolvedReferencedColumnNameMessage(column, textRange);
- }
- return DefaultJpaValidationMessages.buildMessage(
- IMessage.HIGH_SEVERITY,
- JpaValidationMessages.JOIN_COLUMN_UNRESOLVED_REFERENCED_COLUMN_NAME,
- new String[] {column.getReferencedColumnName(), column.getReferencedColumnDbTable().getName()},
- column,
- textRange
- );
- }
-
- protected IMessage buildVirtualUnresolvedReferencedColumnNameMessage(BaseJoinColumn column, TextRange textRange) {
- return DefaultJpaValidationMessages.buildMessage(
- IMessage.HIGH_SEVERITY,
- JpaValidationMessages.VIRTUAL_ATTRIBUTE_JOIN_COLUMN_UNRESOLVED_REFERENCED_COLUMN_NAME,
- new String[] {this.getAttributeName(), column.getReferencedColumnName(), column.getReferencedColumnDbTable().getName()},
- column,
- textRange
- );
- }
-
- public IMessage buildUnspecifiedNameMultipleJoinColumnsMessage(BaseJoinColumn column, TextRange textRange) {
- if (this.isPersistentAttributeVirtual()) {
- return this.buildVirtualUnspecifiedNameMultipleJoinColumnsMessage(column, textRange);
- }
- return DefaultJpaValidationMessages.buildMessage(
- IMessage.HIGH_SEVERITY,
- JpaValidationMessages.JOIN_COLUMN_NAME_MUST_BE_SPECIFIED_MULTIPLE_JOIN_COLUMNS,
- new String[0],
- column,
- textRange
- );
- }
-
- protected IMessage buildVirtualUnspecifiedNameMultipleJoinColumnsMessage(BaseJoinColumn column, TextRange textRange) {
- return DefaultJpaValidationMessages.buildMessage(
- IMessage.HIGH_SEVERITY,
- JpaValidationMessages.VIRTUAL_ATTRIBUTE_JOIN_COLUMN_NAME_MUST_BE_SPECIFIED_MULTIPLE_JOIN_COLUMNS,
- new String[] {this.getAttributeName()},
- column,
- textRange
- );
- }
-
- public IMessage buildUnspecifiedReferencedColumnNameMultipleJoinColumnsMessage(BaseJoinColumn column, TextRange textRange) {
- if (this.isPersistentAttributeVirtual()) {
- return this.buildVirtualUnspecifiedReferencedColumnNameMultipleJoinColumnsMessage(column, textRange);
- }
- return DefaultJpaValidationMessages.buildMessage(
- IMessage.HIGH_SEVERITY,
- JpaValidationMessages.JOIN_COLUMN_REFERENCED_COLUMN_NAME_MUST_BE_SPECIFIED_MULTIPLE_JOIN_COLUMNS,
- new String[0],
- column,
- textRange
- );
- }
- protected IMessage buildVirtualUnspecifiedReferencedColumnNameMultipleJoinColumnsMessage(BaseJoinColumn column, TextRange textRange) {
- return DefaultJpaValidationMessages.buildMessage(
- IMessage.HIGH_SEVERITY,
- JpaValidationMessages.VIRTUAL_ATTRIBUTE_JOIN_COLUMN_REFERENCED_COLUMN_NAME_MUST_BE_SPECIFIED_MULTIPLE_JOIN_COLUMNS,
- new String[] {this.getAttributeName()},
- column,
- textRange
- );
+ public JptValidator buildColumnValidator(NamedColumn column, NamedColumnTextRangeResolver textRangeResolver) {
+ return new JoinColumnValidator(getPersistentAttribute(), (JoinColumn) column, this, (JoinColumnTextRangeResolver) textRangeResolver, new EntityTableDescriptionProvider());
}
}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/AbstractOrmMultiRelationshipMapping.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/AbstractOrmMultiRelationshipMapping.java
index d360b28a4b..07c9743f8c 100644
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/AbstractOrmMultiRelationshipMapping.java
+++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/AbstractOrmMultiRelationshipMapping.java
@@ -16,6 +16,7 @@ import org.eclipse.emf.common.util.EList;
import org.eclipse.jdt.core.IPackageFragment;
import org.eclipse.jdt.core.IType;
import org.eclipse.jpt.core.context.AttributeMapping;
+import org.eclipse.jpt.core.context.AttributeOverride;
import org.eclipse.jpt.core.context.BaseColumn;
import org.eclipse.jpt.core.context.BaseOverride;
import org.eclipse.jpt.core.context.CollectionMapping;
@@ -35,9 +36,13 @@ import org.eclipse.jpt.core.context.orm.OrmMultiRelationshipMapping;
import org.eclipse.jpt.core.context.orm.OrmOrderable;
import org.eclipse.jpt.core.context.orm.OrmPersistentAttribute;
import org.eclipse.jpt.core.context.orm.OrmTypeMapping;
+import org.eclipse.jpt.core.internal.context.BaseColumnTextRangeResolver;
+import org.eclipse.jpt.core.internal.context.JptValidator;
import org.eclipse.jpt.core.internal.context.MappingTools;
-import org.eclipse.jpt.core.internal.validation.DefaultJpaValidationMessages;
-import org.eclipse.jpt.core.internal.validation.JpaValidationMessages;
+import org.eclipse.jpt.core.internal.context.NamedColumnTextRangeResolver;
+import org.eclipse.jpt.core.internal.jpa1.context.JoiningStrategyTableDescriptionProvider;
+import org.eclipse.jpt.core.internal.jpa1.context.MapKeyAttributeOverrideColumnValidator;
+import org.eclipse.jpt.core.internal.jpa1.context.MapKeyColumnValidator;
import org.eclipse.jpt.core.jpa2.context.Orderable2_0;
import org.eclipse.jpt.core.jpa2.context.java.JavaCollectionMapping2_0;
import org.eclipse.jpt.core.jpa2.context.orm.OrmCollectionMapping2_0;
@@ -727,50 +732,8 @@ public abstract class AbstractOrmMultiRelationshipMapping<T extends AbstractXmlM
return AbstractOrmMultiRelationshipMapping.this.getValidationTextRange();
}
- public IMessage buildTableNotValidMessage(BaseColumn column, TextRange textRange) {
- if (isVirtual()) {
- return this.buildVirtualTableNotValidMessage(column, textRange);
- }
- return DefaultJpaValidationMessages.buildMessage(
- IMessage.HIGH_SEVERITY,
- JpaValidationMessages.MAP_KEY_COLUMN_TABLE_NOT_VALID,
- new String[] {column.getTable(), column.getName(), getPredominantJoiningStrategy().getColumnTableNotValidDescription()},
- column,
- textRange
- );
- }
-
- protected IMessage buildVirtualTableNotValidMessage(BaseColumn column, TextRange textRange) {
- return DefaultJpaValidationMessages.buildMessage(
- IMessage.HIGH_SEVERITY,
- JpaValidationMessages.VIRTUAL_ATTRIBUTE_MAP_KEY_COLUMN_TABLE_NOT_VALID,
- new String[] {getName(), column.getTable(), column.getName(), getPredominantJoiningStrategy().getColumnTableNotValidDescription()},
- column,
- textRange
- );
- }
-
- public IMessage buildUnresolvedNameMessage(NamedColumn column, TextRange textRange) {
- if (isVirtual()) {
- return this.buildVirtualUnresolvedNameMessage(column, textRange);
- }
- return DefaultJpaValidationMessages.buildMessage(
- IMessage.HIGH_SEVERITY,
- JpaValidationMessages.MAP_KEY_COLUMN_UNRESOLVED_NAME,
- new String[] {column.getName(), column.getDbTable().getName()},
- column,
- textRange
- );
- }
-
- protected IMessage buildVirtualUnresolvedNameMessage(NamedColumn column, TextRange textRange) {
- return DefaultJpaValidationMessages.buildMessage(
- IMessage.HIGH_SEVERITY,
- JpaValidationMessages.VIRTUAL_ATTRIBUTE_MAP_KEY_COLUMN_UNRESOLVED_NAME,
- new String[] {getName(), column.getName(), column.getDbTable().getName()},
- column,
- textRange
- );
+ public JptValidator buildColumnValidator(NamedColumn column, NamedColumnTextRangeResolver textRangeResolver) {
+ return new MapKeyColumnValidator(getPersistentAttribute(), (BaseColumn) column, (BaseColumnTextRangeResolver) textRangeResolver, new JoiningStrategyTableDescriptionProvider(getPredominantJoiningStrategy()));
}
}
@@ -839,97 +802,8 @@ public abstract class AbstractOrmMultiRelationshipMapping<T extends AbstractXmlM
return !StringTools.stringsAreEqual(getDefaultTableName(), tableName);
}
- public IMessage buildColumnUnresolvedNameMessage(BaseOverride override, NamedColumn column, TextRange textRange) {
- if (isVirtual()) {
- return this.buildVirtualAttributeColumnUnresolvedNameMessage(override.getName(), column, textRange);
- }
- if (override.isVirtual()) {
- return this.buildVirtualOverrideColumnUnresolvedNameMessage(override.getName(), column, textRange);
- }
- return DefaultJpaValidationMessages.buildMessage(
- IMessage.HIGH_SEVERITY,
- JpaValidationMessages.COLUMN_UNRESOLVED_NAME,
- new String[] {
- column.getName(),
- column.getDbTable().getName()},
- column,
- textRange
- );
- }
-
- protected IMessage buildVirtualAttributeColumnUnresolvedNameMessage(String overrideName, NamedColumn column, TextRange textRange) {
- return DefaultJpaValidationMessages.buildMessage(
- IMessage.HIGH_SEVERITY,
- JpaValidationMessages.VIRTUAL_ATTRIBUTE_MAP_KEY_ATTRIBUTE_OVERRIDE_COLUMN_UNRESOLVED_NAME,
- new String[] {
- AbstractOrmMultiRelationshipMapping.this.getName(),
- overrideName,
- column.getName(),
- column.getDbTable().getName()},
- column,
- textRange
- );
- }
-
- protected IMessage buildVirtualOverrideColumnUnresolvedNameMessage(String overrideName, NamedColumn column, TextRange textRange) {
- return DefaultJpaValidationMessages.buildMessage(
- IMessage.HIGH_SEVERITY,
- JpaValidationMessages.VIRTUAL_MAP_KEY_ATTRIBUTE_OVERRIDE_COLUMN_UNRESOLVED_NAME,
- new String[] {
- overrideName,
- column.getName(),
- column.getDbTable().getName()},
- column,
- textRange
- );
- }
-
- public IMessage buildColumnTableNotValidMessage(BaseOverride override, BaseColumn column, TextRange textRange) {
- if (isVirtual()) {
- return this.buildVirtualAttributeColumnTableNotValidMessage(override.getName(), column, textRange);
- }
- if (override.isVirtual()) {
- return this.buildVirtualOverrideColumnTableNotValidMessage(override.getName(), column, textRange);
- }
- return DefaultJpaValidationMessages.buildMessage(
- IMessage.HIGH_SEVERITY,
- JpaValidationMessages.COLUMN_TABLE_NOT_VALID,
- new String[] {
- column.getTable(),
- column.getName(),
- getPredominantJoiningStrategy().getColumnTableNotValidDescription()},
- column,
- textRange
- );
- }
-
- protected IMessage buildVirtualAttributeColumnTableNotValidMessage(String overrideName, BaseColumn column, TextRange textRange) {
- return DefaultJpaValidationMessages.buildMessage(
- IMessage.HIGH_SEVERITY,
- JpaValidationMessages.VIRTUAL_ATTRIBUTE_MAP_KEY_ATTRIBUTE_OVERRIDE_COLUMN_TABLE_NOT_VALID,
- new String[] {
- AbstractOrmMultiRelationshipMapping.this.getName(),
- overrideName,
- column.getTable(),
- column.getName(),
- getPredominantJoiningStrategy().getColumnTableNotValidDescription()},
- column,
- textRange
- );
- }
-
- protected IMessage buildVirtualOverrideColumnTableNotValidMessage(String overrideName, BaseColumn column, TextRange textRange) {
- return DefaultJpaValidationMessages.buildMessage(
- IMessage.HIGH_SEVERITY,
- JpaValidationMessages.VIRTUAL_MAP_KEY_ATTRIBUTE_OVERRIDE_COLUMN_TABLE_NOT_VALID,
- new String[] {
- overrideName,
- column.getTable(),
- column.getName(),
- getPredominantJoiningStrategy().getColumnTableNotValidDescription()},
- column,
- textRange
- );
+ public JptValidator buildColumnValidator(BaseOverride override, BaseColumn column, BaseColumn.Owner owner, BaseColumnTextRangeResolver textRangeResolver) {
+ return new MapKeyAttributeOverrideColumnValidator(getPersistentAttribute(), (AttributeOverride) override, column, textRangeResolver, new JoiningStrategyTableDescriptionProvider(getPredominantJoiningStrategy()));
}
public TextRange getValidationTextRange() {
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/AbstractOrmNamedColumn.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/AbstractOrmNamedColumn.java
index cca8d0cb49..74ff5696dd 100644
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/AbstractOrmNamedColumn.java
+++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/AbstractOrmNamedColumn.java
@@ -13,6 +13,8 @@ import java.util.List;
import org.eclipse.jpt.core.context.NamedColumn;
import org.eclipse.jpt.core.context.XmlContextNode;
import org.eclipse.jpt.core.context.orm.OrmNamedColumn;
+import org.eclipse.jpt.core.internal.context.JptValidator;
+import org.eclipse.jpt.core.internal.context.NamedColumnTextRangeResolver;
import org.eclipse.jpt.core.resource.orm.AbstractXmlNamedColumn;
import org.eclipse.jpt.core.utility.TextRange;
import org.eclipse.jpt.db.Column;
@@ -206,14 +208,14 @@ public abstract class AbstractOrmNamedColumn<T extends AbstractXmlNamedColumn> e
@Override
public void validate(List<IMessage> messages, IReporter reporter) {
super.validate(messages, reporter);
- this.validateName(messages);
+ this.buildColumnValidator().validate(messages, reporter);
}
-
- protected void validateName(List<IMessage> messages) {
- Table dbTable = this.getDbTable();
- if (dbTable != null && ! this.isResolved()) {
- messages.add(this.getOwner().buildUnresolvedNameMessage(this, this.getNameTextRange()));
- }
+
+ protected JptValidator buildColumnValidator() {
+ return this.getOwner().buildColumnValidator(this, buildTextRangeResolver());
}
+ protected NamedColumnTextRangeResolver buildTextRangeResolver() {
+ return new OrmNamedColumnTextRangeResolver(this);
+ }
} \ No newline at end of file
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/AbstractOrmVersionMapping.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/AbstractOrmVersionMapping.java
index 3bb0379b24..1265b806b7 100644
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/AbstractOrmVersionMapping.java
+++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/AbstractOrmVersionMapping.java
@@ -24,14 +24,15 @@ import org.eclipse.jpt.core.context.orm.OrmColumnMapping;
import org.eclipse.jpt.core.context.orm.OrmConverter;
import org.eclipse.jpt.core.context.orm.OrmPersistentAttribute;
import org.eclipse.jpt.core.context.orm.OrmVersionMapping;
-import org.eclipse.jpt.core.internal.validation.DefaultJpaValidationMessages;
-import org.eclipse.jpt.core.internal.validation.JpaValidationDescriptionMessages;
-import org.eclipse.jpt.core.internal.validation.JpaValidationMessages;
+import org.eclipse.jpt.core.internal.context.BaseColumnTextRangeResolver;
+import org.eclipse.jpt.core.internal.context.JptValidator;
+import org.eclipse.jpt.core.internal.context.NamedColumnTextRangeResolver;
+import org.eclipse.jpt.core.internal.jpa1.context.EntityTableDescriptionProvider;
+import org.eclipse.jpt.core.internal.jpa1.context.NamedColumnValidator;
import org.eclipse.jpt.core.resource.orm.Attributes;
import org.eclipse.jpt.core.resource.orm.OrmFactory;
import org.eclipse.jpt.core.resource.orm.XmlColumn;
import org.eclipse.jpt.core.resource.orm.XmlVersion;
-import org.eclipse.jpt.core.utility.TextRange;
import org.eclipse.jpt.db.Table;
import org.eclipse.jpt.utility.internal.iterables.CompositeIterable;
import org.eclipse.jpt.utility.internal.iterables.EmptyIterable;
@@ -243,57 +244,8 @@ public abstract class AbstractOrmVersionMapping<T extends XmlVersion>
this.getColumn().validate(messages, reporter);
}
-
- public IMessage buildUnresolvedNameMessage(NamedColumn column, TextRange textRange) {
- if (isVirtual()) {
- return this.buildVirtualUnresolvedNameMessage(column, textRange);
- }
- return DefaultJpaValidationMessages.buildMessage(
- IMessage.HIGH_SEVERITY,
- JpaValidationMessages.COLUMN_UNRESOLVED_NAME,
- new String[] {column.getName(), column.getDbTable().getName()},
- column,
- textRange
- );
- }
-
- protected IMessage buildVirtualUnresolvedNameMessage(NamedColumn column, TextRange textRange) {
- return DefaultJpaValidationMessages.buildMessage(
- IMessage.HIGH_SEVERITY,
- JpaValidationMessages.VIRTUAL_ATTRIBUTE_COLUMN_UNRESOLVED_NAME,
- new String[] {getName(), column.getName(), column.getDbTable().getName()},
- column,
- textRange
- );
- }
-
- public IMessage buildTableNotValidMessage(BaseColumn column, TextRange textRange) {
- if (isVirtual()) {
- return this.buildVirtualTableNotValidMessage(column, textRange);
- }
- return DefaultJpaValidationMessages.buildMessage(
- IMessage.HIGH_SEVERITY,
- JpaValidationMessages.COLUMN_TABLE_NOT_VALID,
- new String[] {
- column.getTable(),
- column.getName(),
- JpaValidationDescriptionMessages.NOT_VALID_FOR_THIS_ENTITY},
- column,
- textRange
- );
- }
- public IMessage buildVirtualTableNotValidMessage(BaseColumn column, TextRange textRange) {
- return DefaultJpaValidationMessages.buildMessage(
- IMessage.HIGH_SEVERITY,
- JpaValidationMessages.VIRTUAL_ATTRIBUTE_COLUMN_TABLE_NOT_VALID,
- new String[] {
- getName(),
- column.getTable(),
- column.getName(),
- JpaValidationDescriptionMessages.NOT_VALID_FOR_THIS_ENTITY},
- column,
- textRange
- );
+ public JptValidator buildColumnValidator(NamedColumn column, NamedColumnTextRangeResolver textRangeResolver) {
+ return new NamedColumnValidator(getPersistentAttribute(), (BaseColumn) column, (BaseColumnTextRangeResolver) textRangeResolver, new EntityTableDescriptionProvider());
}
}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/GenericOrmJoinColumnInAssociationOverrideJoiningStrategy.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/GenericOrmJoinColumnInAssociationOverrideJoiningStrategy.java
index d82061ceca..f1ec5a66de 100644
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/GenericOrmJoinColumnInAssociationOverrideJoiningStrategy.java
+++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/GenericOrmJoinColumnInAssociationOverrideJoiningStrategy.java
@@ -23,10 +23,12 @@ import org.eclipse.jpt.core.context.orm.OrmAssociationOverrideRelationshipRefere
import org.eclipse.jpt.core.context.orm.OrmJoinColumn;
import org.eclipse.jpt.core.context.orm.OrmJoinColumnInAssociationOverrideJoiningStrategy;
import org.eclipse.jpt.core.context.orm.OrmJoinColumn.Owner;
+import org.eclipse.jpt.core.internal.context.BaseColumnTextRangeResolver;
+import org.eclipse.jpt.core.internal.context.JptValidator;
+import org.eclipse.jpt.core.internal.context.NamedColumnTextRangeResolver;
import org.eclipse.jpt.core.resource.orm.XmlAssociationOverride;
import org.eclipse.jpt.core.utility.TextRange;
import org.eclipse.jpt.db.Table;
-import org.eclipse.wst.validation.internal.provisional.core.IMessage;
public class GenericOrmJoinColumnInAssociationOverrideJoiningStrategy
extends AbstractOrmJoinColumnJoiningStrategy
@@ -208,24 +210,8 @@ public class GenericOrmJoinColumnInAssociationOverrideJoiningStrategy
return GenericOrmJoinColumnInAssociationOverrideJoiningStrategy.this.getValidationTextRange();
}
- public IMessage buildTableNotValidMessage(BaseColumn column, TextRange textRange) {
- return getAssociationOverrideOwner().buildColumnTableNotValidMessage(getAssociationOverride(), column, textRange);
- }
-
- public IMessage buildUnresolvedNameMessage(NamedColumn column, TextRange textRange) {
- return getAssociationOverrideOwner().buildColumnUnresolvedNameMessage(getAssociationOverride(), column, textRange);
- }
-
- public IMessage buildUnresolvedReferencedColumnNameMessage(BaseJoinColumn column, TextRange textRange) {
- return getAssociationOverrideOwner().buildColumnUnresolvedReferencedColumnNameMessage(getAssociationOverride(), column, textRange);
- }
-
- public IMessage buildUnspecifiedNameMultipleJoinColumnsMessage(BaseJoinColumn column, TextRange textRange) {
- return getAssociationOverrideOwner().buildUnspecifiedNameMultipleJoinColumnsMessage(getAssociationOverride(), column, textRange);
- }
-
- public IMessage buildUnspecifiedReferencedColumnNameMultipleJoinColumnsMessage(BaseJoinColumn column, TextRange textRange) {
- return getAssociationOverrideOwner().buildUnspecifiedReferencedColumnNameMultipleJoinColumnsMessage(getAssociationOverride(), column, textRange);
+ public JptValidator buildColumnValidator(NamedColumn column, NamedColumnTextRangeResolver textRangeResolver) {
+ return getAssociationOverrideOwner().buildColumnValidator(getAssociationOverride(), (BaseColumn) column, this, (BaseColumnTextRangeResolver) textRangeResolver);
}
}
}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/GenericOrmPrimaryKeyJoinColumnJoiningStrategy.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/GenericOrmPrimaryKeyJoinColumnJoiningStrategy.java
index f1a1758182..73db34143d 100644
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/GenericOrmPrimaryKeyJoinColumnJoiningStrategy.java
+++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/GenericOrmPrimaryKeyJoinColumnJoiningStrategy.java
@@ -26,6 +26,8 @@ import org.eclipse.jpt.core.context.orm.OrmPrimaryKeyJoinColumn;
import org.eclipse.jpt.core.context.orm.OrmPrimaryKeyJoinColumnEnabledRelationshipReference;
import org.eclipse.jpt.core.context.orm.OrmPrimaryKeyJoinColumnJoiningStrategy;
import org.eclipse.jpt.core.context.orm.OrmRelationshipMapping;
+import org.eclipse.jpt.core.internal.context.JptValidator;
+import org.eclipse.jpt.core.internal.context.NamedColumnTextRangeResolver;
import org.eclipse.jpt.core.internal.validation.JpaValidationDescriptionMessages;
import org.eclipse.jpt.core.resource.orm.OrmFactory;
import org.eclipse.jpt.core.resource.orm.XmlOneToOne;
@@ -282,23 +284,7 @@ public class GenericOrmPrimaryKeyJoinColumnJoiningStrategy
return GenericOrmPrimaryKeyJoinColumnJoiningStrategy.this.getValidationTextRange();
}
- public IMessage buildUnresolvedNameMessage(NamedColumn column, TextRange textRange) {
- throw new UnsupportedOperationException("validation not supported yet"); //$NON-NLS-1$
- }
-
- public IMessage buildTableNotValidMessage(BaseColumn column, TextRange textRange) {
- throw new UnsupportedOperationException("validation not supported yet"); //$NON-NLS-1$
- }
-
- public IMessage buildUnresolvedReferencedColumnNameMessage(BaseJoinColumn column, TextRange textRange) {
- throw new UnsupportedOperationException("validation not supported yet"); //$NON-NLS-1$
- }
-
- public IMessage buildUnspecifiedNameMultipleJoinColumnsMessage(BaseJoinColumn column, TextRange textRange) {
- throw new UnsupportedOperationException("validation not supported yet"); //$NON-NLS-1$
- }
-
- public IMessage buildUnspecifiedReferencedColumnNameMultipleJoinColumnsMessage(BaseJoinColumn column, TextRange textRange) {
+ public JptValidator buildColumnValidator(NamedColumn column, NamedColumnTextRangeResolver textRangeResolver) {
throw new UnsupportedOperationException("validation not supported yet"); //$NON-NLS-1$
}
}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/OrmBaseColumnTextRangeResolver.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/OrmBaseColumnTextRangeResolver.java
new file mode 100644
index 0000000000..fef9ec8c82
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/OrmBaseColumnTextRangeResolver.java
@@ -0,0 +1,34 @@
+/*******************************************************************************
+ * Copyright (c) 2010 Oracle.
+ * All rights reserved. This program and the accompanying materials are
+ * made available under the terms of the Eclipse Public License v1.0 which
+ * accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.jpt.core.internal.context.orm;
+
+import org.eclipse.jpt.core.context.orm.OrmBaseColumn;
+import org.eclipse.jpt.core.internal.context.BaseColumnTextRangeResolver;
+import org.eclipse.jpt.core.utility.TextRange;
+
+public class OrmBaseColumnTextRangeResolver
+ extends OrmNamedColumnTextRangeResolver
+ implements BaseColumnTextRangeResolver
+{
+
+ public OrmBaseColumnTextRangeResolver(OrmBaseColumn column) {
+ super(column);
+ }
+
+ @Override
+ protected OrmBaseColumn getColumn() {
+ return (OrmBaseColumn) super.getColumn();
+ }
+
+ public TextRange getTableTextRange() {
+ return this.getColumn().getTableTextRange();
+ }
+}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/OrmJoinColumnTextRangeResolver.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/OrmJoinColumnTextRangeResolver.java
new file mode 100644
index 0000000000..01fd5de12a
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/OrmJoinColumnTextRangeResolver.java
@@ -0,0 +1,41 @@
+/*******************************************************************************
+ * Copyright (c) 2010 Oracle.
+ * All rights reserved. This program and the accompanying materials are
+ * made available under the terms of the Eclipse Public License v1.0 which
+ * accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.jpt.core.internal.context.orm;
+
+import org.eclipse.jpt.core.context.orm.OrmJoinColumn;
+import org.eclipse.jpt.core.internal.context.BaseColumnTextRangeResolver;
+import org.eclipse.jpt.core.internal.context.JoinColumnTextRangeResolver;
+import org.eclipse.jpt.core.utility.TextRange;
+
+public class OrmJoinColumnTextRangeResolver
+ extends OrmNamedColumnTextRangeResolver
+ implements
+ BaseColumnTextRangeResolver,
+ JoinColumnTextRangeResolver
+{
+
+ public OrmJoinColumnTextRangeResolver(OrmJoinColumn column) {
+ super(column);
+ }
+
+ @Override
+ protected OrmJoinColumn getColumn() {
+ return (OrmJoinColumn) super.getColumn();
+ }
+
+ public TextRange getTableTextRange() {
+ return this.getColumn().getTableTextRange();
+ }
+
+ public TextRange getReferencedColumnNameTextRange() {
+ return this.getColumn().getReferencedColumnNameTextRange();
+ }
+}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/OrmNamedColumnTextRangeResolver.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/OrmNamedColumnTextRangeResolver.java
new file mode 100644
index 0000000000..6e31d44b5f
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/OrmNamedColumnTextRangeResolver.java
@@ -0,0 +1,33 @@
+/*******************************************************************************
+ * Copyright (c) 2010 Oracle.
+ * All rights reserved. This program and the accompanying materials are
+ * made available under the terms of the Eclipse Public License v1.0 which
+ * accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.jpt.core.internal.context.orm;
+
+import org.eclipse.jpt.core.context.orm.OrmNamedColumn;
+import org.eclipse.jpt.core.internal.context.NamedColumnTextRangeResolver;
+import org.eclipse.jpt.core.utility.TextRange;
+
+public class OrmNamedColumnTextRangeResolver
+ implements NamedColumnTextRangeResolver
+{
+ protected final OrmNamedColumn ormNamedColumn;
+
+ public OrmNamedColumnTextRangeResolver(OrmNamedColumn javaNamedColumn) {
+ this.ormNamedColumn = javaNamedColumn;
+ }
+
+ protected OrmNamedColumn getColumn() {
+ return this.ormNamedColumn;
+ }
+
+ public TextRange getNameTextRange() {
+ return this.ormNamedColumn.getNameTextRange();
+ }
+}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/OrmPrimaryKeyJoinColumnTextRangeResolver.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/OrmPrimaryKeyJoinColumnTextRangeResolver.java
new file mode 100644
index 0000000000..b8285a35c6
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/OrmPrimaryKeyJoinColumnTextRangeResolver.java
@@ -0,0 +1,35 @@
+/*******************************************************************************
+ * Copyright (c) 2010 Oracle.
+ * All rights reserved. This program and the accompanying materials are
+ * made available under the terms of the Eclipse Public License v1.0 which
+ * accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.jpt.core.internal.context.orm;
+
+import org.eclipse.jpt.core.context.orm.OrmPrimaryKeyJoinColumn;
+import org.eclipse.jpt.core.internal.context.BaseJoinColumnTextRangeResolver;
+import org.eclipse.jpt.core.utility.TextRange;
+
+public class OrmPrimaryKeyJoinColumnTextRangeResolver
+ extends OrmNamedColumnTextRangeResolver
+ implements
+ BaseJoinColumnTextRangeResolver
+{
+
+ public OrmPrimaryKeyJoinColumnTextRangeResolver(OrmPrimaryKeyJoinColumn column) {
+ super(column);
+ }
+
+ @Override
+ protected OrmPrimaryKeyJoinColumn getColumn() {
+ return (OrmPrimaryKeyJoinColumn) super.getColumn();
+ }
+
+ public TextRange getReferencedColumnNameTextRange() {
+ return this.getColumn().getReferencedColumnNameTextRange();
+ }
+}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/AbstractNamedColumnValidator.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/AbstractNamedColumnValidator.java
new file mode 100644
index 0000000000..6fa112dd94
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/AbstractNamedColumnValidator.java
@@ -0,0 +1,150 @@
+/*******************************************************************************
+ * Copyright (c) 2010 Oracle.
+ * All rights reserved. This program and the accompanying materials are
+ * made available under the terms of the Eclipse Public License v1.0 which
+ * accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.jpt.core.internal.jpa1.context;
+
+import java.util.List;
+import org.eclipse.jpt.core.context.NamedColumn;
+import org.eclipse.jpt.core.context.PersistentAttribute;
+import org.eclipse.jpt.core.internal.context.JptValidator;
+import org.eclipse.jpt.core.internal.context.NamedColumnTextRangeResolver;
+import org.eclipse.jpt.core.internal.jpa1.context.BaseColumnTableValidator.NullTableDescriptionProvider;
+import org.eclipse.jpt.core.internal.jpa1.context.BaseColumnTableValidator.TableDescriptionProvider;
+import org.eclipse.jpt.core.internal.validation.DefaultJpaValidationMessages;
+import org.eclipse.jpt.db.Table;
+import org.eclipse.wst.validation.internal.provisional.core.IMessage;
+import org.eclipse.wst.validation.internal.provisional.core.IReporter;
+
+public abstract class AbstractNamedColumnValidator
+ implements JptValidator
+{
+
+ protected final PersistentAttribute persistentAttribute;
+
+ protected final NamedColumn namedColumn;
+
+ protected final NamedColumnTextRangeResolver textRangeResolver;
+
+ protected final TableValidator tableValidator;
+
+ protected final TableDescriptionProvider tableDescriptionProvider;
+
+ protected AbstractNamedColumnValidator(
+ NamedColumn column,
+ NamedColumnTextRangeResolver textRangeResolver) {
+ this(null, column, textRangeResolver);
+ }
+
+ protected AbstractNamedColumnValidator(
+ NamedColumn column,
+ NamedColumnTextRangeResolver textRangeResolver,
+ TableDescriptionProvider provider) {
+ this(null, column, textRangeResolver, provider);
+ }
+
+ protected AbstractNamedColumnValidator(
+ PersistentAttribute persistentAttribute,
+ NamedColumn column,
+ NamedColumnTextRangeResolver textRangeResolver) {
+ this(persistentAttribute, column, textRangeResolver, new NullTableDescriptionProvider());
+ }
+
+ protected AbstractNamedColumnValidator(
+ PersistentAttribute persistentAttribute,
+ NamedColumn column,
+ NamedColumnTextRangeResolver textRangeResolver,
+ TableDescriptionProvider provider) {
+ this.persistentAttribute = persistentAttribute;
+ this.namedColumn = column;
+ this.textRangeResolver = textRangeResolver;
+ this.tableDescriptionProvider = provider;
+ this.tableValidator = this.buildTableValidator();
+ }
+
+ protected TableValidator buildTableValidator() {
+ return new NullTableValidator();
+ }
+
+ public NamedColumn getColumn() {
+ return this.namedColumn;
+ }
+
+ public NamedColumnTextRangeResolver getTextRangeResolver() {
+ return this.textRangeResolver;
+ }
+
+ protected boolean isPersistentAttributeVirtual() {
+ return this.persistentAttribute != null && this.persistentAttribute.isVirtual();
+ }
+
+ protected String getPersistentAttributeName() {
+ return this.persistentAttribute.getName();
+ }
+
+ public void validate(List<IMessage> messages, IReporter reporter) {
+ if (this.tableValidator.isTableNameInvalid()) {
+ this.tableValidator.validate(messages, reporter);
+ }
+ else {
+ this.validateName(messages);
+ }
+ }
+
+ protected void validateName(List<IMessage> messages) {
+ Table dbTable = this.namedColumn.getDbTable();
+ if (dbTable != null && !this.namedColumn.isResolved()) {
+ messages.add(this.buildUnresolvedNameMessage());
+ }
+ }
+
+ protected IMessage buildUnresolvedNameMessage() {
+ if (isPersistentAttributeVirtual()) {
+ return this.buildVirtualAttributeUnresolvedNameMessage();
+ }
+ return this.buildUnresolvedNameMessage(this.getUnresolvedNameMessage());
+ }
+
+ protected IMessage buildUnresolvedNameMessage(String message) {
+ return DefaultJpaValidationMessages.buildMessage(
+ IMessage.HIGH_SEVERITY,
+ message,
+ new String[] {this.namedColumn.getName(), this.namedColumn.getDbTable().getName()},
+ this.namedColumn,
+ this.textRangeResolver.getNameTextRange()
+ );
+ }
+
+ protected abstract String getUnresolvedNameMessage();
+
+ protected IMessage buildVirtualAttributeUnresolvedNameMessage() {
+ return DefaultJpaValidationMessages.buildMessage(
+ IMessage.HIGH_SEVERITY,
+ this.getVirtualAttributeUnresolvedNameMessage(),
+ new String[] {this.getPersistentAttributeName(), this.namedColumn.getName(), this.namedColumn.getDbTable().getName()},
+ this.namedColumn,
+ this.textRangeResolver.getNameTextRange()
+ );
+ }
+
+ protected abstract String getVirtualAttributeUnresolvedNameMessage();
+
+ public interface TableValidator extends JptValidator {
+ boolean isTableNameInvalid();
+ }
+
+ public static class NullTableValidator implements TableValidator {
+ public void validate(List<IMessage> messages, IReporter reporter) {
+ // nothing to validate
+ }
+ public boolean isTableNameInvalid() {
+ return false;
+ }
+ }
+}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/AssociationOverrideJoinColumnValidator.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/AssociationOverrideJoinColumnValidator.java
new file mode 100644
index 0000000000..4f957002d3
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/AssociationOverrideJoinColumnValidator.java
@@ -0,0 +1,235 @@
+/*******************************************************************************
+ * Copyright (c) 2010 Oracle.
+ * All rights reserved. This program and the accompanying materials are
+ * made available under the terms of the Eclipse Public License v1.0 which
+ * accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.jpt.core.internal.jpa1.context;
+
+import org.eclipse.jpt.core.context.AssociationOverride;
+import org.eclipse.jpt.core.context.JoinColumn;
+import org.eclipse.jpt.core.context.PersistentAttribute;
+import org.eclipse.jpt.core.internal.context.JoinColumnTextRangeResolver;
+import org.eclipse.jpt.core.internal.jpa1.context.BaseColumnTableValidator.TableDescriptionProvider;
+import org.eclipse.jpt.core.internal.validation.DefaultJpaValidationMessages;
+import org.eclipse.jpt.core.internal.validation.JpaValidationMessages;
+import org.eclipse.wst.validation.internal.provisional.core.IMessage;
+
+public class AssociationOverrideJoinColumnValidator extends JoinColumnValidator
+{
+ private final AssociationOverride override;
+
+ public AssociationOverrideJoinColumnValidator(
+ AssociationOverride override,
+ JoinColumn column,
+ JoinColumn.Owner joinColumnOwner,
+ JoinColumnTextRangeResolver textRangeResolver,
+ TableDescriptionProvider provider) {
+ super(column, joinColumnOwner, textRangeResolver, provider);
+ this.override = override;
+ }
+
+ public AssociationOverrideJoinColumnValidator(
+ PersistentAttribute persistentAttribute,
+ AssociationOverride override,
+ JoinColumn column,
+ JoinColumn.Owner joinColumnOwner,
+ JoinColumnTextRangeResolver textRangeResolver,
+ TableDescriptionProvider provider) {
+ super(persistentAttribute, column, joinColumnOwner, textRangeResolver, provider);
+ this.override = override;
+ }
+
+ @Override
+ protected TableValidator buildTableValidator() {
+ return new AssociationOverrideJoinColumnTableValidator(this.persistentAttribute, this.getColumn(), this.getTextRangeResolver(), this.tableDescriptionProvider);
+ }
+
+ @Override
+ protected IMessage buildUnresolvedNameMessage() {
+ if (this.override.isVirtual()) {
+ return this.buildVirtualOverrideUnresolvedNameMessage();
+ }
+ return super.buildUnresolvedNameMessage();
+ }
+
+ protected IMessage buildVirtualOverrideUnresolvedNameMessage() {
+ return DefaultJpaValidationMessages.buildMessage(
+ IMessage.HIGH_SEVERITY,
+ JpaValidationMessages.VIRTUAL_ASSOCIATION_OVERRIDE_JOIN_COLUMN_UNRESOLVED_NAME,
+ new String[] {this.override.getName(), this.getColumn().getName(), this.getColumn().getDbTable().getName()},
+ this.getColumn(),
+ this.getTextRangeResolver().getNameTextRange()
+ );
+ }
+
+ @Override
+ protected IMessage buildVirtualAttributeUnresolvedNameMessage() {
+ return DefaultJpaValidationMessages.buildMessage(
+ IMessage.HIGH_SEVERITY,
+ this.getVirtualAttributeUnresolvedNameMessage(),
+ new String[] {
+ this.getPersistentAttributeName(),
+ this.override.getName(),
+ getColumn().getName(),
+ getColumn().getDbTable().getName()},
+ this.namedColumn,
+ this.textRangeResolver.getNameTextRange()
+ );
+ }
+
+ @Override
+ protected String getVirtualAttributeUnresolvedNameMessage() {
+ return JpaValidationMessages.VIRTUAL_ATTRIBUTE_ASSOCIATION_OVERRIDE_JOIN_COLUMN_UNRESOLVED_NAME;
+ }
+
+ @Override
+ public IMessage buildUnresolvedReferencedColumnNameMessage() {
+ if (this.override.isVirtual()) {
+ return this.buildVirtualOverrideUnresolvedReferencedColumnNameMessage();
+ }
+ return super.buildUnresolvedReferencedColumnNameMessage();
+ }
+
+ protected IMessage buildVirtualOverrideUnresolvedReferencedColumnNameMessage() {
+ return DefaultJpaValidationMessages.buildMessage(
+ IMessage.HIGH_SEVERITY,
+ JpaValidationMessages.VIRTUAL_ASSOCIATION_OVERRIDE_JOIN_COLUMN_UNRESOLVED_REFERENCED_COLUMN_NAME,
+ new String[] {this.override.getName(), this.getColumn().getReferencedColumnName(), this.getColumn().getReferencedColumnDbTable().getName()},
+ this.getColumn(),
+ this.getTextRangeResolver().getReferencedColumnNameTextRange()
+ );
+ }
+
+ @Override
+ protected IMessage buildVirtualAttributeUnresolvedReferencedColumnNameMessage() {
+ return DefaultJpaValidationMessages.buildMessage(
+ IMessage.HIGH_SEVERITY,
+ this.getVirtualAttributeUnresolvedReferencedColumnNameMessage(),
+ new String[] {
+ this.getPersistentAttributeName(),
+ this.override.getName(),
+ getColumn().getReferencedColumnName(),
+ getColumn().getReferencedColumnDbTable().getName()},
+ this.getColumn(),
+ this.getTextRangeResolver().getReferencedColumnNameTextRange()
+ );
+ }
+
+ @Override
+ protected String getVirtualAttributeUnresolvedReferencedColumnNameMessage() {
+ return JpaValidationMessages.VIRTUAL_ATTRIBUTE_ASSOCIATION_OVERRIDE_JOIN_COLUMN_REFERENCED_COLUMN_UNRESOLVED_NAME;
+ }
+
+ @Override
+ protected IMessage buildUnspecifiedNameMultipleJoinColumnsMessage() {
+ if (this.override.isVirtual()) {
+ return this.buildVirtualOverrideUnspecifiedNameMultipleJoinColumnsMessage();
+ }
+ return super.buildUnspecifiedNameMultipleJoinColumnsMessage();
+ }
+
+ protected IMessage buildVirtualOverrideUnspecifiedNameMultipleJoinColumnsMessage() {
+ return DefaultJpaValidationMessages.buildMessage(
+ IMessage.HIGH_SEVERITY,
+ JpaValidationMessages.VIRTUAL_ASSOCIATION_OVERRIDE_JOIN_COLUMN_NAME_MUST_BE_SPECIFIED_MULTIPLE_JOIN_COLUMNS,
+ new String[] {this.override.getName()},
+ this.getColumn(),
+ this.getTextRangeResolver().getNameTextRange()
+ );
+ }
+
+ @Override
+ protected IMessage buildVirtualAttributeUnspecifiedNameMultipleJoinColumnsMessage() {
+ return DefaultJpaValidationMessages.buildMessage(
+ IMessage.HIGH_SEVERITY,
+ this.getVirtualAttributeUnspecifiedNameMultipleJoinColumnsMessage(),
+ new String[] {this.getPersistentAttributeName(), this.override.getName()},
+ this.getColumn(),
+ this.getTextRangeResolver().getNameTextRange()
+ );
+ }
+
+ @Override
+ protected String getVirtualAttributeUnspecifiedNameMultipleJoinColumnsMessage() {
+ return JpaValidationMessages.VIRTUAL_ATTRIBUTE_ASSOCIATION_OVERRIDE_JOIN_COLUMN_NAME_MUST_BE_SPECIFIED_MULTIPLE_JOIN_COLUMNS;
+ }
+
+ @Override
+ protected IMessage buildUnspecifiedReferencedColumnNameMultipleJoinColumnsMessage() {
+ if (this.override.isVirtual()) {
+ return this.buildVirtualOverrideUnspecifiedReferencedColumnNameMultipleJoinColumnsMessage();
+ }
+ return super.buildUnspecifiedReferencedColumnNameMultipleJoinColumnsMessage();
+ }
+
+ protected IMessage buildVirtualOverrideUnspecifiedReferencedColumnNameMultipleJoinColumnsMessage() {
+ return DefaultJpaValidationMessages.buildMessage(
+ IMessage.HIGH_SEVERITY,
+ JpaValidationMessages.VIRTUAL_ASSOCIATION_OVERRIDE_JOIN_COLUMN_REFERENCED_COLUMN_NAME_MUST_BE_SPECIFIED_MULTIPLE_JOIN_COLUMNS,
+ new String[] {this.override.getName()},
+ this.getColumn(),
+ this.getTextRangeResolver().getReferencedColumnNameTextRange()
+ );
+ }
+
+ @Override
+ protected IMessage buildVirtualAttributeUnspecifiedReferencedColumnNameMultipleJoinColumnsMessage() {
+ return DefaultJpaValidationMessages.buildMessage(
+ IMessage.HIGH_SEVERITY,
+ this.getVirtualAttributeUnspecifiedReferencedColumnNameMultipleJoinColumnsMessage(),
+ new String[] {getPersistentAttributeName(), this.override.getName()},
+ this.getColumn(),
+ this.getTextRangeResolver().getReferencedColumnNameTextRange()
+ );
+ }
+
+ @Override
+ protected String getVirtualAttributeUnspecifiedReferencedColumnNameMultipleJoinColumnsMessage() {
+ return JpaValidationMessages.VIRTUAL_ATTRIBUTE_ASSOCIATION_OVERRIDE_JOIN_COLUMN_REFERENCED_COLUMN_NAME_MUST_BE_SPECIFIED_MULTIPLE_JOIN_COLUMNS;
+ }
+
+
+ public class AssociationOverrideJoinColumnTableValidator extends JoinColumnTableValidator {
+
+ protected AssociationOverrideJoinColumnTableValidator(
+ PersistentAttribute persistentAttribute, JoinColumn column, JoinColumnTextRangeResolver textRangeResolver, TableDescriptionProvider provider) {
+ super(persistentAttribute, column, textRangeResolver, provider);
+ }
+
+ @Override
+ public IMessage buildTableNotValidMessage() {
+ if (AssociationOverrideJoinColumnValidator.this.override.isVirtual()) {
+ return this.buildVirtualOverrideColumnTableNotValidMessage();
+ }
+ return super.buildTableNotValidMessage();
+ }
+
+ protected IMessage buildVirtualOverrideColumnTableNotValidMessage() {
+ return DefaultJpaValidationMessages.buildMessage(
+ IMessage.HIGH_SEVERITY,
+ getVirtualOverrideColumnTableNotValidMessage(),
+ new String[] {
+ AssociationOverrideJoinColumnValidator.this.override.getName(),
+ this.getColumn().getTable(),
+ this.getColumn().getName(),
+ this.getColumnTableDescriptionMessage()},
+ this.getColumn(),
+ getTextRangeResolver().getTableTextRange()
+ );
+ }
+
+ protected String getVirtualOverrideColumnTableNotValidMessage() {
+ return JpaValidationMessages.VIRTUAL_ASSOCIATION_OVERRIDE_JOIN_COLUMN_TABLE_NOT_VALID;
+ }
+
+ @Override
+ protected String getVirtualAttributeColumnTableNotValidMessage() {
+ return JpaValidationMessages.VIRTUAL_ATTRIBUTE_ASSOCIATION_OVERRIDE_JOIN_COLUMN_TABLE_NOT_VALID;
+ }
+ }
+}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/AttributeOverrideColumnValidator.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/AttributeOverrideColumnValidator.java
new file mode 100644
index 0000000000..63604d99b7
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/AttributeOverrideColumnValidator.java
@@ -0,0 +1,134 @@
+/*******************************************************************************
+ * Copyright (c) 2010 Oracle.
+ * All rights reserved. This program and the accompanying materials are
+ * made available under the terms of the Eclipse Public License v1.0 which
+ * accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.jpt.core.internal.jpa1.context;
+
+import org.eclipse.jpt.core.context.AttributeOverride;
+import org.eclipse.jpt.core.context.BaseColumn;
+import org.eclipse.jpt.core.context.PersistentAttribute;
+import org.eclipse.jpt.core.internal.context.BaseColumnTextRangeResolver;
+import org.eclipse.jpt.core.internal.jpa1.context.BaseColumnTableValidator.TableDescriptionProvider;
+import org.eclipse.jpt.core.internal.validation.DefaultJpaValidationMessages;
+import org.eclipse.jpt.core.internal.validation.JpaValidationMessages;
+import org.eclipse.wst.validation.internal.provisional.core.IMessage;
+
+public class AttributeOverrideColumnValidator extends NamedColumnValidator
+{
+ private final AttributeOverride override;
+
+ public AttributeOverrideColumnValidator(
+ AttributeOverride override,
+ BaseColumn column,
+ BaseColumnTextRangeResolver textRangeResolver,
+ TableDescriptionProvider message) {
+ super(column, textRangeResolver, message);
+ this.override = override;
+ }
+
+ public AttributeOverrideColumnValidator(
+ PersistentAttribute persistentAttribute,
+ AttributeOverride override,
+ BaseColumn column,
+ BaseColumnTextRangeResolver textRangeResolver,
+ TableDescriptionProvider message) {
+ super(persistentAttribute, column, textRangeResolver, message);
+ this.override = override;
+ }
+
+ @Override
+ protected TableValidator buildTableValidator() {
+ return new AttributeOverrideColumnTableValidator(this.persistentAttribute, this.getColumn(), this.getTextRangeResolver(), this.tableDescriptionProvider);
+ }
+
+ @Override
+ protected IMessage buildUnresolvedNameMessage() {
+ if (this.override.isVirtual()) {
+ return this.buildVirtualColumnUnresolvedNameMessage();
+ }
+ return super.buildUnresolvedNameMessage();
+ }
+
+ protected IMessage buildVirtualColumnUnresolvedNameMessage() {
+ return DefaultJpaValidationMessages.buildMessage(
+ IMessage.HIGH_SEVERITY,
+ getVirtualOverrideUnresolvedNameMessage(),
+ new String[] {this.override.getName(), this.namedColumn.getName(), this.namedColumn.getDbTable().getName()},
+ this.namedColumn,
+ this.textRangeResolver.getNameTextRange()
+ );
+ }
+
+ protected String getVirtualOverrideUnresolvedNameMessage() {
+ return JpaValidationMessages.VIRTUAL_ATTRIBUTE_OVERRIDE_COLUMN_UNRESOLVED_NAME;
+ }
+
+ @Override
+ protected IMessage buildVirtualAttributeUnresolvedNameMessage() {
+ return DefaultJpaValidationMessages.buildMessage(
+ IMessage.HIGH_SEVERITY,
+ this.getVirtualAttributeUnresolvedNameMessage(),
+ new String[] {
+ getPersistentAttributeName(),
+ this.override.getName(),
+ getColumn().getName(),
+ getColumn().getDbTable().getName()},
+ this.namedColumn,
+ this.textRangeResolver.getNameTextRange()
+ );
+ }
+
+ @Override
+ protected String getVirtualAttributeUnresolvedNameMessage() {
+ return JpaValidationMessages.VIRTUAL_ATTRIBUTE_ATTRIBUTE_OVERRIDE_COLUMN_UNRESOLVED_NAME;
+ }
+
+
+ public class AttributeOverrideColumnTableValidator extends BaseColumnTableValidator {
+
+ protected AttributeOverrideColumnTableValidator(
+ PersistentAttribute persistentAttribute,
+ BaseColumn column,
+ BaseColumnTextRangeResolver textRangeResolver,
+ TableDescriptionProvider provider) {
+ super(persistentAttribute, column, textRangeResolver, provider);
+ }
+
+ @Override
+ public IMessage buildTableNotValidMessage() {
+ if (AttributeOverrideColumnValidator.this.override.isVirtual()) {
+ return this.buildVirtualOverrideColumnTableNotValidMessage();
+ }
+ return super.buildTableNotValidMessage();
+ }
+
+ protected IMessage buildVirtualOverrideColumnTableNotValidMessage() {
+ return DefaultJpaValidationMessages.buildMessage(
+ IMessage.HIGH_SEVERITY,
+ getVirtualOverrideColumnTableNotValidMessage(),
+ new String[] {
+ AttributeOverrideColumnValidator.this.override.getName(),
+ this.getColumn().getTable(),
+ this.getColumn().getName(),
+ this.getColumnTableDescriptionMessage()},
+ this.getColumn(),
+ getTextRangeResolver().getTableTextRange()
+ );
+ }
+
+ protected String getVirtualOverrideColumnTableNotValidMessage() {
+ return JpaValidationMessages.VIRTUAL_ATTRIBUTE_OVERRIDE_COLUMN_TABLE_NOT_VALID;
+ }
+
+ @Override
+ protected String getVirtualAttributeColumnTableNotValidMessage() {
+ return JpaValidationMessages.VIRTUAL_ATTRIBUTE_ATTRIBUTE_OVERRIDE_COLUMN_TABLE_NOT_VALID;
+ }
+ }
+}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/BaseColumnTableValidator.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/BaseColumnTableValidator.java
new file mode 100644
index 0000000000..bf0386f397
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/BaseColumnTableValidator.java
@@ -0,0 +1,119 @@
+/*******************************************************************************
+ * Copyright (c) 2010 Oracle.
+ * All rights reserved. This program and the accompanying materials are
+ * made available under the terms of the Eclipse Public License v1.0 which
+ * accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.jpt.core.internal.jpa1.context;
+
+import java.util.List;
+import org.eclipse.jpt.core.context.BaseColumn;
+import org.eclipse.jpt.core.context.PersistentAttribute;
+import org.eclipse.jpt.core.internal.context.BaseColumnTextRangeResolver;
+import org.eclipse.jpt.core.internal.jpa1.context.AbstractNamedColumnValidator.TableValidator;
+import org.eclipse.jpt.core.internal.validation.DefaultJpaValidationMessages;
+import org.eclipse.jpt.core.internal.validation.JpaValidationMessages;
+import org.eclipse.wst.validation.internal.provisional.core.IMessage;
+import org.eclipse.wst.validation.internal.provisional.core.IReporter;
+
+public class BaseColumnTableValidator implements TableValidator
+{
+
+ protected final PersistentAttribute persistentAttribute;
+
+ protected final BaseColumn column;
+
+ protected final BaseColumnTextRangeResolver textRangeResolver;
+
+ protected final TableDescriptionProvider tableDescriptionProvider;
+
+ protected BaseColumnTableValidator(
+ PersistentAttribute persistentAttribute, BaseColumn column, BaseColumnTextRangeResolver textRangeResolver, TableDescriptionProvider tableDescriptionProvider) {
+ super();
+ this.persistentAttribute = persistentAttribute;
+ this.column = column;
+ this.textRangeResolver = textRangeResolver;
+ this.tableDescriptionProvider = tableDescriptionProvider;
+ }
+
+ public BaseColumn getColumn() {
+ return this.column;
+ }
+
+ public BaseColumnTextRangeResolver getTextRangeResolver() {
+ return this.textRangeResolver;
+ }
+
+ protected boolean isPersistentAttributeVirtual() {
+ return this.persistentAttribute != null && this.persistentAttribute.isVirtual();
+ }
+
+ protected String getPersistentAttributeName() {
+ return this.persistentAttribute.getName();
+ }
+
+ public boolean isTableNameInvalid() {
+ return this.getColumn().tableNameIsInvalid();
+ }
+
+ public void validate(List<IMessage> messages, IReporter reporter) {
+ messages.add(buildTableNotValidMessage());
+ }
+
+ public IMessage buildTableNotValidMessage() {
+ if (isPersistentAttributeVirtual()) {
+ return buildVirtualAttributeTableNotValidMessage();
+ }
+ return DefaultJpaValidationMessages.buildMessage(
+ IMessage.HIGH_SEVERITY,
+ this.getColumnTableNotValidMessage(),
+ new String[] {
+ getColumn().getTable(),
+ getColumn().getName(),
+ this.getColumnTableDescriptionMessage()},
+ getColumn(),
+ getTextRangeResolver().getTableTextRange()
+ );
+ }
+
+ protected String getColumnTableNotValidMessage() {
+ return JpaValidationMessages.COLUMN_TABLE_NOT_VALID;
+ }
+
+ protected String getColumnTableDescriptionMessage() {
+ return this.tableDescriptionProvider.getColumnTableDescriptionMessage();
+ }
+
+ protected IMessage buildVirtualAttributeTableNotValidMessage() {
+ return DefaultJpaValidationMessages.buildMessage(
+ IMessage.HIGH_SEVERITY,
+ this.getVirtualAttributeColumnTableNotValidMessage(),
+ new String[] {
+ getPersistentAttributeName(),
+ getColumn().getTable(),
+ getColumn().getName(),
+ this.getColumnTableDescriptionMessage()},
+ getColumn(),
+ getTextRangeResolver().getTableTextRange()
+ );
+ }
+
+ protected String getVirtualAttributeColumnTableNotValidMessage() {
+ return JpaValidationMessages.VIRTUAL_ATTRIBUTE_COLUMN_TABLE_NOT_VALID;
+ }
+
+
+ public static interface TableDescriptionProvider {
+ String getColumnTableDescriptionMessage();
+ }
+
+ public static class NullTableDescriptionProvider implements TableDescriptionProvider {
+ public String getColumnTableDescriptionMessage() {
+ throw new UnsupportedOperationException();
+ }
+ }
+}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/BaseJoinColumnValidator.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/BaseJoinColumnValidator.java
new file mode 100644
index 0000000000..5b7f308587
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/BaseJoinColumnValidator.java
@@ -0,0 +1,172 @@
+/*******************************************************************************
+ * Copyright (c) 2010 Oracle.
+ * All rights reserved. This program and the accompanying materials are
+ * made available under the terms of the Eclipse Public License v1.0 which
+ * accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.jpt.core.internal.jpa1.context;
+
+import java.util.List;
+import org.eclipse.jpt.core.context.BaseJoinColumn;
+import org.eclipse.jpt.core.context.PersistentAttribute;
+import org.eclipse.jpt.core.internal.context.BaseJoinColumnTextRangeResolver;
+import org.eclipse.jpt.core.internal.jpa1.context.BaseColumnTableValidator.TableDescriptionProvider;
+import org.eclipse.jpt.core.internal.validation.DefaultJpaValidationMessages;
+import org.eclipse.wst.validation.internal.provisional.core.IMessage;
+
+public abstract class BaseJoinColumnValidator extends AbstractNamedColumnValidator
+{
+ private final BaseJoinColumn.Owner joinColumnOwner;
+
+ protected BaseJoinColumnValidator(
+ BaseJoinColumn column,
+ BaseJoinColumn.Owner joinColumnOwner,
+ BaseJoinColumnTextRangeResolver textRangeResolver,
+ TableDescriptionProvider provider) {
+ super(column, textRangeResolver, provider);
+ this.joinColumnOwner = joinColumnOwner;
+ }
+
+ protected BaseJoinColumnValidator(
+ PersistentAttribute persistentAttribute,
+ BaseJoinColumn column,
+ BaseJoinColumn.Owner joinColumnOwner,
+ BaseJoinColumnTextRangeResolver textRangeResolver,
+ TableDescriptionProvider provider) {
+ super(persistentAttribute, column, textRangeResolver, provider);
+ this.joinColumnOwner = joinColumnOwner;
+ }
+
+ @Override
+ public BaseJoinColumn getColumn() {
+ return (BaseJoinColumn) super.getColumn();
+ }
+
+ @Override
+ public BaseJoinColumnTextRangeResolver getTextRangeResolver() {
+ return (BaseJoinColumnTextRangeResolver) super.getTextRangeResolver();
+ }
+
+ @Override
+ //this method will only be called if the table validates correctly
+ protected void validateName(List<IMessage> messages) {
+ this.validateJoinColumnName(messages);
+ this.validateReferencedColumnName(messages);
+ }
+
+ protected void validateJoinColumnName(List<IMessage> messages) {
+ if (this.getColumn().getSpecifiedName() == null && this.joinColumnOwner.joinColumnsSize() > 1) {
+ messages.add(this.buildUnspecifiedNameMultipleJoinColumnsMessage());
+ }
+ else if (this.getColumn().getName() != null){
+ super.validateName(messages);
+ }
+ //If the name is null and there is only one join-column, one of these validation messages will apply
+ // 1. target entity does not have a primary key
+ // 2. target entity is not specified
+ // 3. target entity is not an entity
+ }
+
+ protected void validateReferencedColumnName(List<IMessage> messages) {
+ if (this.getColumn().getSpecifiedReferencedColumnName() == null && this.joinColumnOwner.joinColumnsSize() > 1) {
+ messages.add(this.buildUnspecifiedReferencedColumnNameMultipleJoinColumnsMessage());
+ }
+ else if (this.getColumn().getSpecifiedReferencedColumnName() != null) {
+ if (this.getColumn().getReferencedColumnDbTable() != null && ! this.getColumn().isReferencedColumnResolved()) {
+ messages.add(this.buildUnresolvedReferencedColumnNameMessage());
+ }
+ }
+ //If the referenced column name is null and there is only one join-column, one of these validation messages will apply
+ // 1. target entity does not have a primary key
+ // 2. target entity is not specified
+ // 3. target entity is not an entity
+ }
+
+ protected IMessage buildUnresolvedReferencedColumnNameMessage() {
+ if (isPersistentAttributeVirtual()) {
+ return this.buildVirtualAttributeUnresolvedReferencedColumnNameMessage();
+ }
+ return buildUnresolvedReferencedColumnNameMessage(this.getUnresolvedReferencedColumnNameMessage());
+ }
+
+ protected abstract String getUnresolvedReferencedColumnNameMessage();
+
+ protected IMessage buildUnresolvedReferencedColumnNameMessage(String message) {
+ return DefaultJpaValidationMessages.buildMessage(
+ IMessage.HIGH_SEVERITY,
+ message,
+ new String[] {this.getColumn().getReferencedColumnName(), this.getColumn().getReferencedColumnDbTable().getName()},
+ this.getColumn(),
+ this.getTextRangeResolver().getReferencedColumnNameTextRange()
+ );
+ }
+
+ protected IMessage buildVirtualAttributeUnresolvedReferencedColumnNameMessage() {
+ return DefaultJpaValidationMessages.buildMessage(
+ IMessage.HIGH_SEVERITY,
+ this.getVirtualAttributeUnresolvedReferencedColumnNameMessage(),
+ new String[] {getPersistentAttributeName(), this.getColumn().getReferencedColumnName(), this.namedColumn.getDbTable().getName()},
+ this.getColumn(),
+ this.getTextRangeResolver().getReferencedColumnNameTextRange()
+ );
+ }
+
+ protected abstract String getVirtualAttributeUnresolvedReferencedColumnNameMessage();
+
+ protected IMessage buildUnspecifiedNameMultipleJoinColumnsMessage() {
+ if (isPersistentAttributeVirtual()) {
+ return this.buildVirtualAttributeUnspecifiedNameMultipleJoinColumnsMessage();
+ }
+ return DefaultJpaValidationMessages.buildMessage(
+ IMessage.HIGH_SEVERITY,
+ this.getUnspecifiedNameMultipleJoinColumnsMessage(),
+ new String[0],
+ this.getColumn(),
+ this.getTextRangeResolver().getNameTextRange()
+ );
+ }
+ protected abstract String getUnspecifiedNameMultipleJoinColumnsMessage();
+
+ protected IMessage buildVirtualAttributeUnspecifiedNameMultipleJoinColumnsMessage() {
+ return DefaultJpaValidationMessages.buildMessage(
+ IMessage.HIGH_SEVERITY,
+ this.getVirtualAttributeUnspecifiedNameMultipleJoinColumnsMessage(),
+ new String[] {this.getPersistentAttributeName()},
+ this.getColumn(),
+ this.getTextRangeResolver().getNameTextRange()
+ );
+ }
+
+ protected abstract String getVirtualAttributeUnspecifiedNameMultipleJoinColumnsMessage();
+
+ protected IMessage buildUnspecifiedReferencedColumnNameMultipleJoinColumnsMessage() {
+ if (isPersistentAttributeVirtual()) {
+ return this.buildVirtualAttributeUnspecifiedReferencedColumnNameMultipleJoinColumnsMessage();
+ }
+ return DefaultJpaValidationMessages.buildMessage(
+ IMessage.HIGH_SEVERITY,
+ this.getUnspecifiedReferencedColumnNameMultipleJoinColumnsMessage(),
+ new String[0],
+ this.getColumn(),
+ this.getTextRangeResolver().getReferencedColumnNameTextRange()
+ );
+ }
+
+ protected abstract String getUnspecifiedReferencedColumnNameMultipleJoinColumnsMessage();
+
+ protected IMessage buildVirtualAttributeUnspecifiedReferencedColumnNameMultipleJoinColumnsMessage() {
+ return DefaultJpaValidationMessages.buildMessage(
+ IMessage.HIGH_SEVERITY,
+ this.getVirtualAttributeUnspecifiedReferencedColumnNameMultipleJoinColumnsMessage(),
+ new String[] {this.getPersistentAttributeName()},
+ this.getColumn(),
+ this.getTextRangeResolver().getReferencedColumnNameTextRange()
+ );
+ }
+
+ protected abstract String getVirtualAttributeUnspecifiedReferencedColumnNameMultipleJoinColumnsMessage();
+}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/CollectionTableTableDescriptionProvider.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/CollectionTableTableDescriptionProvider.java
new file mode 100644
index 0000000000..dbfefa6174
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/CollectionTableTableDescriptionProvider.java
@@ -0,0 +1,12 @@
+package org.eclipse.jpt.core.internal.jpa1.context;
+
+import org.eclipse.jpt.core.internal.jpa1.context.BaseColumnTableValidator.TableDescriptionProvider;
+import org.eclipse.jpt.core.internal.validation.JpaValidationDescriptionMessages;
+
+public class CollectionTableTableDescriptionProvider implements TableDescriptionProvider
+{
+ public String getColumnTableDescriptionMessage() {
+ return JpaValidationDescriptionMessages.DOES_NOT_MATCH_COLLECTION_TABLE;
+ }
+
+}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/DiscriminatorColumnValidator.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/DiscriminatorColumnValidator.java
new file mode 100644
index 0000000000..40f6d5d20f
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/DiscriminatorColumnValidator.java
@@ -0,0 +1,34 @@
+/*******************************************************************************
+ * Copyright (c) 2010 Oracle.
+ * All rights reserved. This program and the accompanying materials are
+ * made available under the terms of the Eclipse Public License v1.0 which
+ * accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.jpt.core.internal.jpa1.context;
+
+import org.eclipse.jpt.core.context.NamedColumn;
+import org.eclipse.jpt.core.internal.context.NamedColumnTextRangeResolver;
+import org.eclipse.jpt.core.internal.validation.JpaValidationMessages;
+
+public class DiscriminatorColumnValidator extends AbstractNamedColumnValidator
+{
+ public DiscriminatorColumnValidator(
+ NamedColumn namedColumn,
+ NamedColumnTextRangeResolver textRangeResolver) {
+ super(namedColumn, textRangeResolver);
+ }
+
+ @Override
+ protected String getUnresolvedNameMessage() {
+ return JpaValidationMessages.DISCRIMINATOR_COLUMN_UNRESOLVED_NAME;
+ }
+
+ @Override
+ protected String getVirtualAttributeUnresolvedNameMessage() {
+ throw new UnsupportedOperationException();
+ }
+}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/EntityTableDescriptionProvider.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/EntityTableDescriptionProvider.java
new file mode 100644
index 0000000000..6810b06c9c
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/EntityTableDescriptionProvider.java
@@ -0,0 +1,12 @@
+package org.eclipse.jpt.core.internal.jpa1.context;
+
+import org.eclipse.jpt.core.internal.jpa1.context.BaseColumnTableValidator.TableDescriptionProvider;
+import org.eclipse.jpt.core.internal.validation.JpaValidationDescriptionMessages;
+
+public class EntityTableDescriptionProvider implements TableDescriptionProvider
+{
+ public String getColumnTableDescriptionMessage() {
+ return JpaValidationDescriptionMessages.NOT_VALID_FOR_THIS_ENTITY;
+ }
+
+}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/InverseJoinColumnValidator.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/InverseJoinColumnValidator.java
new file mode 100644
index 0000000000..8dd273d52e
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/InverseJoinColumnValidator.java
@@ -0,0 +1,110 @@
+/*******************************************************************************
+ * Copyright (c) 2010 Oracle.
+ * All rights reserved. This program and the accompanying materials are
+ * made available under the terms of the Eclipse Public License v1.0 which
+ * accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.jpt.core.internal.jpa1.context;
+
+import org.eclipse.jpt.core.context.JoinColumn;
+import org.eclipse.jpt.core.context.PersistentAttribute;
+import org.eclipse.jpt.core.internal.context.JoinColumnTextRangeResolver;
+import org.eclipse.jpt.core.internal.jpa1.context.BaseColumnTableValidator.TableDescriptionProvider;
+import org.eclipse.jpt.core.internal.validation.JpaValidationMessages;
+
+public class InverseJoinColumnValidator extends BaseJoinColumnValidator
+{
+ public InverseJoinColumnValidator(
+ JoinColumn column,
+ JoinColumn.Owner joinColumnOwner,
+ JoinColumnTextRangeResolver textRangeResolver,
+ TableDescriptionProvider provider) {
+ super(column, joinColumnOwner, textRangeResolver, provider);
+ }
+
+ public InverseJoinColumnValidator(
+ PersistentAttribute persistentAttribute,
+ JoinColumn column,
+ JoinColumn.Owner joinColumnOwner,
+ JoinColumnTextRangeResolver textRangeResolver,
+ TableDescriptionProvider provider) {
+ super(persistentAttribute, column, joinColumnOwner, textRangeResolver, provider);
+ }
+
+ @Override
+ public JoinColumn getColumn() {
+ return (JoinColumn) super.getColumn();
+ }
+
+ @Override
+ public JoinColumnTextRangeResolver getTextRangeResolver() {
+ return (JoinColumnTextRangeResolver) super.getTextRangeResolver();
+ }
+
+ @Override
+ protected TableValidator buildTableValidator() {
+ return new InverseJoinColumnTableValidator(this.persistentAttribute, this.getColumn(), this.getTextRangeResolver(), this.tableDescriptionProvider);
+ }
+
+ @Override
+ protected String getUnresolvedNameMessage() {
+ return JpaValidationMessages.INVERSE_JOIN_COLUMN_UNRESOLVED_NAME;
+ }
+
+ @Override
+ protected String getVirtualAttributeUnresolvedNameMessage() {
+ return JpaValidationMessages.VIRTUAL_ATTRIBUTE_INVERSE_JOIN_COLUMN_UNRESOLVED_NAME;
+ }
+
+ @Override
+ protected String getUnresolvedReferencedColumnNameMessage() {
+ return JpaValidationMessages.INVERSE_JOIN_COLUMN_UNRESOLVED_REFERENCED_COLUMN_NAME;
+ }
+
+ @Override
+ protected String getVirtualAttributeUnresolvedReferencedColumnNameMessage() {
+ return JpaValidationMessages.VIRTUAL_ATTRIBUTE_INVERSE_JOIN_COLUMN_UNRESOLVED_REFERENCED_COLUMN_NAME;
+ }
+
+ @Override
+ protected String getUnspecifiedNameMultipleJoinColumnsMessage() {
+ return JpaValidationMessages.INVERSE_JOIN_COLUMN_NAME_MUST_BE_SPECIFIED_MULTIPLE_JOIN_COLUMNS;
+ }
+
+ @Override
+ protected String getVirtualAttributeUnspecifiedNameMultipleJoinColumnsMessage() {
+ return JpaValidationMessages.VIRTUAL_ATTRIBUTE_INVERSE_JOIN_COLUMN_NAME_MUST_BE_SPECIFIED_MULTIPLE_JOIN_COLUMNS;
+ }
+
+ @Override
+ protected String getUnspecifiedReferencedColumnNameMultipleJoinColumnsMessage() {
+ return JpaValidationMessages.INVERSE_JOIN_COLUMN_REFERENCED_COLUMN_NAME_MUST_BE_SPECIFIED_MULTIPLE_JOIN_COLUMNS;
+ }
+
+ @Override
+ protected String getVirtualAttributeUnspecifiedReferencedColumnNameMultipleJoinColumnsMessage() {
+ return JpaValidationMessages.VIRTUAL_ATTRIBUTE_INVERSE_JOIN_COLUMN_REFERENCED_COLUMN_NAME_MUST_BE_SPECIFIED_MULTIPLE_JOIN_COLUMNS;
+ }
+
+ public static class InverseJoinColumnTableValidator extends BaseColumnTableValidator
+ {
+ public InverseJoinColumnTableValidator(
+ PersistentAttribute persistentAttribute, JoinColumn column, JoinColumnTextRangeResolver textRangeResolver, TableDescriptionProvider provider) {
+ super(persistentAttribute, column, textRangeResolver, provider);
+ }
+
+ @Override
+ protected String getColumnTableNotValidMessage() {
+ return JpaValidationMessages.INVERSE_JOIN_COLUMN_TABLE_NOT_VALID;
+ }
+
+ @Override
+ protected String getVirtualAttributeColumnTableNotValidMessage() {
+ return JpaValidationMessages.VIRTUAL_ATTRIBUTE_INVERSE_JOIN_COLUMN_TABLE_NOT_VALID;
+ }
+ }
+}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/JoinColumnValidator.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/JoinColumnValidator.java
new file mode 100644
index 0000000000..dcf3535d21
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/JoinColumnValidator.java
@@ -0,0 +1,110 @@
+/*******************************************************************************
+ * Copyright (c) 2010 Oracle.
+ * All rights reserved. This program and the accompanying materials are
+ * made available under the terms of the Eclipse Public License v1.0 which
+ * accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.jpt.core.internal.jpa1.context;
+
+import org.eclipse.jpt.core.context.JoinColumn;
+import org.eclipse.jpt.core.context.PersistentAttribute;
+import org.eclipse.jpt.core.internal.context.JoinColumnTextRangeResolver;
+import org.eclipse.jpt.core.internal.jpa1.context.BaseColumnTableValidator.TableDescriptionProvider;
+import org.eclipse.jpt.core.internal.validation.JpaValidationMessages;
+
+public class JoinColumnValidator extends BaseJoinColumnValidator
+{
+ public JoinColumnValidator(
+ JoinColumn column,
+ JoinColumn.Owner joinColumnOwner,
+ JoinColumnTextRangeResolver textRangeResolver,
+ TableDescriptionProvider provider) {
+ super(column, joinColumnOwner, textRangeResolver, provider);
+ }
+
+ public JoinColumnValidator(
+ PersistentAttribute persistentAttribute,
+ JoinColumn column,
+ JoinColumn.Owner joinColumnOwner,
+ JoinColumnTextRangeResolver textRangeResolver,
+ TableDescriptionProvider provider) {
+ super(persistentAttribute, column, joinColumnOwner, textRangeResolver, provider);
+ }
+
+ @Override
+ public JoinColumn getColumn() {
+ return (JoinColumn) super.getColumn();
+ }
+
+ @Override
+ public JoinColumnTextRangeResolver getTextRangeResolver() {
+ return (JoinColumnTextRangeResolver) super.getTextRangeResolver();
+ }
+
+ @Override
+ protected TableValidator buildTableValidator() {
+ return new JoinColumnTableValidator(this.persistentAttribute, this.getColumn(), this.getTextRangeResolver(), this.tableDescriptionProvider);
+ }
+
+ @Override
+ protected String getUnresolvedNameMessage() {
+ return JpaValidationMessages.JOIN_COLUMN_UNRESOLVED_NAME;
+ }
+
+ @Override
+ protected String getVirtualAttributeUnresolvedNameMessage() {
+ return JpaValidationMessages.VIRTUAL_ATTRIBUTE_JOIN_COLUMN_UNRESOLVED_NAME;
+ }
+
+ @Override
+ protected String getUnresolvedReferencedColumnNameMessage() {
+ return JpaValidationMessages.JOIN_COLUMN_UNRESOLVED_REFERENCED_COLUMN_NAME;
+ }
+
+ @Override
+ protected String getVirtualAttributeUnresolvedReferencedColumnNameMessage() {
+ return JpaValidationMessages.VIRTUAL_ATTRIBUTE_JOIN_COLUMN_UNRESOLVED_REFERENCED_COLUMN_NAME;
+ }
+
+ @Override
+ protected String getUnspecifiedNameMultipleJoinColumnsMessage() {
+ return JpaValidationMessages.JOIN_COLUMN_NAME_MUST_BE_SPECIFIED_MULTIPLE_JOIN_COLUMNS;
+ }
+
+ @Override
+ protected String getVirtualAttributeUnspecifiedNameMultipleJoinColumnsMessage() {
+ return JpaValidationMessages.VIRTUAL_ATTRIBUTE_JOIN_COLUMN_NAME_MUST_BE_SPECIFIED_MULTIPLE_JOIN_COLUMNS;
+ }
+
+ @Override
+ protected String getUnspecifiedReferencedColumnNameMultipleJoinColumnsMessage() {
+ return JpaValidationMessages.JOIN_COLUMN_REFERENCED_COLUMN_NAME_MUST_BE_SPECIFIED_MULTIPLE_JOIN_COLUMNS;
+ }
+
+ @Override
+ protected String getVirtualAttributeUnspecifiedReferencedColumnNameMultipleJoinColumnsMessage() {
+ return JpaValidationMessages.VIRTUAL_ATTRIBUTE_JOIN_COLUMN_REFERENCED_COLUMN_NAME_MUST_BE_SPECIFIED_MULTIPLE_JOIN_COLUMNS;
+ }
+
+ public static class JoinColumnTableValidator extends BaseColumnTableValidator
+ {
+ public JoinColumnTableValidator(
+ PersistentAttribute persistentAttribute, JoinColumn column, JoinColumnTextRangeResolver textRangeResolver, TableDescriptionProvider provider) {
+ super(persistentAttribute, column, textRangeResolver, provider);
+ }
+
+ @Override
+ protected String getColumnTableNotValidMessage() {
+ return JpaValidationMessages.JOIN_COLUMN_TABLE_NOT_VALID;
+ }
+
+ @Override
+ protected String getVirtualAttributeColumnTableNotValidMessage() {
+ return JpaValidationMessages.VIRTUAL_ATTRIBUTE_JOIN_COLUMN_TABLE_NOT_VALID;
+ }
+ }
+}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/JoinTableTableDescriptionProvider.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/JoinTableTableDescriptionProvider.java
new file mode 100644
index 0000000000..487cc10792
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/JoinTableTableDescriptionProvider.java
@@ -0,0 +1,12 @@
+package org.eclipse.jpt.core.internal.jpa1.context;
+
+import org.eclipse.jpt.core.internal.jpa1.context.BaseColumnTableValidator.TableDescriptionProvider;
+import org.eclipse.jpt.core.internal.validation.JpaValidationDescriptionMessages;
+
+public class JoinTableTableDescriptionProvider implements TableDescriptionProvider
+{
+ public String getColumnTableDescriptionMessage() {
+ return JpaValidationDescriptionMessages.DOES_NOT_MATCH_JOIN_TABLE;
+ }
+
+}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/JoiningStrategyTableDescriptionProvider.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/JoiningStrategyTableDescriptionProvider.java
new file mode 100644
index 0000000000..4be5686c0b
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/JoiningStrategyTableDescriptionProvider.java
@@ -0,0 +1,20 @@
+package org.eclipse.jpt.core.internal.jpa1.context;
+
+import org.eclipse.jpt.core.context.JoiningStrategy;
+import org.eclipse.jpt.core.internal.jpa1.context.BaseColumnTableValidator.TableDescriptionProvider;
+
+public class JoiningStrategyTableDescriptionProvider implements TableDescriptionProvider
+{
+
+ private final JoiningStrategy joiningStrategy;
+
+ public JoiningStrategyTableDescriptionProvider(JoiningStrategy joiningStrategy) {
+ super();
+ this.joiningStrategy = joiningStrategy;
+ }
+
+ public String getColumnTableDescriptionMessage() {
+ return this.joiningStrategy.getColumnTableNotValidDescription();
+ }
+
+}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/MapKeyAttributeOverrideColumnValidator.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/MapKeyAttributeOverrideColumnValidator.java
new file mode 100644
index 0000000000..4f8f13c71c
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/MapKeyAttributeOverrideColumnValidator.java
@@ -0,0 +1,76 @@
+/*******************************************************************************
+ * Copyright (c) 2010 Oracle.
+ * All rights reserved. This program and the accompanying materials are
+ * made available under the terms of the Eclipse Public License v1.0 which
+ * accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.jpt.core.internal.jpa1.context;
+
+import org.eclipse.jpt.core.context.AttributeOverride;
+import org.eclipse.jpt.core.context.BaseColumn;
+import org.eclipse.jpt.core.context.PersistentAttribute;
+import org.eclipse.jpt.core.internal.context.BaseColumnTextRangeResolver;
+import org.eclipse.jpt.core.internal.jpa1.context.BaseColumnTableValidator.TableDescriptionProvider;
+import org.eclipse.jpt.core.internal.validation.JpaValidationMessages;
+
+public class MapKeyAttributeOverrideColumnValidator extends AttributeOverrideColumnValidator
+{
+
+ public MapKeyAttributeOverrideColumnValidator(
+ AttributeOverride override,
+ BaseColumn column,
+ BaseColumnTextRangeResolver textRangeResolver,
+ TableDescriptionProvider provider) {
+ super(override, column, textRangeResolver, provider);
+ }
+
+ public MapKeyAttributeOverrideColumnValidator(
+ PersistentAttribute persistentAttribute,
+ AttributeOverride override,
+ BaseColumn column,
+ BaseColumnTextRangeResolver textRangeResolver,
+ TableDescriptionProvider provider) {
+ super(persistentAttribute, override, column, textRangeResolver, provider);
+ }
+
+ @Override
+ protected TableValidator buildTableValidator() {
+ return new MapKeyAttributeOverrideColumnTableValidator(this.persistentAttribute, this.getColumn(), this.getTextRangeResolver(), this.tableDescriptionProvider);
+ }
+
+ @Override
+ protected String getVirtualOverrideUnresolvedNameMessage() {
+ return JpaValidationMessages.VIRTUAL_MAP_KEY_ATTRIBUTE_OVERRIDE_COLUMN_UNRESOLVED_NAME;
+ }
+
+ @Override
+ protected String getVirtualAttributeUnresolvedNameMessage() {
+ return JpaValidationMessages.VIRTUAL_ATTRIBUTE_MAP_KEY_ATTRIBUTE_OVERRIDE_COLUMN_UNRESOLVED_NAME;
+ }
+
+ public class MapKeyAttributeOverrideColumnTableValidator
+ extends AttributeOverrideColumnTableValidator {
+
+ protected MapKeyAttributeOverrideColumnTableValidator(
+ PersistentAttribute persistentAttribute,
+ BaseColumn column,
+ BaseColumnTextRangeResolver textRangeResolver,
+ TableDescriptionProvider provider) {
+ super(persistentAttribute, column, textRangeResolver, provider);
+ }
+
+ @Override
+ protected String getVirtualOverrideColumnTableNotValidMessage() {
+ return JpaValidationMessages.VIRTUAL_MAP_KEY_ATTRIBUTE_OVERRIDE_COLUMN_TABLE_NOT_VALID;
+ }
+
+ @Override
+ protected String getVirtualAttributeColumnTableNotValidMessage() {
+ return JpaValidationMessages.VIRTUAL_ATTRIBUTE_MAP_KEY_ATTRIBUTE_OVERRIDE_COLUMN_TABLE_NOT_VALID;
+ }
+ }
+}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/MapKeyColumnValidator.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/MapKeyColumnValidator.java
new file mode 100644
index 0000000000..23ef86acd6
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/MapKeyColumnValidator.java
@@ -0,0 +1,82 @@
+/*******************************************************************************
+ * Copyright (c) 2010 Oracle.
+ * All rights reserved. This program and the accompanying materials are
+ * made available under the terms of the Eclipse Public License v1.0 which
+ * accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.jpt.core.internal.jpa1.context;
+
+import org.eclipse.jpt.core.context.BaseColumn;
+import org.eclipse.jpt.core.context.PersistentAttribute;
+import org.eclipse.jpt.core.internal.context.BaseColumnTextRangeResolver;
+import org.eclipse.jpt.core.internal.jpa1.context.BaseColumnTableValidator.TableDescriptionProvider;
+import org.eclipse.jpt.core.internal.validation.JpaValidationMessages;
+
+public class MapKeyColumnValidator extends AbstractNamedColumnValidator
+{
+
+ public MapKeyColumnValidator(
+ BaseColumn column,
+ BaseColumnTextRangeResolver textRangeResolver,
+ TableDescriptionProvider provider) {
+ super(column, textRangeResolver, provider);
+ }
+
+ public MapKeyColumnValidator(
+ PersistentAttribute persistentAttribute,
+ BaseColumn column,
+ BaseColumnTextRangeResolver textRangeResolver,
+ TableDescriptionProvider provider) {
+ super(persistentAttribute, column, textRangeResolver, provider);
+ }
+
+ @Override
+ public BaseColumn getColumn() {
+ return (BaseColumn) super.getColumn();
+ }
+
+ @Override
+ public BaseColumnTextRangeResolver getTextRangeResolver() {
+ return (BaseColumnTextRangeResolver) super.getTextRangeResolver();
+ }
+
+ @Override
+ protected TableValidator buildTableValidator() {
+ return new MapKeyColumnTableValidator(this.persistentAttribute, this.getColumn(), this.getTextRangeResolver(), this.tableDescriptionProvider);
+ }
+
+ @Override
+ protected String getUnresolvedNameMessage() {
+ return JpaValidationMessages.MAP_KEY_COLUMN_UNRESOLVED_NAME;
+ }
+
+ @Override
+ protected String getVirtualAttributeUnresolvedNameMessage() {
+ return JpaValidationMessages.VIRTUAL_ATTRIBUTE_MAP_KEY_COLUMN_UNRESOLVED_NAME;
+ }
+
+ public static class MapKeyColumnTableValidator extends BaseColumnTableValidator {
+
+ protected MapKeyColumnTableValidator(
+ PersistentAttribute persistentAttribute,
+ BaseColumn column,
+ BaseColumnTextRangeResolver textRangeResolver,
+ TableDescriptionProvider provider) {
+ super(persistentAttribute, column, textRangeResolver, provider);
+ }
+
+ @Override
+ protected String getColumnTableNotValidMessage() {
+ return JpaValidationMessages.MAP_KEY_COLUMN_TABLE_NOT_VALID;
+ }
+
+ @Override
+ protected String getVirtualAttributeColumnTableNotValidMessage() {
+ return JpaValidationMessages.VIRTUAL_ATTRIBUTE_MAP_KEY_COLUMN_TABLE_NOT_VALID;
+ }
+ }
+}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/NamedColumnValidator.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/NamedColumnValidator.java
new file mode 100644
index 0000000000..56048ee1b6
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/NamedColumnValidator.java
@@ -0,0 +1,61 @@
+/*******************************************************************************
+ * Copyright (c) 2010 Oracle.
+ * All rights reserved. This program and the accompanying materials are
+ * made available under the terms of the Eclipse Public License v1.0 which
+ * accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.jpt.core.internal.jpa1.context;
+
+import org.eclipse.jpt.core.context.BaseColumn;
+import org.eclipse.jpt.core.context.PersistentAttribute;
+import org.eclipse.jpt.core.internal.context.BaseColumnTextRangeResolver;
+import org.eclipse.jpt.core.internal.jpa1.context.BaseColumnTableValidator.TableDescriptionProvider;
+import org.eclipse.jpt.core.internal.validation.JpaValidationMessages;
+
+public class NamedColumnValidator extends AbstractNamedColumnValidator
+{
+
+ public NamedColumnValidator(
+ BaseColumn column,
+ BaseColumnTextRangeResolver textRangeResolver,
+ TableDescriptionProvider provider) {
+ super(column, textRangeResolver, provider);
+ }
+
+ public NamedColumnValidator(
+ PersistentAttribute persistentAttribute,
+ BaseColumn column,
+ BaseColumnTextRangeResolver textRangeResolver,
+ TableDescriptionProvider provider) {
+ super(persistentAttribute, column, textRangeResolver, provider);
+ }
+
+ @Override
+ public BaseColumn getColumn() {
+ return (BaseColumn) super.getColumn();
+ }
+
+ @Override
+ public BaseColumnTextRangeResolver getTextRangeResolver() {
+ return (BaseColumnTextRangeResolver) super.getTextRangeResolver();
+ }
+
+ @Override
+ protected TableValidator buildTableValidator() {
+ return new BaseColumnTableValidator(this.persistentAttribute, this.getColumn(), this.getTextRangeResolver(), this.tableDescriptionProvider);
+ }
+
+ @Override
+ protected String getUnresolvedNameMessage() {
+ return JpaValidationMessages.COLUMN_UNRESOLVED_NAME;
+ }
+
+ @Override
+ protected String getVirtualAttributeUnresolvedNameMessage() {
+ return JpaValidationMessages.VIRTUAL_ATTRIBUTE_COLUMN_UNRESOLVED_NAME;
+ }
+}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/PrimaryKeyJoinColumnValidator.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/PrimaryKeyJoinColumnValidator.java
new file mode 100644
index 0000000000..ae71a7f341
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/PrimaryKeyJoinColumnValidator.java
@@ -0,0 +1,91 @@
+/*******************************************************************************
+ * Copyright (c) 2010 Oracle.
+ * All rights reserved. This program and the accompanying materials are
+ * made available under the terms of the Eclipse Public License v1.0 which
+ * accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.jpt.core.internal.jpa1.context;
+
+import org.eclipse.jpt.core.context.BaseJoinColumn;
+import org.eclipse.jpt.core.internal.context.BaseJoinColumnTextRangeResolver;
+import org.eclipse.jpt.core.internal.jpa1.context.BaseColumnTableValidator.NullTableDescriptionProvider;
+import org.eclipse.jpt.core.internal.validation.JpaValidationMessages;
+import org.eclipse.wst.validation.internal.provisional.core.IMessage;
+
+public abstract class PrimaryKeyJoinColumnValidator extends BaseJoinColumnValidator
+{
+ protected PrimaryKeyJoinColumnValidator(
+ BaseJoinColumn column,
+ BaseJoinColumn.Owner owner,
+ BaseJoinColumnTextRangeResolver textRangeResolver) {
+ super(column, owner, textRangeResolver, new NullTableDescriptionProvider());
+ }
+
+ @Override
+ public IMessage buildUnresolvedNameMessage() {
+ if (getColumn().isVirtual()) {
+ return this.buildUnresolvedNameMessage(this.getVirtualPKJoinColumnUnresolvedNameMessage());
+ }
+ return super.buildUnresolvedNameMessage();
+ }
+
+ @Override
+ protected IMessage buildUnresolvedReferencedColumnNameMessage() {
+ if (getColumn().isVirtual()) {
+ return this.buildUnresolvedReferencedColumnNameMessage(this.getVirtualPKJoinColumnUnresolvedReferencedColumnNameMessage());
+ }
+ return super.buildUnresolvedReferencedColumnNameMessage();
+ }
+
+ @Override
+ protected String getUnresolvedNameMessage() {
+ return JpaValidationMessages.PRIMARY_KEY_JOIN_COLUMN_UNRESOLVED_NAME;
+ }
+
+ @Override
+ protected String getVirtualAttributeUnresolvedNameMessage() {
+ throw new UnsupportedOperationException();
+ }
+
+ protected String getVirtualPKJoinColumnUnresolvedNameMessage() {
+ return JpaValidationMessages.VIRTUAL_PRIMARY_KEY_JOIN_COLUMN_UNRESOLVED_NAME;
+ }
+
+ @Override
+ protected String getUnresolvedReferencedColumnNameMessage() {
+ return JpaValidationMessages.PRIMARY_KEY_JOIN_COLUMN_UNRESOLVED_REFERENCED_COLUMN_NAME;
+ }
+
+ @Override
+ protected String getVirtualAttributeUnresolvedReferencedColumnNameMessage() {
+ return JpaValidationMessages.PRIMARY_KEY_JOIN_COLUMN_UNRESOLVED_REFERENCED_COLUMN_NAME;
+ }
+
+ protected String getVirtualPKJoinColumnUnresolvedReferencedColumnNameMessage() {
+ return JpaValidationMessages.VIRTUAL_PRIMARY_KEY_JOIN_COLUMN_UNRESOLVED_REFERENCED_COLUMN_NAME;
+ }
+
+ @Override
+ protected String getUnspecifiedNameMultipleJoinColumnsMessage() {
+ return JpaValidationMessages.PRIMARY_KEY_JOIN_COLUMN_NAME_MUST_BE_SPECIFIED_MULTIPLE_JOIN_COLUMNS;
+ }
+
+ @Override
+ protected String getVirtualAttributeUnspecifiedNameMultipleJoinColumnsMessage() {
+ throw new UnsupportedOperationException();
+ }
+
+ @Override
+ protected String getUnspecifiedReferencedColumnNameMultipleJoinColumnsMessage() {
+ return JpaValidationMessages.PRIMARY_KEY_JOIN_COLUMN_REFERENCED_COLUMN_NAME_MUST_BE_SPECIFIED_MULTIPLE_JOIN_COLUMNS;
+ }
+
+ @Override
+ protected String getVirtualAttributeUnspecifiedReferencedColumnNameMultipleJoinColumnsMessage() {
+ throw new UnsupportedOperationException();
+ }
+}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/SecondaryTablePrimaryKeyJoinColumnValidator.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/SecondaryTablePrimaryKeyJoinColumnValidator.java
new file mode 100644
index 0000000000..f6f9f78e32
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/SecondaryTablePrimaryKeyJoinColumnValidator.java
@@ -0,0 +1,112 @@
+/*******************************************************************************
+ * Copyright (c) 2010 Oracle.
+ * All rights reserved. This program and the accompanying materials are
+ * made available under the terms of the Eclipse Public License v1.0 which
+ * accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.jpt.core.internal.jpa1.context;
+
+import org.eclipse.jpt.core.context.BaseJoinColumn;
+import org.eclipse.jpt.core.context.SecondaryTable;
+import org.eclipse.jpt.core.internal.context.BaseJoinColumnTextRangeResolver;
+import org.eclipse.jpt.core.internal.validation.DefaultJpaValidationMessages;
+import org.eclipse.jpt.core.internal.validation.JpaValidationMessages;
+import org.eclipse.wst.validation.internal.provisional.core.IMessage;
+
+public class SecondaryTablePrimaryKeyJoinColumnValidator extends PrimaryKeyJoinColumnValidator
+{
+ private final SecondaryTable secondaryTable;
+
+ public SecondaryTablePrimaryKeyJoinColumnValidator(
+ SecondaryTable secondaryTable,
+ BaseJoinColumn column,
+ BaseJoinColumn.Owner owner,
+ BaseJoinColumnTextRangeResolver textRangeResolver) {
+ super(column, owner, textRangeResolver);
+ this.secondaryTable = secondaryTable;
+ }
+
+ protected boolean isSecondaryTableVirtual() {
+ return this.secondaryTable.isVirtual();
+ }
+
+ protected String getSecondaryTableName() {
+ return this.secondaryTable.getName();
+ }
+
+ @Override
+ public IMessage buildUnresolvedNameMessage() {
+ if (isSecondaryTableVirtual()) {
+ return this.buildVirtualSecondaryTableUnresolvedNameMessage();
+ }
+ return super.buildUnresolvedNameMessage();
+ }
+
+ protected IMessage buildVirtualSecondaryTableUnresolvedNameMessage() {
+ return DefaultJpaValidationMessages.buildMessage(
+ IMessage.HIGH_SEVERITY,
+ JpaValidationMessages.VIRTUAL_SECONDARY_TABLE_PRIMARY_KEY_JOIN_COLUMN_UNRESOLVED_NAME,
+ new String[] {this.getSecondaryTableName(), getColumn().getName(), getColumn().getDbTable().getName()},
+ getColumn(),
+ getTextRangeResolver().getNameTextRange()
+ );
+ }
+
+ @Override
+ public IMessage buildUnresolvedReferencedColumnNameMessage() {
+ if (isSecondaryTableVirtual()) {
+ return this.buildVirtualSecondaryTableUnresolvedReferencedColumnNameMessage();
+ }
+ return super.buildUnresolvedReferencedColumnNameMessage();
+ }
+
+ protected IMessage buildVirtualSecondaryTableUnresolvedReferencedColumnNameMessage() {
+ return DefaultJpaValidationMessages.buildMessage(
+ IMessage.HIGH_SEVERITY,
+ JpaValidationMessages.VIRTUAL_SECONDARY_TABLE_PRIMARY_KEY_JOIN_COLUMN_UNRESOLVED_REFERENCED_COLUMN_NAME,
+ new String[] {this.getSecondaryTableName(), getColumn().getName(), getColumn().getDbTable().getName()},
+ getColumn(),
+ getTextRangeResolver().getReferencedColumnNameTextRange()
+ );
+ }
+
+ @Override
+ public IMessage buildUnspecifiedNameMultipleJoinColumnsMessage() {
+ if (this.isSecondaryTableVirtual()) {
+ return this.buildVirtualSecondaryTableUnspecifiedNameMultipleJoinColumnsMessage();
+ }
+ return super.buildUnspecifiedNameMultipleJoinColumnsMessage();
+ }
+
+ protected IMessage buildVirtualSecondaryTableUnspecifiedNameMultipleJoinColumnsMessage() {
+ return DefaultJpaValidationMessages.buildMessage(
+ IMessage.HIGH_SEVERITY,
+ JpaValidationMessages.VIRTUAL_SECONDARY_TABLE_PRIMARY_KEY_JOIN_COLUMN_NAME_MUST_BE_SPECIFIED_MULTIPLE_JOIN_COLUMNS,
+ new String[] {this.getSecondaryTableName()},
+ getColumn(),
+ getTextRangeResolver().getNameTextRange()
+ );
+ }
+
+ @Override
+ public IMessage buildUnspecifiedReferencedColumnNameMultipleJoinColumnsMessage() {
+ if (this.isSecondaryTableVirtual()) {
+ return this.buildVirtualSecondaryTableUnspecifiedReferencedColumnNameMultipleJoinColumnsMessage();
+ }
+ return super.buildUnspecifiedReferencedColumnNameMultipleJoinColumnsMessage();
+ }
+
+ protected IMessage buildVirtualSecondaryTableUnspecifiedReferencedColumnNameMultipleJoinColumnsMessage() {
+ return DefaultJpaValidationMessages.buildMessage(
+ IMessage.HIGH_SEVERITY,
+ JpaValidationMessages.VIRTUAL_SECONDARY_TABLE_PRIMARY_KEY_JOIN_COLUMN_REFERENCED_COLUMN_NAME_MUST_BE_SPECIFIED_MULTIPLE_JOIN_COLUMNS,
+ new String[] {this.getSecondaryTableName()},
+ getColumn(),
+ getTextRangeResolver().getReferencedColumnNameTextRange()
+ );
+ }
+}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/java/GenericJavaAssociationOverrideContainer.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/java/GenericJavaAssociationOverrideContainer.java
index 552a6aa8f7..25c999ddb2 100644
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/java/GenericJavaAssociationOverrideContainer.java
+++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/java/GenericJavaAssociationOverrideContainer.java
@@ -15,17 +15,16 @@ import java.util.Iterator;
import java.util.List;
import java.util.ListIterator;
import org.eclipse.jdt.core.dom.CompilationUnit;
-import org.eclipse.jpt.core.context.AssociationOverride;
import org.eclipse.jpt.core.context.BaseColumn;
-import org.eclipse.jpt.core.context.BaseJoinColumn;
import org.eclipse.jpt.core.context.BaseOverride;
-import org.eclipse.jpt.core.context.NamedColumn;
import org.eclipse.jpt.core.context.RelationshipMapping;
import org.eclipse.jpt.core.context.RelationshipReference;
import org.eclipse.jpt.core.context.TypeMapping;
import org.eclipse.jpt.core.context.java.JavaAssociationOverride;
import org.eclipse.jpt.core.context.java.JavaAssociationOverrideContainer;
import org.eclipse.jpt.core.context.java.JavaJpaContextNode;
+import org.eclipse.jpt.core.internal.context.BaseColumnTextRangeResolver;
+import org.eclipse.jpt.core.internal.context.JptValidator;
import org.eclipse.jpt.core.internal.context.MappingTools;
import org.eclipse.jpt.core.internal.context.java.AbstractJavaJpaContextNode;
import org.eclipse.jpt.core.resource.java.AssociationOverrideAnnotation;
@@ -422,24 +421,8 @@ public class GenericJavaAssociationOverrideContainer extends AbstractJavaJpaCont
return getOwner().getDbTable(tableName);
}
- public IMessage buildColumnTableNotValidMessage(BaseOverride override, BaseColumn column, TextRange textRange) {
- return getOwner().buildColumnTableNotValidMessage(override, column, textRange);
- }
-
- public IMessage buildColumnUnresolvedNameMessage(BaseOverride override, NamedColumn column, TextRange textRange) {
- return getOwner().buildColumnUnresolvedNameMessage(override, column, textRange);
- }
-
- public IMessage buildColumnUnresolvedReferencedColumnNameMessage(AssociationOverride override, BaseJoinColumn column, TextRange textRange) {
- return getOwner().buildColumnUnresolvedReferencedColumnNameMessage(override, column, textRange);
- }
-
- public IMessage buildUnspecifiedNameMultipleJoinColumnsMessage(AssociationOverride override, BaseJoinColumn column, TextRange textRange) {
- return getOwner().buildUnspecifiedNameMultipleJoinColumnsMessage(override, column, textRange);
- }
-
- public IMessage buildUnspecifiedReferencedColumnNameMultipleJoinColumnsMessage(AssociationOverride override, BaseJoinColumn column, TextRange textRange) {
- return getOwner().buildUnspecifiedReferencedColumnNameMultipleJoinColumnsMessage(override, column, textRange);
+ public JptValidator buildColumnValidator(BaseOverride override, BaseColumn column, BaseColumn.Owner owner, BaseColumnTextRangeResolver textRangeResolver) {
+ return getOwner().buildColumnValidator(override, column, owner, textRangeResolver);
}
}
}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/java/GenericJavaAttributeOverride.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/java/GenericJavaAttributeOverride.java
index 9ccff4bc9d..86903d2545 100644
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/java/GenericJavaAttributeOverride.java
+++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/java/GenericJavaAttributeOverride.java
@@ -21,6 +21,9 @@ import org.eclipse.jpt.core.context.TypeMapping;
import org.eclipse.jpt.core.context.java.JavaAttributeOverride;
import org.eclipse.jpt.core.context.java.JavaAttributeOverrideContainer;
import org.eclipse.jpt.core.context.java.JavaColumn;
+import org.eclipse.jpt.core.internal.context.BaseColumnTextRangeResolver;
+import org.eclipse.jpt.core.internal.context.JptValidator;
+import org.eclipse.jpt.core.internal.context.NamedColumnTextRangeResolver;
import org.eclipse.jpt.core.internal.context.java.AbstractJavaOverride;
import org.eclipse.jpt.core.internal.validation.DefaultJpaValidationMessages;
import org.eclipse.jpt.core.internal.validation.JpaValidationMessages;
@@ -28,7 +31,6 @@ import org.eclipse.jpt.core.jpa2.context.AttributeOverride2_0;
import org.eclipse.jpt.core.jpa2.context.SingleRelationshipMapping2_0;
import org.eclipse.jpt.core.resource.java.AttributeOverrideAnnotation;
import org.eclipse.jpt.core.resource.java.ColumnAnnotation;
-import org.eclipse.jpt.core.utility.TextRange;
import org.eclipse.jpt.db.Table;
import org.eclipse.jpt.utility.Filter;
import org.eclipse.jpt.utility.internal.iterables.CompositeIterable;
@@ -244,11 +246,7 @@ public class GenericJavaAttributeOverride
}
}
- public IMessage buildUnresolvedNameMessage(NamedColumn column, TextRange textRange) {
- return getOwner().buildColumnUnresolvedNameMessage(this, column, textRange);
- }
-
- public IMessage buildTableNotValidMessage(BaseColumn column, TextRange textRange) {
- return getOwner().buildColumnTableNotValidMessage(this, column, textRange);
+ public JptValidator buildColumnValidator(NamedColumn column, NamedColumnTextRangeResolver textRangeResolver) {
+ return getOwner().buildColumnValidator(this, (BaseColumn) column, this, (BaseColumnTextRangeResolver) textRangeResolver);
}
}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/java/GenericJavaAttributeOverrideContainer.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/java/GenericJavaAttributeOverrideContainer.java
index 027151e02d..1a90ce0781 100644
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/java/GenericJavaAttributeOverrideContainer.java
+++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/java/GenericJavaAttributeOverrideContainer.java
@@ -18,11 +18,12 @@ import org.eclipse.jdt.core.dom.CompilationUnit;
import org.eclipse.jpt.core.context.BaseColumn;
import org.eclipse.jpt.core.context.BaseOverride;
import org.eclipse.jpt.core.context.Column;
-import org.eclipse.jpt.core.context.NamedColumn;
import org.eclipse.jpt.core.context.TypeMapping;
import org.eclipse.jpt.core.context.java.JavaAttributeOverride;
import org.eclipse.jpt.core.context.java.JavaAttributeOverrideContainer;
import org.eclipse.jpt.core.context.java.JavaJpaContextNode;
+import org.eclipse.jpt.core.internal.context.BaseColumnTextRangeResolver;
+import org.eclipse.jpt.core.internal.context.JptValidator;
import org.eclipse.jpt.core.internal.context.java.AbstractJavaJpaContextNode;
import org.eclipse.jpt.core.internal.context.java.VirtualAttributeOverrideAnnotation;
import org.eclipse.jpt.core.resource.java.Annotation;
@@ -440,12 +441,8 @@ public class GenericJavaAttributeOverrideContainer extends AbstractJavaJpaContex
return getOwner().getDbTable(tableName);
}
- public IMessage buildColumnTableNotValidMessage(BaseOverride override, BaseColumn column, TextRange textRange) {
- return getOwner().buildColumnTableNotValidMessage(override, column, textRange);
- }
-
- public IMessage buildColumnUnresolvedNameMessage(BaseOverride override, NamedColumn column, TextRange textRange) {
- return getOwner().buildColumnUnresolvedNameMessage(override, column, textRange);
+ public JptValidator buildColumnValidator(BaseOverride override, BaseColumn column, BaseColumn.Owner owner, BaseColumnTextRangeResolver textRangeResolver) {
+ return getOwner().buildColumnValidator(override, column, owner, textRangeResolver);
}
}
}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/java/GenericJavaEmbeddedMapping.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/java/GenericJavaEmbeddedMapping.java
index 3f4ca58cdb..24494a33ad 100644
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/java/GenericJavaEmbeddedMapping.java
+++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/java/GenericJavaEmbeddedMapping.java
@@ -17,18 +17,19 @@ import org.eclipse.jpt.core.MappingKeys;
import org.eclipse.jpt.core.context.AssociationOverride;
import org.eclipse.jpt.core.context.AttributeMapping;
import org.eclipse.jpt.core.context.BaseColumn;
-import org.eclipse.jpt.core.context.BaseJoinColumn;
import org.eclipse.jpt.core.context.BaseOverride;
-import org.eclipse.jpt.core.context.NamedColumn;
+import org.eclipse.jpt.core.context.JoinColumn;
import org.eclipse.jpt.core.context.RelationshipReference;
import org.eclipse.jpt.core.context.TypeMapping;
import org.eclipse.jpt.core.context.java.JavaAssociationOverrideContainer;
import org.eclipse.jpt.core.context.java.JavaPersistentAttribute;
+import org.eclipse.jpt.core.internal.context.BaseColumnTextRangeResolver;
+import org.eclipse.jpt.core.internal.context.JoinColumnTextRangeResolver;
+import org.eclipse.jpt.core.internal.context.JptValidator;
import org.eclipse.jpt.core.internal.context.MappingTools;
import org.eclipse.jpt.core.internal.context.java.AbstractJavaBaseEmbeddedMapping;
-import org.eclipse.jpt.core.internal.validation.DefaultJpaValidationMessages;
-import org.eclipse.jpt.core.internal.validation.JpaValidationDescriptionMessages;
-import org.eclipse.jpt.core.internal.validation.JpaValidationMessages;
+import org.eclipse.jpt.core.internal.jpa1.context.AssociationOverrideJoinColumnValidator;
+import org.eclipse.jpt.core.internal.jpa1.context.EntityTableDescriptionProvider;
import org.eclipse.jpt.core.jpa2.JpaFactory2_0;
import org.eclipse.jpt.core.jpa2.context.java.JavaEmbeddedMapping2_0;
import org.eclipse.jpt.core.resource.java.EmbeddedAnnotation;
@@ -250,126 +251,8 @@ public class GenericJavaEmbeddedMapping
return GenericJavaEmbeddedMapping.this.getValidationTextRange(astRoot);
}
- public IMessage buildColumnTableNotValidMessage(BaseOverride override, BaseColumn column, TextRange textRange) {
- if (override.isVirtual()) {
- return this.buildVirtualOverrideColumnTableNotValidMessage(override.getName(), column, textRange);
- }
- return DefaultJpaValidationMessages.buildMessage(
- IMessage.HIGH_SEVERITY,
- JpaValidationMessages.JOIN_COLUMN_TABLE_NOT_VALID,
- new String[] {
- column.getTable(),
- column.getName(),
- JpaValidationDescriptionMessages.NOT_VALID_FOR_THIS_ENTITY},
- column,
- textRange
- );
- }
-
- protected IMessage buildVirtualOverrideColumnTableNotValidMessage(String overrideName, BaseColumn column, TextRange textRange) {
- return DefaultJpaValidationMessages.buildMessage(
- IMessage.HIGH_SEVERITY,
- JpaValidationMessages.VIRTUAL_ASSOCIATION_OVERRIDE_JOIN_COLUMN_TABLE_NOT_VALID,
- new String[] {
- overrideName,
- column.getTable(),
- column.getName(),
- JpaValidationDescriptionMessages.NOT_VALID_FOR_THIS_ENTITY},
- column,
- textRange
- );
- }
-
- public IMessage buildColumnUnresolvedNameMessage(BaseOverride override, NamedColumn column, TextRange textRange) {
- if (override.isVirtual()) {
- return this.buildVirtualColumnUnresolvedNameMessage(override.getName(), column, textRange);
- }
- return DefaultJpaValidationMessages.buildMessage(
- IMessage.HIGH_SEVERITY,
- JpaValidationMessages.JOIN_COLUMN_UNRESOLVED_NAME,
- new String[] {column.getName(), column.getDbTable().getName()},
- column,
- textRange
- );
- }
-
- protected IMessage buildVirtualColumnUnresolvedNameMessage(String overrideName, NamedColumn column, TextRange textRange) {
- return DefaultJpaValidationMessages.buildMessage(
- IMessage.HIGH_SEVERITY,
- JpaValidationMessages.VIRTUAL_ASSOCIATION_OVERRIDE_JOIN_COLUMN_UNRESOLVED_NAME,
- new String[] {overrideName, column.getName(), column.getDbTable().getName()},
- column,
- textRange
- );
- }
-
- public IMessage buildColumnUnresolvedReferencedColumnNameMessage(AssociationOverride override, BaseJoinColumn column, TextRange textRange) {
- if (override.isVirtual()) {
- return this.buildVirtualColumnUnresolvedReferencedColumnNameMessage(override.getName(), column, textRange);
- }
- return DefaultJpaValidationMessages.buildMessage(
- IMessage.HIGH_SEVERITY,
- JpaValidationMessages.JOIN_COLUMN_UNRESOLVED_REFERENCED_COLUMN_NAME,
- new String[] {column.getReferencedColumnName(), column.getReferencedColumnDbTable().getName()},
- column,
- textRange
- );
- }
-
- protected IMessage buildVirtualColumnUnresolvedReferencedColumnNameMessage(String overrideName, BaseJoinColumn column, TextRange textRange) {
- return DefaultJpaValidationMessages.buildMessage(
- IMessage.HIGH_SEVERITY,
- JpaValidationMessages.VIRTUAL_ASSOCIATION_OVERRIDE_JOIN_COLUMN_UNRESOLVED_REFERENCED_COLUMN_NAME,
- new String[] {overrideName, column.getReferencedColumnName(), column.getReferencedColumnDbTable().getName()},
- column,
- textRange
- );
- }
-
- public IMessage buildUnspecifiedNameMultipleJoinColumnsMessage(AssociationOverride override, BaseJoinColumn column, TextRange textRange) {
- if (override.isVirtual()) {
- return this.buildVirtualUnspecifiedNameMultipleJoinColumnsMessage(override.getName(), column, textRange);
- }
- return DefaultJpaValidationMessages.buildMessage(
- IMessage.HIGH_SEVERITY,
- JpaValidationMessages.JOIN_COLUMN_NAME_MUST_BE_SPECIFIED_MULTIPLE_JOIN_COLUMNS,
- new String[0],
- column,
- textRange
- );
- }
-
- protected IMessage buildVirtualUnspecifiedNameMultipleJoinColumnsMessage(String overrideName, BaseJoinColumn column, TextRange textRange) {
- return DefaultJpaValidationMessages.buildMessage(
- IMessage.HIGH_SEVERITY,
- JpaValidationMessages.VIRTUAL_ASSOCIATION_OVERRIDE_JOIN_COLUMN_NAME_MUST_BE_SPECIFIED_MULTIPLE_JOIN_COLUMNS,
- new String[] {overrideName},
- column,
- textRange
- );
- }
-
- public IMessage buildUnspecifiedReferencedColumnNameMultipleJoinColumnsMessage(AssociationOverride override, BaseJoinColumn column, TextRange textRange) {
- if (override.isVirtual()) {
- return this.buildVirtualUnspecifiedReferencedColumnNameMultipleJoinColumnsMessage(override.getName(), column, textRange);
- }
- return DefaultJpaValidationMessages.buildMessage(
- IMessage.HIGH_SEVERITY,
- JpaValidationMessages.JOIN_COLUMN_REFERENCED_COLUMN_NAME_MUST_BE_SPECIFIED_MULTIPLE_JOIN_COLUMNS,
- new String[0],
- column,
- textRange
- );
- }
-
- protected IMessage buildVirtualUnspecifiedReferencedColumnNameMultipleJoinColumnsMessage(String overrideName, BaseJoinColumn column, TextRange textRange) {
- return DefaultJpaValidationMessages.buildMessage(
- IMessage.HIGH_SEVERITY,
- JpaValidationMessages.VIRTUAL_ASSOCIATION_OVERRIDE_JOIN_COLUMN_REFERENCED_COLUMN_NAME_MUST_BE_SPECIFIED_MULTIPLE_JOIN_COLUMNS,
- new String[] {overrideName},
- column,
- textRange
- );
+ public JptValidator buildColumnValidator(BaseOverride override, BaseColumn column, BaseColumn.Owner owner, BaseColumnTextRangeResolver textRangeResolver) {
+ return new AssociationOverrideJoinColumnValidator((AssociationOverride) override, (JoinColumn) column, (JoinColumn.Owner) owner, (JoinColumnTextRangeResolver) textRangeResolver, new EntityTableDescriptionProvider());
}
}
}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/java/GenericJavaJoinColumn.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/java/GenericJavaJoinColumn.java
index a357dd5e90..ee6f259f93 100644
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/java/GenericJavaJoinColumn.java
+++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/java/GenericJavaJoinColumn.java
@@ -10,14 +10,14 @@
package org.eclipse.jpt.core.internal.jpa1.context.java;
import java.util.Iterator;
-import java.util.List;
-
import org.eclipse.jdt.core.dom.CompilationUnit;
import org.eclipse.jpt.core.context.BaseJoinColumn;
import org.eclipse.jpt.core.context.java.JavaJoinColumn;
import org.eclipse.jpt.core.context.java.JavaJpaContextNode;
import org.eclipse.jpt.core.internal.context.MappingTools;
+import org.eclipse.jpt.core.internal.context.NamedColumnTextRangeResolver;
import org.eclipse.jpt.core.internal.context.java.AbstractJavaBaseColumn;
+import org.eclipse.jpt.core.internal.context.java.JavaJoinColumnTextRangeResolver;
import org.eclipse.jpt.core.resource.java.JoinColumnAnnotation;
import org.eclipse.jpt.core.utility.TextRange;
import org.eclipse.jpt.db.Column;
@@ -26,7 +26,6 @@ import org.eclipse.jpt.utility.Filter;
import org.eclipse.jpt.utility.internal.StringTools;
import org.eclipse.jpt.utility.internal.iterables.EmptyIterable;
import org.eclipse.jpt.utility.internal.iterables.FilteringIterable;
-import org.eclipse.wst.validation.internal.provisional.core.IMessage;
public class GenericJavaJoinColumn extends AbstractJavaBaseColumn<JoinColumnAnnotation> implements JavaJoinColumn
@@ -153,45 +152,7 @@ public class GenericJavaJoinColumn extends AbstractJavaBaseColumn<JoinColumnAnno
}
@Override
- //this method will only be called if the table validates correctly
- protected void validateName(List<IMessage> messages, CompilationUnit astRoot) {
- this.validateJoinColumnName(messages, astRoot);
- this.validateReferencedColumnName(messages, astRoot);
- }
-
- protected void validateJoinColumnName(List<IMessage> messages, CompilationUnit astRoot) {
- if (getSpecifiedName() == null && this.getOwner().joinColumnsSize() > 1) {
- messages.add(this.buildUnspecifiedNameMultipleJoinColumnsMessage(astRoot));
- }
- else if (this.getName() != null){
- super.validateName(messages, astRoot);
- }
- //If the name is null and there is only one join-column, one of these validation messages will apply
- // 1. target entity does not have a primary key
- // 2. target entity is not specified
- // 3. target entity is not an entity
- }
-
- protected void validateReferencedColumnName(List<IMessage> messages, CompilationUnit astRoot) {
- if (getSpecifiedReferencedColumnName() == null && this.getOwner().joinColumnsSize() > 1) {
- messages.add(this.buildUnspecifiedReferencedColumnNameMultipleJoinColumnsMessage(astRoot));
- }
- else if (this.getSpecifiedReferencedColumnName() != null) {
- if (this.getReferencedColumnDbTable() != null && ! this.isReferencedColumnResolved()) {
- messages.add(getOwner().buildUnresolvedReferencedColumnNameMessage(this, this.getReferencedColumnNameTextRange(astRoot)));
- }
- }
- //If the referenced column name is null and there is only one join-column, one of these validation messages will apply
- // 1. target entity does not have a primary key
- // 2. target entity is not specified
- // 3. target entity is not an entity
- }
-
- protected IMessage buildUnspecifiedNameMultipleJoinColumnsMessage(CompilationUnit astRoot) {
- return getOwner().buildUnspecifiedNameMultipleJoinColumnsMessage(this, getNameTextRange(astRoot));
- }
-
- protected IMessage buildUnspecifiedReferencedColumnNameMultipleJoinColumnsMessage(CompilationUnit astRoot) {
- return getOwner().buildUnspecifiedReferencedColumnNameMultipleJoinColumnsMessage(this, getReferencedColumnNameTextRange(astRoot));
+ protected NamedColumnTextRangeResolver buildTextRangeResolver(CompilationUnit astRoot) {
+ return new JavaJoinColumnTextRangeResolver(this, astRoot);
}
}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/java/GenericJavaJoinTable.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/java/GenericJavaJoinTable.java
index d9c2c680b8..18ea915f70 100644
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/java/GenericJavaJoinTable.java
+++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/java/GenericJavaJoinTable.java
@@ -13,9 +13,7 @@ import java.util.Iterator;
import java.util.List;
import java.util.ListIterator;
import java.util.Vector;
-
import org.eclipse.jdt.core.dom.CompilationUnit;
-import org.eclipse.jpt.core.context.BaseColumn;
import org.eclipse.jpt.core.context.BaseJoinColumn;
import org.eclipse.jpt.core.context.Entity;
import org.eclipse.jpt.core.context.JoinColumn;
@@ -26,10 +24,14 @@ import org.eclipse.jpt.core.context.TypeMapping;
import org.eclipse.jpt.core.context.java.JavaJoinColumn;
import org.eclipse.jpt.core.context.java.JavaJoinTable;
import org.eclipse.jpt.core.context.java.JavaJoinTableJoiningStrategy;
+import org.eclipse.jpt.core.internal.context.JoinColumnTextRangeResolver;
+import org.eclipse.jpt.core.internal.context.JptValidator;
import org.eclipse.jpt.core.internal.context.MappingTools;
+import org.eclipse.jpt.core.internal.context.NamedColumnTextRangeResolver;
+import org.eclipse.jpt.core.internal.jpa1.context.InverseJoinColumnValidator;
+import org.eclipse.jpt.core.internal.jpa1.context.JoinColumnValidator;
+import org.eclipse.jpt.core.internal.jpa1.context.JoinTableTableDescriptionProvider;
import org.eclipse.jpt.core.internal.resource.java.NullJoinColumnAnnotation;
-import org.eclipse.jpt.core.internal.validation.DefaultJpaValidationMessages;
-import org.eclipse.jpt.core.internal.validation.JpaValidationDescriptionMessages;
import org.eclipse.jpt.core.internal.validation.JpaValidationMessages;
import org.eclipse.jpt.core.resource.java.JoinColumnAnnotation;
import org.eclipse.jpt.core.resource.java.JoinTableAnnotation;
@@ -384,68 +386,6 @@ public class GenericJavaJoinTable
public TextRange getValidationTextRange(CompilationUnit astRoot) {
return GenericJavaJoinTable.this.getValidationTextRange(astRoot);
}
-
- public IMessage buildTableNotValidMessage(BaseColumn column, TextRange textRange) {
- return DefaultJpaValidationMessages.buildMessage(
- IMessage.HIGH_SEVERITY,
- this.getTableNotValidMessage(),
- new String[] {
- column.getTable(),
- column.getName(),
- JpaValidationDescriptionMessages.DOES_NOT_MATCH_JOIN_TABLE},
- column,
- textRange
- );
- }
-
- protected abstract String getTableNotValidMessage();
-
- public IMessage buildUnresolvedNameMessage(NamedColumn column, TextRange textRange) {
- return DefaultJpaValidationMessages.buildMessage(
- IMessage.HIGH_SEVERITY,
- this.getUnresolvedNameMessage(),
- new String[] {column.getName(), column.getDbTable().getName()},
- column,
- textRange
- );
- }
-
- protected abstract String getUnresolvedNameMessage();
-
- public IMessage buildUnresolvedReferencedColumnNameMessage(BaseJoinColumn column, TextRange textRange) {
- return DefaultJpaValidationMessages.buildMessage(
- IMessage.HIGH_SEVERITY,
- this.getUnresolvedReferencedColumnNameMessage(),
- new String[] {column.getReferencedColumnName(), column.getReferencedColumnDbTable().getName()},
- column,
- textRange
- );
- }
-
- protected abstract String getUnresolvedReferencedColumnNameMessage();
-
- public IMessage buildUnspecifiedNameMultipleJoinColumnsMessage(BaseJoinColumn column, TextRange textRange) {
- return DefaultJpaValidationMessages.buildMessage(
- IMessage.HIGH_SEVERITY,
- this.getUnspecifiedNameMultipleJoinColumnsMessage(),
- new String[0],
- column,
- textRange
- );
- }
-
- protected abstract String getUnspecifiedNameMultipleJoinColumnsMessage();
-
- public IMessage buildUnspecifiedReferencedColumnNameMultipleJoinColumnsMessage(BaseJoinColumn column, TextRange textRange) {
- return DefaultJpaValidationMessages.buildMessage(
- IMessage.HIGH_SEVERITY,
- this.getUnspecifiedReferencedColumnNameMultipleJoinColumnsMessage(),
- new String[0],
- column,
- textRange
- );
- }
- protected abstract String getUnspecifiedReferencedColumnNameMultipleJoinColumnsMessage();
}
@@ -500,29 +440,8 @@ public class GenericJavaJoinTable
return GenericJavaJoinTable.this.joinColumnsSize();
}
- @Override
- protected String getUnresolvedNameMessage() {
- return JpaValidationMessages.JOIN_COLUMN_UNRESOLVED_NAME;
- }
-
- @Override
- protected String getTableNotValidMessage() {
- return JpaValidationMessages.JOIN_COLUMN_TABLE_NOT_VALID;
- }
-
- @Override
- protected String getUnspecifiedNameMultipleJoinColumnsMessage() {
- return JpaValidationMessages.JOIN_COLUMN_NAME_MUST_BE_SPECIFIED_MULTIPLE_JOIN_COLUMNS;
- }
-
- @Override
- protected String getUnresolvedReferencedColumnNameMessage() {
- return JpaValidationMessages.JOIN_COLUMN_UNRESOLVED_REFERENCED_COLUMN_NAME;
- }
-
- @Override
- protected String getUnspecifiedReferencedColumnNameMultipleJoinColumnsMessage() {
- return JpaValidationMessages.JOIN_COLUMN_REFERENCED_COLUMN_NAME_MUST_BE_SPECIFIED_MULTIPLE_JOIN_COLUMNS;
+ public JptValidator buildColumnValidator(NamedColumn column, NamedColumnTextRangeResolver textRangeResolver) {
+ return new JoinColumnValidator((JoinColumn) column, this, (JoinColumnTextRangeResolver) textRangeResolver, new JoinTableTableDescriptionProvider());
}
}
@@ -566,29 +485,8 @@ public class GenericJavaJoinTable
return GenericJavaJoinTable.this.inverseJoinColumnsSize();
}
- @Override
- protected String getUnresolvedNameMessage() {
- return JpaValidationMessages.INVERSE_JOIN_COLUMN_UNRESOLVED_NAME;
- }
-
- @Override
- protected String getTableNotValidMessage() {
- return JpaValidationMessages.INVERSE_JOIN_COLUMN_TABLE_NOT_VALID;
- }
-
- @Override
- protected String getUnresolvedReferencedColumnNameMessage() {
- return JpaValidationMessages.INVERSE_JOIN_COLUMN_UNRESOLVED_REFERENCED_COLUMN_NAME;
- }
-
- @Override
- protected String getUnspecifiedNameMultipleJoinColumnsMessage() {
- return JpaValidationMessages.INVERSE_JOIN_COLUMN_NAME_MUST_BE_SPECIFIED_MULTIPLE_JOIN_COLUMNS;
- }
-
- @Override
- protected String getUnspecifiedReferencedColumnNameMultipleJoinColumnsMessage() {
- return JpaValidationMessages.INVERSE_JOIN_COLUMN_REFERENCED_COLUMN_NAME_MUST_BE_SPECIFIED_MULTIPLE_JOIN_COLUMNS;
+ public JptValidator buildColumnValidator(NamedColumn column, NamedColumnTextRangeResolver textRangeResolver) {
+ return new InverseJoinColumnValidator((JoinColumn) column, this, (JoinColumnTextRangeResolver) textRangeResolver, new JoinTableTableDescriptionProvider());
}
}
}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/java/GenericJavaOrderable.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/java/GenericJavaOrderable.java
index 6ebe7b84fc..c7baf701d9 100644
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/java/GenericJavaOrderable.java
+++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/java/GenericJavaOrderable.java
@@ -19,11 +19,15 @@ import org.eclipse.jpt.core.context.TypeMapping;
import org.eclipse.jpt.core.context.java.JavaAttributeMapping;
import org.eclipse.jpt.core.context.java.JavaNamedColumn;
import org.eclipse.jpt.core.context.java.JavaPersistentAttribute;
+import org.eclipse.jpt.core.internal.context.JptValidator;
+import org.eclipse.jpt.core.internal.context.NamedColumnTextRangeResolver;
import org.eclipse.jpt.core.internal.context.java.AbstractJavaJpaContextNode;
+import org.eclipse.jpt.core.internal.jpa2.context.OrderColumnValidator;
import org.eclipse.jpt.core.internal.jpa2.context.java.NullJavaOrderColumn2_0;
import org.eclipse.jpt.core.internal.validation.DefaultJpaValidationMessages;
import org.eclipse.jpt.core.internal.validation.JpaValidationMessages;
import org.eclipse.jpt.core.jpa2.JpaFactory2_0;
+import org.eclipse.jpt.core.jpa2.context.OrderColumn2_0;
import org.eclipse.jpt.core.jpa2.context.Orderable2_0;
import org.eclipse.jpt.core.jpa2.context.java.JavaOrderColumn2_0;
import org.eclipse.jpt.core.jpa2.context.java.JavaOrderable2_0;
@@ -388,14 +392,8 @@ public class GenericJavaOrderable
return GenericJavaOrderable.this.getValidationTextRange(astRoot);
}
- public IMessage buildUnresolvedNameMessage(NamedColumn column, TextRange textRange) {
- return DefaultJpaValidationMessages.buildMessage(
- IMessage.HIGH_SEVERITY,
- JpaValidationMessages.ORDER_COLUMN_UNRESOLVED_NAME,
- new String[] {column.getName(), column.getDbTable().getName()},
- column,
- textRange
- );
+ public JptValidator buildColumnValidator(NamedColumn column, NamedColumnTextRangeResolver textRangeResolver) {
+ return new OrderColumnValidator((OrderColumn2_0) column, textRangeResolver);
}
}
}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/java/GenericJavaPrimaryKeyJoinColumn.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/java/GenericJavaPrimaryKeyJoinColumn.java
index 6a66e6da61..137b58f28f 100644
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/java/GenericJavaPrimaryKeyJoinColumn.java
+++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/java/GenericJavaPrimaryKeyJoinColumn.java
@@ -10,13 +10,13 @@
package org.eclipse.jpt.core.internal.jpa1.context.java;
import java.util.Iterator;
-import java.util.List;
-
import org.eclipse.jdt.core.dom.CompilationUnit;
import org.eclipse.jpt.core.context.java.JavaBaseJoinColumn;
import org.eclipse.jpt.core.context.java.JavaJpaContextNode;
import org.eclipse.jpt.core.context.java.JavaPrimaryKeyJoinColumn;
+import org.eclipse.jpt.core.internal.context.NamedColumnTextRangeResolver;
import org.eclipse.jpt.core.internal.context.java.AbstractJavaNamedColumn;
+import org.eclipse.jpt.core.internal.context.java.JavaPrimaryKeyJoinColumnTextRangeResolver;
import org.eclipse.jpt.core.resource.java.PrimaryKeyJoinColumnAnnotation;
import org.eclipse.jpt.core.utility.TextRange;
import org.eclipse.jpt.db.Column;
@@ -25,7 +25,6 @@ import org.eclipse.jpt.utility.Filter;
import org.eclipse.jpt.utility.internal.StringTools;
import org.eclipse.jpt.utility.internal.iterables.EmptyIterable;
import org.eclipse.jpt.utility.internal.iterables.FilteringIterable;
-import org.eclipse.wst.validation.internal.provisional.core.IMessage;
public class GenericJavaPrimaryKeyJoinColumn extends AbstractJavaNamedColumn<PrimaryKeyJoinColumnAnnotation>
@@ -163,47 +162,9 @@ public class GenericJavaPrimaryKeyJoinColumn extends AbstractJavaNamedColumn<Pri
sb.append("=>"); //$NON-NLS-1$
sb.append(this.getReferencedColumnName());
}
-
- @Override
- //this method will only be called if the table validates correctly
- protected void validateName(List<IMessage> messages, CompilationUnit astRoot) {
- this.validateJoinColumnName(messages, astRoot);
- this.validateReferencedColumnName(messages, astRoot);
- }
-
- protected void validateJoinColumnName(List<IMessage> messages, CompilationUnit astRoot) {
- if (getSpecifiedName() == null && this.getOwner().joinColumnsSize() > 1) {
- messages.add(this.buildUnspecifiedNameMultipleJoinColumnsMessage(astRoot));
- }
- else if (this.getName() != null){
- super.validateName(messages, astRoot);
- }
- //If the name is null and there is only one join-column, one of these validation messages will apply
- // 1. target entity does not have a primary key
- // 2. target entity is not specified
- // 3. target entity is not an entity
- }
-
- protected void validateReferencedColumnName(List<IMessage> messages, CompilationUnit astRoot) {
- if (getSpecifiedReferencedColumnName() == null && this.getOwner().joinColumnsSize() > 1) {
- messages.add(this.buildUnspecifiedReferencedColumnNameMultipleJoinColumnsMessage(astRoot));
- }
- else if (this.getReferencedColumnName() != null) {
- if (this.getReferencedColumnDbTable() != null && ! this.isReferencedColumnResolved()) {
- messages.add(getOwner().buildUnresolvedReferencedColumnNameMessage(this, this.getReferencedColumnNameTextRange(astRoot)));
- }
- }
- //If the referenced column name is null and there is only one join-column, one of these validation messages will apply
- // 1. target entity does not have a primary key
- // 2. target entity is not specified
- // 3. target entity is not an entity
- }
-
- protected IMessage buildUnspecifiedNameMultipleJoinColumnsMessage(CompilationUnit astRoot) {
- return getOwner().buildUnspecifiedNameMultipleJoinColumnsMessage(this, getNameTextRange(astRoot));
- }
- protected IMessage buildUnspecifiedReferencedColumnNameMultipleJoinColumnsMessage(CompilationUnit astRoot) {
- return getOwner().buildUnspecifiedReferencedColumnNameMultipleJoinColumnsMessage(this, getReferencedColumnNameTextRange(astRoot));
+ @Override
+ protected NamedColumnTextRangeResolver buildTextRangeResolver(CompilationUnit astRoot) {
+ return new JavaPrimaryKeyJoinColumnTextRangeResolver(this, astRoot);
}
}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/java/GenericJavaSecondaryTable.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/java/GenericJavaSecondaryTable.java
index e3a8df4319..972fa51953 100644
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/java/GenericJavaSecondaryTable.java
+++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/java/GenericJavaSecondaryTable.java
@@ -13,7 +13,6 @@ import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
import java.util.ListIterator;
-
import org.eclipse.jdt.core.dom.CompilationUnit;
import org.eclipse.jpt.core.context.BaseJoinColumn;
import org.eclipse.jpt.core.context.Entity;
@@ -24,7 +23,11 @@ import org.eclipse.jpt.core.context.java.JavaBaseJoinColumn;
import org.eclipse.jpt.core.context.java.JavaEntity;
import org.eclipse.jpt.core.context.java.JavaPrimaryKeyJoinColumn;
import org.eclipse.jpt.core.context.java.JavaSecondaryTable;
+import org.eclipse.jpt.core.internal.context.BaseJoinColumnTextRangeResolver;
+import org.eclipse.jpt.core.internal.context.JptValidator;
+import org.eclipse.jpt.core.internal.context.NamedColumnTextRangeResolver;
import org.eclipse.jpt.core.internal.context.java.AbstractJavaTable;
+import org.eclipse.jpt.core.internal.jpa1.context.SecondaryTablePrimaryKeyJoinColumnValidator;
import org.eclipse.jpt.core.internal.resource.java.NullPrimaryKeyJoinColumnAnnotation;
import org.eclipse.jpt.core.internal.validation.DefaultJpaValidationMessages;
import org.eclipse.jpt.core.internal.validation.JpaValidationMessages;
@@ -405,62 +408,8 @@ public class GenericJavaSecondaryTable
return GenericJavaSecondaryTable.this.primaryKeyJoinColumnsSize();
}
- public IMessage buildUnresolvedNameMessage(NamedColumn column, TextRange textRange) {
- if (((BaseJoinColumn) column).isVirtual()) {
- return DefaultJpaValidationMessages.buildMessage(
- IMessage.HIGH_SEVERITY,
- JpaValidationMessages.VIRTUAL_PRIMARY_KEY_JOIN_COLUMN_UNRESOLVED_NAME,
- new String[] {column.getName(), column.getDbTable().getName()},
- column,
- textRange
- );
- }
- return DefaultJpaValidationMessages.buildMessage(
- IMessage.HIGH_SEVERITY,
- JpaValidationMessages.PRIMARY_KEY_JOIN_COLUMN_UNRESOLVED_NAME,
- new String[] {column.getName(), column.getDbTable().getName()},
- column,
- textRange
- );
- }
-
- public IMessage buildUnresolvedReferencedColumnNameMessage(BaseJoinColumn column, TextRange textRange) {
- if (column.isVirtual()) {
- return DefaultJpaValidationMessages.buildMessage(
- IMessage.HIGH_SEVERITY,
- JpaValidationMessages.VIRTUAL_PRIMARY_KEY_JOIN_COLUMN_UNRESOLVED_REFERENCED_COLUMN_NAME,
- new String[] {column.getReferencedColumnName(), column.getReferencedColumnDbTable().getName()},
- column,
- textRange
- );
- }
- return DefaultJpaValidationMessages.buildMessage(
- IMessage.HIGH_SEVERITY,
- JpaValidationMessages.PRIMARY_KEY_JOIN_COLUMN_UNRESOLVED_REFERENCED_COLUMN_NAME,
- new String[] {column.getReferencedColumnName(), column.getReferencedColumnDbTable().getName()},
- column,
- textRange
- );
- }
-
- public IMessage buildUnspecifiedNameMultipleJoinColumnsMessage(BaseJoinColumn column, TextRange textRange) {
- return DefaultJpaValidationMessages.buildMessage(
- IMessage.HIGH_SEVERITY,
- JpaValidationMessages.PRIMARY_KEY_JOIN_COLUMN_NAME_MUST_BE_SPECIFIED_MULTIPLE_JOIN_COLUMNS,
- new String[0],
- column,
- textRange
- );
- }
-
- public IMessage buildUnspecifiedReferencedColumnNameMultipleJoinColumnsMessage(BaseJoinColumn column, TextRange textRange) {
- return DefaultJpaValidationMessages.buildMessage(
- IMessage.HIGH_SEVERITY,
- JpaValidationMessages.PRIMARY_KEY_JOIN_COLUMN_REFERENCED_COLUMN_NAME_MUST_BE_SPECIFIED_MULTIPLE_JOIN_COLUMNS,
- new String[0],
- column,
- textRange
- );
+ public JptValidator buildColumnValidator(NamedColumn column, NamedColumnTextRangeResolver textRangeResolver) {
+ return new SecondaryTablePrimaryKeyJoinColumnValidator(GenericJavaSecondaryTable.this, (BaseJoinColumn) column, this, (BaseJoinColumnTextRangeResolver) textRangeResolver);
}
}
}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/orm/GenericOrmAssociationOverrideContainer.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/orm/GenericOrmAssociationOverrideContainer.java
index c0e87d796a..145d75da33 100644
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/orm/GenericOrmAssociationOverrideContainer.java
+++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/orm/GenericOrmAssociationOverrideContainer.java
@@ -16,16 +16,16 @@ import java.util.ListIterator;
import org.eclipse.emf.common.util.EList;
import org.eclipse.jpt.core.context.AssociationOverride;
import org.eclipse.jpt.core.context.BaseColumn;
-import org.eclipse.jpt.core.context.BaseJoinColumn;
import org.eclipse.jpt.core.context.BaseOverride;
import org.eclipse.jpt.core.context.JoiningStrategy;
-import org.eclipse.jpt.core.context.NamedColumn;
import org.eclipse.jpt.core.context.RelationshipMapping;
import org.eclipse.jpt.core.context.RelationshipReference;
import org.eclipse.jpt.core.context.TypeMapping;
import org.eclipse.jpt.core.context.XmlContextNode;
import org.eclipse.jpt.core.context.orm.OrmAssociationOverride;
import org.eclipse.jpt.core.context.orm.OrmAssociationOverrideContainer;
+import org.eclipse.jpt.core.internal.context.BaseColumnTextRangeResolver;
+import org.eclipse.jpt.core.internal.context.JptValidator;
import org.eclipse.jpt.core.internal.context.MappingTools;
import org.eclipse.jpt.core.internal.context.orm.AbstractOrmXmlContextNode;
import org.eclipse.jpt.core.resource.orm.OrmFactory;
@@ -357,24 +357,8 @@ public class GenericOrmAssociationOverrideContainer extends AbstractOrmXmlContex
return getOwner().getDbTable(tableName);
}
- public IMessage buildColumnTableNotValidMessage(BaseOverride override, BaseColumn column, TextRange textRange) {
- return getOwner().buildColumnTableNotValidMessage(override, column, textRange);
- }
-
- public IMessage buildColumnUnresolvedNameMessage(BaseOverride override, NamedColumn column, TextRange textRange) {
- return getOwner().buildColumnUnresolvedNameMessage(override, column, textRange);
- }
-
- public IMessage buildColumnUnresolvedReferencedColumnNameMessage(AssociationOverride override, BaseJoinColumn column, TextRange textRange) {
- return getOwner().buildColumnUnresolvedReferencedColumnNameMessage(override, column, textRange);
- }
-
- public IMessage buildUnspecifiedNameMultipleJoinColumnsMessage(AssociationOverride override, BaseJoinColumn column, TextRange textRange) {
- return getOwner().buildUnspecifiedNameMultipleJoinColumnsMessage(override, column, textRange);
- }
-
- public IMessage buildUnspecifiedReferencedColumnNameMultipleJoinColumnsMessage(AssociationOverride override, BaseJoinColumn column, TextRange textRange) {
- return getOwner().buildUnspecifiedReferencedColumnNameMultipleJoinColumnsMessage(override, column, textRange);
+ public JptValidator buildColumnValidator(BaseOverride override, BaseColumn column, BaseColumn.Owner owner, BaseColumnTextRangeResolver textRangeResolver) {
+ return getOwner().buildColumnValidator(override, column, owner, textRangeResolver);
}
}
}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/orm/GenericOrmAttributeOverride.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/orm/GenericOrmAttributeOverride.java
index 267264314b..de4dee8db6 100644
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/orm/GenericOrmAttributeOverride.java
+++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/orm/GenericOrmAttributeOverride.java
@@ -21,6 +21,9 @@ import org.eclipse.jpt.core.context.TypeMapping;
import org.eclipse.jpt.core.context.orm.OrmAttributeOverride;
import org.eclipse.jpt.core.context.orm.OrmAttributeOverrideContainer;
import org.eclipse.jpt.core.context.orm.OrmColumn;
+import org.eclipse.jpt.core.internal.context.BaseColumnTextRangeResolver;
+import org.eclipse.jpt.core.internal.context.JptValidator;
+import org.eclipse.jpt.core.internal.context.NamedColumnTextRangeResolver;
import org.eclipse.jpt.core.internal.validation.DefaultJpaValidationMessages;
import org.eclipse.jpt.core.internal.validation.JpaValidationMessages;
import org.eclipse.jpt.core.jpa2.context.AttributeOverride2_0;
@@ -28,7 +31,6 @@ import org.eclipse.jpt.core.jpa2.context.SingleRelationshipMapping2_0;
import org.eclipse.jpt.core.resource.orm.OrmFactory;
import org.eclipse.jpt.core.resource.orm.XmlAttributeOverride;
import org.eclipse.jpt.core.resource.orm.XmlColumn;
-import org.eclipse.jpt.core.utility.TextRange;
import org.eclipse.jpt.db.Table;
import org.eclipse.jpt.utility.internal.iterables.CompositeIterable;
import org.eclipse.jpt.utility.internal.iterables.FilteringIterable;
@@ -231,11 +233,7 @@ public class GenericOrmAttributeOverride
}
}
- public IMessage buildUnresolvedNameMessage(NamedColumn column, TextRange textRange) {
- return getOwner().buildColumnUnresolvedNameMessage(this, column, textRange);
- }
-
- public IMessage buildTableNotValidMessage(BaseColumn column, TextRange textRange) {
- return getOwner().buildColumnTableNotValidMessage(this, column, textRange);
+ public JptValidator buildColumnValidator(NamedColumn column, NamedColumnTextRangeResolver textRangeResolver) {
+ return getOwner().buildColumnValidator(this, (BaseColumn) column, this, (BaseColumnTextRangeResolver) textRangeResolver);
}
}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/orm/GenericOrmAttributeOverrideContainer.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/orm/GenericOrmAttributeOverrideContainer.java
index 59e42b7749..6f455e027e 100644
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/orm/GenericOrmAttributeOverrideContainer.java
+++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/orm/GenericOrmAttributeOverrideContainer.java
@@ -18,11 +18,12 @@ import org.eclipse.jpt.core.context.AttributeOverride;
import org.eclipse.jpt.core.context.BaseColumn;
import org.eclipse.jpt.core.context.BaseOverride;
import org.eclipse.jpt.core.context.Column;
-import org.eclipse.jpt.core.context.NamedColumn;
import org.eclipse.jpt.core.context.TypeMapping;
import org.eclipse.jpt.core.context.XmlContextNode;
import org.eclipse.jpt.core.context.orm.OrmAttributeOverride;
import org.eclipse.jpt.core.context.orm.OrmAttributeOverrideContainer;
+import org.eclipse.jpt.core.internal.context.BaseColumnTextRangeResolver;
+import org.eclipse.jpt.core.internal.context.JptValidator;
import org.eclipse.jpt.core.internal.context.orm.AbstractOrmXmlContextNode;
import org.eclipse.jpt.core.internal.context.orm.VirtualXmlAttributeOverride;
import org.eclipse.jpt.core.resource.orm.OrmFactory;
@@ -371,13 +372,9 @@ public class GenericOrmAttributeOverrideContainer
public Table getDbTable(String tableName) {
return getOwner().getDbTable(tableName);
}
-
- public IMessage buildColumnTableNotValidMessage(BaseOverride override, BaseColumn column, TextRange textRange) {
- return getOwner().buildColumnTableNotValidMessage(override, column, textRange);
- }
- public IMessage buildColumnUnresolvedNameMessage(BaseOverride override, NamedColumn column, TextRange textRange) {
- return getOwner().buildColumnUnresolvedNameMessage(override, column, textRange);
+ public JptValidator buildColumnValidator(BaseOverride override, BaseColumn column, BaseColumn.Owner owner, BaseColumnTextRangeResolver textRangeResolver) {
+ return getOwner().buildColumnValidator(override, column, owner, textRangeResolver);
}
}
}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/orm/GenericOrmEmbeddedMapping.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/orm/GenericOrmEmbeddedMapping.java
index 85bb6269bd..62ea237278 100644
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/orm/GenericOrmEmbeddedMapping.java
+++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/orm/GenericOrmEmbeddedMapping.java
@@ -16,9 +16,8 @@ import org.eclipse.jpt.core.MappingKeys;
import org.eclipse.jpt.core.context.AssociationOverride;
import org.eclipse.jpt.core.context.AttributeMapping;
import org.eclipse.jpt.core.context.BaseColumn;
-import org.eclipse.jpt.core.context.BaseJoinColumn;
import org.eclipse.jpt.core.context.BaseOverride;
-import org.eclipse.jpt.core.context.NamedColumn;
+import org.eclipse.jpt.core.context.JoinColumn;
import org.eclipse.jpt.core.context.RelationshipMapping;
import org.eclipse.jpt.core.context.RelationshipReference;
import org.eclipse.jpt.core.context.TypeMapping;
@@ -27,11 +26,13 @@ import org.eclipse.jpt.core.context.orm.OrmAssociationOverrideContainer;
import org.eclipse.jpt.core.context.orm.OrmAttributeMapping;
import org.eclipse.jpt.core.context.orm.OrmPersistentAttribute;
import org.eclipse.jpt.core.context.orm.OrmTypeMapping;
+import org.eclipse.jpt.core.internal.context.BaseColumnTextRangeResolver;
+import org.eclipse.jpt.core.internal.context.JoinColumnTextRangeResolver;
+import org.eclipse.jpt.core.internal.context.JptValidator;
import org.eclipse.jpt.core.internal.context.MappingTools;
import org.eclipse.jpt.core.internal.context.orm.AbstractOrmBaseEmbeddedMapping;
-import org.eclipse.jpt.core.internal.validation.DefaultJpaValidationMessages;
-import org.eclipse.jpt.core.internal.validation.JpaValidationDescriptionMessages;
-import org.eclipse.jpt.core.internal.validation.JpaValidationMessages;
+import org.eclipse.jpt.core.internal.jpa1.context.AssociationOverrideJoinColumnValidator;
+import org.eclipse.jpt.core.internal.jpa1.context.EntityTableDescriptionProvider;
import org.eclipse.jpt.core.jpa2.context.java.JavaEmbeddedMapping2_0;
import org.eclipse.jpt.core.jpa2.context.orm.OrmEmbeddedMapping2_0;
import org.eclipse.jpt.core.resource.orm.Attributes;
@@ -271,212 +272,8 @@ public class GenericOrmEmbeddedMapping
return GenericOrmEmbeddedMapping.this.getValidationTextRange();
}
- public IMessage buildColumnTableNotValidMessage(BaseOverride override, BaseColumn column, TextRange textRange) {
- if (isVirtual()) {
- return this.buildVirtualAttributeColumnTableNotValidMessage(override.getName(), column, textRange);
- }
- if (override.isVirtual()) {
- return this.buildVirtualOverrideColumnTableNotValidMessage(override.getName(), column, textRange);
- }
- return DefaultJpaValidationMessages.buildMessage(
- IMessage.HIGH_SEVERITY,
- JpaValidationMessages.JOIN_COLUMN_TABLE_NOT_VALID,
- new String[] {
- column.getTable(),
- column.getName(),
- JpaValidationDescriptionMessages.NOT_VALID_FOR_THIS_ENTITY},
- column,
- textRange
- );
- }
-
- protected IMessage buildVirtualAttributeColumnTableNotValidMessage(String overrideName, BaseColumn column, TextRange textRange) {
- return DefaultJpaValidationMessages.buildMessage(
- IMessage.HIGH_SEVERITY,
- JpaValidationMessages.VIRTUAL_ATTRIBUTE_ASSOCIATION_OVERRIDE_JOIN_COLUMN_TABLE_NOT_VALID,
- new String[] {
- GenericOrmEmbeddedMapping.this.getName(),
- overrideName,
- column.getTable(),
- column.getName(),
- JpaValidationDescriptionMessages.NOT_VALID_FOR_THIS_ENTITY},
- column,
- textRange
- );
- }
-
- protected IMessage buildVirtualOverrideColumnTableNotValidMessage(String overrideName, BaseColumn column, TextRange textRange) {
- return DefaultJpaValidationMessages.buildMessage(
- IMessage.HIGH_SEVERITY,
- JpaValidationMessages.VIRTUAL_ASSOCIATION_OVERRIDE_JOIN_COLUMN_TABLE_NOT_VALID,
- new String[] {
- overrideName,
- column.getTable(),
- column.getName(),
- JpaValidationDescriptionMessages.NOT_VALID_FOR_THIS_ENTITY},
- column,
- textRange
- );
- }
-
- public IMessage buildColumnUnresolvedNameMessage(BaseOverride override, NamedColumn column, TextRange textRange) {
- if (isVirtual()) {
- return this.buildVirtualAttributeColumnUnresolvedNameMessage(override.getName(), column, textRange);
- }
- if (override.isVirtual()) {
- return this.buildVirtualOverrideColumnUnresolvedNameMessage(override.getName(), column, textRange);
- }
- return DefaultJpaValidationMessages.buildMessage(
- IMessage.HIGH_SEVERITY,
- JpaValidationMessages.JOIN_COLUMN_UNRESOLVED_NAME,
- new String[] {column.getName(), column.getDbTable().getName()},
- column,
- textRange
- );
- }
-
- protected IMessage buildVirtualAttributeColumnUnresolvedNameMessage(String overrideName, NamedColumn column, TextRange textRange) {
- return DefaultJpaValidationMessages.buildMessage(
- IMessage.HIGH_SEVERITY,
- JpaValidationMessages.VIRTUAL_ATTRIBUTE_ASSOCIATION_OVERRIDE_JOIN_COLUMN_UNRESOLVED_NAME,
- new String[] {
- GenericOrmEmbeddedMapping.this.getName(),
- overrideName,
- column.getName(),
- column.getDbTable().getName()},
- column,
- textRange
- );
- }
-
- protected IMessage buildVirtualOverrideColumnUnresolvedNameMessage(String overrideName, NamedColumn column, TextRange textRange) {
- return DefaultJpaValidationMessages.buildMessage(
- IMessage.HIGH_SEVERITY,
- JpaValidationMessages.VIRTUAL_ASSOCIATION_OVERRIDE_JOIN_COLUMN_UNRESOLVED_NAME,
- new String[] {
- overrideName,
- column.getName(),
- column.getDbTable().getName()},
- column,
- textRange
- );
- }
-
- public IMessage buildColumnUnresolvedReferencedColumnNameMessage(AssociationOverride override, BaseJoinColumn column, TextRange textRange) {
- if (isVirtual()) {
- return this.buildVirtualAttributeColumnUnresolvedReferencedColumnNameMessage(override.getName(), column, textRange);
- }
- if (override.isVirtual()) {
- return this.buildVirtualOverrideColumnUnresolvedReferencedColumnNameMessage(override.getName(), column, textRange);
- }
- return DefaultJpaValidationMessages.buildMessage(
- IMessage.HIGH_SEVERITY,
- JpaValidationMessages.JOIN_COLUMN_UNRESOLVED_REFERENCED_COLUMN_NAME,
- new String[] {
- column.getReferencedColumnName(),
- column.getReferencedColumnDbTable().getName()},
- column,
- textRange
- );
- }
-
- protected IMessage buildVirtualAttributeColumnUnresolvedReferencedColumnNameMessage(String overrideName, BaseJoinColumn column, TextRange textRange) {
- return DefaultJpaValidationMessages.buildMessage(
- IMessage.HIGH_SEVERITY,
- JpaValidationMessages.VIRTUAL_ATTRIBUTE_ASSOCIATION_OVERRIDE_JOIN_COLUMN_REFERENCED_COLUMN_UNRESOLVED_NAME,
- new String[] {
- GenericOrmEmbeddedMapping.this.getName(),
- overrideName,
- column.getReferencedColumnName(),
- column.getReferencedColumnDbTable().getName()},
- column,
- textRange
- );
- }
-
- protected IMessage buildVirtualOverrideColumnUnresolvedReferencedColumnNameMessage(String overrideName, BaseJoinColumn column, TextRange textRange) {
- return DefaultJpaValidationMessages.buildMessage(
- IMessage.HIGH_SEVERITY,
- JpaValidationMessages.VIRTUAL_ASSOCIATION_OVERRIDE_JOIN_COLUMN_UNRESOLVED_REFERENCED_COLUMN_NAME,
- new String[] {
- overrideName,
- column.getReferencedColumnName(),
- column.getReferencedColumnDbTable().getName()},
- column,
- textRange
- );
- }
-
- public IMessage buildUnspecifiedNameMultipleJoinColumnsMessage(AssociationOverride override, BaseJoinColumn column, TextRange textRange) {
- if (isVirtual()) {
- return this.buildVirtualAttributeUnspecifiedNameMultipleJoinColumnsMessage(override.getName(), column, textRange);
- }
- if (override.isVirtual()) {
- return this.buildVirtualOverrideUnspecifiedNameMultipleJoinColumnsMessage(override.getName(), column, textRange);
- }
- return DefaultJpaValidationMessages.buildMessage(
- IMessage.HIGH_SEVERITY,
- JpaValidationMessages.JOIN_COLUMN_NAME_MUST_BE_SPECIFIED_MULTIPLE_JOIN_COLUMNS,
- new String[0],
- column,
- textRange
- );
- }
-
- protected IMessage buildVirtualAttributeUnspecifiedNameMultipleJoinColumnsMessage(String overrideName, BaseJoinColumn column, TextRange textRange) {
- return DefaultJpaValidationMessages.buildMessage(
- IMessage.HIGH_SEVERITY,
- JpaValidationMessages.VIRTUAL_ATTRIBUTE_ASSOCIATION_OVERRIDE_JOIN_COLUMN_NAME_MUST_BE_SPECIFIED_MULTIPLE_JOIN_COLUMNS,
- new String[] {GenericOrmEmbeddedMapping.this.getName(), overrideName},
- column,
- textRange
- );
- }
-
- protected IMessage buildVirtualOverrideUnspecifiedNameMultipleJoinColumnsMessage(String overrideName, BaseJoinColumn column, TextRange textRange) {
- return DefaultJpaValidationMessages.buildMessage(
- IMessage.HIGH_SEVERITY,
- JpaValidationMessages.VIRTUAL_ASSOCIATION_OVERRIDE_JOIN_COLUMN_NAME_MUST_BE_SPECIFIED_MULTIPLE_JOIN_COLUMNS,
- new String[] {overrideName},
- column,
- textRange
- );
- }
-
- public IMessage buildUnspecifiedReferencedColumnNameMultipleJoinColumnsMessage(AssociationOverride override, BaseJoinColumn column, TextRange textRange) {
- if (isVirtual()) {
- return this.buildVirtualAttributeUnspecifiedReferencedColumnNameMultipleJoinColumnsMessage(override.getName(), column, textRange);
- }
- if (override.isVirtual()) {
- return this.buildVirtualOverrideUnspecifiedReferencedColumnNameMultipleJoinColumnsMessage(override.getName(), column, textRange);
- }
- return DefaultJpaValidationMessages.buildMessage(
- IMessage.HIGH_SEVERITY,
- JpaValidationMessages.JOIN_COLUMN_REFERENCED_COLUMN_NAME_MUST_BE_SPECIFIED_MULTIPLE_JOIN_COLUMNS,
- new String[0],
- column,
- textRange
- );
- }
-
- protected IMessage buildVirtualAttributeUnspecifiedReferencedColumnNameMultipleJoinColumnsMessage(String overrideName, BaseJoinColumn column, TextRange textRange) {
- return DefaultJpaValidationMessages.buildMessage(
- IMessage.HIGH_SEVERITY,
- JpaValidationMessages.VIRTUAL_ATTRIBUTE_ASSOCIATION_OVERRIDE_JOIN_COLUMN_REFERENCED_COLUMN_NAME_MUST_BE_SPECIFIED_MULTIPLE_JOIN_COLUMNS,
- new String[] {GenericOrmEmbeddedMapping.this.getName(), overrideName},
- column,
- textRange
- );
- }
-
- protected IMessage buildVirtualOverrideUnspecifiedReferencedColumnNameMultipleJoinColumnsMessage(String overrideName, BaseJoinColumn column, TextRange textRange) {
- return DefaultJpaValidationMessages.buildMessage(
- IMessage.HIGH_SEVERITY,
- JpaValidationMessages.VIRTUAL_ASSOCIATION_OVERRIDE_JOIN_COLUMN_REFERENCED_COLUMN_NAME_MUST_BE_SPECIFIED_MULTIPLE_JOIN_COLUMNS,
- new String[] {overrideName},
- column,
- textRange
- );
+ public JptValidator buildColumnValidator(BaseOverride override, BaseColumn column, BaseColumn.Owner owner, BaseColumnTextRangeResolver textRangeResolver) {
+ return new AssociationOverrideJoinColumnValidator(getPersistentAttribute(), (AssociationOverride) override, (JoinColumn) column, (JoinColumn.Owner) owner, (JoinColumnTextRangeResolver) textRangeResolver, new EntityTableDescriptionProvider());
}
}
}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/orm/GenericOrmJoinColumn.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/orm/GenericOrmJoinColumn.java
index c9b27ba0c0..ef8c162a1f 100644
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/orm/GenericOrmJoinColumn.java
+++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/orm/GenericOrmJoinColumn.java
@@ -9,18 +9,17 @@
******************************************************************************/
package org.eclipse.jpt.core.internal.jpa1.context.orm;
-import java.util.List;
-
import org.eclipse.jpt.core.context.JoinColumn;
import org.eclipse.jpt.core.context.XmlContextNode;
import org.eclipse.jpt.core.context.orm.OrmJoinColumn;
import org.eclipse.jpt.core.internal.context.MappingTools;
+import org.eclipse.jpt.core.internal.context.NamedColumnTextRangeResolver;
import org.eclipse.jpt.core.internal.context.orm.AbstractOrmBaseColumn;
+import org.eclipse.jpt.core.internal.context.orm.OrmJoinColumnTextRangeResolver;
import org.eclipse.jpt.core.resource.orm.XmlJoinColumn;
import org.eclipse.jpt.core.utility.TextRange;
import org.eclipse.jpt.db.Column;
import org.eclipse.jpt.db.Table;
-import org.eclipse.wst.validation.internal.provisional.core.IMessage;
public class GenericOrmJoinColumn extends AbstractOrmBaseColumn<XmlJoinColumn> implements OrmJoinColumn
{
@@ -151,52 +150,9 @@ public class GenericOrmJoinColumn extends AbstractOrmBaseColumn<XmlJoinColumn> i
protected String buildDefaultReferencedColumnName() {
return MappingTools.buildJoinColumnDefaultReferencedColumnName(this.getOwner());
}
-
-
- //******************* validation ***********************
@Override
- //this method will only be called if the table validates correctly
- protected void validateName(List<IMessage> messages) {
- //do not call super here, first need to check for multiple join columns errors
- this.validateJoinColumnName(messages);
- this.validateReferencedColumnName(messages);
- }
-
- protected void validateJoinColumnName(List<IMessage> messages) {
- if (this.getSpecifiedName() == null && this.getOwner().joinColumnsSize() > 1) {
- messages.add(this.buildUnspecifiedNameMultipleJoinColumnsMessage());
- }
- else if (this.getName() != null){
- super.validateName(messages);
- }
- //If the name is null and there is only one join-column, one of these validation messages will apply
- // 1. target entity does not have a primary key
- // 2. target entity is not specified
- // 3. target entity is not an entity
- }
-
- protected void validateReferencedColumnName(List<IMessage> messages) {
- if (this.getSpecifiedReferencedColumnName() == null && this.getOwner().joinColumnsSize() > 1) {
- messages.add(this.buildUnspecifiedReferencedColumnNameMultipleJoinColumnsMessage());
- }
- else if (this.getSpecifiedReferencedColumnName() != null) {
- Table refColumnDbTable = this.getReferencedColumnDbTable();
- if (refColumnDbTable != null && ! this.isReferencedColumnResolved()) {
- messages.add(getOwner().buildUnresolvedReferencedColumnNameMessage(this, this.getReferencedColumnNameTextRange()));
- }
- }
- //If the referenced column name is null and there is only one join-column, one of these validation messages will apply
- // 1. target entity does not have a primary key
- // 2. target entity is not specified
- // 3. target entity is not an entity
- }
-
- protected IMessage buildUnspecifiedNameMultipleJoinColumnsMessage() {
- return getOwner().buildUnspecifiedNameMultipleJoinColumnsMessage(this, getNameTextRange());
- }
-
- protected IMessage buildUnspecifiedReferencedColumnNameMultipleJoinColumnsMessage() {
- return getOwner().buildUnspecifiedReferencedColumnNameMultipleJoinColumnsMessage(this, getReferencedColumnNameTextRange());
+ protected NamedColumnTextRangeResolver buildTextRangeResolver() {
+ return new OrmJoinColumnTextRangeResolver(this);
}
}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/orm/GenericOrmJoinTable.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/orm/GenericOrmJoinTable.java
index 4f5d33555b..95bead2723 100644
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/orm/GenericOrmJoinTable.java
+++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/orm/GenericOrmJoinTable.java
@@ -14,7 +14,6 @@ import java.util.List;
import java.util.ListIterator;
import java.util.Vector;
-import org.eclipse.jpt.core.context.BaseColumn;
import org.eclipse.jpt.core.context.BaseJoinColumn;
import org.eclipse.jpt.core.context.Entity;
import org.eclipse.jpt.core.context.JoinColumn;
@@ -26,9 +25,13 @@ import org.eclipse.jpt.core.context.TypeMapping;
import org.eclipse.jpt.core.context.orm.OrmJoinColumn;
import org.eclipse.jpt.core.context.orm.OrmJoinTable;
import org.eclipse.jpt.core.context.orm.OrmJoinTableJoiningStrategy;
+import org.eclipse.jpt.core.internal.context.JoinColumnTextRangeResolver;
+import org.eclipse.jpt.core.internal.context.JptValidator;
import org.eclipse.jpt.core.internal.context.MappingTools;
-import org.eclipse.jpt.core.internal.validation.DefaultJpaValidationMessages;
-import org.eclipse.jpt.core.internal.validation.JpaValidationDescriptionMessages;
+import org.eclipse.jpt.core.internal.context.NamedColumnTextRangeResolver;
+import org.eclipse.jpt.core.internal.jpa1.context.InverseJoinColumnValidator;
+import org.eclipse.jpt.core.internal.jpa1.context.JoinColumnValidator;
+import org.eclipse.jpt.core.internal.jpa1.context.JoinTableTableDescriptionProvider;
import org.eclipse.jpt.core.internal.validation.JpaValidationMessages;
import org.eclipse.jpt.core.resource.orm.AbstractXmlReferenceTable;
import org.eclipse.jpt.core.resource.orm.OrmFactory;
@@ -365,7 +368,7 @@ public class GenericOrmJoinTable
}
public PersistentAttribute getPersistentAttribute() {
- return GenericOrmJoinTable.this.getRelationshipMapping().getPersistentAttribute();
+ return GenericOrmJoinTable.this.getPersistentAttribute();
}
/**
@@ -411,148 +414,6 @@ public class GenericOrmJoinTable
protected String getPersistentAttributeName() {
return getPersistentAttribute().getName();
}
-
- public IMessage buildTableNotValidMessage(BaseColumn column, TextRange textRange) {
- if (isPersistentAttributeVirtual()) {
- return this.buildVirtualTableNotValidMessage(column, textRange);
- }
- return DefaultJpaValidationMessages.buildMessage(
- IMessage.HIGH_SEVERITY,
- this.getTableNotValidMessage(),
- new String[] {
- column.getTable(),
- column.getName(),
- JpaValidationDescriptionMessages.DOES_NOT_MATCH_JOIN_TABLE},
- column,
- textRange
- );
- }
-
- protected IMessage buildVirtualTableNotValidMessage(BaseColumn column, TextRange textRange) {
- return DefaultJpaValidationMessages.buildMessage(
- IMessage.HIGH_SEVERITY,
- this.getVirtualTableNotValidMessage(),
- new String[] {
- getName(),
- column.getTable(),
- column.getName(),
- JpaValidationDescriptionMessages.DOES_NOT_MATCH_JOIN_TABLE},
- column,
- textRange
- );
- }
-
- protected abstract String getTableNotValidMessage();
-
- protected abstract String getVirtualTableNotValidMessage();
-
- public IMessage buildUnresolvedNameMessage(NamedColumn column, TextRange textRange) {
- if (isPersistentAttributeVirtual()) {
- return this.buildVirtualUnresolvedNameMessage(column, textRange);
- }
- return DefaultJpaValidationMessages.buildMessage(
- IMessage.HIGH_SEVERITY,
- this.getUnresolvedNameMessage(),
- new String[] {column.getName(), column.getDbTable().getName()},
- column,
- textRange
- );
- }
-
- protected IMessage buildVirtualUnresolvedNameMessage(NamedColumn column, TextRange textRange) {
- return DefaultJpaValidationMessages.buildMessage(
- IMessage.HIGH_SEVERITY,
- this.getVirtualUnresolvedNameMessage(),
- new String[] {getPersistentAttributeName(), column.getName(), column.getDbTable().getName()},
- column,
- textRange
- );
- }
-
- protected abstract String getUnresolvedNameMessage();
-
- protected abstract String getVirtualUnresolvedNameMessage();
-
- public IMessage buildUnresolvedReferencedColumnNameMessage(BaseJoinColumn column, TextRange textRange) {
- if (isPersistentAttributeVirtual()) {
- return this.buildVirtualUnresolvedReferencedColumnNameMessage(column, textRange);
- }
- return DefaultJpaValidationMessages.buildMessage(
- IMessage.HIGH_SEVERITY,
- this.getUnresolvedReferencedColumnNameMessage(),
- new String[] {column.getReferencedColumnName(), column.getReferencedColumnDbTable().getName()},
- column,
- textRange
- );
- }
-
- protected IMessage buildVirtualUnresolvedReferencedColumnNameMessage(BaseJoinColumn column, TextRange textRange) {
- return DefaultJpaValidationMessages.buildMessage(
- IMessage.HIGH_SEVERITY,
- this.getVirtualUnresolvedReferencedColumnNameMessage(),
- new String[] {this.getPersistentAttributeName(), column.getReferencedColumnName(), column.getReferencedColumnDbTable().getName()},
- column,
- textRange
- );
- }
-
- protected abstract String getUnresolvedReferencedColumnNameMessage();
-
- protected abstract String getVirtualUnresolvedReferencedColumnNameMessage();
-
- public IMessage buildUnspecifiedNameMultipleJoinColumnsMessage(BaseJoinColumn column, TextRange textRange) {
- if (this.isPersistentAttributeVirtual()) {
- return this.buildVirtualUnspecifiedNameMultipleJoinColumnsMessage(column, textRange);
- }
- return DefaultJpaValidationMessages.buildMessage(
- IMessage.HIGH_SEVERITY,
- getUnspecifiedNameMultipleJoinColumnsMessage(),
- new String[0],
- column,
- textRange
- );
- }
-
- protected IMessage buildVirtualUnspecifiedNameMultipleJoinColumnsMessage(BaseJoinColumn column, TextRange textRange) {
- return DefaultJpaValidationMessages.buildMessage(
- IMessage.HIGH_SEVERITY,
- getVirtualUnspecifiedNameMultipleJoinColumnsMessage(),
- new String[] {this.getPersistentAttributeName()},
- column,
- textRange
- );
- }
-
- protected abstract String getUnspecifiedNameMultipleJoinColumnsMessage();
-
- protected abstract String getVirtualUnspecifiedNameMultipleJoinColumnsMessage();
-
- public IMessage buildUnspecifiedReferencedColumnNameMultipleJoinColumnsMessage(BaseJoinColumn column, TextRange textRange) {
- if (this.isPersistentAttributeVirtual()) {
- return this.buildVirtualUnspecifiedReferencedColumnNameMultipleJoinColumnsMessage(column, textRange);
- }
- return DefaultJpaValidationMessages.buildMessage(
- IMessage.HIGH_SEVERITY,
- getUnspecifiedReferencedColumnNameMultipleJoinColumnsMessage(),
- new String[0],
- column,
- textRange
- );
- }
-
- protected IMessage buildVirtualUnspecifiedReferencedColumnNameMultipleJoinColumnsMessage(BaseJoinColumn column, TextRange textRange) {
- return DefaultJpaValidationMessages.buildMessage(
- IMessage.HIGH_SEVERITY,
- getVirtualUnspecifiedReferencedColumnNameMultipleJoinColumnsMessage(),
- new String[] {this.getPersistentAttributeName()},
- column,
- textRange
- );
- }
-
- protected abstract String getUnspecifiedReferencedColumnNameMultipleJoinColumnsMessage();
-
- protected abstract String getVirtualUnspecifiedReferencedColumnNameMultipleJoinColumnsMessage();
}
@@ -611,54 +472,8 @@ public class GenericOrmJoinTable
return GenericOrmJoinTable.this.joinColumnsSize();
}
- @Override
- protected String getTableNotValidMessage() {
- return JpaValidationMessages.JOIN_COLUMN_TABLE_NOT_VALID;
- }
-
- @Override
- public String getVirtualTableNotValidMessage() {
- return JpaValidationMessages.VIRTUAL_ATTRIBUTE_JOIN_COLUMN_TABLE_NOT_VALID;
- }
-
- @Override
- protected String getUnresolvedNameMessage() {
- return JpaValidationMessages.JOIN_COLUMN_UNRESOLVED_NAME;
- }
-
- @Override
- protected String getVirtualUnresolvedNameMessage() {
- return JpaValidationMessages.VIRTUAL_ATTRIBUTE_JOIN_COLUMN_UNRESOLVED_NAME;
- }
-
- @Override
- public String getUnresolvedReferencedColumnNameMessage() {
- return JpaValidationMessages.JOIN_COLUMN_UNRESOLVED_REFERENCED_COLUMN_NAME;
- }
-
- @Override
- public String getVirtualUnresolvedReferencedColumnNameMessage() {
- return JpaValidationMessages.VIRTUAL_ATTRIBUTE_JOIN_COLUMN_UNRESOLVED_REFERENCED_COLUMN_NAME;
- }
-
- @Override
- public String getUnspecifiedNameMultipleJoinColumnsMessage() {
- return JpaValidationMessages.JOIN_COLUMN_NAME_MUST_BE_SPECIFIED_MULTIPLE_JOIN_COLUMNS;
- }
-
- @Override
- public String getVirtualUnspecifiedNameMultipleJoinColumnsMessage() {
- return JpaValidationMessages.VIRTUAL_ATTRIBUTE_JOIN_COLUMN_NAME_MUST_BE_SPECIFIED_MULTIPLE_JOIN_COLUMNS;
- }
-
- @Override
- public String getUnspecifiedReferencedColumnNameMultipleJoinColumnsMessage() {
- return JpaValidationMessages.JOIN_COLUMN_REFERENCED_COLUMN_NAME_MUST_BE_SPECIFIED_MULTIPLE_JOIN_COLUMNS;
- }
-
- @Override
- public String getVirtualUnspecifiedReferencedColumnNameMultipleJoinColumnsMessage() {
- return JpaValidationMessages.VIRTUAL_ATTRIBUTE_JOIN_COLUMN_REFERENCED_COLUMN_NAME_MUST_BE_SPECIFIED_MULTIPLE_JOIN_COLUMNS;
+ public JptValidator buildColumnValidator(NamedColumn column, NamedColumnTextRangeResolver textRangeResolver) {
+ return new JoinColumnValidator(getPersistentAttribute(), (JoinColumn) column, this, (JoinColumnTextRangeResolver) textRangeResolver, new JoinTableTableDescriptionProvider());
}
}
@@ -712,54 +527,8 @@ public class GenericOrmJoinTable
return GenericOrmJoinTable.this.inverseJoinColumnsSize();
}
- @Override
- protected String getTableNotValidMessage() {
- return JpaValidationMessages.INVERSE_JOIN_COLUMN_TABLE_NOT_VALID;
- }
-
- @Override
- public String getVirtualTableNotValidMessage() {
- return JpaValidationMessages.VIRTUAL_ATTRIBUTE_INVERSE_JOIN_COLUMN_TABLE_NOT_VALID;
- }
-
- @Override
- public String getUnresolvedNameMessage() {
- return JpaValidationMessages.INVERSE_JOIN_COLUMN_UNRESOLVED_NAME;
- }
-
- @Override
- public String getVirtualUnresolvedNameMessage() {
- return JpaValidationMessages.VIRTUAL_ATTRIBUTE_INVERSE_JOIN_COLUMN_UNRESOLVED_NAME;
- }
-
- @Override
- public String getUnresolvedReferencedColumnNameMessage() {
- return JpaValidationMessages.INVERSE_JOIN_COLUMN_UNRESOLVED_REFERENCED_COLUMN_NAME;
- }
-
- @Override
- public String getVirtualUnresolvedReferencedColumnNameMessage() {
- return JpaValidationMessages.VIRTUAL_ATTRIBUTE_INVERSE_JOIN_COLUMN_UNRESOLVED_REFERENCED_COLUMN_NAME;
- }
-
- @Override
- public String getUnspecifiedNameMultipleJoinColumnsMessage() {
- return JpaValidationMessages.INVERSE_JOIN_COLUMN_NAME_MUST_BE_SPECIFIED_MULTIPLE_JOIN_COLUMNS;
- }
-
- @Override
- public String getVirtualUnspecifiedNameMultipleJoinColumnsMessage() {
- return JpaValidationMessages.VIRTUAL_ATTRIBUTE_INVERSE_JOIN_COLUMN_NAME_MUST_BE_SPECIFIED_MULTIPLE_JOIN_COLUMNS;
- }
-
- @Override
- public String getUnspecifiedReferencedColumnNameMultipleJoinColumnsMessage() {
- return JpaValidationMessages.INVERSE_JOIN_COLUMN_REFERENCED_COLUMN_NAME_MUST_BE_SPECIFIED_MULTIPLE_JOIN_COLUMNS;
- }
-
- @Override
- public String getVirtualUnspecifiedReferencedColumnNameMultipleJoinColumnsMessage() {
- return JpaValidationMessages.VIRTUAL_ATTRIBUTE_INVERSE_JOIN_COLUMN_REFERENCED_COLUMN_NAME_MUST_BE_SPECIFIED_MULTIPLE_JOIN_COLUMNS;
+ public JptValidator buildColumnValidator(NamedColumn column, NamedColumnTextRangeResolver textRangeResolver) {
+ return new InverseJoinColumnValidator(getPersistentAttribute(), (JoinColumn) column, this, (JoinColumnTextRangeResolver) textRangeResolver, new JoinTableTableDescriptionProvider());
}
}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/orm/GenericOrmOrderable.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/orm/GenericOrmOrderable.java
index ec57ce6b5f..27bec3ce30 100644
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/orm/GenericOrmOrderable.java
+++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/orm/GenericOrmOrderable.java
@@ -16,9 +16,12 @@ import org.eclipse.jpt.core.context.TypeMapping;
import org.eclipse.jpt.core.context.orm.OrmAttributeMapping;
import org.eclipse.jpt.core.context.orm.OrmNamedColumn;
import org.eclipse.jpt.core.context.orm.OrmPersistentAttribute;
+import org.eclipse.jpt.core.internal.context.JptValidator;
+import org.eclipse.jpt.core.internal.context.NamedColumnTextRangeResolver;
import org.eclipse.jpt.core.internal.context.orm.AbstractOrmXmlContextNode;
-import org.eclipse.jpt.core.internal.validation.DefaultJpaValidationMessages;
+import org.eclipse.jpt.core.internal.jpa2.context.OrderColumnValidator;
import org.eclipse.jpt.core.internal.validation.JpaValidationMessages;
+import org.eclipse.jpt.core.jpa2.context.OrderColumn2_0;
import org.eclipse.jpt.core.jpa2.context.Orderable2_0;
import org.eclipse.jpt.core.jpa2.context.orm.OrmOrderColumn2_0;
import org.eclipse.jpt.core.jpa2.context.orm.OrmOrderable2_0;
@@ -302,35 +305,8 @@ public class GenericOrmOrderable
return GenericOrmOrderable.this.getValidationTextRange();
}
- public IMessage buildUnresolvedNameMessage(NamedColumn column, TextRange textRange) {
- if (isPersistentAttributeVirtual()) {
- return this.buildVirtualUnresolvedNameMessage(column, textRange);
- }
- return DefaultJpaValidationMessages.buildMessage(
- IMessage.HIGH_SEVERITY,
- JpaValidationMessages.ORDER_COLUMN_UNRESOLVED_NAME,
- new String[] {column.getName(), column.getDbTable().getName()},
- column,
- textRange
- );
- }
-
- protected IMessage buildVirtualUnresolvedNameMessage(NamedColumn column, TextRange textRange) {
- return DefaultJpaValidationMessages.buildMessage(
- IMessage.HIGH_SEVERITY,
- JpaValidationMessages.VIRTUAL_ATTRIBUTE_ORDER_COLUMN_UNRESOLVED_NAME,
- new String[] {getPersistentAttributeName(), column.getName(), column.getDbTable().getName()},
- column,
- textRange
- );
- }
-
- protected boolean isPersistentAttributeVirtual() {
- return getPersistentAttribute().isVirtual();
- }
-
- protected String getPersistentAttributeName() {
- return getPersistentAttribute().getName();
+ public JptValidator buildColumnValidator(NamedColumn column, NamedColumnTextRangeResolver textRangeResolver) {
+ return new OrderColumnValidator(getPersistentAttribute(), (OrderColumn2_0) column, textRangeResolver);
}
}
}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/orm/GenericOrmPrimaryKeyJoinColumn.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/orm/GenericOrmPrimaryKeyJoinColumn.java
index 4e4f893c5a..541a3911fd 100644
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/orm/GenericOrmPrimaryKeyJoinColumn.java
+++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/orm/GenericOrmPrimaryKeyJoinColumn.java
@@ -9,17 +9,17 @@
******************************************************************************/
package org.eclipse.jpt.core.internal.jpa1.context.orm;
-import java.util.List;
import org.eclipse.jpt.core.context.PrimaryKeyJoinColumn;
import org.eclipse.jpt.core.context.XmlContextNode;
import org.eclipse.jpt.core.context.orm.OrmBaseJoinColumn;
import org.eclipse.jpt.core.context.orm.OrmPrimaryKeyJoinColumn;
+import org.eclipse.jpt.core.internal.context.NamedColumnTextRangeResolver;
import org.eclipse.jpt.core.internal.context.orm.AbstractOrmNamedColumn;
+import org.eclipse.jpt.core.internal.context.orm.OrmPrimaryKeyJoinColumnTextRangeResolver;
import org.eclipse.jpt.core.resource.orm.XmlPrimaryKeyJoinColumn;
import org.eclipse.jpt.core.utility.TextRange;
import org.eclipse.jpt.db.Column;
import org.eclipse.jpt.db.Table;
-import org.eclipse.wst.validation.internal.provisional.core.IMessage;
public class GenericOrmPrimaryKeyJoinColumn extends AbstractOrmNamedColumn<XmlPrimaryKeyJoinColumn>
implements OrmPrimaryKeyJoinColumn
@@ -151,51 +151,8 @@ public class GenericOrmPrimaryKeyJoinColumn extends AbstractOrmNamedColumn<XmlPr
return buildDefaultName();
}
-
- //******************* validation ***********************
-
@Override
- //this method will only be called if the table validates correctly
- protected void validateName(List<IMessage> messages) {
- //do not call super here, first need to check for multiple join columns errors
- this.validateJoinColumnName(messages);
- this.validateReferencedColumnName(messages);
- }
-
- protected void validateJoinColumnName(List<IMessage> messages) {
- if (this.getSpecifiedName() == null && this.getOwner().joinColumnsSize() > 1) {
- messages.add(this.buildUnspecifiedNameMultipleJoinColumnsMessage());
- }
- else if (this.getName() != null){
- super.validateName(messages);
- }
- //If the name is null and there is only one join-column, one of these validation messages will apply
- // 1. target entity does not have a primary key
- // 2. target entity is not specified
- // 3. target entity is not an entity
- }
-
- protected void validateReferencedColumnName(List<IMessage> messages) {
- if (this.getSpecifiedReferencedColumnName() == null && this.getOwner().joinColumnsSize() > 1) {
- messages.add(this.buildUnspecifiedReferencedColumnNameMultipleJoinColumnsMessage());
- }
- else if (this.getReferencedColumnName() != null) {
- Table refColumnDbTable = this.getReferencedColumnDbTable();
- if (refColumnDbTable != null && ! this.isReferencedColumnResolved()) {
- messages.add(getOwner().buildUnresolvedReferencedColumnNameMessage(this, this.getReferencedColumnNameTextRange()));
- }
- }
- //If the referenced column name is null and there is only one join-column, one of these validation messages will apply
- // 1. target entity does not have a primary key
- // 2. target entity is not specified
- // 3. target entity is not an entity
- }
-
- protected IMessage buildUnspecifiedNameMultipleJoinColumnsMessage() {
- return getOwner().buildUnspecifiedNameMultipleJoinColumnsMessage(this, getNameTextRange());
- }
-
- protected IMessage buildUnspecifiedReferencedColumnNameMultipleJoinColumnsMessage() {
- return getOwner().buildUnspecifiedReferencedColumnNameMultipleJoinColumnsMessage(this, getReferencedColumnNameTextRange());
+ protected NamedColumnTextRangeResolver buildTextRangeResolver() {
+ return new OrmPrimaryKeyJoinColumnTextRangeResolver(this);
}
}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/orm/GenericOrmSecondaryTable.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/orm/GenericOrmSecondaryTable.java
index ad7faba7f9..01c4ee633f 100644
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/orm/GenericOrmSecondaryTable.java
+++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/orm/GenericOrmSecondaryTable.java
@@ -13,7 +13,6 @@ import java.util.Iterator;
import java.util.List;
import java.util.ListIterator;
import java.util.Vector;
-
import org.eclipse.jpt.core.context.BaseJoinColumn;
import org.eclipse.jpt.core.context.Entity;
import org.eclipse.jpt.core.context.NamedColumn;
@@ -24,7 +23,11 @@ import org.eclipse.jpt.core.context.orm.OrmBaseJoinColumn;
import org.eclipse.jpt.core.context.orm.OrmEntity;
import org.eclipse.jpt.core.context.orm.OrmPrimaryKeyJoinColumn;
import org.eclipse.jpt.core.context.orm.OrmSecondaryTable;
+import org.eclipse.jpt.core.internal.context.BaseJoinColumnTextRangeResolver;
+import org.eclipse.jpt.core.internal.context.JptValidator;
+import org.eclipse.jpt.core.internal.context.NamedColumnTextRangeResolver;
import org.eclipse.jpt.core.internal.context.orm.AbstractOrmTable;
+import org.eclipse.jpt.core.internal.jpa1.context.SecondaryTablePrimaryKeyJoinColumnValidator;
import org.eclipse.jpt.core.internal.validation.DefaultJpaValidationMessages;
import org.eclipse.jpt.core.internal.validation.JpaValidationMessages;
import org.eclipse.jpt.core.resource.orm.OrmFactory;
@@ -396,114 +399,8 @@ public class GenericOrmSecondaryTable
return GenericOrmSecondaryTable.this.getName();
}
- public IMessage buildUnresolvedNameMessage(NamedColumn column, TextRange textRange) {
- if (isSecondaryTableVirtual()) {
- return buildVirtualUnresolvedNameMessage(column, textRange);
- }
- if (((BaseJoinColumn) column).isVirtual()) {
- return DefaultJpaValidationMessages.buildMessage(
- IMessage.HIGH_SEVERITY,
- JpaValidationMessages.VIRTUAL_PRIMARY_KEY_JOIN_COLUMN_UNRESOLVED_NAME,
- new String[] {column.getName(), column.getTable()},
- column,
- textRange
- );
- }
- return DefaultJpaValidationMessages.buildMessage(
- IMessage.HIGH_SEVERITY,
- JpaValidationMessages.PRIMARY_KEY_JOIN_COLUMN_UNRESOLVED_NAME,
- new String[] {column.getName(), column.getTable()},
- column,
- textRange
- );
- }
-
- protected IMessage buildVirtualUnresolvedNameMessage(NamedColumn column, TextRange textRange) {
- return DefaultJpaValidationMessages.buildMessage(
- IMessage.HIGH_SEVERITY,
- JpaValidationMessages.VIRTUAL_SECONDARY_TABLE_PRIMARY_KEY_JOIN_COLUMN_UNRESOLVED_NAME,
- new String[] {this.getSecondaryTableName(), column.getName(), column.getDbTable().getName()},
- column,
- textRange
- );
- }
-
- public IMessage buildUnresolvedReferencedColumnNameMessage(BaseJoinColumn column, TextRange textRange) {
- if (isSecondaryTableVirtual()) {
- return buildVirtualUnresolvedReferencedColumnNameMessage(column, textRange);
- }
- if (column.isVirtual()) {
- return DefaultJpaValidationMessages.buildMessage(
- IMessage.HIGH_SEVERITY,
- JpaValidationMessages.VIRTUAL_PRIMARY_KEY_JOIN_COLUMN_UNRESOLVED_REFERENCED_COLUMN_NAME,
- new String[] {column.getReferencedColumnName(), column.getReferencedColumnDbTable().getName()},
- column,
- textRange
- );
- }
- return DefaultJpaValidationMessages.buildMessage(
- IMessage.HIGH_SEVERITY,
- JpaValidationMessages.PRIMARY_KEY_JOIN_COLUMN_UNRESOLVED_REFERENCED_COLUMN_NAME,
- new String[] {column.getReferencedColumnName(), column.getReferencedColumnDbTable().getName()},
- column,
- textRange
- );
- }
-
- protected IMessage buildVirtualUnresolvedReferencedColumnNameMessage(BaseJoinColumn column, TextRange textRange) {
- return DefaultJpaValidationMessages.buildMessage(
- IMessage.HIGH_SEVERITY,
- JpaValidationMessages.VIRTUAL_SECONDARY_TABLE_PRIMARY_KEY_JOIN_COLUMN_UNRESOLVED_REFERENCED_COLUMN_NAME,
- new String[] {this.getSecondaryTableName(), column.getReferencedColumnName(), column.getReferencedColumnDbTable().getName()},
- column,
- textRange
- );
- }
-
- public IMessage buildUnspecifiedNameMultipleJoinColumnsMessage(BaseJoinColumn column, TextRange textRange) {
- if (this.isSecondaryTableVirtual()) {
- return this.buildVirtualUnspecifiedNameMultipleJoinColumnsMessage(column, textRange);
- }
- return DefaultJpaValidationMessages.buildMessage(
- IMessage.HIGH_SEVERITY,
- JpaValidationMessages.PRIMARY_KEY_JOIN_COLUMN_NAME_MUST_BE_SPECIFIED_MULTIPLE_JOIN_COLUMNS,
- new String[0],
- column,
- textRange
- );
- }
-
- protected IMessage buildVirtualUnspecifiedNameMultipleJoinColumnsMessage(BaseJoinColumn column, TextRange textRange) {
- return DefaultJpaValidationMessages.buildMessage(
- IMessage.HIGH_SEVERITY,
- JpaValidationMessages.VIRTUAL_SECONDARY_TABLE_PRIMARY_KEY_JOIN_COLUMN_NAME_MUST_BE_SPECIFIED_MULTIPLE_JOIN_COLUMNS,
- new String[] {this.getSecondaryTableName()},
- column,
- textRange
- );
- }
-
- public IMessage buildUnspecifiedReferencedColumnNameMultipleJoinColumnsMessage(BaseJoinColumn column, TextRange textRange) {
- if (this.isSecondaryTableVirtual()) {
- return this.buildVirtualUnspecifiedReferencedColumnNameMultipleJoinColumnsMessage(column, textRange);
- }
- return DefaultJpaValidationMessages.buildMessage(
- IMessage.HIGH_SEVERITY,
- JpaValidationMessages.PRIMARY_KEY_JOIN_COLUMN_REFERENCED_COLUMN_NAME_MUST_BE_SPECIFIED_MULTIPLE_JOIN_COLUMNS,
- new String[0],
- column,
- textRange
- );
- }
-
- protected IMessage buildVirtualUnspecifiedReferencedColumnNameMultipleJoinColumnsMessage(BaseJoinColumn column, TextRange textRange) {
- return DefaultJpaValidationMessages.buildMessage(
- IMessage.HIGH_SEVERITY,
- JpaValidationMessages.VIRTUAL_SECONDARY_TABLE_PRIMARY_KEY_JOIN_COLUMN_REFERENCED_COLUMN_NAME_MUST_BE_SPECIFIED_MULTIPLE_JOIN_COLUMNS,
- new String[] {this.getSecondaryTableName()},
- column,
- textRange
- );
+ public JptValidator buildColumnValidator(NamedColumn column, NamedColumnTextRangeResolver textRangeResolver) {
+ return new SecondaryTablePrimaryKeyJoinColumnValidator(GenericOrmSecondaryTable.this, (BaseJoinColumn) column, this, (BaseJoinColumnTextRangeResolver) textRangeResolver);
}
}
}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/context/OrderColumnValidator.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/context/OrderColumnValidator.java
new file mode 100644
index 0000000000..0a967fc06f
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/context/OrderColumnValidator.java
@@ -0,0 +1,43 @@
+/*******************************************************************************
+ * Copyright (c) 2010 Oracle.
+ * All rights reserved. This program and the accompanying materials are
+ * made available under the terms of the Eclipse Public License v1.0 which
+ * accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.jpt.core.internal.jpa2.context;
+
+import org.eclipse.jpt.core.context.PersistentAttribute;
+import org.eclipse.jpt.core.internal.context.NamedColumnTextRangeResolver;
+import org.eclipse.jpt.core.internal.jpa1.context.AbstractNamedColumnValidator;
+import org.eclipse.jpt.core.internal.validation.JpaValidationMessages;
+import org.eclipse.jpt.core.jpa2.context.OrderColumn2_0;
+
+public class OrderColumnValidator extends AbstractNamedColumnValidator
+{
+ public OrderColumnValidator(
+ OrderColumn2_0 column,
+ NamedColumnTextRangeResolver textRangeResolver) {
+ super(column, textRangeResolver);
+ }
+
+ public OrderColumnValidator(
+ PersistentAttribute persistentAttribute,
+ OrderColumn2_0 column,
+ NamedColumnTextRangeResolver textRangeResolver) {
+ super(persistentAttribute, column, textRangeResolver);
+ }
+
+ @Override
+ protected String getUnresolvedNameMessage() {
+ return JpaValidationMessages.ORDER_COLUMN_UNRESOLVED_NAME;
+ }
+
+ @Override
+ protected String getVirtualAttributeUnresolvedNameMessage() {
+ return JpaValidationMessages.VIRTUAL_ATTRIBUTE_ORDER_COLUMN_UNRESOLVED_NAME;
+ }
+}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/context/java/AbstractJavaElementCollectionMapping2_0.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/context/java/AbstractJavaElementCollectionMapping2_0.java
index 8736b45a3d..3b9a9f8dcb 100644
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/context/java/AbstractJavaElementCollectionMapping2_0.java
+++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/context/java/AbstractJavaElementCollectionMapping2_0.java
@@ -19,7 +19,6 @@ import org.eclipse.jpt.core.context.AssociationOverride;
import org.eclipse.jpt.core.context.AttributeMapping;
import org.eclipse.jpt.core.context.AttributeOverride;
import org.eclipse.jpt.core.context.BaseColumn;
-import org.eclipse.jpt.core.context.BaseJoinColumn;
import org.eclipse.jpt.core.context.BaseOverride;
import org.eclipse.jpt.core.context.Column;
import org.eclipse.jpt.core.context.Converter;
@@ -27,6 +26,7 @@ import org.eclipse.jpt.core.context.Embeddable;
import org.eclipse.jpt.core.context.Entity;
import org.eclipse.jpt.core.context.FetchType;
import org.eclipse.jpt.core.context.Fetchable;
+import org.eclipse.jpt.core.context.JoinColumn;
import org.eclipse.jpt.core.context.NamedColumn;
import org.eclipse.jpt.core.context.PersistentType;
import org.eclipse.jpt.core.context.RelationshipReference;
@@ -38,10 +38,19 @@ import org.eclipse.jpt.core.context.java.JavaColumn;
import org.eclipse.jpt.core.context.java.JavaConverter;
import org.eclipse.jpt.core.context.java.JavaOverrideContainer;
import org.eclipse.jpt.core.context.java.JavaPersistentAttribute;
+import org.eclipse.jpt.core.internal.context.BaseColumnTextRangeResolver;
+import org.eclipse.jpt.core.internal.context.JoinColumnTextRangeResolver;
+import org.eclipse.jpt.core.internal.context.JptValidator;
import org.eclipse.jpt.core.internal.context.MappingTools;
+import org.eclipse.jpt.core.internal.context.NamedColumnTextRangeResolver;
import org.eclipse.jpt.core.internal.context.java.AbstractJavaAttributeMapping;
+import org.eclipse.jpt.core.internal.jpa1.context.AssociationOverrideJoinColumnValidator;
+import org.eclipse.jpt.core.internal.jpa1.context.AttributeOverrideColumnValidator;
+import org.eclipse.jpt.core.internal.jpa1.context.CollectionTableTableDescriptionProvider;
+import org.eclipse.jpt.core.internal.jpa1.context.MapKeyAttributeOverrideColumnValidator;
+import org.eclipse.jpt.core.internal.jpa1.context.MapKeyColumnValidator;
+import org.eclipse.jpt.core.internal.jpa1.context.NamedColumnValidator;
import org.eclipse.jpt.core.internal.validation.DefaultJpaValidationMessages;
-import org.eclipse.jpt.core.internal.validation.JpaValidationDescriptionMessages;
import org.eclipse.jpt.core.internal.validation.JpaValidationMessages;
import org.eclipse.jpt.core.jpa2.JpaFactory2_0;
import org.eclipse.jpt.core.jpa2.MappingKeys2_0;
@@ -1242,35 +1251,6 @@ public abstract class AbstractJavaElementCollectionMapping2_0
public TextRange getValidationTextRange(CompilationUnit astRoot) {
return AbstractJavaElementCollectionMapping2_0.this.getValidationTextRange(astRoot);
}
-
- public IMessage buildTableNotValidMessage(BaseColumn column, TextRange textRange) {
- return DefaultJpaValidationMessages.buildMessage(
- IMessage.HIGH_SEVERITY,
- this.getColumnTableNotValidMessage(),
- new String[] {
- column.getTable(),
- column.getName(),
- JpaValidationDescriptionMessages.DOES_NOT_MATCH_COLLECTION_TABLE},
- column,
- textRange
- );
- }
-
- protected abstract String getColumnTableNotValidMessage();
-
- public IMessage buildUnresolvedNameMessage(NamedColumn column, TextRange textRange) {
- return DefaultJpaValidationMessages.buildMessage(
- IMessage.HIGH_SEVERITY,
- this.getColumnUnresolvedNameMessage(),
- new String[] {
- column.getName(),
- column.getDbTable().getName()},
- column,
- textRange
- );
- }
-
- protected abstract String getColumnUnresolvedNameMessage();
}
protected class ValueColumnOwner extends ColumnOwner {
@@ -1278,14 +1258,8 @@ public abstract class AbstractJavaElementCollectionMapping2_0
return AbstractJavaElementCollectionMapping2_0.this.getName();
}
- @Override
- protected String getColumnTableNotValidMessage() {
- return JpaValidationMessages.COLUMN_TABLE_NOT_VALID;
- }
-
- @Override
- protected String getColumnUnresolvedNameMessage() {
- return JpaValidationMessages.COLUMN_UNRESOLVED_NAME;
+ public JptValidator buildColumnValidator(NamedColumn column, NamedColumnTextRangeResolver textRangeResolver) {
+ return new NamedColumnValidator((BaseColumn) column, (BaseColumnTextRangeResolver) textRangeResolver, new CollectionTableTableDescriptionProvider());
}
}
@@ -1294,14 +1268,8 @@ public abstract class AbstractJavaElementCollectionMapping2_0
return AbstractJavaElementCollectionMapping2_0.this.getName() + "_KEY"; //$NON-NLS-1$
}
- @Override
- protected String getColumnTableNotValidMessage() {
- return JpaValidationMessages.MAP_KEY_COLUMN_TABLE_NOT_VALID;
- }
-
- @Override
- protected String getColumnUnresolvedNameMessage() {
- return JpaValidationMessages.MAP_KEY_COLUMN_UNRESOLVED_NAME;
+ public JptValidator buildColumnValidator(NamedColumn column, NamedColumnTextRangeResolver textRangeResolver) {
+ return new MapKeyColumnValidator((BaseColumn) column, (BaseColumnTextRangeResolver) textRangeResolver, new CollectionTableTableDescriptionProvider());
}
}
@@ -1375,127 +1343,9 @@ public abstract class AbstractJavaElementCollectionMapping2_0
}
return !overrideName.startsWith("key."); //$NON-NLS-1$
}
-
- public IMessage buildColumnTableNotValidMessage(BaseOverride override, BaseColumn column, TextRange textRange) {
- if (override.isVirtual()) {
- return this.buildVirtualOverrideColumnTableNotValidMessage(override.getName(), column, textRange);
- }
- return DefaultJpaValidationMessages.buildMessage(
- IMessage.HIGH_SEVERITY,
- JpaValidationMessages.JOIN_COLUMN_TABLE_NOT_VALID,
- new String[] {
- column.getTable(),
- column.getName(),
- JpaValidationDescriptionMessages.DOES_NOT_MATCH_COLLECTION_TABLE},
- column,
- textRange
- );
- }
-
- protected IMessage buildVirtualOverrideColumnTableNotValidMessage(String overrideName, BaseColumn column, TextRange textRange) {
- return DefaultJpaValidationMessages.buildMessage(
- IMessage.HIGH_SEVERITY,
- JpaValidationMessages.VIRTUAL_ASSOCIATION_OVERRIDE_JOIN_COLUMN_TABLE_NOT_VALID,
- new String[] {
- overrideName,
- column.getTable(),
- column.getName(),
- JpaValidationDescriptionMessages.DOES_NOT_MATCH_COLLECTION_TABLE},
- column,
- textRange
- );
- }
-
- public IMessage buildColumnUnresolvedNameMessage(BaseOverride override, NamedColumn column, TextRange textRange) {
- if (override.isVirtual()) {
- return this.buildVirtualColumnUnresolvedNameMessage(override.getName(), column, textRange);
- }
- return DefaultJpaValidationMessages.buildMessage(
- IMessage.HIGH_SEVERITY,
- JpaValidationMessages.JOIN_COLUMN_UNRESOLVED_NAME,
- new String[] {column.getName(), column.getDbTable().getName()},
- column,
- textRange
- );
- }
-
- protected IMessage buildVirtualColumnUnresolvedNameMessage(String overrideName, NamedColumn column, TextRange textRange) {
- return DefaultJpaValidationMessages.buildMessage(
- IMessage.HIGH_SEVERITY,
- JpaValidationMessages.VIRTUAL_ASSOCIATION_OVERRIDE_JOIN_COLUMN_UNRESOLVED_NAME,
- new String[] {overrideName, column.getName(), column.getDbTable().getName()},
- column,
- textRange
- );
- }
-
- public IMessage buildColumnUnresolvedReferencedColumnNameMessage(AssociationOverride override, BaseJoinColumn column, TextRange textRange) {
- if (override.isVirtual()) {
- return this.buildVirtualColumnUnresolvedReferencedColumnNameMessage(override.getName(), column, textRange);
- }
- return DefaultJpaValidationMessages.buildMessage(
- IMessage.HIGH_SEVERITY,
- JpaValidationMessages.JOIN_COLUMN_UNRESOLVED_REFERENCED_COLUMN_NAME,
- new String[] {column.getReferencedColumnName(), column.getReferencedColumnDbTable().getName()},
- column,
- textRange
- );
- }
-
- protected IMessage buildVirtualColumnUnresolvedReferencedColumnNameMessage(String overrideName, BaseJoinColumn column, TextRange textRange) {
- return DefaultJpaValidationMessages.buildMessage(
- IMessage.HIGH_SEVERITY,
- JpaValidationMessages.VIRTUAL_ASSOCIATION_OVERRIDE_JOIN_COLUMN_UNRESOLVED_REFERENCED_COLUMN_NAME,
- new String[] {overrideName, column.getReferencedColumnName(), column.getReferencedColumnDbTable().getName()},
- column,
- textRange
- );
- }
-
- public IMessage buildUnspecifiedNameMultipleJoinColumnsMessage(AssociationOverride override, BaseJoinColumn column, TextRange textRange) {
- if (override.isVirtual()) {
- return this.buildVirtualUnspecifiedNameMultipleJoinColumnsMessage(override.getName(), column, textRange);
- }
- return DefaultJpaValidationMessages.buildMessage(
- IMessage.HIGH_SEVERITY,
- JpaValidationMessages.JOIN_COLUMN_NAME_MUST_BE_SPECIFIED_MULTIPLE_JOIN_COLUMNS,
- new String[0],
- column,
- textRange
- );
- }
-
- protected IMessage buildVirtualUnspecifiedNameMultipleJoinColumnsMessage(String overrideName, BaseJoinColumn column, TextRange textRange) {
- return DefaultJpaValidationMessages.buildMessage(
- IMessage.HIGH_SEVERITY,
- JpaValidationMessages.VIRTUAL_ASSOCIATION_OVERRIDE_JOIN_COLUMN_NAME_MUST_BE_SPECIFIED_MULTIPLE_JOIN_COLUMNS,
- new String[] {overrideName},
- column,
- textRange
- );
- }
-
- public IMessage buildUnspecifiedReferencedColumnNameMultipleJoinColumnsMessage(AssociationOverride override, BaseJoinColumn column, TextRange textRange) {
- if (override.isVirtual()) {
- return this.buildVirtualUnspecifiedReferencedColumnNameMultipleJoinColumnsMessage(override.getName(), column, textRange);
- }
- return DefaultJpaValidationMessages.buildMessage(
- IMessage.HIGH_SEVERITY,
- JpaValidationMessages.JOIN_COLUMN_REFERENCED_COLUMN_NAME_MUST_BE_SPECIFIED_MULTIPLE_JOIN_COLUMNS,
- new String[0],
- column,
- textRange
- );
- }
-
- protected IMessage buildVirtualUnspecifiedReferencedColumnNameMultipleJoinColumnsMessage(String overrideName, BaseJoinColumn column, TextRange textRange) {
- return DefaultJpaValidationMessages.buildMessage(
- IMessage.HIGH_SEVERITY,
- JpaValidationMessages.VIRTUAL_ASSOCIATION_OVERRIDE_JOIN_COLUMN_REFERENCED_COLUMN_NAME_MUST_BE_SPECIFIED_MULTIPLE_JOIN_COLUMNS,
- new String[] {overrideName},
- column,
- textRange
- );
+
+ public JptValidator buildColumnValidator(BaseOverride override, BaseColumn column, BaseColumn.Owner columnOwner, BaseColumnTextRangeResolver textRangeResolver) {
+ return new AssociationOverrideJoinColumnValidator((AssociationOverride) override, (JoinColumn) column, (JoinColumn.Owner) columnOwner, (JoinColumnTextRangeResolver) textRangeResolver, new CollectionTableTableDescriptionProvider());
}
}
@@ -1538,57 +1388,8 @@ public abstract class AbstractJavaElementCollectionMapping2_0
return !overrideName.startsWith("key."); //$NON-NLS-1$
}
- public IMessage buildColumnUnresolvedNameMessage(BaseOverride override, NamedColumn column, TextRange textRange) {
- if (override.isVirtual()) {
- return this.buildVirtualColumnUnresolvedNameMessage(override.getName(), column, textRange);
- }
- return DefaultJpaValidationMessages.buildMessage(
- IMessage.HIGH_SEVERITY,
- JpaValidationMessages.COLUMN_UNRESOLVED_NAME,
- new String[] {column.getName(), column.getDbTable().getName()},
- column,
- textRange
- );
- }
-
- protected IMessage buildVirtualColumnUnresolvedNameMessage(String overrideName, NamedColumn column, TextRange textRange) {
- return DefaultJpaValidationMessages.buildMessage(
- IMessage.HIGH_SEVERITY,
- JpaValidationMessages.VIRTUAL_ATTRIBUTE_OVERRIDE_COLUMN_UNRESOLVED_NAME,
- new String[] {overrideName, column.getName(), column.getDbTable().getName()},
- column,
- textRange
- );
- }
-
- public IMessage buildColumnTableNotValidMessage(BaseOverride override, BaseColumn column, TextRange textRange) {
- if (override.isVirtual()) {
- return this.buildVirtualColumnTableNotValidMessage(override.getName(), column, textRange);
- }
- return DefaultJpaValidationMessages.buildMessage(
- IMessage.HIGH_SEVERITY,
- JpaValidationMessages.COLUMN_TABLE_NOT_VALID,
- new String[] {
- column.getTable(),
- column.getName(),
- JpaValidationDescriptionMessages.DOES_NOT_MATCH_COLLECTION_TABLE},
- column,
- textRange
- );
- }
-
- protected IMessage buildVirtualColumnTableNotValidMessage(String overrideName, BaseColumn column, TextRange textRange) {
- return DefaultJpaValidationMessages.buildMessage(
- IMessage.HIGH_SEVERITY,
- JpaValidationMessages.VIRTUAL_ATTRIBUTE_OVERRIDE_COLUMN_TABLE_NOT_VALID,
- new String[] {
- overrideName,
- column.getTable(),
- column.getName(),
- JpaValidationDescriptionMessages.DOES_NOT_MATCH_COLLECTION_TABLE},
- column,
- textRange
- );
+ public JptValidator buildColumnValidator(BaseOverride override, BaseColumn column, BaseColumn.Owner columnOwner, BaseColumnTextRangeResolver textRangeResolver) {
+ return new AttributeOverrideColumnValidator((AttributeOverride) override, column, textRangeResolver, new CollectionTableTableDescriptionProvider());
}
}
@@ -1628,57 +1429,8 @@ public abstract class AbstractJavaElementCollectionMapping2_0
return MappingTools.resolveOverridenColumn(getOverridableTypeMapping(), attributeOverrideName);
}
- public IMessage buildColumnUnresolvedNameMessage(BaseOverride override, NamedColumn column, TextRange textRange) {
- if (override.isVirtual()) {
- return this.buildVirtualColumnUnresolvedNameMessage(override.getName(), column, textRange);
- }
- return DefaultJpaValidationMessages.buildMessage(
- IMessage.HIGH_SEVERITY,
- JpaValidationMessages.COLUMN_UNRESOLVED_NAME,
- new String[] {column.getName(), column.getDbTable().getName()},
- column,
- textRange
- );
- }
-
- protected IMessage buildVirtualColumnUnresolvedNameMessage(String overrideName, NamedColumn column, TextRange textRange) {
- return DefaultJpaValidationMessages.buildMessage(
- IMessage.HIGH_SEVERITY,
- JpaValidationMessages.VIRTUAL_MAP_KEY_ATTRIBUTE_OVERRIDE_COLUMN_UNRESOLVED_NAME,
- new String[] {overrideName, column.getName(), column.getDbTable().getName()},
- column,
- textRange
- );
- }
-
- public IMessage buildColumnTableNotValidMessage(BaseOverride override, BaseColumn column, TextRange textRange) {
- if (override.isVirtual()) {
- return this.buildVirtualColumnTableNotValidMessage(override.getName(), column, textRange);
- }
- return DefaultJpaValidationMessages.buildMessage(
- IMessage.HIGH_SEVERITY,
- JpaValidationMessages.COLUMN_TABLE_NOT_VALID,
- new String[] {
- column.getTable(),
- column.getName(),
- JpaValidationDescriptionMessages.DOES_NOT_MATCH_COLLECTION_TABLE },
- column,
- textRange
- );
- }
-
- protected IMessage buildVirtualColumnTableNotValidMessage(String overrideName, BaseColumn column, TextRange textRange) {
- return DefaultJpaValidationMessages.buildMessage(
- IMessage.HIGH_SEVERITY,
- JpaValidationMessages.VIRTUAL_MAP_KEY_ATTRIBUTE_OVERRIDE_COLUMN_TABLE_NOT_VALID,
- new String[] {
- overrideName,
- column.getTable(),
- column.getName(),
- JpaValidationDescriptionMessages.DOES_NOT_MATCH_COLLECTION_TABLE},
- column,
- textRange
- );
+ public JptValidator buildColumnValidator(BaseOverride override, BaseColumn column, BaseColumn.Owner columnOwner, BaseColumnTextRangeResolver textRangeResolver) {
+ return new MapKeyAttributeOverrideColumnValidator((AttributeOverride) override, column, textRangeResolver, new CollectionTableTableDescriptionProvider());
}
}
}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/context/java/GenericJavaCollectionTable2_0.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/context/java/GenericJavaCollectionTable2_0.java
index 41dcc0cfb6..a26266fffe 100644
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/context/java/GenericJavaCollectionTable2_0.java
+++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/context/java/GenericJavaCollectionTable2_0.java
@@ -11,24 +11,26 @@ package org.eclipse.jpt.core.internal.jpa2.context.java;
import java.util.Iterator;
import org.eclipse.jdt.core.dom.CompilationUnit;
-import org.eclipse.jpt.core.context.BaseColumn;
import org.eclipse.jpt.core.context.BaseJoinColumn;
import org.eclipse.jpt.core.context.Entity;
+import org.eclipse.jpt.core.context.JoinColumn;
import org.eclipse.jpt.core.context.NamedColumn;
import org.eclipse.jpt.core.context.PersistentAttribute;
import org.eclipse.jpt.core.context.TypeMapping;
import org.eclipse.jpt.core.context.java.JavaJoinColumn;
+import org.eclipse.jpt.core.internal.context.JoinColumnTextRangeResolver;
+import org.eclipse.jpt.core.internal.context.JptValidator;
import org.eclipse.jpt.core.internal.context.MappingTools;
+import org.eclipse.jpt.core.internal.context.NamedColumnTextRangeResolver;
+import org.eclipse.jpt.core.internal.jpa1.context.CollectionTableTableDescriptionProvider;
+import org.eclipse.jpt.core.internal.jpa1.context.JoinColumnValidator;
import org.eclipse.jpt.core.internal.jpa1.context.java.GenericJavaReferenceTable;
-import org.eclipse.jpt.core.internal.validation.DefaultJpaValidationMessages;
-import org.eclipse.jpt.core.internal.validation.JpaValidationDescriptionMessages;
import org.eclipse.jpt.core.internal.validation.JpaValidationMessages;
import org.eclipse.jpt.core.jpa2.context.java.JavaCollectionTable2_0;
import org.eclipse.jpt.core.jpa2.context.java.JavaElementCollectionMapping2_0;
import org.eclipse.jpt.core.jpa2.resource.java.CollectionTable2_0Annotation;
import org.eclipse.jpt.core.utility.TextRange;
import org.eclipse.jpt.utility.internal.iterators.EmptyIterator;
-import org.eclipse.wst.validation.internal.provisional.core.IMessage;
/**
* Java collection table
@@ -190,57 +192,8 @@ public class GenericJavaCollectionTable2_0
return GenericJavaCollectionTable2_0.this.joinColumnsSize();
}
- public IMessage buildTableNotValidMessage(BaseColumn column, TextRange textRange) {
- return DefaultJpaValidationMessages.buildMessage(
- IMessage.HIGH_SEVERITY,
- JpaValidationMessages.JOIN_COLUMN_TABLE_NOT_VALID,
- new String[] {
- column.getTable(),
- column.getName(),
- JpaValidationDescriptionMessages.DOES_NOT_MATCH_COLLECTION_TABLE},
- column,
- textRange
- );
- }
-
- public IMessage buildUnresolvedNameMessage(NamedColumn column, TextRange textRange) {
- return DefaultJpaValidationMessages.buildMessage(
- IMessage.HIGH_SEVERITY,
- JpaValidationMessages.JOIN_COLUMN_UNRESOLVED_NAME,
- new String[] {column.getName(), column.getDbTable().getName()},
- column,
- textRange
- );
- }
-
- public IMessage buildUnresolvedReferencedColumnNameMessage(BaseJoinColumn column, TextRange textRange) {
- return DefaultJpaValidationMessages.buildMessage(
- IMessage.HIGH_SEVERITY,
- JpaValidationMessages.JOIN_COLUMN_UNRESOLVED_REFERENCED_COLUMN_NAME,
- new String[] {column.getReferencedColumnName(), column.getReferencedColumnDbTable().getName()},
- column,
- textRange
- );
- }
-
- public IMessage buildUnspecifiedNameMultipleJoinColumnsMessage(BaseJoinColumn column, TextRange textRange) {
- return DefaultJpaValidationMessages.buildMessage(
- IMessage.HIGH_SEVERITY,
- JpaValidationMessages.JOIN_COLUMN_NAME_MUST_BE_SPECIFIED_MULTIPLE_JOIN_COLUMNS,
- new String[0],
- column,
- textRange
- );
- }
-
- public IMessage buildUnspecifiedReferencedColumnNameMultipleJoinColumnsMessage(BaseJoinColumn column, TextRange textRange) {
- return DefaultJpaValidationMessages.buildMessage(
- IMessage.HIGH_SEVERITY,
- JpaValidationMessages.JOIN_COLUMN_REFERENCED_COLUMN_NAME_MUST_BE_SPECIFIED_MULTIPLE_JOIN_COLUMNS,
- new String[0],
- column,
- textRange
- );
+ public JptValidator buildColumnValidator(NamedColumn column, NamedColumnTextRangeResolver textRangeResolver) {
+ return new JoinColumnValidator((JoinColumn) column, this, (JoinColumnTextRangeResolver) textRangeResolver, new CollectionTableTableDescriptionProvider());
}
}
}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/context/orm/AbstractOrmElementCollectionMapping2_0.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/context/orm/AbstractOrmElementCollectionMapping2_0.java
index c9c1a4a160..fee0e19a0b 100644
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/context/orm/AbstractOrmElementCollectionMapping2_0.java
+++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/context/orm/AbstractOrmElementCollectionMapping2_0.java
@@ -20,7 +20,6 @@ import org.eclipse.jpt.core.context.AssociationOverride;
import org.eclipse.jpt.core.context.AttributeMapping;
import org.eclipse.jpt.core.context.AttributeOverride;
import org.eclipse.jpt.core.context.BaseColumn;
-import org.eclipse.jpt.core.context.BaseJoinColumn;
import org.eclipse.jpt.core.context.BaseOverride;
import org.eclipse.jpt.core.context.Column;
import org.eclipse.jpt.core.context.Converter;
@@ -28,6 +27,7 @@ import org.eclipse.jpt.core.context.Embeddable;
import org.eclipse.jpt.core.context.Entity;
import org.eclipse.jpt.core.context.FetchType;
import org.eclipse.jpt.core.context.Fetchable;
+import org.eclipse.jpt.core.context.JoinColumn;
import org.eclipse.jpt.core.context.NamedColumn;
import org.eclipse.jpt.core.context.PersistentType;
import org.eclipse.jpt.core.context.RelationshipReference;
@@ -42,11 +42,20 @@ import org.eclipse.jpt.core.context.orm.OrmConverter;
import org.eclipse.jpt.core.context.orm.OrmOverrideContainer;
import org.eclipse.jpt.core.context.orm.OrmPersistentAttribute;
import org.eclipse.jpt.core.context.orm.OrmTypeMapping;
+import org.eclipse.jpt.core.internal.context.BaseColumnTextRangeResolver;
+import org.eclipse.jpt.core.internal.context.JoinColumnTextRangeResolver;
+import org.eclipse.jpt.core.internal.context.JptValidator;
import org.eclipse.jpt.core.internal.context.MappingTools;
+import org.eclipse.jpt.core.internal.context.NamedColumnTextRangeResolver;
import org.eclipse.jpt.core.internal.context.orm.AbstractOrmAttributeMapping;
import org.eclipse.jpt.core.internal.context.orm.VirtualXmlAttributeOverrideColumn;
+import org.eclipse.jpt.core.internal.jpa1.context.AssociationOverrideJoinColumnValidator;
+import org.eclipse.jpt.core.internal.jpa1.context.AttributeOverrideColumnValidator;
+import org.eclipse.jpt.core.internal.jpa1.context.CollectionTableTableDescriptionProvider;
+import org.eclipse.jpt.core.internal.jpa1.context.MapKeyAttributeOverrideColumnValidator;
+import org.eclipse.jpt.core.internal.jpa1.context.MapKeyColumnValidator;
+import org.eclipse.jpt.core.internal.jpa1.context.NamedColumnValidator;
import org.eclipse.jpt.core.internal.validation.DefaultJpaValidationMessages;
-import org.eclipse.jpt.core.internal.validation.JpaValidationDescriptionMessages;
import org.eclipse.jpt.core.internal.validation.JpaValidationMessages;
import org.eclipse.jpt.core.jpa2.MappingKeys2_0;
import org.eclipse.jpt.core.jpa2.context.MetamodelField;
@@ -1316,68 +1325,6 @@ public abstract class AbstractOrmElementCollectionMapping2_0<T extends XmlElemen
public TextRange getValidationTextRange() {
return AbstractOrmElementCollectionMapping2_0.this.getValidationTextRange();
}
-
- public IMessage buildTableNotValidMessage(BaseColumn column, TextRange textRange) {
- if (isVirtual()) {
- return this.buildVirtualTableNotValidMessage(column, textRange);
- }
- return DefaultJpaValidationMessages.buildMessage(
- IMessage.HIGH_SEVERITY,
- getColumnTableNotValidMessage(),
- new String[] {
- column.getTable(),
- column.getName(),
- JpaValidationDescriptionMessages.DOES_NOT_MATCH_COLLECTION_TABLE},
- column,
- textRange
- );
- }
-
- protected IMessage buildVirtualTableNotValidMessage(BaseColumn column, TextRange textRange) {
- return DefaultJpaValidationMessages.buildMessage(
- IMessage.HIGH_SEVERITY,
- this.getVirtualAttributeColumnTableNotValidMessage(),
- new String[] {
- getName(),
- column.getTable(),
- column.getName(),
- JpaValidationDescriptionMessages.DOES_NOT_MATCH_COLLECTION_TABLE},
- column,
- textRange
- );
- }
-
- public IMessage buildUnresolvedNameMessage(NamedColumn column, TextRange textRange) {
- if (isVirtual()) {
- return this.buildVirtualUnresolvedNameMessage(column, textRange);
- }
- return DefaultJpaValidationMessages.buildMessage(
- IMessage.HIGH_SEVERITY,
- this.getColumnUnresolvedNameMessage(),
- new String[] {
- column.getName(),
- column.getDbTable().getName()},
- column,
- textRange
- );
- }
-
- protected IMessage buildVirtualUnresolvedNameMessage(NamedColumn column, TextRange textRange) {
- return DefaultJpaValidationMessages.buildMessage(
- IMessage.HIGH_SEVERITY,
- this.getVirtualAttributeColumnUnresolvedNameMessage(),
- new String[] {getName(), column.getName(), column.getDbTable().getName()},
- column,
- textRange
- );
- }
- protected abstract String getColumnTableNotValidMessage();
-
- protected abstract String getVirtualAttributeColumnTableNotValidMessage();
-
- protected abstract String getColumnUnresolvedNameMessage();
-
- protected abstract String getVirtualAttributeColumnUnresolvedNameMessage();
}
protected class ValueColumnOwner extends ColumnOwner {
@@ -1398,24 +1345,8 @@ public abstract class AbstractOrmElementCollectionMapping2_0<T extends XmlElemen
return AbstractOrmElementCollectionMapping2_0.this.getName();
}
- @Override
- public String getColumnTableNotValidMessage() {
- return JpaValidationMessages.COLUMN_TABLE_NOT_VALID;
- }
-
- @Override
- public String getVirtualAttributeColumnTableNotValidMessage() {
- return JpaValidationMessages.VIRTUAL_ATTRIBUTE_COLUMN_TABLE_NOT_VALID;
- }
-
- @Override
- public String getColumnUnresolvedNameMessage() {
- return JpaValidationMessages.COLUMN_UNRESOLVED_NAME;
- }
-
- @Override
- public String getVirtualAttributeColumnUnresolvedNameMessage() {
- return JpaValidationMessages.VIRTUAL_ATTRIBUTE_COLUMN_UNRESOLVED_NAME;
+ public JptValidator buildColumnValidator(NamedColumn column, NamedColumnTextRangeResolver textRangeResolver) {
+ return new NamedColumnValidator(getPersistentAttribute(), (BaseColumn) column, (BaseColumnTextRangeResolver) textRangeResolver, new CollectionTableTableDescriptionProvider());
}
}
@@ -1437,26 +1368,9 @@ public abstract class AbstractOrmElementCollectionMapping2_0<T extends XmlElemen
return AbstractOrmElementCollectionMapping2_0.this.getName() + "_KEY"; //$NON-NLS-1$
}
- @Override
- protected String getColumnTableNotValidMessage() {
- return JpaValidationMessages.MAP_KEY_COLUMN_TABLE_NOT_VALID;
+ public JptValidator buildColumnValidator(NamedColumn column, NamedColumnTextRangeResolver textRangeResolver) {
+ return new MapKeyColumnValidator(getPersistentAttribute(), (BaseColumn) column, (BaseColumnTextRangeResolver) textRangeResolver, new CollectionTableTableDescriptionProvider());
}
-
- @Override
- protected String getVirtualAttributeColumnTableNotValidMessage() {
- return JpaValidationMessages.VIRTUAL_ATTRIBUTE_MAP_KEY_COLUMN_TABLE_NOT_VALID;
- }
-
- @Override
- public String getColumnUnresolvedNameMessage() {
- return JpaValidationMessages.MAP_KEY_COLUMN_UNRESOLVED_NAME;
- }
-
- @Override
- public String getVirtualAttributeColumnUnresolvedNameMessage() {
- return JpaValidationMessages.VIRTUAL_ATTRIBUTE_MAP_KEY_COLUMN_UNRESOLVED_NAME;
- }
-
}
protected abstract class OverrideContainerOwner implements OrmOverrideContainer.Owner {
@@ -1514,218 +1428,8 @@ public abstract class AbstractOrmElementCollectionMapping2_0<T extends XmlElemen
return MappingTools.resolveRelationshipReference(getOverridableTypeMapping(), associationOverrideName);
}
- public IMessage buildColumnTableNotValidMessage(BaseOverride override, BaseColumn column, TextRange textRange) {
- if (isVirtual()) {
- return this.buildVirtualAttributeColumnTableNotValidMessage(override.getName(), column, textRange);
- }
- if (override.isVirtual()) {
- return this.buildVirtualOverrideColumnTableNotValidMessage(override.getName(), column, textRange);
- }
- return DefaultJpaValidationMessages.buildMessage(
- IMessage.HIGH_SEVERITY,
- JpaValidationMessages.JOIN_COLUMN_TABLE_NOT_VALID,
- new String[] {
- column.getTable(),
- column.getName(),
- JpaValidationDescriptionMessages.DOES_NOT_MATCH_COLLECTION_TABLE},
- column,
- textRange
- );
- }
-
- protected IMessage buildVirtualAttributeColumnTableNotValidMessage(String overrideName, BaseColumn column, TextRange textRange) {
- return DefaultJpaValidationMessages.buildMessage(
- IMessage.HIGH_SEVERITY,
- JpaValidationMessages.VIRTUAL_ATTRIBUTE_ASSOCIATION_OVERRIDE_JOIN_COLUMN_TABLE_NOT_VALID,
- new String[] {
- AbstractOrmElementCollectionMapping2_0.this.getName(),
- overrideName,
- column.getTable(),
- column.getName(),
- JpaValidationDescriptionMessages.DOES_NOT_MATCH_COLLECTION_TABLE},
- column,
- textRange
- );
- }
-
- protected IMessage buildVirtualOverrideColumnTableNotValidMessage(String overrideName, BaseColumn column, TextRange textRange) {
- return DefaultJpaValidationMessages.buildMessage(
- IMessage.HIGH_SEVERITY,
- JpaValidationMessages.VIRTUAL_ASSOCIATION_OVERRIDE_JOIN_COLUMN_TABLE_NOT_VALID,
- new String[] {
- overrideName,
- column.getTable(),
- column.getName(),
- JpaValidationDescriptionMessages.DOES_NOT_MATCH_COLLECTION_TABLE},
- column,
- textRange
- );
- }
-
- public IMessage buildColumnUnresolvedNameMessage(BaseOverride override, NamedColumn column, TextRange textRange) {
- if (isVirtual()) {
- return this.buildVirtualAttributeColumnUnresolvedNameMessage(override.getName(), column, textRange);
- }
- if (override.isVirtual()) {
- return this.buildVirtualOverrideColumnUnresolvedNameMessage(override.getName(), column, textRange);
- }
- return DefaultJpaValidationMessages.buildMessage(
- IMessage.HIGH_SEVERITY,
- JpaValidationMessages.JOIN_COLUMN_UNRESOLVED_NAME,
- new String[] {
- column.getName(),
- column.getDbTable().getName()},
- column,
- textRange
- );
- }
-
- protected IMessage buildVirtualAttributeColumnUnresolvedNameMessage(String overrideName, NamedColumn column, TextRange textRange) {
- return DefaultJpaValidationMessages.buildMessage(
- IMessage.HIGH_SEVERITY,
- JpaValidationMessages.VIRTUAL_ATTRIBUTE_ASSOCIATION_OVERRIDE_JOIN_COLUMN_UNRESOLVED_NAME,
- new String[] {
- AbstractOrmElementCollectionMapping2_0.this.getName(),
- overrideName,
- column.getName(),
- column.getDbTable().getName()},
- column,
- textRange
- );
- }
-
- protected IMessage buildVirtualOverrideColumnUnresolvedNameMessage(String overrideName, NamedColumn column, TextRange textRange) {
- return DefaultJpaValidationMessages.buildMessage(
- IMessage.HIGH_SEVERITY,
- JpaValidationMessages.VIRTUAL_ASSOCIATION_OVERRIDE_JOIN_COLUMN_UNRESOLVED_NAME,
- new String[] {
- overrideName,
- column.getName(),
- column.getDbTable().getName()},
- column,
- textRange
- );
- }
-
- public IMessage buildColumnUnresolvedReferencedColumnNameMessage(AssociationOverride override, BaseJoinColumn column, TextRange textRange) {
- if (isVirtual()) {
- return this.buildVirtualAttributeColumnUnresolvedReferencedColumnNameMessage(override.getName(), column, textRange);
- }
- if (override.isVirtual()) {
- return this.buildVirtualOverrideColumnUnresolvedReferencedColumnNameMessage(override.getName(), column, textRange);
- }
- return DefaultJpaValidationMessages.buildMessage(
- IMessage.HIGH_SEVERITY,
- JpaValidationMessages.JOIN_COLUMN_UNRESOLVED_REFERENCED_COLUMN_NAME,
- new String[] {
- column.getReferencedColumnName(),
- column.getReferencedColumnDbTable().getName()},
- column,
- textRange
- );
- }
-
- protected IMessage buildVirtualAttributeColumnUnresolvedReferencedColumnNameMessage(String overrideName, BaseJoinColumn column, TextRange textRange) {
- return DefaultJpaValidationMessages.buildMessage(
- IMessage.HIGH_SEVERITY,
- JpaValidationMessages.VIRTUAL_ATTRIBUTE_ASSOCIATION_OVERRIDE_JOIN_COLUMN_REFERENCED_COLUMN_UNRESOLVED_NAME,
- new String[] {
- AbstractOrmElementCollectionMapping2_0.this.getName(),
- overrideName,
- column.getReferencedColumnName(),
- column.getReferencedColumnDbTable().getName()},
- column,
- textRange
- );
- }
-
- protected IMessage buildVirtualOverrideColumnUnresolvedReferencedColumnNameMessage(String overrideName, BaseJoinColumn column, TextRange textRange) {
- return DefaultJpaValidationMessages.buildMessage(
- IMessage.HIGH_SEVERITY,
- JpaValidationMessages.VIRTUAL_ASSOCIATION_OVERRIDE_JOIN_COLUMN_UNRESOLVED_REFERENCED_COLUMN_NAME,
- new String[] {
- overrideName,
- column.getReferencedColumnName(),
- column.getReferencedColumnDbTable().getName()},
- column,
- textRange
- );
- }
-
- public IMessage buildUnspecifiedNameMultipleJoinColumnsMessage(AssociationOverride override, BaseJoinColumn column, TextRange textRange) {
- if (isVirtual()) {
- return this.buildVirtualAttributeUnspecifiedNameMultipleJoinColumnsMessage(override.getName(), column, textRange);
- }
- if (override.isVirtual()) {
- return this.buildVirtualOverrideUnspecifiedNameMultipleJoinColumnsMessage(override.getName(), column, textRange);
- }
- return DefaultJpaValidationMessages.buildMessage(
- IMessage.HIGH_SEVERITY,
- JpaValidationMessages.JOIN_COLUMN_NAME_MUST_BE_SPECIFIED_MULTIPLE_JOIN_COLUMNS,
- new String[] {
- column.getReferencedColumnName(),
- column.getReferencedColumnDbTable().getName()},
- column,
- textRange
- );
- }
-
- protected IMessage buildVirtualAttributeUnspecifiedNameMultipleJoinColumnsMessage(String overrideName, BaseJoinColumn column, TextRange textRange) {
- return DefaultJpaValidationMessages.buildMessage(
- IMessage.HIGH_SEVERITY,
- JpaValidationMessages.VIRTUAL_ATTRIBUTE_ASSOCIATION_OVERRIDE_JOIN_COLUMN_NAME_MUST_BE_SPECIFIED_MULTIPLE_JOIN_COLUMNS,
- new String[] {AbstractOrmElementCollectionMapping2_0.this.getName(), overrideName},
- column,
- textRange
- );
- }
-
- protected IMessage buildVirtualOverrideUnspecifiedNameMultipleJoinColumnsMessage(String overrideName, BaseJoinColumn column, TextRange textRange) {
- return DefaultJpaValidationMessages.buildMessage(
- IMessage.HIGH_SEVERITY,
- JpaValidationMessages.VIRTUAL_ASSOCIATION_OVERRIDE_JOIN_COLUMN_NAME_MUST_BE_SPECIFIED_MULTIPLE_JOIN_COLUMNS,
- new String[] {overrideName},
- column,
- textRange
- );
- }
-
- public IMessage buildUnspecifiedReferencedColumnNameMultipleJoinColumnsMessage(AssociationOverride override, BaseJoinColumn column, TextRange textRange) {
- if (isVirtual()) {
- return this.buildVirtualAttributeUnspecifiedReferencedColumnNameMultipleJoinColumnsMessage(override.getName(), column, textRange);
- }
- if (override.isVirtual()) {
- return this.buildVirtualOverrideUnspecifiedReferencedColumnNameMultipleJoinColumnsMessage(override.getName(), column, textRange);
- }
- return DefaultJpaValidationMessages.buildMessage(
- IMessage.HIGH_SEVERITY,
- JpaValidationMessages.JOIN_COLUMN_REFERENCED_COLUMN_NAME_MUST_BE_SPECIFIED_MULTIPLE_JOIN_COLUMNS,
- new String[] {
- column.getReferencedColumnName(),
- column.getReferencedColumnDbTable().getName()},
- column,
- textRange
- );
- }
-
- protected IMessage buildVirtualAttributeUnspecifiedReferencedColumnNameMultipleJoinColumnsMessage(String overrideName, BaseJoinColumn column, TextRange textRange) {
- return DefaultJpaValidationMessages.buildMessage(
- IMessage.HIGH_SEVERITY,
- JpaValidationMessages.VIRTUAL_ATTRIBUTE_ASSOCIATION_OVERRIDE_JOIN_COLUMN_REFERENCED_COLUMN_NAME_MUST_BE_SPECIFIED_MULTIPLE_JOIN_COLUMNS,
- new String[] {AbstractOrmElementCollectionMapping2_0.this.getName(), overrideName},
- column,
- textRange
- );
- }
-
- protected IMessage buildVirtualOverrideUnspecifiedReferencedColumnNameMultipleJoinColumnsMessage(String overrideName, BaseJoinColumn column, TextRange textRange) {
- return DefaultJpaValidationMessages.buildMessage(
- IMessage.HIGH_SEVERITY,
- JpaValidationMessages.VIRTUAL_ASSOCIATION_OVERRIDE_JOIN_COLUMN_REFERENCED_COLUMN_NAME_MUST_BE_SPECIFIED_MULTIPLE_JOIN_COLUMNS,
- new String[] {overrideName},
- column,
- textRange
- );
+ public JptValidator buildColumnValidator(BaseOverride override, BaseColumn column, BaseColumn.Owner columnOwner, BaseColumnTextRangeResolver textRangeResolver) {
+ return new AssociationOverrideJoinColumnValidator(getPersistentAttribute(), (AssociationOverride) override, (JoinColumn) column, (JoinColumn.Owner) columnOwner, (JoinColumnTextRangeResolver) textRangeResolver, new CollectionTableTableDescriptionProvider());
}
public TextRange getValidationTextRange() {
@@ -1769,97 +1473,8 @@ public abstract class AbstractOrmElementCollectionMapping2_0<T extends XmlElemen
return new VirtualXmlAttributeOverrideColumn(overridableColumn);
}
- public IMessage buildColumnUnresolvedNameMessage(BaseOverride override, NamedColumn column, TextRange textRange) {
- if (isVirtual()) {
- return this.buildVirtualAttributeColumnUnresolvedNameMessage(override.getName(), column, textRange);
- }
- if (override.isVirtual()) {
- return this.buildVirtualOverrideColumnUnresolvedNameMessage(override.getName(), column, textRange);
- }
- return DefaultJpaValidationMessages.buildMessage(
- IMessage.HIGH_SEVERITY,
- JpaValidationMessages.COLUMN_UNRESOLVED_NAME,
- new String[] {
- column.getName(),
- column.getDbTable().getName()},
- column,
- textRange
- );
- }
-
- protected IMessage buildVirtualAttributeColumnUnresolvedNameMessage(String overrideName, NamedColumn column, TextRange textRange) {
- return DefaultJpaValidationMessages.buildMessage(
- IMessage.HIGH_SEVERITY,
- JpaValidationMessages.VIRTUAL_ATTRIBUTE_ATTRIBUTE_OVERRIDE_COLUMN_UNRESOLVED_NAME,
- new String[] {
- AbstractOrmElementCollectionMapping2_0.this.getName(),
- overrideName,
- column.getName(),
- column.getDbTable().getName()},
- column,
- textRange
- );
- }
-
- protected IMessage buildVirtualOverrideColumnUnresolvedNameMessage(String overrideName, NamedColumn column, TextRange textRange) {
- return DefaultJpaValidationMessages.buildMessage(
- IMessage.HIGH_SEVERITY,
- JpaValidationMessages.VIRTUAL_ATTRIBUTE_OVERRIDE_COLUMN_UNRESOLVED_NAME,
- new String[] {
- overrideName,
- column.getName(),
- column.getDbTable().getName()},
- column,
- textRange
- );
- }
-
- public IMessage buildColumnTableNotValidMessage(BaseOverride override, BaseColumn column, TextRange textRange) {
- if (isVirtual()) {
- return this.buildVirtualAttributeColumnTableNotValidMessage(override.getName(), column, textRange);
- }
- if (override.isVirtual()) {
- return this.buildVirtualOverrideColumnTableNotValidMessage(override.getName(), column, textRange);
- }
- return DefaultJpaValidationMessages.buildMessage(
- IMessage.HIGH_SEVERITY,
- JpaValidationMessages.COLUMN_TABLE_NOT_VALID,
- new String[] {
- column.getTable(),
- column.getName(),
- JpaValidationDescriptionMessages.DOES_NOT_MATCH_COLLECTION_TABLE},
- column,
- textRange
- );
- }
-
- protected IMessage buildVirtualAttributeColumnTableNotValidMessage(String overrideName, BaseColumn column, TextRange textRange) {
- return DefaultJpaValidationMessages.buildMessage(
- IMessage.HIGH_SEVERITY,
- JpaValidationMessages.VIRTUAL_ATTRIBUTE_ATTRIBUTE_OVERRIDE_COLUMN_TABLE_NOT_VALID,
- new String[] {
- AbstractOrmElementCollectionMapping2_0.this.getName(),
- overrideName,
- column.getTable(),
- column.getName(),
- JpaValidationDescriptionMessages.DOES_NOT_MATCH_COLLECTION_TABLE},
- column,
- textRange
- );
- }
-
- protected IMessage buildVirtualOverrideColumnTableNotValidMessage(String overrideName, BaseColumn column, TextRange textRange) {
- return DefaultJpaValidationMessages.buildMessage(
- IMessage.HIGH_SEVERITY,
- JpaValidationMessages.VIRTUAL_ATTRIBUTE_OVERRIDE_COLUMN_TABLE_NOT_VALID,
- new String[] {
- overrideName,
- column.getTable(),
- column.getName(),
- JpaValidationDescriptionMessages.DOES_NOT_MATCH_COLLECTION_TABLE},
- column,
- textRange
- );
+ public JptValidator buildColumnValidator(BaseOverride override, BaseColumn column, BaseColumn.Owner columnOwner, BaseColumnTextRangeResolver textRangeResolver) {
+ return new AttributeOverrideColumnValidator(getPersistentAttribute(), (AttributeOverride) override, column, textRangeResolver, new CollectionTableTableDescriptionProvider());
}
public TextRange getValidationTextRange() {
@@ -1900,98 +1515,9 @@ public abstract class AbstractOrmElementCollectionMapping2_0<T extends XmlElemen
public XmlColumn buildVirtualXmlColumn(Column overridableColumn, String attributeName, boolean isMetadataComplete) {
return new VirtualXmlAttributeOverrideColumn(overridableColumn);
}
-
- public IMessage buildColumnUnresolvedNameMessage(BaseOverride override, NamedColumn column, TextRange textRange) {
- if (isVirtual()) {
- return this.buildVirtualAttributeColumnUnresolvedNameMessage(override.getName(), column, textRange);
- }
- if (override.isVirtual()) {
- return this.buildVirtualOverrideColumnUnresolvedNameMessage(override.getName(), column, textRange);
- }
- return DefaultJpaValidationMessages.buildMessage(
- IMessage.HIGH_SEVERITY,
- JpaValidationMessages.COLUMN_UNRESOLVED_NAME,
- new String[] {
- column.getName(),
- column.getDbTable().getName()},
- column,
- textRange
- );
- }
-
- protected IMessage buildVirtualAttributeColumnUnresolvedNameMessage(String overrideName, NamedColumn column, TextRange textRange) {
- return DefaultJpaValidationMessages.buildMessage(
- IMessage.HIGH_SEVERITY,
- JpaValidationMessages.VIRTUAL_ATTRIBUTE_MAP_KEY_ATTRIBUTE_OVERRIDE_COLUMN_UNRESOLVED_NAME,
- new String[] {
- AbstractOrmElementCollectionMapping2_0.this.getName(),
- overrideName,
- column.getName(),
- column.getDbTable().getName()},
- column,
- textRange
- );
- }
-
- protected IMessage buildVirtualOverrideColumnUnresolvedNameMessage(String overrideName, NamedColumn column, TextRange textRange) {
- return DefaultJpaValidationMessages.buildMessage(
- IMessage.HIGH_SEVERITY,
- JpaValidationMessages.VIRTUAL_MAP_KEY_ATTRIBUTE_OVERRIDE_COLUMN_UNRESOLVED_NAME,
- new String[] {
- overrideName,
- column.getName(),
- column.getDbTable().getName()},
- column,
- textRange
- );
- }
-
- public IMessage buildColumnTableNotValidMessage(BaseOverride override, BaseColumn column, TextRange textRange) {
- if (isVirtual()) {
- return this.buildVirtualAttributeColumnTableNotValidMessage(override.getName(), column, textRange);
- }
- if (override.isVirtual()) {
- return this.buildVirtualOverrideColumnTableNotValidMessage(override.getName(), column, textRange);
- }
- return DefaultJpaValidationMessages.buildMessage(
- IMessage.HIGH_SEVERITY,
- JpaValidationMessages.COLUMN_TABLE_NOT_VALID,
- new String[] {
- column.getTable(),
- column.getName(),
- JpaValidationDescriptionMessages.DOES_NOT_MATCH_COLLECTION_TABLE},
- column,
- textRange
- );
- }
-
- protected IMessage buildVirtualAttributeColumnTableNotValidMessage(String overrideName, BaseColumn column, TextRange textRange) {
- return DefaultJpaValidationMessages.buildMessage(
- IMessage.HIGH_SEVERITY,
- JpaValidationMessages.VIRTUAL_ATTRIBUTE_MAP_KEY_ATTRIBUTE_OVERRIDE_COLUMN_TABLE_NOT_VALID,
- new String[] {
- AbstractOrmElementCollectionMapping2_0.this.getName(),
- overrideName,
- column.getTable(),
- column.getName(),
- JpaValidationDescriptionMessages.DOES_NOT_MATCH_COLLECTION_TABLE},
- column,
- textRange
- );
- }
-
- protected IMessage buildVirtualOverrideColumnTableNotValidMessage(String overrideName, BaseColumn column, TextRange textRange) {
- return DefaultJpaValidationMessages.buildMessage(
- IMessage.HIGH_SEVERITY,
- JpaValidationMessages.VIRTUAL_MAP_KEY_ATTRIBUTE_OVERRIDE_COLUMN_TABLE_NOT_VALID,
- new String[] {
- overrideName,
- column.getTable(),
- column.getName(),
- JpaValidationDescriptionMessages.DOES_NOT_MATCH_COLLECTION_TABLE},
- column,
- textRange
- );
+
+ public JptValidator buildColumnValidator(BaseOverride override, BaseColumn column, BaseColumn.Owner columnOwner, BaseColumnTextRangeResolver textRangeResolver) {
+ return new MapKeyAttributeOverrideColumnValidator(getPersistentAttribute(), (AttributeOverride) override, column, textRangeResolver, new CollectionTableTableDescriptionProvider());
}
public TextRange getValidationTextRange() {
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/context/orm/GenericOrmCollectionTable2_0.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/context/orm/GenericOrmCollectionTable2_0.java
index 31db53cffb..2fbd15243c 100644
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/context/orm/GenericOrmCollectionTable2_0.java
+++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/context/orm/GenericOrmCollectionTable2_0.java
@@ -10,17 +10,20 @@
package org.eclipse.jpt.core.internal.jpa2.context.orm;
import java.util.Iterator;
-import org.eclipse.jpt.core.context.BaseColumn;
import org.eclipse.jpt.core.context.BaseJoinColumn;
import org.eclipse.jpt.core.context.Entity;
+import org.eclipse.jpt.core.context.JoinColumn;
import org.eclipse.jpt.core.context.NamedColumn;
import org.eclipse.jpt.core.context.PersistentAttribute;
import org.eclipse.jpt.core.context.TypeMapping;
import org.eclipse.jpt.core.context.orm.OrmJoinColumn;
+import org.eclipse.jpt.core.internal.context.JoinColumnTextRangeResolver;
+import org.eclipse.jpt.core.internal.context.JptValidator;
import org.eclipse.jpt.core.internal.context.MappingTools;
+import org.eclipse.jpt.core.internal.context.NamedColumnTextRangeResolver;
+import org.eclipse.jpt.core.internal.jpa1.context.CollectionTableTableDescriptionProvider;
+import org.eclipse.jpt.core.internal.jpa1.context.JoinColumnValidator;
import org.eclipse.jpt.core.internal.jpa1.context.orm.GenericOrmReferenceTable;
-import org.eclipse.jpt.core.internal.validation.DefaultJpaValidationMessages;
-import org.eclipse.jpt.core.internal.validation.JpaValidationDescriptionMessages;
import org.eclipse.jpt.core.internal.validation.JpaValidationMessages;
import org.eclipse.jpt.core.jpa2.context.CollectionTable2_0;
import org.eclipse.jpt.core.jpa2.context.orm.OrmCollectionTable2_0;
@@ -29,7 +32,6 @@ import org.eclipse.jpt.core.resource.orm.OrmFactory;
import org.eclipse.jpt.core.resource.orm.XmlCollectionTable;
import org.eclipse.jpt.core.utility.TextRange;
import org.eclipse.jpt.utility.internal.iterators.EmptyIterator;
-import org.eclipse.wst.validation.internal.provisional.core.IMessage;
/**
* orm.xml collection table
@@ -218,133 +220,8 @@ public class GenericOrmCollectionTable2_0
return GenericOrmCollectionTable2_0.this.joinColumnsSize();
}
- protected boolean isPersistentAttributeVirtual() {
- return getPersistentAttribute().isVirtual();
- }
-
- protected String getPersistentAttributeName() {
- return getPersistentAttribute().getName();
- }
-
- public IMessage buildTableNotValidMessage(BaseColumn column, TextRange textRange) {
- if (this.isPersistentAttributeVirtual()) {
- return this.buildVirtualTableNotValidMessage(column, textRange);
- }
- return DefaultJpaValidationMessages.buildMessage(
- IMessage.HIGH_SEVERITY,
- JpaValidationMessages.JOIN_COLUMN_TABLE_NOT_VALID,
- new String[] {
- column.getTable(),
- column.getName(),
- JpaValidationDescriptionMessages.DOES_NOT_MATCH_COLLECTION_TABLE},
- column,
- textRange
- );
- }
-
- protected IMessage buildVirtualTableNotValidMessage(BaseColumn column, TextRange textRange) {
- return DefaultJpaValidationMessages.buildMessage(
- IMessage.HIGH_SEVERITY,
- JpaValidationMessages.VIRTUAL_ATTRIBUTE_JOIN_COLUMN_TABLE_NOT_VALID,
- new String[] {
- this.getPersistentAttributeName(),
- column.getTable(),
- column.getName(),
- JpaValidationDescriptionMessages.DOES_NOT_MATCH_COLLECTION_TABLE},
- column,
- textRange
- );
- }
-
- public IMessage buildUnresolvedNameMessage(NamedColumn column, TextRange textRange) {
- if (this.isPersistentAttributeVirtual()) {
- return this.buildVirtualUnresolvedNameMessage(column, textRange);
- }
- return DefaultJpaValidationMessages.buildMessage(
- IMessage.HIGH_SEVERITY,
- JpaValidationMessages.JOIN_COLUMN_UNRESOLVED_NAME,
- new String[] {column.getName(), column.getDbTable().getName()},
- column,
- textRange
- );
- }
-
- protected IMessage buildVirtualUnresolvedNameMessage(NamedColumn column, TextRange textRange) {
- return DefaultJpaValidationMessages.buildMessage(
- IMessage.HIGH_SEVERITY,
- JpaValidationMessages.VIRTUAL_ATTRIBUTE_JOIN_COLUMN_UNRESOLVED_NAME,
- new String[] {this.getPersistentAttributeName(), column.getName(), column.getDbTable().getName()},
- column,
- textRange
- );
- }
-
- public IMessage buildUnresolvedReferencedColumnNameMessage(BaseJoinColumn column, TextRange textRange) {
- if (this.isPersistentAttributeVirtual()) {
- return this.buildVirtualUnresolvedReferencedColumnNameMessage(column, textRange);
- }
- return DefaultJpaValidationMessages.buildMessage(
- IMessage.HIGH_SEVERITY,
- JpaValidationMessages.JOIN_COLUMN_UNRESOLVED_REFERENCED_COLUMN_NAME,
- new String[] {column.getReferencedColumnName(), column.getReferencedColumnDbTable().getName()},
- column,
- textRange
- );
- }
-
- protected IMessage buildVirtualUnresolvedReferencedColumnNameMessage(BaseJoinColumn column, TextRange textRange) {
- return DefaultJpaValidationMessages.buildMessage(
- IMessage.HIGH_SEVERITY,
- JpaValidationMessages.VIRTUAL_ATTRIBUTE_JOIN_COLUMN_UNRESOLVED_REFERENCED_COLUMN_NAME,
- new String[] {this.getPersistentAttributeName(), column.getReferencedColumnName(), column.getReferencedColumnDbTable().getName()},
- column,
- textRange
- );
- }
-
- public IMessage buildUnspecifiedNameMultipleJoinColumnsMessage(BaseJoinColumn column, TextRange textRange) {
- if (this.isPersistentAttributeVirtual()) {
- return this.buildVirtualUnspecifiedNameMultipleJoinColumnsMessage(column, textRange);
- }
- return DefaultJpaValidationMessages.buildMessage(
- IMessage.HIGH_SEVERITY,
- JpaValidationMessages.JOIN_COLUMN_NAME_MUST_BE_SPECIFIED_MULTIPLE_JOIN_COLUMNS,
- new String[0],
- column,
- textRange
- );
- }
-
- protected IMessage buildVirtualUnspecifiedNameMultipleJoinColumnsMessage(BaseJoinColumn column, TextRange textRange) {
- return DefaultJpaValidationMessages.buildMessage(
- IMessage.HIGH_SEVERITY,
- JpaValidationMessages.VIRTUAL_ATTRIBUTE_JOIN_COLUMN_NAME_MUST_BE_SPECIFIED_MULTIPLE_JOIN_COLUMNS,
- new String[] {this.getPersistentAttributeName()},
- column,
- textRange
- );
- }
-
- public IMessage buildUnspecifiedReferencedColumnNameMultipleJoinColumnsMessage(BaseJoinColumn column, TextRange textRange) {
- if (this.isPersistentAttributeVirtual()) {
- return this.buildVirtualUnspecifiedReferencedColumnNameMultipleJoinColumnsMessage(column, textRange);
- }
- return DefaultJpaValidationMessages.buildMessage(
- IMessage.HIGH_SEVERITY,
- JpaValidationMessages.JOIN_COLUMN_REFERENCED_COLUMN_NAME_MUST_BE_SPECIFIED_MULTIPLE_JOIN_COLUMNS,
- new String[0],
- column,
- textRange
- );
- }
- protected IMessage buildVirtualUnspecifiedReferencedColumnNameMultipleJoinColumnsMessage(BaseJoinColumn column, TextRange textRange) {
- return DefaultJpaValidationMessages.buildMessage(
- IMessage.HIGH_SEVERITY,
- JpaValidationMessages.VIRTUAL_ATTRIBUTE_JOIN_COLUMN_REFERENCED_COLUMN_NAME_MUST_BE_SPECIFIED_MULTIPLE_JOIN_COLUMNS,
- new String[] {this.getPersistentAttributeName()},
- column,
- textRange
- );
+ public JptValidator buildColumnValidator(NamedColumn column, NamedColumnTextRangeResolver textRangeResolver) {
+ return new JoinColumnValidator(getPersistentAttribute(), (JoinColumn) column, this, (JoinColumnTextRangeResolver) textRangeResolver, new CollectionTableTableDescriptionProvider());
}
}
}

Back to the top