diff options
Diffstat (limited to 'jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/AbstractOrmJoinColumnInRelationshipMappingJoiningStrategy.java')
-rw-r--r-- | jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/AbstractOrmJoinColumnInRelationshipMappingJoiningStrategy.java | 135 |
1 files changed, 8 insertions, 127 deletions
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()); } } |