diff options
author | kmoore | 2008-12-09 14:53:23 +0000 |
---|---|---|
committer | kmoore | 2008-12-09 14:53:23 +0000 |
commit | d0571d5bd5482dd6e6a2fd1d5f766e7957aa83e8 (patch) | |
tree | 1b4b8b72b26c36f3a0959dfa8e3119e27d9024df /jpa | |
parent | 9979ddd04df6150fc5222168333fbf67a27c17c1 (diff) | |
download | webtools.dali-d0571d5bd5482dd6e6a2fd1d5f766e7957aa83e8.tar.gz webtools.dali-d0571d5bd5482dd6e6a2fd1d5f766e7957aa83e8.tar.xz webtools.dali-d0571d5bd5482dd6e6a2fd1d5f766e7957aa83e8.zip |
257629 - Invalid Problem reported for multi-relationship mapping when join table doesn't resolve
Diffstat (limited to 'jpa')
15 files changed, 210 insertions, 37 deletions
diff --git a/jpa/plugins/org.eclipse.jpt.core/property_files/jpa_validation.properties b/jpa/plugins/org.eclipse.jpt.core/property_files/jpa_validation.properties index efe749bbce..7f0d00b530 100644 --- a/jpa/plugins/org.eclipse.jpt.core/property_files/jpa_validation.properties +++ b/jpa/plugins/org.eclipse.jpt.core/property_files/jpa_validation.properties @@ -52,7 +52,7 @@ JOIN_TABLE_UNRESOLVED_CATALOG=Catalog \"{0}\" cannot be resolved for join table JOIN_TABLE_UNRESOLVED_SCHEMA=Schema \"{0}\" cannot be resolved for join table \"{1}\" VIRTUAL_ATTRIBUTE_JOIN_TABLE_UNRESOLVED_CATALOG=In implied attribute \"{0}\", catalog \"{1}\" cannot be resolved for join table \"{2}\" VIRTUAL_ATTRIBUTE_JOIN_TABLE_UNRESOLVED_SCHEMA=In implied attribute \"{0}\", schema \"{1}\" cannot be resolved for join table \"{2}\" -JOIN_TABLE_CANNOT_BE_DETERMINED=Target Entity for \"{0}\" not defined - join table cannot be determined +JOIN_TABLE_UNRESOLVED_NAME=Join table \"{0}\" cannot be resolved VIRTUAL_ATTRIBUTE_JOIN_TABLE_UNRESOLVED_NAME=In implied attribute \"{0}\", join table \"{1}\" cannot be resolved COLUMN_UNRESOLVED_TABLE=Table \"{0}\" for column \"{1}\" cannot be resolved VIRTUAL_ATTRIBUTE_COLUMN_UNRESOLVED_TABLE=In implied attribute \"{0}\", table \"{1}\" for column \"{2}\" cannot be resolved @@ -72,4 +72,8 @@ VIRTUAL_ASSOCIATION_OVERRIDE_JOIN_COLUMN_REFERENCED_COLUMN_UNRESOLVED_NAME=In im GENERATED_VALUE_UNRESOLVED_GENERATOR=No generator named \"{0}\" is defined in the persistence unit PRIMARY_KEY_JOIN_COLUMN_UNRESOLVED_NAME=Primary key join column \"{0}\" cannot be resolved PRIMARY_KEY_JOIN_COLUMN_UNRESOLVED_REFERENCED_COLUMN_NAME=Referenced Column \"{0}\" in primary key join column \"{1}\" cannot be resolved -NO_JPA_PROJECT=This project has the JPA facet, but no JPA project could be created. See the error log for more details.
\ No newline at end of file +NO_JPA_PROJECT=This project has the JPA facet, but no JPA project could be created. See the error log for more details. +TARGET_ENTITY_NOT_DEFINED=Target entity for \"{0}\" is not defined +VIRTUAL_ATTRIBUTE_TARGET_ENTITY_NOT_DEFINED=In implied attribute \"{0}\", target entity is not defined +TARGET_ENTITY_IS_NOT_AN_ENTITY=Target entity \"{0}\" for \"{1}\" is not an Entity +VIRTUAL_ATTRIBUTE_TARGET_ENTITY_IS_NOT_AN_ENTITY=In implied attribute \"{0}\", target entity \"{1}\" is not an Entity diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/AbstractJavaRelationshipMapping.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/AbstractJavaRelationshipMapping.java index eb57863dcc..c3d83d09a7 100644 --- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/AbstractJavaRelationshipMapping.java +++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/AbstractJavaRelationshipMapping.java @@ -10,18 +10,24 @@ 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.Entity; import org.eclipse.jpt.core.context.FetchType; import org.eclipse.jpt.core.context.TypeMapping; import org.eclipse.jpt.core.context.java.JavaPersistentAttribute; import org.eclipse.jpt.core.context.java.JavaRelationshipMapping; 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.resource.java.JavaResourcePersistentAttribute; import org.eclipse.jpt.core.resource.java.RelationshipMappingAnnotation; +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.EmptyIterator; import org.eclipse.jpt.utility.internal.iterators.FilteringIterator; +import org.eclipse.wst.validation.internal.provisional.core.IMessage; /** * @@ -44,6 +50,11 @@ public abstract class AbstractJavaRelationshipMapping<T extends RelationshipMapp super(parent); this.cascade = new JavaCascade(this); } + + @Override + public JavaPersistentAttribute getParent() { + return (JavaPersistentAttribute) super.getParent(); + } // ********** target entity ********** @@ -204,5 +215,43 @@ public abstract class AbstractJavaRelationshipMapping<T extends RelationshipMapp protected Iterator<String> javaCandidateMappedByAttributeNames(Filter<String> filter) { return StringTools.convertToJavaStringLiterals(this.candidateMappedByAttributeNames(filter)); } + + @Override + public void validate(List<IMessage> messages, CompilationUnit astRoot) { + super.validate(messages, astRoot); + validateTargetEntity(messages, astRoot); + } + + protected void validateTargetEntity(List<IMessage> messages, CompilationUnit astRoot) { + if (getTargetEntity() == null) { + messages.add( + DefaultJpaValidationMessages.buildMessage( + IMessage.HIGH_SEVERITY, + JpaValidationMessages.TARGET_ENTITY_NOT_DEFINED, + new String[] {this.getAttributeName()}, + this, + this.getValidationTextRange(astRoot) + ) + ); + } + else if (getResolvedTargetEntity() == null) { + messages.add( + DefaultJpaValidationMessages.buildMessage( + IMessage.HIGH_SEVERITY, + JpaValidationMessages.TARGET_ENTITY_IS_NOT_AN_ENTITY, + new String[] {getTargetEntity(), this.getAttributeName()}, + this, + this.getTargetEntityTextRange(astRoot) + ) + ); + } + } + + protected TextRange getTextRange(TextRange textRange, CompilationUnit astRoot) { + return (textRange != null) ? textRange : this.getParent().getValidationTextRange(astRoot); + } + protected TextRange getTargetEntityTextRange(CompilationUnit astRoot) { + return this.getTextRange(this.getResourceMapping().getTargetEntityTextRange(astRoot), astRoot); + } } diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/GenericJavaJoinTable.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/GenericJavaJoinTable.java index c3f231dda0..c675304bf4 100644 --- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/GenericJavaJoinTable.java +++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/GenericJavaJoinTable.java @@ -539,16 +539,16 @@ public class GenericJavaJoinTable } if ( ! this.isResolved()) { - String attributeName = this.getRelationshipMapping().getPersistentAttribute().getName(); - messages.add( - DefaultJpaValidationMessages.buildMessage( - IMessage.HIGH_SEVERITY, - JpaValidationMessages.JOIN_TABLE_CANNOT_BE_DETERMINED, - new String[] {attributeName}, - this, - this.getNameTextRange(astRoot) - ) - ); + if (getName() != null) { //if name is null, the validation will be handled elsewhere, such as the target entity is not defined + messages.add( + DefaultJpaValidationMessages.buildMessage( + IMessage.HIGH_SEVERITY, + JpaValidationMessages.JOIN_TABLE_UNRESOLVED_NAME, + new String[] {this.getName()}, + this, + this.getNameTextRange(astRoot)) + ); + } return; } diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/AbstractOrmRelationshipMapping.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/AbstractOrmRelationshipMapping.java index 42e0665424..23182773ca 100644 --- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/AbstractOrmRelationshipMapping.java +++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/AbstractOrmRelationshipMapping.java @@ -10,6 +10,7 @@ package org.eclipse.jpt.core.internal.context.orm; import java.util.Iterator; +import java.util.List; import org.eclipse.jpt.core.MappingKeys; import org.eclipse.jpt.core.context.AttributeMapping; import org.eclipse.jpt.core.context.Entity; @@ -19,10 +20,14 @@ import org.eclipse.jpt.core.context.RelationshipMapping; import org.eclipse.jpt.core.context.orm.OrmPersistentAttribute; import org.eclipse.jpt.core.context.orm.OrmRelationshipMapping; 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.resource.java.JavaResourcePersistentAttribute; import org.eclipse.jpt.core.resource.orm.XmlAttributeMapping; import org.eclipse.jpt.core.resource.orm.XmlRelationshipMapping; +import org.eclipse.jpt.core.utility.TextRange; import org.eclipse.jpt.utility.internal.iterators.EmptyIterator; +import org.eclipse.wst.validation.internal.provisional.core.IMessage; public abstract class AbstractOrmRelationshipMapping<T extends XmlRelationshipMapping> @@ -44,6 +49,10 @@ public abstract class AbstractOrmRelationshipMapping<T extends XmlRelationshipMa this.cascade = new OrmCascade(this); } + @Override + public OrmPersistentAttribute getParent() { + return (OrmPersistentAttribute) super.getParent(); + } // ********** target entity ********** @@ -226,5 +235,69 @@ public abstract class AbstractOrmRelationshipMapping<T extends XmlRelationshipMa public Iterator<String> candidateMappedByAttributeNames() { return this.allTargetEntityAttributeNames(); } - + + @Override + public void validate(List<IMessage> messages) { + super.validate(messages); + validateTargetEntity(messages); + } + + protected void validateTargetEntity(List<IMessage> messages) { + if (getTargetEntity() == null) { + if (getPersistentAttribute().isVirtual()) { + messages.add( + DefaultJpaValidationMessages.buildMessage( + IMessage.HIGH_SEVERITY, + JpaValidationMessages.VIRTUAL_ATTRIBUTE_TARGET_ENTITY_NOT_DEFINED, + new String[] {this.getAttributeName()}, + this, + this.getValidationTextRange() + ) + ); + } + else { + messages.add( + DefaultJpaValidationMessages.buildMessage( + IMessage.HIGH_SEVERITY, + JpaValidationMessages.TARGET_ENTITY_NOT_DEFINED, + new String[] {this.getAttributeName()}, + this, + this.getValidationTextRange() + ) + ); + } + } + else if (getResolvedTargetEntity() == null) { + if (getPersistentAttribute().isVirtual()) { + messages.add( + DefaultJpaValidationMessages.buildMessage( + IMessage.HIGH_SEVERITY, + JpaValidationMessages.VIRTUAL_ATTRIBUTE_TARGET_ENTITY_IS_NOT_AN_ENTITY, + new String[] {this.getAttributeName(), getTargetEntity()}, + this, + this.getValidationTextRange() + ) + ); + } + else { + messages.add( + DefaultJpaValidationMessages.buildMessage( + IMessage.HIGH_SEVERITY, + JpaValidationMessages.TARGET_ENTITY_IS_NOT_AN_ENTITY, + new String[] {getTargetEntity(), this.getAttributeName()}, + this, + this.getTargetEntityTextRange() + ) + ); + } + } + } + + protected TextRange getTextRange(TextRange textRange) { + return (textRange != null) ? textRange : this.getParent().getValidationTextRange(); + } + + protected TextRange getTargetEntityTextRange() { + return this.getTextRange(this.getResourceAttributeMapping().getTargetEntityTextRange()); + } } diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/GenericOrmJoinTable.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/GenericOrmJoinTable.java index dadca85f25..8d722bfd8d 100644 --- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/GenericOrmJoinTable.java +++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/GenericOrmJoinTable.java @@ -528,29 +528,29 @@ public class GenericOrmJoinTable } return; } - if ( ! this.isResolved()) { - if (mapping.getPersistentAttribute().isVirtual()) { - messages.add( - DefaultJpaValidationMessages.buildMessage( - IMessage.HIGH_SEVERITY, - JpaValidationMessages.VIRTUAL_ATTRIBUTE_JOIN_TABLE_UNRESOLVED_NAME, - new String[] {mapping.getName(), this.getName()}, - this, - this.getNameTextRange() - ) - ); - } else { - String attributeName = mapping.getPersistentAttribute().getName(); - messages.add( - DefaultJpaValidationMessages.buildMessage( - IMessage.HIGH_SEVERITY, - JpaValidationMessages.JOIN_TABLE_CANNOT_BE_DETERMINED, - new String[] {attributeName}, - this, - this.getNameTextRange() - ) - ); + if (getName() != null) { //if name is null, the validation will be handled elsewhere, such as the target entity is not defined + if (mapping.getPersistentAttribute().isVirtual()) { + messages.add( + DefaultJpaValidationMessages.buildMessage( + IMessage.HIGH_SEVERITY, + JpaValidationMessages.VIRTUAL_ATTRIBUTE_JOIN_TABLE_UNRESOLVED_NAME, + new String[] {mapping.getName(), this.getName()}, + this, + this.getNameTextRange() + ) + ); + } + else { + messages.add( + DefaultJpaValidationMessages.buildMessage( + IMessage.HIGH_SEVERITY, + JpaValidationMessages.JOIN_TABLE_UNRESOLVED_NAME, + new String[] {this.getName()}, + this, + this.getNameTextRange()) + ); + } } return; } diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/VirtualXmlManyToMany.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/VirtualXmlManyToMany.java index b186719135..10bb14661d 100644 --- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/VirtualXmlManyToMany.java +++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/VirtualXmlManyToMany.java @@ -118,4 +118,8 @@ public class VirtualXmlManyToMany extends VirtualXmlAttributeMapping<JavaManyToM public TextRange getMappedByTextRange() { return null; } + + public TextRange getTargetEntityTextRange() { + return null; + } } diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/VirtualXmlManyToOne.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/VirtualXmlManyToOne.java index af58c5dada..bd7f637535 100644 --- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/VirtualXmlManyToOne.java +++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/VirtualXmlManyToOne.java @@ -20,6 +20,7 @@ import org.eclipse.jpt.core.resource.orm.OrmPackage; import org.eclipse.jpt.core.resource.orm.XmlJoinColumn; import org.eclipse.jpt.core.resource.orm.XmlJoinTable; import org.eclipse.jpt.core.resource.orm.XmlManyToOne; +import org.eclipse.jpt.core.utility.TextRange; import org.eclipse.jpt.utility.internal.CollectionTools; /** @@ -97,4 +98,8 @@ public class VirtualXmlManyToOne extends VirtualXmlAttributeMapping<JavaManyToOn public void setTargetEntity(@SuppressWarnings("unused") String value) { throw new UnsupportedOperationException("cannot set values on a virtual mapping"); //$NON-NLS-1$ } + + public TextRange getTargetEntityTextRange() { + return null; + } } diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/VirtualXmlOneToMany.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/VirtualXmlOneToMany.java index dac9874452..f4c6764f48 100644 --- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/VirtualXmlOneToMany.java +++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/VirtualXmlOneToMany.java @@ -119,4 +119,8 @@ public class VirtualXmlOneToMany extends VirtualXmlAttributeMapping<JavaOneToMan public TextRange getMappedByTextRange() { return null; } + + public TextRange getTargetEntityTextRange() { + return null; + } } diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/VirtualXmlOneToOne.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/VirtualXmlOneToOne.java index 02f36f8357..46d035426e 100644 --- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/VirtualXmlOneToOne.java +++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/VirtualXmlOneToOne.java @@ -127,4 +127,8 @@ public class VirtualXmlOneToOne extends VirtualXmlAttributeMapping<JavaOneToOneM public TextRange getMappedByTextRange() { return null; } + + public TextRange getTargetEntityTextRange() { + return null; + } } diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/validation/JpaValidationMessages.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/validation/JpaValidationMessages.java index 04436db73f..b2faee9eeb 100644 --- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/validation/JpaValidationMessages.java +++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/validation/JpaValidationMessages.java @@ -58,7 +58,7 @@ public interface JpaValidationMessages { public static final String JOIN_TABLE_UNRESOLVED_SCHEMA = "JOIN_TABLE_UNRESOLVED_SCHEMA"; public static final String VIRTUAL_ATTRIBUTE_JOIN_TABLE_UNRESOLVED_CATALOG = "VIRTUAL_ATTRIBUTE_JOIN_TABLE_UNRESOLVED_CATALOG"; public static final String VIRTUAL_ATTRIBUTE_JOIN_TABLE_UNRESOLVED_SCHEMA = "VIRTUAL_ATTRIBUTE_JOIN_TABLE_UNRESOLVED_SCHEMA"; - public static final String JOIN_TABLE_CANNOT_BE_DETERMINED = "JOIN_TABLE_CANNOT_BE_DETERMINED"; + public static final String JOIN_TABLE_UNRESOLVED_NAME = "JOIN_TABLE_UNRESOLVED_NAME"; public static final String VIRTUAL_ATTRIBUTE_JOIN_TABLE_UNRESOLVED_NAME = "VIRTUAL_ATTRIBUTE_JOIN_TABLE_UNRESOLVED_NAME"; public static final String COLUMN_UNRESOLVED_TABLE = "COLUMN_UNRESOLVED_TABLE"; public static final String VIRTUAL_ATTRIBUTE_COLUMN_UNRESOLVED_TABLE = "VIRTUAL_ATTRIBUTE_COLUMN_UNRESOLVED_TABLE"; @@ -79,4 +79,9 @@ public interface JpaValidationMessages { public static final String PRIMARY_KEY_JOIN_COLUMN_UNRESOLVED_NAME = "PRIMARY_KEY_JOIN_COLUMN_UNRESOLVED_NAME"; public static final String PRIMARY_KEY_JOIN_COLUMN_UNRESOLVED_REFERENCED_COLUMN_NAME = "PRIMARY_KEY_JOIN_COLUMN_UNRESOLVED_REFERENCED_COLUMN_NAME"; public static final String NO_JPA_PROJECT = "NO_JPA_PROJECT"; + public static final String TARGET_ENTITY_NOT_DEFINED = "TARGET_ENTITY_NOT_DEFINED"; + public static final String VIRTUAL_ATTRIBUTE_TARGET_ENTITY_NOT_DEFINED = "VIRTUAL_ATTRIBUTE_TARGET_ENTITY_NOT_DEFINED"; + public static final String TARGET_ENTITY_IS_NOT_AN_ENTITY = "TARGET_ENTITY_IS_NOT_AN_ENTITY"; + public static final String VIRTUAL_ATTRIBUTE_TARGET_ENTITY_IS_NOT_AN_ENTITY = "VIRTUAL_ATTRIBUTE_TARGET_ENTITY_IS_NOT_AN_ENTITY"; + } diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/resource/orm/XmlManyToManyImpl.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/resource/orm/XmlManyToManyImpl.java index 50435a3aca..8e019fe2aa 100644 --- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/resource/orm/XmlManyToManyImpl.java +++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/resource/orm/XmlManyToManyImpl.java @@ -738,6 +738,10 @@ public class XmlManyToManyImpl extends AbstractXmlAttributeMapping implements Xm return getAttributeTextRange(OrmXmlMapper.MAPPED_BY); } + public TextRange getTargetEntityTextRange() { + return getAttributeTextRange(OrmXmlMapper.TARGET_ENTITY); + } + public String getMappingKey() { return MappingKeys.MANY_TO_MANY_ATTRIBUTE_MAPPING_KEY; } diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/resource/orm/XmlManyToOneImpl.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/resource/orm/XmlManyToOneImpl.java index bfe2bde187..3f47b1b913 100644 --- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/resource/orm/XmlManyToOneImpl.java +++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/resource/orm/XmlManyToOneImpl.java @@ -19,6 +19,8 @@ import org.eclipse.emf.ecore.impl.ENotificationImpl; import org.eclipse.emf.ecore.util.EObjectContainmentEList; import org.eclipse.emf.ecore.util.InternalEList; import org.eclipse.jpt.core.MappingKeys; +import org.eclipse.jpt.core.internal.resource.orm.translators.OrmXmlMapper; +import org.eclipse.jpt.core.utility.TextRange; /** * <!-- begin-user-doc --> @@ -631,7 +633,11 @@ public class XmlManyToOneImpl extends AbstractXmlAttributeMapping implements Xml result.append(')'); return result.toString(); } - + + public TextRange getTargetEntityTextRange() { + return getAttributeTextRange(OrmXmlMapper.TARGET_ENTITY); + } + public String getMappingKey() { return MappingKeys.MANY_TO_ONE_ATTRIBUTE_MAPPING_KEY; } diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/resource/orm/XmlOneToManyImpl.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/resource/orm/XmlOneToManyImpl.java index 51632202bc..bd0df02c8f 100644 --- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/resource/orm/XmlOneToManyImpl.java +++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/resource/orm/XmlOneToManyImpl.java @@ -791,6 +791,10 @@ public class XmlOneToManyImpl extends AbstractXmlAttributeMapping implements Xml return getAttributeTextRange(OrmXmlMapper.MAPPED_BY); } + public TextRange getTargetEntityTextRange() { + return getAttributeTextRange(OrmXmlMapper.TARGET_ENTITY); + } + public String getMappingKey() { return MappingKeys.ONE_TO_MANY_ATTRIBUTE_MAPPING_KEY; } diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/resource/orm/XmlOneToOneImpl.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/resource/orm/XmlOneToOneImpl.java index b9ec20c005..627af4b2c8 100644 --- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/resource/orm/XmlOneToOneImpl.java +++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/resource/orm/XmlOneToOneImpl.java @@ -755,6 +755,10 @@ public class XmlOneToOneImpl extends AbstractXmlAttributeMapping implements XmlO return getAttributeTextRange(OrmXmlMapper.MAPPED_BY); } + public TextRange getTargetEntityTextRange() { + return getAttributeTextRange(OrmXmlMapper.TARGET_ENTITY); + } + public String getMappingKey() { return MappingKeys.ONE_TO_ONE_ATTRIBUTE_MAPPING_KEY; } diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/resource/orm/XmlRelationshipMapping.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/resource/orm/XmlRelationshipMapping.java index 78ee50bc0a..b4dabbe9b7 100644 --- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/resource/orm/XmlRelationshipMapping.java +++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/resource/orm/XmlRelationshipMapping.java @@ -9,6 +9,8 @@ ******************************************************************************/ package org.eclipse.jpt.core.resource.orm; +import org.eclipse.jpt.core.utility.TextRange; + /** * <!-- begin-user-doc --> @@ -144,5 +146,10 @@ public interface XmlRelationshipMapping extends XmlAttributeMapping * @generated */ void setJoinTable(XmlJoinTable value); + + /** + * Return the {@link TextRange} for the target-entity attribute. + */ + TextRange getTargetEntityTextRange(); } // RelationshipMapping |