diff options
author | bvosburgh | 2011-04-28 02:00:43 +0000 |
---|---|---|
committer | bvosburgh | 2011-04-28 02:00:43 +0000 |
commit | 91d39dcd91de9ef79763cec17430b395452b73f9 (patch) | |
tree | 8436ff8238739c092ce7d5058f8657a3b505181d /jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context | |
parent | e924740cdaae5f03ac6917e162fd98ad7d3971af (diff) | |
download | webtools.dali-91d39dcd91de9ef79763cec17430b395452b73f9.tar.gz webtools.dali-91d39dcd91de9ef79763cec17430b395452b73f9.tar.xz webtools.dali-91d39dcd91de9ef79763cec17430b395452b73f9.zip |
[336296] fix validation of virtual attribute mappings
Diffstat (limited to 'jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context')
4 files changed, 30 insertions, 15 deletions
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/PersistentType.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/PersistentType.java index a77d422449..56d56f6943 100644 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/PersistentType.java +++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/PersistentType.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2006, 2010 Oracle. All rights reserved. + * Copyright (c) 2006, 2011 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. @@ -13,6 +13,7 @@ import java.util.Iterator; import java.util.List; import java.util.ListIterator; import org.eclipse.jdt.core.IPackageFragment; +import org.eclipse.jpt.common.core.utility.TextRange; import org.eclipse.jpt.jpa.core.JpaStructureNode; import org.eclipse.wst.validation.internal.provisional.core.IMessage; import org.eclipse.wst.validation.internal.provisional.core.IReporter; @@ -159,17 +160,24 @@ public interface PersistentType */ void validate(List<IMessage> messages, IReporter reporter); + /** + * Return the text range to be used with any validation messages related + * to the persistent type. + */ + TextRange getValidationTextRange(); + // ********** misc ********** /** * Return whether the persistent type applies to the - * specified type name qualified with '.'. + * specified type name qualified with <code>'.'</code>. */ boolean isFor(String typeName); /** - * Return true if persistent type resolves to a java class in the given package fragment + * Return whether the persistent type resolves to a Java class in the + * specified package fragment. */ boolean isIn(IPackageFragment packageFragment); @@ -196,7 +204,7 @@ public interface PersistentType { /** * Return the access type that overrides the client persistent type's - * access type; <code>null</code> if there is no such access override + * access type; <code>null</code> if there is no such access override. */ AccessType getOverridePersistentTypeAccess(); diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/java/JavaPersistentAttribute.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/java/JavaPersistentAttribute.java index 27b1653476..68f880167f 100644 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/java/JavaPersistentAttribute.java +++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/java/JavaPersistentAttribute.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2006, 2010 Oracle. All rights reserved. + * Copyright (c) 2006, 2011 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. @@ -31,7 +31,7 @@ import org.eclipse.jpt.jpa.core.resource.java.JavaResourcePersistentAttribute; public interface JavaPersistentAttribute extends PersistentAttribute, JavaJpaContextNode { - // ********** mapping ********** + // ********** covariant overrides ********** JavaAttributeMapping getMapping(); @@ -41,12 +41,13 @@ public interface JavaPersistentAttribute // ********** misc ********** /** - * Return the "resource" persistent attribute. + * Return the corresponding <em>resource</em> persistent attribute. */ JavaResourcePersistentAttribute getResourcePersistentAttribute(); /** - * Return whether the attribute contains the given offset into the text file. + * Return whether the attribute contains the given offset into its Java + * source code file. */ boolean contains(int offset, CompilationUnit astRoot); @@ -67,12 +68,14 @@ public interface JavaPersistentAttribute boolean isProperty(); /** - * Return whether the attribute is 'public', which is problematic for fields. + * Return whether the attribute is <code>public</code>, + * which is problematic for fields. */ boolean isPublic(); /** - * Return whether the attribute is 'final', which is problematic. + * Return whether the attribute is <code>final</code>, + * which is problematic. */ boolean isFinal(); diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/OrmOverrideContainer.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/OrmOverrideContainer.java index fb15a1aadc..6070d36550 100644 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/OrmOverrideContainer.java +++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/OrmOverrideContainer.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2010 Oracle. All rights reserved. + * Copyright (c) 2010, 2011 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. @@ -33,6 +33,9 @@ import org.eclipse.jpt.jpa.core.resource.orm.XmlOverride; public interface OrmOverrideContainer extends OverrideContainer, XmlContextNode { + // we need this covariant override because there is no override *container* + // element in the orm.xml (there is just a list of overrides) + XmlContextNode getParent(); ListIterator<? extends OrmReadOnlyOverride> overrides(); OrmReadOnlyOverride getOverrideNamed(String name); ListIterator<? extends OrmOverride> specifiedOverrides(); diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/OrmPersistentType.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/OrmPersistentType.java index b0b82a3b03..b5b5c6ac12 100644 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/OrmPersistentType.java +++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/OrmPersistentType.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2008, 2010 Oracle. All rights reserved. + * Copyright (c) 2008, 2011 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. @@ -70,8 +70,8 @@ public interface OrmPersistentType // OrmReadOnlyPersistenAttribute.convertToSpecified(String mappingKey) OrmPersistentAttribute addSpecifiedAttribute(String mappingKey, String attributeName); - - // ********** virtual attributes ********** +// TODO bjv rename to 'defaultAttributes' + // ********** default attributes ********** String VIRTUAL_ATTRIBUTES_LIST = "virtualAttributes"; //$NON-NLS-1$ @@ -189,7 +189,8 @@ public interface OrmPersistentType String JAVA_PERSISTENT_TYPE_PROPERTY = "javaPersistentType"; //$NON-NLS-1$ /** - * Return the persistent type's default package. + * Return the persistent type's default package, as set in its entity + * mappings. */ String getDefaultPackage(); } |