Download
Getting Started
Members
Projects
Community
Marketplace
Events
Planet Eclipse
Newsletter
Videos
Participate
Report a Bug
Forums
Mailing Lists
Wiki
IRC
How to Contribute
Working Groups
Automotive
Internet of Things
LocationTech
Long-Term Support
PolarSys
Science
OpenMDM
More
Community
Marketplace
Events
Planet Eclipse
Newsletter
Videos
Participate
Report a Bug
Forums
Mailing Lists
Wiki
IRC
How to Contribute
Working Groups
Automotive
Internet of Things
LocationTech
Long-Term Support
PolarSys
Science
OpenMDM
Toggle navigation
Bugzilla – Attachment 195369 Details for
Bug 336296
[API] Validation for virtual attributes does not currently work
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
Log In
[x]
|
Terms of Use
|
Copyright Agent
[patch]
patch 1a
336296-1.txt (text/plain), 313.71 KB, created by
Brian Vosburgh
on 2011-05-11 11:02:59 EDT
(
hide
)
Description:
patch 1a
Filename:
MIME Type:
Creator:
Brian Vosburgh
Created:
2011-05-11 11:02:59 EDT
Size:
313.71 KB
patch
obsolete
>### Eclipse Workspace Patch 1.0 >#P org.eclipse.jpt.common.utility >Index: src/org/eclipse/jpt/common/utility/internal/iterables/SubIterableWrapper.java >=================================================================== >RCS file: /cvsroot/webtools/org.eclipse.jpa/components/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/iterables/SubIterableWrapper.java,v >retrieving revision 1.1 >diff -u -r1.1 SubIterableWrapper.java >--- src/org/eclipse/jpt/common/utility/internal/iterables/SubIterableWrapper.java 5 Feb 2011 16:22:00 -0000 1.1 >+++ src/org/eclipse/jpt/common/utility/internal/iterables/SubIterableWrapper.java 11 May 2011 14:49:36 -0000 >@@ -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. >@@ -24,7 +24,7 @@ > * > * @see org.eclipse.jpt.common.utility.internal.iterators.SubIteratorWrapper > */ >-public class SubIterableWrapper<E1, E2> >+public class SubIterableWrapper<E1, E2 extends E1> > implements Iterable<E2> > { > private final Iterable<E1> iterable; >@@ -43,5 +43,4 @@ > public String toString() { > return StringTools.buildToStringFor(this, this.iterable); > } >- > } >Index: src/org/eclipse/jpt/common/utility/internal/iterators/SubIteratorWrapper.java >=================================================================== >RCS file: /cvsroot/webtools/org.eclipse.jpa/components/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/iterators/SubIteratorWrapper.java,v >retrieving revision 1.1 >diff -u -r1.1 SubIteratorWrapper.java >--- src/org/eclipse/jpt/common/utility/internal/iterators/SubIteratorWrapper.java 5 Feb 2011 16:22:01 -0000 1.1 >+++ src/org/eclipse/jpt/common/utility/internal/iterators/SubIteratorWrapper.java 11 May 2011 14:49:36 -0000 >@@ -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. >@@ -23,7 +23,7 @@ > * > * @see org.eclipse.jpt.common.utility.internal.iterables.SubIterableWrapper > */ >-public class SubIteratorWrapper<E1, E2> >+public class SubIteratorWrapper<E1, E2 extends E1> > implements Iterator<E2> > { > private final Iterator<E1> iterator; >@@ -55,5 +55,4 @@ > public String toString() { > return StringTools.buildToStringFor(this, this.iterator); > } >- > } >Index: src/org/eclipse/jpt/common/utility/internal/model/value/TransformationListValueModel.java >=================================================================== >RCS file: /cvsroot/webtools/org.eclipse.jpa/components/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/model/value/TransformationListValueModel.java,v >retrieving revision 1.1 >diff -u -r1.1 TransformationListValueModel.java >--- src/org/eclipse/jpt/common/utility/internal/model/value/TransformationListValueModel.java 5 Feb 2011 16:22:01 -0000 1.1 >+++ src/org/eclipse/jpt/common/utility/internal/model/value/TransformationListValueModel.java 11 May 2011 14:49:36 -0000 >@@ -39,8 +39,8 @@ > * As an alternative to building a {@link Transformer}, > * a subclass of <code>TransformationListValueModelAdapter</code> can > * either override {@link #transformItem_(Object)} or, >- * if something other than null should be returned when the wrapped item >- * is null, override {@link #transformItem(Object)}. >+ * if something other than <code>null</code> should be returned when the >+ * wrapped item is <code>null</code>, override {@link #transformItem(Object)}. > * <p> > * <strong>NB:</strong> Since we only listen to the wrapped list when we have > * listeners ourselves and we can only stay in synch with the wrapped >#P org.eclipse.jpt.jpa.core >Index: src/org/eclipse/jpt/jpa/core/context/Generator.java >=================================================================== >RCS file: /cvsroot/webtools/org.eclipse.jpa/components/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/Generator.java,v >retrieving revision 1.1 >diff -u -r1.1 Generator.java >--- src/org/eclipse/jpt/jpa/core/context/Generator.java 6 Feb 2011 02:07:17 -0000 1.1 >+++ src/org/eclipse/jpt/jpa/core/context/Generator.java 11 May 2011 14:49:38 -0000 >@@ -1,5 +1,5 @@ > /******************************************************************************* >- * Copyright (c) 2007, 2010 Oracle. All rights reserved. >+ * Copyright (c) 2007, 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,8 +33,7 @@ > extends JpaNamedContextNode<Generator> > { > /** >- * TODO use this precedence until adopters protest... >- * then move to JpaPlatform >+ * TODO bjv remove! > */ > @SuppressWarnings("unchecked") > Iterable<Class<? extends Generator>> PRECEDENCE_TYPE_LIST = Arrays.asList( >Index: src/org/eclipse/jpt/jpa/core/context/JpaNamedContextNode.java >=================================================================== >RCS file: /cvsroot/webtools/org.eclipse.jpa/components/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/JpaNamedContextNode.java,v >retrieving revision 1.1 >diff -u -r1.1 JpaNamedContextNode.java >--- src/org/eclipse/jpt/jpa/core/context/JpaNamedContextNode.java 6 Feb 2011 02:07:17 -0000 1.1 >+++ src/org/eclipse/jpt/jpa/core/context/JpaNamedContextNode.java 11 May 2011 14:49:38 -0000 >@@ -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. >@@ -12,7 +12,7 @@ > /** > * Named context node that may have collisions with or override other nodes > * with the same name defined elsewhere in the persistence unit >- * (e.g. sequence generators). >+ * (e.g. sequence/table generators, named/named native queries). > * <p> > * Provisional API: This interface is part of an interim API that is still > * under development and expected to change significantly before reaching >@@ -31,12 +31,13 @@ > > > // ********** validation ********** >- >+// TODO bjv - get rid of these methods - validation is done in the persistence unit instead >+// of in a distributed fashion... > /** > * Return whether the node "overrides" the specified node > * within the nodes' persistence unit. > * (e.g. a query defined in <code>orm.xml</code> >- * "overrides" one defined in a Java annotation). >+ * "overrides" one with the same name defined in a Java annotation). > * > * @see #duplicates(Object) > */ >@@ -44,9 +45,11 @@ > > /** > * Return whether the node is a "duplicate" of the specified node. >- * Two nodes are duplicates if they both have the same, >- * non-null name and neither node "overrides" the other. >- * >+ * Two nodes are duplicates if<ul> >+ * <li>they both have the same, non-empty name >+ * <li>neither node "overrides" the other >+ * <li>they both are in the same persistence unit >+ * </ul> > * @see #overrides(Object) > */ > boolean duplicates(T other); >Index: src/org/eclipse/jpt/jpa/core/context/MappingFile.java >=================================================================== >RCS file: /cvsroot/webtools/org.eclipse.jpa/components/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/MappingFile.java,v >retrieving revision 1.1 >diff -u -r1.1 MappingFile.java >--- src/org/eclipse/jpt/jpa/core/context/MappingFile.java 6 Feb 2011 02:07:17 -0000 1.1 >+++ src/org/eclipse/jpt/jpa/core/context/MappingFile.java 11 May 2011 14:49:38 -0000 >@@ -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. >@@ -44,12 +44,6 @@ > MappingFileRoot getRoot(); > > /** >- * Return the specified persistent type if it is listed in the mapping file; >- * otherwise return null. >- */ >- PersistentType getPersistentType(String name); >- >- /** > * Return true if this mapping file exists in the given folder > */ > boolean isIn(IFolder folder); >Index: src/org/eclipse/jpt/jpa/core/context/MappingFileRoot.java >=================================================================== >RCS file: /cvsroot/webtools/org.eclipse.jpa/components/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/MappingFileRoot.java,v >retrieving revision 1.1 >diff -u -r1.1 MappingFileRoot.java >--- src/org/eclipse/jpt/jpa/core/context/MappingFileRoot.java 6 Feb 2011 02:07:17 -0000 1.1 >+++ src/org/eclipse/jpt/jpa/core/context/MappingFileRoot.java 11 May 2011 14:49:38 -0000 >@@ -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. >@@ -10,6 +10,7 @@ > package org.eclipse.jpt.jpa.core.context; > > import org.eclipse.jpt.jpa.core.JpaStructureNode; >+import org.eclipse.jpt.jpa.core.context.persistence.PersistentTypeContainer; > > /** > * The root of a JPA mapping file. >@@ -24,7 +25,7 @@ > * @since 2.1 > */ > public interface MappingFileRoot >- extends XmlContextNode, JpaStructureNode >+ extends XmlContextNode, JpaStructureNode, PersistentTypeContainer > { > /** > * covariant override >Index: src/org/eclipse/jpt/jpa/core/context/java/JarFile.java >=================================================================== >RCS file: /cvsroot/webtools/org.eclipse.jpa/components/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/java/JarFile.java,v >retrieving revision 1.1 >diff -u -r1.1 JarFile.java >--- src/org/eclipse/jpt/jpa/core/context/java/JarFile.java 6 Feb 2011 02:07:14 -0000 1.1 >+++ src/org/eclipse/jpt/jpa/core/context/java/JarFile.java 11 May 2011 14:49:38 -0000 >@@ -1,5 +1,5 @@ > /******************************************************************************* >- * Copyright (c) 2009, 2010 Oracle. All rights reserved. >+ * Copyright (c) 2009, 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. >@@ -11,11 +11,9 @@ > > import java.util.Iterator; > import java.util.List; >- > import org.eclipse.core.resources.IFolder; > import org.eclipse.jpt.jpa.core.JpaStructureNode; > import org.eclipse.jpt.jpa.core.context.JpaContextNode; >-import org.eclipse.jpt.jpa.core.context.PersistentType; > import org.eclipse.jpt.jpa.core.context.persistence.PersistentTypeContainer; > import org.eclipse.jpt.jpa.core.resource.java.JavaResourcePackageFragmentRoot; > import org.eclipse.wst.validation.internal.provisional.core.IMessage; >@@ -55,12 +53,6 @@ > */ > int javaPersistentTypesSize(); > >- /** >- * Return the persistent type with the specified name. >- * Return null if the persistent type is not found. >- */ >- PersistentType getPersistentType(String typeName); >- > > // ********** validation ********** > >Index: src/org/eclipse/jpt/jpa/core/context/orm/EntityMappings.java >=================================================================== >RCS file: /cvsroot/webtools/org.eclipse.jpa/components/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/EntityMappings.java,v >retrieving revision 1.1 >diff -u -r1.1 EntityMappings.java >--- src/org/eclipse/jpt/jpa/core/context/orm/EntityMappings.java 6 Feb 2011 02:07:21 -0000 1.1 >+++ src/org/eclipse/jpt/jpa/core/context/orm/EntityMappings.java 11 May 2011 14:49:38 -0000 >@@ -1,5 +1,5 @@ > /******************************************************************************* >- * Copyright (c) 2007, 2010 Oracle. All rights reserved. >+ * Copyright (c) 2007, 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. >@@ -15,7 +15,6 @@ > import org.eclipse.jpt.jpa.core.context.AccessType; > import org.eclipse.jpt.jpa.core.context.MappingFileRoot; > import org.eclipse.jpt.jpa.core.context.PersistentType; >-import org.eclipse.jpt.jpa.core.context.persistence.PersistentTypeContainer; > import org.eclipse.jpt.jpa.core.resource.java.JavaResourcePersistentType; > import org.eclipse.jpt.jpa.core.resource.orm.XmlEntityMappings; > import org.eclipse.jpt.jpa.db.Catalog; >@@ -40,7 +39,7 @@ > * @since 2.0 > */ > public interface EntityMappings >- extends MappingFileRoot, PersistentType.Owner, PersistentTypeContainer >+ extends MappingFileRoot, PersistentType.Owner > { > /** > * Covariant override. >@@ -107,17 +106,13 @@ > * Covariant override. > */ > ListIterable<OrmPersistentType> getPersistentTypes(); >+ OrmPersistentType getPersistentType(String className); > int getPersistentTypesSize(); > OrmPersistentType addPersistentType(String mappingKey, String className); > void removePersistentType(int index); > void removePersistentType(OrmPersistentType persistentType); > //void movePersistentType(int targetIndex, int sourceIndex); > boolean containsPersistentType(String className); >- /** >- * Return the persistent type listed in the mapping file >- * with the specified type name. Return null if none exists. >- */ >- OrmPersistentType getPersistentType(String className); > String PERSISTENT_TYPES_LIST = "persistentTypes"; //$NON-NLS-1$ > > ListIterable<OrmSequenceGenerator> getSequenceGenerators(); >Index: src/org/eclipse/jpt/jpa/core/context/persistence/JarFileRef.java >=================================================================== >RCS file: /cvsroot/webtools/org.eclipse.jpa/components/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/persistence/JarFileRef.java,v >retrieving revision 1.1 >diff -u -r1.1 JarFileRef.java >--- src/org/eclipse/jpt/jpa/core/context/persistence/JarFileRef.java 6 Feb 2011 02:07:27 -0000 1.1 >+++ src/org/eclipse/jpt/jpa/core/context/persistence/JarFileRef.java 11 May 2011 14:49:38 -0000 >@@ -1,5 +1,5 @@ > /******************************************************************************* >- * Copyright (c) 2009, 2010 Oracle. All rights reserved. >+ * Copyright (c) 2009, 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. >@@ -11,7 +11,6 @@ > > import org.eclipse.core.resources.IFolder; > import org.eclipse.jpt.jpa.core.JpaStructureNode; >-import org.eclipse.jpt.jpa.core.context.PersistentType; > import org.eclipse.jpt.jpa.core.context.XmlContextNode; > import org.eclipse.jpt.jpa.core.context.java.JarFile; > import org.eclipse.jpt.jpa.core.resource.persistence.XmlJarFileRef; >@@ -75,17 +74,11 @@ > Iterable<ReplaceEdit> createReplaceFolderEdits(IFolder originalFolder, String newName); > > >- // ********** queries ********** >+ // ********** misc ********** > > XmlJarFileRef getXmlJarFileRef(); > > /** >- * Return the persistent type, as listed in the JAR file, >- * with the specified name. Return null if it does not exists. >- */ >- PersistentType getPersistentType(String typeName); >- >- /** > * Return whether the text representation of the JAR file ref contains > * the specified text offset. > */ >Index: src/org/eclipse/jpt/jpa/core/context/persistence/MappingFileRef.java >=================================================================== >RCS file: /cvsroot/webtools/org.eclipse.jpa/components/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/persistence/MappingFileRef.java,v >retrieving revision 1.1 >diff -u -r1.1 MappingFileRef.java >--- src/org/eclipse/jpt/jpa/core/context/persistence/MappingFileRef.java 6 Feb 2011 02:07:27 -0000 1.1 >+++ src/org/eclipse/jpt/jpa/core/context/persistence/MappingFileRef.java 11 May 2011 14:49:38 -0000 >@@ -1,5 +1,5 @@ > /******************************************************************************* >- * Copyright (c) 2007, 2010 Oracle. All rights reserved. >+ * Copyright (c) 2007, 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. >@@ -17,7 +17,6 @@ > import org.eclipse.jpt.jpa.core.JpaStructureNode; > import org.eclipse.jpt.jpa.core.context.MappingFile; > import org.eclipse.jpt.jpa.core.context.MappingFilePersistenceUnitMetadata; >-import org.eclipse.jpt.jpa.core.context.PersistentType; > import org.eclipse.jpt.jpa.core.context.XmlContextNode; > import org.eclipse.jpt.jpa.core.resource.persistence.XmlMappingFileRef; > import org.eclipse.text.edits.DeleteEdit; >@@ -79,6 +78,7 @@ > > /** > * Return mapping file corresponding to the mapping file ref's file name. >+ * This can be <code>null</code> if the file name is invalid. > */ > MappingFile getMappingFile(); > >@@ -110,12 +110,6 @@ > boolean isImplied(); > > /** >- * Return the persistent type, as listed in the mapping file, >- * with the specified name. Return null if it does not exists. >- */ >- PersistentType getPersistentType(String typeName); >- >- /** > * Return whether the specified text offset is within > * the text representation of the mapping file. > */ >Index: src/org/eclipse/jpt/jpa/core/context/persistence/PersistenceUnit.java >=================================================================== >RCS file: /cvsroot/webtools/org.eclipse.jpa/components/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/persistence/PersistenceUnit.java,v >retrieving revision 1.2 >diff -u -r1.2 PersistenceUnit.java >--- src/org/eclipse/jpt/jpa/core/context/persistence/PersistenceUnit.java 3 Mar 2011 00:01:17 -0000 1.2 >+++ src/org/eclipse/jpt/jpa/core/context/persistence/PersistenceUnit.java 11 May 2011 14:49:38 -0000 >@@ -13,7 +13,6 @@ > import java.util.ListIterator; > import java.util.Map; > import java.util.Set; >- > import org.eclipse.core.resources.IFile; > import org.eclipse.core.resources.IFolder; > import org.eclipse.core.runtime.IPath; >@@ -24,7 +23,6 @@ > import org.eclipse.jpt.jpa.core.context.Embeddable; > import org.eclipse.jpt.jpa.core.context.Entity; > import org.eclipse.jpt.jpa.core.context.Generator; >-import org.eclipse.jpt.jpa.core.context.PersistentType; > import org.eclipse.jpt.jpa.core.context.Query; > import org.eclipse.jpt.jpa.core.context.XmlContextNode; > import org.eclipse.jpt.jpa.core.resource.persistence.XmlPersistenceUnit; >@@ -613,36 +611,44 @@ > /** > * String constant associated with changes to the persistence unit's > * collection of "global" generators. >- * NB: There are no granular collection change notifications; >- * only a "collection changed" notification when the collection >- * is rebuilt at the finish of the persistence unit's "update". > */ > String GENERATORS_COLLECTION = "generators"; //$NON-NLS-1$ > > /** >- * Return the generators defined within the persistence unit's scope, >- * including generators with duplicate names. >+ * Return the "active" generators defined within the persistence unit's scope, >+ * including generators with duplicate names. "Active" generators are:<ul> >+ * <li>any generator defined in mapping files >+ * <li>any generator defined via Java annotations that is not "overridden" >+ * by a mapping file generator with the same name >+ * </ul> >+ * <strong>NB:</strong> A Java generator defined on a class or attribute >+ * that is overridden in a mapping file is <em>not</em>, as a result, >+ * itself overridden. A Java generator can only be overridden by a mapping >+ * file generator with the same name. >+ * <p> >+ * <strong>NB:</strong> A Java generator defined on a class or attribute >+ * whose corresponding mapping file mapping (or mapping file) is marked >+ * "metadata complete" is ignored. > */ >+ // TODO bjv change to getGeneratorNames() etc. > Iterator<Generator> generators(); > > /** >- * Return the size of the list of generators defined within the persistence unit's scope, >- * including generators with duplicate names. >+ * Return the number of "active" generators defined within the persistence >+ * unit's scope. >+ * @see #generators() > */ > int generatorsSize(); > > /** > * Add the specified generator (that is defined elsewhere) to the > * list of generators defined within the persistence unit's scope. >- * NB: This is to be called by every generator during "update". >- * This method does not directly generate a change notification. >- * The change notification is fired at the end of the persistence unit's >- * "update", once all the generators have added themselves. > */ >+ // TODO bjv remove > void addGenerator(Generator generator); > > /** >- * Return the names of the generators defined in the persistence >+ * Return the names of the "active" generators defined in the persistence > * unit's scope, with duplicates removed. > */ > Iterable<String> getUniqueGeneratorNames(); >@@ -653,31 +659,28 @@ > /** > * String constant associated with changes to the persistence unit's > * collection of "global" queries. >- * NB: There are no granular collection change notifications; >- * only a "collection changed" notification when the collection is >- * rebuilt at the finish of the persistence unit's "update". > */ > String QUERIES_COLLECTION = "queries"; //$NON-NLS-1$ > > /** >- * Return the queries defined within the persistence unit's scope, >- * including queries with duplicate names. >+ * Return the "active" queries defined within the persistence unit's scope, >+ * including queries with duplicate names. These are very similar to >+ * generators. >+ * @see #generators() > */ >+ // TODO bjv change to getQueryNames() etc. > Iterator<Query> queries(); > > /** >- * Return the number of queries defined within the persistence unit's scope, >- * including queries with duplicate names. >+ * Return the number of "active" queries defined within the persistence >+ * unit's scope. >+ * @see #queries() > */ > int queriesSize(); > > /** > * Add the specified query (that is defined elsewhere) to the > * list of queries defined within the persistence unit's scope. >- * NB: This is to be called by every query during "update". >- * This method does not directly generate a change notification. >- * The change notification is fired at the end of the persistence unit's >- * "update", once all the queries have added themselves. > */ > void addQuery(Query query); > >@@ -691,12 +694,6 @@ > XmlPersistenceUnit getXmlPersistenceUnit(); > > /** >- * Return the persistent type specified in the persistence unit with the >- * specified name. >- */ >- PersistentType getPersistentType(String typeName); >- >- /** > * Return whether the persistence unit specifies a persistent type with the > * specified name (i.e. the type is listed either in the persistence unit's > * list of specified classes or in one of the persistent unit's mapping files). >@@ -736,41 +733,51 @@ > * Return a map with entity names as the key and class names as the value. > * Duplicate class names are eliminated. > */ >+ // TODO bjv > Map<String, Set<String>> mapEntityNameToClassNames(); > > /** > * Return the class names of all the mapped orm classes cross the persistent unit > */ >+ // TODO bjv probably should re-work, but also should use "mapping file" instead of >+ // "orm"... > Iterable<String> getOrmMappedClassNames(); > > /** > * Return all the entities defined in both the implied and specified mapping files > * of a persistence unit > */ >+ // TODO bjv probably should re-work, but also should use "mapping file" instead of >+ // "orm"... > Iterable<Entity> getOrmEntities(); > > /** > * Return the entity names of all the entities defined in both the implied and specified mapping files > * of a persistence unit > */ >+ // TODO bjv probably should re-work, but also should use "mapping file" instead of >+ // "orm"... > Iterator<String> ormEntityNames(); > > /** > * Return all the entities defined with both the implied and specified Java classes > * of a persistence unit > */ >+ // TODO bjv remove > Iterable<Entity> getJavaEntities(); > > /** > * Return the entity names of all the entities defined with both the implied and specified Java classes > * of a persistence unit > */ >+ // TODO bjv remove > Iterator<String> javaEntityNames(); > > /** > * Return the entity names of entities only defined with mapped Java classes of a persistence unit. > * The names of Java entities overridden by entities defined in the mapping files are excluded. > */ >+ // TODO bjv > Iterator<String> javaEntityNamesExclOverridden(); > > >@@ -848,5 +855,4 @@ > * sure the location does not violate the persistence.xml schema. > */ > int findInsertLocationForMappingFileRef(); >- > } >Index: src/org/eclipse/jpt/jpa/core/context/persistence/PersistentTypeContainer.java >=================================================================== >RCS file: /cvsroot/webtools/org.eclipse.jpa/components/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/persistence/PersistentTypeContainer.java,v >retrieving revision 1.1 >diff -u -r1.1 PersistentTypeContainer.java >--- src/org/eclipse/jpt/jpa/core/context/persistence/PersistentTypeContainer.java 6 Feb 2011 02:07:27 -0000 1.1 >+++ src/org/eclipse/jpt/jpa/core/context/persistence/PersistentTypeContainer.java 11 May 2011 14:49:38 -0000 >@@ -1,5 +1,5 @@ > /******************************************************************************* >- * Copyright (c) 2009, 2010 Oracle. All rights reserved. >+ * Copyright (c) 2009, 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. >@@ -27,10 +27,32 @@ > public interface PersistentTypeContainer { > > /** >- * Return the container's persistent types. >+ * Return the container's persistent types. The returned list may contain >+ * multiple persistent types for the same Java class; e.g.<ul> >+ * <li>the same type is specified in both the <code>persistence.xml</code> and >+ * <code>orm.xml</code> files >+ * <Li>the same type is specified multiple times in the same >+ * <code>persistence.xml</code> or <code>orm.xml</code> file >+ * <li>the same type is in a jar file specified in the >+ * <code>persistence.xml</code> file and is specified in the >+ * <code>persistence.xml</code> file and/or an <code>orm.xml</code> file >+ * </ul> > */ > Iterable<? extends PersistentType> getPersistentTypes(); > >+ /** >+ * Return the persistent type with the specified name. >+ * Return <code>null</code> if the persistent type is not found. >+ * If the persistent unit has more than one persistent type with the >+ * specified name, return the first one found, using the following >+ * search order:<ul> >+ * <li>mapping files >+ * <li>classes >+ * <li>jar files >+ * </ul> >+ */ >+ PersistentType getPersistentType(String typeName); >+ > > Transformer<PersistentTypeContainer, Iterable<? extends PersistentType>> TRANSFORMER = > new Transformer<PersistentTypeContainer, Iterable<? extends PersistentType>>() { >Index: src/org/eclipse/jpt/jpa/core/internal/context/MappingTools.java >=================================================================== >RCS file: /cvsroot/webtools/org.eclipse.jpa/components/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/MappingTools.java,v >retrieving revision 1.2 >diff -u -r1.2 MappingTools.java >--- src/org/eclipse/jpt/jpa/core/internal/context/MappingTools.java 1 Apr 2011 22:20:49 -0000 1.2 >+++ src/org/eclipse/jpt/jpa/core/internal/context/MappingTools.java 11 May 2011 14:49:38 -0000 >@@ -323,25 +323,34 @@ > * @see JpaNamedContextNode#duplicates(Object) > */ > public static <T extends JpaNamedContextNode<? super T>> boolean nodesAreDuplicates(T node1, T node2) { >- return (node1 != node2) && >- ! StringTools.stringIsEmpty(node1.getName()) && >- node1.getName().equals(node2.getName()) && >+ return nodesArePotentalDuplicates_(node1, node2) && > ! node1.overrides(node2) && > ! node2.overrides(node1); > } > > /** >+ * Return whether the specified nodes<ul> >+ * <li>are <em>not</em> the same node >+ * <li>have the same non-empty name >+ * <li>are in the same persistence unit >+ * </ul> >+ */ >+ private static <T extends JpaNamedContextNode<? super T>> boolean nodesArePotentalDuplicates_(T node1, T node2) { >+ return (node1 != node2) && >+ StringTools.stringIsNotEmpty(node1.getName()) && >+ node1.getName().equals(node2.getName()) && >+ (node1.getPersistenceUnit() == node2.getPersistenceUnit()); >+ } >+ >+ /** > * Return whether the first specified node "overrides" the second, > * based on the "precedence" of their classes. > * @see JpaNamedContextNode#overrides(Object) > */ > public static <T extends JpaNamedContextNode<? super T>> boolean nodeOverrides(T node1, T node2, Iterable<Class<? extends T>> precedenceTypeList) { > // this isn't ideal, but use it until adopters protest... >- return (node1.getName() != null) && >- (node2.getName() != null) && >- node1.getName().equals(node2.getName()) && >- (node1.getPersistenceUnit() == node2.getPersistenceUnit()) && >- (calculatePrecedence(node1, precedenceTypeList) < calculatePrecedence(node2, precedenceTypeList)); >+ return nodesArePotentalDuplicates_(node1, node2) && >+ calculatePrecedence(node1, precedenceTypeList) < calculatePrecedence(node2, precedenceTypeList); > } > > /** >Index: src/org/eclipse/jpt/jpa/core/internal/context/java/AbstractJavaBaseEmbeddedMapping.java >=================================================================== >RCS file: /cvsroot/webtools/org.eclipse.jpa/components/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/AbstractJavaBaseEmbeddedMapping.java,v >retrieving revision 1.1 >diff -u -r1.1 AbstractJavaBaseEmbeddedMapping.java >--- src/org/eclipse/jpt/jpa/core/internal/context/java/AbstractJavaBaseEmbeddedMapping.java 6 Feb 2011 02:07:12 -0000 1.1 >+++ src/org/eclipse/jpt/jpa/core/internal/context/java/AbstractJavaBaseEmbeddedMapping.java 11 May 2011 14:49:38 -0000 >@@ -1,5 +1,5 @@ > /******************************************************************************* >- * Copyright (c) 2007, 2010 Oracle. All rights reserved. >+ * Copyright (c) 2007, 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. >@@ -309,11 +309,15 @@ > } > > public JptValidator buildValidator(Override_ override, OverrideContainer container, OverrideTextRangeResolver textRangeResolver) { >- return new AttributeOverrideValidator((AttributeOverride) override, (AttributeOverrideContainer) container, textRangeResolver, new EmbeddableOverrideDescriptionProvider()); >+ return new AttributeOverrideValidator(this.getPersistentAttribute(), (AttributeOverride) override, (AttributeOverrideContainer) container, textRangeResolver, new EmbeddableOverrideDescriptionProvider()); > } > > public JptValidator buildColumnValidator(Override_ override, BaseColumn column, BaseColumn.Owner owner, BaseColumnTextRangeResolver textRangeResolver) { >- return new AttributeOverrideColumnValidator((AttributeOverride) override, column, textRangeResolver, new EntityTableDescriptionProvider()); >+ return new AttributeOverrideColumnValidator(this.getPersistentAttribute(), (AttributeOverride) override, column, textRangeResolver, new EntityTableDescriptionProvider()); >+ } >+ >+ protected JavaPersistentAttribute getPersistentAttribute() { >+ return AbstractJavaBaseEmbeddedMapping.this.getPersistentAttribute(); > } > } > } >Index: src/org/eclipse/jpt/jpa/core/internal/context/java/AbstractJavaBasicMapping.java >=================================================================== >RCS file: /cvsroot/webtools/org.eclipse.jpa/components/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/AbstractJavaBasicMapping.java,v >retrieving revision 1.1 >diff -u -r1.1 AbstractJavaBasicMapping.java >--- src/org/eclipse/jpt/jpa/core/internal/context/java/AbstractJavaBasicMapping.java 6 Feb 2011 02:07:12 -0000 1.1 >+++ src/org/eclipse/jpt/jpa/core/internal/context/java/AbstractJavaBasicMapping.java 11 May 2011 14:49:38 -0000 >@@ -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. >@@ -347,8 +347,8 @@ > return this.getTypeMapping().allAssociatedTableNames(); > } > >- public JptValidator buildColumnValidator(NamedColumn column, NamedColumnTextRangeResolver textRangeResolver) { >- return new NamedColumnValidator((BaseColumn) column, (BaseColumnTextRangeResolver) textRangeResolver, new EntityTableDescriptionProvider()); >+ public JptValidator buildColumnValidator(NamedColumn col, NamedColumnTextRangeResolver textRangeResolver) { >+ return new NamedColumnValidator(this.getPersistentAttribute(), (BaseColumn) col, (BaseColumnTextRangeResolver) textRangeResolver, new EntityTableDescriptionProvider()); > } > > >Index: src/org/eclipse/jpt/jpa/core/internal/context/java/AbstractJavaEntity.java >=================================================================== >RCS file: /cvsroot/webtools/org.eclipse.jpa/components/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/AbstractJavaEntity.java,v >retrieving revision 1.6 >diff -u -r1.6 AbstractJavaEntity.java >--- src/org/eclipse/jpt/jpa/core/internal/context/java/AbstractJavaEntity.java 28 Apr 2011 02:00:43 -0000 1.6 >+++ src/org/eclipse/jpt/jpa/core/internal/context/java/AbstractJavaEntity.java 11 May 2011 14:49:38 -0000 >@@ -14,7 +14,6 @@ > import java.util.List; > import java.util.ListIterator; > import java.util.Vector; >- > import org.eclipse.jdt.core.dom.CompilationUnit; > import org.eclipse.jpt.common.core.utility.TextRange; > import org.eclipse.jpt.common.utility.Filter; >@@ -34,6 +33,8 @@ > import org.eclipse.jpt.common.utility.internal.iterators.CompositeIterator; > import org.eclipse.jpt.common.utility.internal.iterators.EmptyIterator; > import org.eclipse.jpt.common.utility.internal.iterators.FilteringIterator; >+import org.eclipse.jpt.common.utility.internal.iterators.SubIteratorWrapper; >+import org.eclipse.jpt.common.utility.internal.iterators.SuperIteratorWrapper; > import org.eclipse.jpt.common.utility.internal.iterators.TransformationIterator; > import org.eclipse.jpt.jpa.core.JpaPlatformVariation.Supported; > import org.eclipse.jpt.jpa.core.MappingKeys; >@@ -115,6 +116,8 @@ > import org.eclipse.jpt.jpa.core.resource.java.JavaResourcePersistentMember; > import org.eclipse.jpt.jpa.core.resource.java.JavaResourcePersistentType; > import org.eclipse.jpt.jpa.core.resource.java.NestableAnnotation; >+import org.eclipse.jpt.jpa.core.resource.java.NestablePrimaryKeyJoinColumnAnnotation; >+import org.eclipse.jpt.jpa.core.resource.java.NestableSecondaryTableAnnotation; > import org.eclipse.jpt.jpa.core.resource.java.PrimaryKeyJoinColumnAnnotation; > import org.eclipse.jpt.jpa.core.resource.java.PrimaryKeyJoinColumnsAnnotation; > import org.eclipse.jpt.jpa.core.resource.java.SecondaryTableAnnotation; >@@ -508,12 +511,18 @@ > } > > protected Iterable<SecondaryTableAnnotation> getSecondaryTableAnnotations() { >- return new SubIterableWrapper<NestableAnnotation, SecondaryTableAnnotation>( >- CollectionTools.iterable(this.secondaryTableAnnotations()) >- ); >+ return CollectionTools.iterable(this.secondaryTableAnnotations()); >+ } >+ >+ protected Iterator<SecondaryTableAnnotation> secondaryTableAnnotations() { >+ return new SuperIteratorWrapper<SecondaryTableAnnotation>(this.nestableSecondaryTableAnnotations()); >+ } >+ >+ protected Iterator<NestableSecondaryTableAnnotation> nestableSecondaryTableAnnotations() { >+ return new SubIteratorWrapper<NestableAnnotation, NestableSecondaryTableAnnotation>(this.nestableSecondaryTableAnnotations_()); > } > >- protected Iterator<NestableAnnotation> secondaryTableAnnotations() { >+ protected Iterator<NestableAnnotation> nestableSecondaryTableAnnotations_() { > return this.getResourceAnnotatedElement().annotations(SecondaryTableAnnotation.ANNOTATION_NAME, SecondaryTablesAnnotation.ANNOTATION_NAME); > } > >@@ -645,12 +654,18 @@ > } > > protected Iterable<PrimaryKeyJoinColumnAnnotation> getPrimaryKeyJoinColumnAnnotations() { >- return new SubIterableWrapper<NestableAnnotation, PrimaryKeyJoinColumnAnnotation>( >- CollectionTools.iterable(this.primaryKeyJoinColumnAnnotations()) >- ); >+ return CollectionTools.iterable(this.primaryKeyJoinColumnAnnotations()); >+ } >+ >+ protected Iterator<PrimaryKeyJoinColumnAnnotation> primaryKeyJoinColumnAnnotations() { >+ return new SuperIteratorWrapper<PrimaryKeyJoinColumnAnnotation>(this.nestablePrimaryKeyJoinColumnAnnotations()); >+ } >+ >+ protected Iterator<NestablePrimaryKeyJoinColumnAnnotation> nestablePrimaryKeyJoinColumnAnnotations() { >+ return new SubIteratorWrapper<NestableAnnotation, NestablePrimaryKeyJoinColumnAnnotation>(this.nestablePrimaryKeyJoinColumnAnnotations_()); > } > >- protected Iterator<NestableAnnotation> primaryKeyJoinColumnAnnotations() { >+ protected Iterator<NestableAnnotation> nestablePrimaryKeyJoinColumnAnnotations_() { > return this.getResourceAnnotatedElement().annotations(PrimaryKeyJoinColumnAnnotation.ANNOTATION_NAME, PrimaryKeyJoinColumnsAnnotation.ANNOTATION_NAME); > } > >Index: src/org/eclipse/jpt/jpa/core/internal/context/java/AbstractJavaGenerator.java >=================================================================== >RCS file: /cvsroot/webtools/org.eclipse.jpa/components/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/AbstractJavaGenerator.java,v >retrieving revision 1.2 >diff -u -r1.2 AbstractJavaGenerator.java >--- src/org/eclipse/jpt/jpa/core/internal/context/java/AbstractJavaGenerator.java 28 Apr 2011 02:00:42 -0000 1.2 >+++ src/org/eclipse/jpt/jpa/core/internal/context/java/AbstractJavaGenerator.java 11 May 2011 14:49:38 -0000 >@@ -9,16 +9,22 @@ > ******************************************************************************/ > package org.eclipse.jpt.jpa.core.internal.context.java; > >+import java.util.List; > import org.eclipse.jdt.core.dom.CompilationUnit; > import org.eclipse.jpt.common.core.utility.TextRange; >+import org.eclipse.jpt.common.utility.internal.StringTools; > import org.eclipse.jpt.jpa.core.context.Generator; > import org.eclipse.jpt.jpa.core.context.java.JavaGenerator; > import org.eclipse.jpt.jpa.core.context.java.JavaJpaContextNode; > import org.eclipse.jpt.jpa.core.internal.context.MappingTools; >+import org.eclipse.jpt.jpa.core.internal.validation.DefaultJpaValidationMessages; >+import org.eclipse.jpt.jpa.core.internal.validation.JpaValidationMessages; > import org.eclipse.jpt.jpa.core.resource.java.GeneratorAnnotation; > import org.eclipse.jpt.jpa.db.Catalog; > import org.eclipse.jpt.jpa.db.Schema; > import org.eclipse.jpt.jpa.db.SchemaContainer; >+import org.eclipse.wst.validation.internal.provisional.core.IMessage; >+import org.eclipse.wst.validation.internal.provisional.core.IReporter; > > /** > * Java sequence or table generator >@@ -62,7 +68,6 @@ > super.update(); > this.setDefaultInitialValue(this.buildDefaultInitialValue()); > this.setDefaultAllocationSize(this.buildDefaultAllocationSize()); >- this.getPersistenceUnit().addGenerator(this); > } > > >@@ -154,7 +159,24 @@ > } > > >- // ********** text ranges ********** >+ // ********** validation ********** >+ >+ @Override >+ public void validate(List<IMessage> messages, IReporter reporter, CompilationUnit astRoot) { >+ super.validate(messages, reporter, astRoot); >+ >+ if (StringTools.stringIsEmpty(this.name)){ >+ messages.add( >+ DefaultJpaValidationMessages.buildMessage( >+ IMessage.HIGH_SEVERITY, >+ JpaValidationMessages.GENERATOR_NAME_UNDEFINED, >+ EMPTY_STRING_ARRAY, >+ this, >+ this.getNameTextRange(astRoot) >+ ) >+ ); >+ } >+ } > > public TextRange getValidationTextRange(CompilationUnit astRoot) { > TextRange textRange = this.generatorAnnotation.getTextRange(astRoot); >@@ -223,5 +245,4 @@ > public void toString(StringBuilder sb) { > sb.append(this.name); > } >- > } >Index: src/org/eclipse/jpt/jpa/core/internal/context/java/AbstractJavaIdMapping.java >=================================================================== >RCS file: /cvsroot/webtools/org.eclipse.jpa/components/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/AbstractJavaIdMapping.java,v >retrieving revision 1.2 >diff -u -r1.2 AbstractJavaIdMapping.java >--- src/org/eclipse/jpt/jpa/core/internal/context/java/AbstractJavaIdMapping.java 28 Apr 2011 02:00:43 -0000 1.2 >+++ src/org/eclipse/jpt/jpa/core/internal/context/java/AbstractJavaIdMapping.java 11 May 2011 14:49:38 -0000 >@@ -127,7 +127,7 @@ > return this.generatorContainer; > } > >- private JavaGeneratorContainer buildGeneratorContainer() { >+ protected JavaGeneratorContainer buildGeneratorContainer() { > return this.getJpaFactory().buildJavaGeneratorContainer(this, this); > } > >@@ -390,7 +390,7 @@ > } > > public JptValidator buildColumnValidator(NamedColumn col, NamedColumnTextRangeResolver textRangeResolver) { >- return new NamedColumnValidator((BaseColumn) col, (BaseColumnTextRangeResolver) textRangeResolver, new EntityTableDescriptionProvider()); >+ return new NamedColumnValidator(this.getPersistentAttribute(), (BaseColumn) col, (BaseColumnTextRangeResolver) textRangeResolver, new EntityTableDescriptionProvider()); > } > > >Index: src/org/eclipse/jpt/jpa/core/internal/context/java/AbstractJavaMultiRelationshipMapping.java >=================================================================== >RCS file: /cvsroot/webtools/org.eclipse.jpa/components/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/AbstractJavaMultiRelationshipMapping.java,v >retrieving revision 1.1 >diff -u -r1.1 AbstractJavaMultiRelationshipMapping.java >--- src/org/eclipse/jpt/jpa/core/internal/context/java/AbstractJavaMultiRelationshipMapping.java 6 Feb 2011 02:07:12 -0000 1.1 >+++ src/org/eclipse/jpt/jpa/core/internal/context/java/AbstractJavaMultiRelationshipMapping.java 11 May 2011 14:49:38 -0000 >@@ -692,6 +692,10 @@ > protected RelationshipStrategy getRelationshipStrategy() { > return AbstractJavaMultiRelationshipMapping.this.getRelationship().getStrategy(); > } >+ >+ protected JavaPersistentAttribute getPersistentAttribute() { >+ return AbstractJavaMultiRelationshipMapping.this.getPersistentAttribute(); >+ } > } > > >@@ -718,7 +722,7 @@ > } > > public JptValidator buildColumnValidator(NamedColumn column, NamedColumnTextRangeResolver textRangeResolver) { >- return new MapKeyColumnValidator((BaseColumn) column, (BaseColumnTextRangeResolver) textRangeResolver, new RelationshipStrategyTableDescriptionProvider(this.getRelationshipStrategy())); >+ return new MapKeyColumnValidator(this.getPersistentAttribute(), (BaseColumn) column, (BaseColumnTextRangeResolver) textRangeResolver, new RelationshipStrategyTableDescriptionProvider(this.getRelationshipStrategy())); > } > } > >@@ -770,11 +774,11 @@ > } > > public JptValidator buildValidator(Override_ override, OverrideContainer container, OverrideTextRangeResolver textRangeResolver) { >- return new MapKeyAttributeOverrideValidator((AttributeOverride) override, (AttributeOverrideContainer) container, textRangeResolver, new EmbeddableOverrideDescriptionProvider()); >+ return new MapKeyAttributeOverrideValidator(this.getPersistentAttribute(), (AttributeOverride) override, (AttributeOverrideContainer) container, textRangeResolver, new EmbeddableOverrideDescriptionProvider()); > } > > public JptValidator buildColumnValidator(Override_ override, BaseColumn column, BaseColumn.Owner owner, BaseColumnTextRangeResolver textRangeResolver) { >- return new MapKeyAttributeOverrideColumnValidator((AttributeOverride) override, column, textRangeResolver, new RelationshipStrategyTableDescriptionProvider(this.getRelationshipStrategy())); >+ return new MapKeyAttributeOverrideColumnValidator(this.getPersistentAttribute(), (AttributeOverride) override, column, textRangeResolver, new RelationshipStrategyTableDescriptionProvider(this.getRelationshipStrategy())); > } > } > } >Index: src/org/eclipse/jpt/jpa/core/internal/context/java/AbstractJavaQuery.java >=================================================================== >RCS file: /cvsroot/webtools/org.eclipse.jpa/components/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/AbstractJavaQuery.java,v >retrieving revision 1.2 >diff -u -r1.2 AbstractJavaQuery.java >--- src/org/eclipse/jpt/jpa/core/internal/context/java/AbstractJavaQuery.java 28 Apr 2011 02:00:43 -0000 1.2 >+++ src/org/eclipse/jpt/jpa/core/internal/context/java/AbstractJavaQuery.java 11 May 2011 14:49:38 -0000 >@@ -10,10 +10,12 @@ > package org.eclipse.jpt.jpa.core.internal.context.java; > > import java.util.Iterator; >+import java.util.List; > import java.util.Vector; > import org.eclipse.jdt.core.dom.CompilationUnit; > import org.eclipse.jpt.common.core.utility.TextRange; > import org.eclipse.jpt.common.utility.internal.CollectionTools; >+import org.eclipse.jpt.common.utility.internal.StringTools; > import org.eclipse.jpt.common.utility.internal.iterables.ListIterable; > import org.eclipse.jpt.common.utility.internal.iterables.LiveCloneListIterable; > import org.eclipse.jpt.jpa.core.context.Query; >@@ -23,8 +25,12 @@ > import org.eclipse.jpt.jpa.core.context.java.JavaQueryHint; > import org.eclipse.jpt.jpa.core.internal.context.ContextContainerTools; > import org.eclipse.jpt.jpa.core.internal.context.MappingTools; >+import org.eclipse.jpt.jpa.core.internal.validation.DefaultJpaValidationMessages; >+import org.eclipse.jpt.jpa.core.internal.validation.JpaValidationMessages; > import org.eclipse.jpt.jpa.core.resource.java.QueryAnnotation; > import org.eclipse.jpt.jpa.core.resource.java.QueryHintAnnotation; >+import org.eclipse.wst.validation.internal.provisional.core.IMessage; >+import org.eclipse.wst.validation.internal.provisional.core.IReporter; > > /** > * Java query >@@ -66,7 +72,6 @@ > public void update() { > super.update(); > this.updateNodes(this.getHints()); >- this.getPersistenceUnit().addQuery(this); > } > > >@@ -202,6 +207,57 @@ > } > > >+ // ********** validation ********** >+ >+ @Override >+ public void validate(List<IMessage> messages, IReporter reporter, CompilationUnit astRoot) { >+ super.validate(messages, reporter, astRoot); >+ this.validateName(messages, astRoot); >+ this.validateQuery(messages, reporter, astRoot); >+ } >+ >+ protected void validateName(List<IMessage> messages, CompilationUnit astRoot) { >+ if (StringTools.stringIsEmpty(this.name)) { >+ messages.add( >+ DefaultJpaValidationMessages.buildMessage( >+ IMessage.HIGH_SEVERITY, >+ JpaValidationMessages.QUERY_NAME_UNDEFINED, >+ EMPTY_STRING_ARRAY, >+ this, >+ this.getNameTextRange(astRoot) >+ ) >+ ); >+ } >+ } >+ >+ protected void validateQuery(List<IMessage> messages, IReporter reporter, CompilationUnit astRoot) { >+ if (StringTools.stringIsEmpty(this.query)){ >+ messages.add( >+ DefaultJpaValidationMessages.buildMessage( >+ IMessage.HIGH_SEVERITY, >+ JpaValidationMessages.QUERY_STATEMENT_UNDEFINED, >+ new String[] {this.name}, >+ this, >+ this.getNameTextRange(astRoot) >+ ) >+ ); >+ } else { >+ this.validateQuery_(messages, reporter, astRoot); >+ } >+ } >+ >+ protected abstract void validateQuery_(List<IMessage> messages, IReporter reporter, CompilationUnit astRoot); >+ >+ public TextRange getValidationTextRange(CompilationUnit astRoot) { >+ TextRange textRange = this.queryAnnotation.getTextRange(astRoot); >+ return (textRange != null) ? textRange : this.getParent().getValidationTextRange(astRoot); >+ } >+ >+ public TextRange getNameTextRange(CompilationUnit astRoot) { >+ return this.getValidationTextRange(this.queryAnnotation.getNameTextRange(astRoot), astRoot); >+ } >+ >+ > // ********** misc ********** > > @Override >@@ -221,15 +277,6 @@ > return MappingTools.nodesAreDuplicates(this, other); > } > >- public TextRange getValidationTextRange(CompilationUnit astRoot) { >- TextRange textRange = this.queryAnnotation.getTextRange(astRoot); >- return (textRange != null) ? textRange : this.getParent().getValidationTextRange(astRoot); >- } >- >- public TextRange getNameTextRange(CompilationUnit astRoot) { >- return this.getValidationTextRange(this.queryAnnotation.getNameTextRange(astRoot), astRoot); >- } >- > @Override > public void toString(StringBuilder sb) { > sb.append(this.name); >Index: src/org/eclipse/jpt/jpa/core/internal/context/java/AbstractJavaVersionMapping.java >=================================================================== >RCS file: /cvsroot/webtools/org.eclipse.jpa/components/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/AbstractJavaVersionMapping.java,v >retrieving revision 1.2 >diff -u -r1.2 AbstractJavaVersionMapping.java >--- src/org/eclipse/jpt/jpa/core/internal/context/java/AbstractJavaVersionMapping.java 25 Feb 2011 21:42:36 -0000 1.2 >+++ src/org/eclipse/jpt/jpa/core/internal/context/java/AbstractJavaVersionMapping.java 11 May 2011 14:49:38 -0000 >@@ -1,5 +1,5 @@ > /******************************************************************************* >- * Copyright (c) 2007, 2010 Oracle. All rights reserved. >+ * Copyright (c) 2007, 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. >@@ -244,8 +244,8 @@ > return this.getTypeMapping().allAssociatedTableNames(); > } > >- public JptValidator buildColumnValidator(NamedColumn column, NamedColumnTextRangeResolver textRangeResolver) { >- return new NamedColumnValidator((BaseColumn) column, (BaseColumnTextRangeResolver) textRangeResolver, new EntityTableDescriptionProvider()); >+ public JptValidator buildColumnValidator(NamedColumn col, NamedColumnTextRangeResolver textRangeResolver) { >+ return new NamedColumnValidator(this.getPersistentAttribute(), (BaseColumn) col, (BaseColumnTextRangeResolver) textRangeResolver, new EntityTableDescriptionProvider()); > } > > >@@ -275,10 +275,10 @@ > super.validate(messages, reporter, astRoot); > this.column.validate(messages, reporter, astRoot); > this.converter.validate(messages, reporter, astRoot); >- this.validateAttributeType(messages, reporter, astRoot); >+ this.validateAttributeType(messages, astRoot); > } > >- protected void validateAttributeType(List<IMessage> messages, IReporter reporter, CompilationUnit astRoot) { >+ protected void validateAttributeType(List<IMessage> messages, CompilationUnit astRoot) { > if (!ArrayTools.contains(VERSION_MAPPING_SUPPORTED_TYPES, this.getPersistentAttribute().getTypeName())) { > messages.add( > DefaultJpaValidationMessages.buildMessage( >Index: src/org/eclipse/jpt/jpa/core/internal/context/java/GenericJavaMappingJoinColumnRelationshipStrategy.java >=================================================================== >RCS file: /cvsroot/webtools/org.eclipse.jpa/components/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/GenericJavaMappingJoinColumnRelationshipStrategy.java,v >retrieving revision 1.1 >diff -u -r1.1 GenericJavaMappingJoinColumnRelationshipStrategy.java >--- src/org/eclipse/jpt/jpa/core/internal/context/java/GenericJavaMappingJoinColumnRelationshipStrategy.java 6 Feb 2011 02:07:12 -0000 1.1 >+++ src/org/eclipse/jpt/jpa/core/internal/context/java/GenericJavaMappingJoinColumnRelationshipStrategy.java 11 May 2011 14:49:38 -0000 >@@ -13,6 +13,7 @@ > import org.eclipse.jdt.core.dom.CompilationUnit; > import org.eclipse.jpt.common.core.utility.TextRange; > import org.eclipse.jpt.common.utility.internal.iterators.SubIteratorWrapper; >+import org.eclipse.jpt.common.utility.internal.iterators.SuperIteratorWrapper; > import org.eclipse.jpt.jpa.core.context.Entity; > import org.eclipse.jpt.jpa.core.context.JoinColumn; > import org.eclipse.jpt.jpa.core.context.NamedColumn; >@@ -33,6 +34,7 @@ > import org.eclipse.jpt.jpa.core.resource.java.JoinColumnAnnotation; > import org.eclipse.jpt.jpa.core.resource.java.JoinColumnsAnnotation; > import org.eclipse.jpt.jpa.core.resource.java.NestableAnnotation; >+import org.eclipse.jpt.jpa.core.resource.java.NestableJoinColumnAnnotation; > import org.eclipse.jpt.jpa.db.Table; > > public class GenericJavaMappingJoinColumnRelationshipStrategy >@@ -58,10 +60,14 @@ > > @Override > protected Iterator<JoinColumnAnnotation> joinColumnAnnotations() { >- return new SubIteratorWrapper<NestableAnnotation, JoinColumnAnnotation>(this.joinColumnAnnotations_()); >+ return new SuperIteratorWrapper<JoinColumnAnnotation>(this.nestableJoinColumnAnnotations()); > } > >- protected Iterator<NestableAnnotation> joinColumnAnnotations_() { >+ protected Iterator<NestableJoinColumnAnnotation> nestableJoinColumnAnnotations() { >+ return new SubIteratorWrapper<NestableAnnotation, NestableJoinColumnAnnotation>(this.nestableJoinColumnAnnotations_()); >+ } >+ >+ protected Iterator<NestableAnnotation> nestableJoinColumnAnnotations_() { > return this.getResourcePersistentAttribute().annotations(JoinColumnAnnotation.ANNOTATION_NAME, JoinColumnsAnnotation.ANNOTATION_NAME); > } > >@@ -166,7 +172,7 @@ > return GenericJavaMappingJoinColumnRelationshipStrategy.this.getRelationshipMapping().getName(); > } > >- public PersistentAttribute getPersistentAttribute() { >+ protected PersistentAttribute getPersistentAttribute() { > return GenericJavaMappingJoinColumnRelationshipStrategy.this.getRelationshipMapping().getPersistentAttribute(); > } > >@@ -210,7 +216,7 @@ > } > > public JptValidator buildColumnValidator(NamedColumn column, NamedColumnTextRangeResolver textRangeResolver) { >- return new JoinColumnValidator((JoinColumn) column, this, (JoinColumnTextRangeResolver) textRangeResolver, new EntityTableDescriptionProvider()); >+ return new JoinColumnValidator(this.getPersistentAttribute(), (JoinColumn) column, this, (JoinColumnTextRangeResolver) textRangeResolver, new EntityTableDescriptionProvider()); > } > } > } >Index: src/org/eclipse/jpt/jpa/core/internal/context/java/GenericJavaPrimaryKeyJoinColumnRelationshipStrategy.java >=================================================================== >RCS file: /cvsroot/webtools/org.eclipse.jpa/components/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/GenericJavaPrimaryKeyJoinColumnRelationshipStrategy.java,v >retrieving revision 1.1 >diff -u -r1.1 GenericJavaPrimaryKeyJoinColumnRelationshipStrategy.java >--- src/org/eclipse/jpt/jpa/core/internal/context/java/GenericJavaPrimaryKeyJoinColumnRelationshipStrategy.java 6 Feb 2011 02:07:13 -0000 1.1 >+++ src/org/eclipse/jpt/jpa/core/internal/context/java/GenericJavaPrimaryKeyJoinColumnRelationshipStrategy.java 11 May 2011 14:49:38 -0000 >@@ -20,6 +20,7 @@ > import org.eclipse.jpt.common.utility.internal.iterables.ListIterable; > import org.eclipse.jpt.common.utility.internal.iterables.LiveCloneListIterable; > import org.eclipse.jpt.common.utility.internal.iterators.SubIteratorWrapper; >+import org.eclipse.jpt.common.utility.internal.iterators.SuperIteratorWrapper; > import org.eclipse.jpt.jpa.core.context.BaseJoinColumn; > import org.eclipse.jpt.jpa.core.context.Entity; > import org.eclipse.jpt.jpa.core.context.NamedColumn; >@@ -40,6 +41,7 @@ > import org.eclipse.jpt.jpa.core.internal.validation.JpaValidationDescriptionMessages; > import org.eclipse.jpt.jpa.core.resource.java.JavaResourcePersistentAttribute; > import org.eclipse.jpt.jpa.core.resource.java.NestableAnnotation; >+import org.eclipse.jpt.jpa.core.resource.java.NestablePrimaryKeyJoinColumnAnnotation; > import org.eclipse.jpt.jpa.core.resource.java.PrimaryKeyJoinColumnAnnotation; > import org.eclipse.jpt.jpa.core.resource.java.PrimaryKeyJoinColumnsAnnotation; > import org.eclipse.jpt.jpa.db.Table; >@@ -197,10 +199,14 @@ > // ********** primary key join column annotations ********** > > protected Iterator<PrimaryKeyJoinColumnAnnotation> primaryKeyJoinColumnAnnotations() { >- return new SubIteratorWrapper<NestableAnnotation, PrimaryKeyJoinColumnAnnotation>(this.primaryKeyJoinColumnAnnotations_()); >+ return new SuperIteratorWrapper<PrimaryKeyJoinColumnAnnotation>(this.nestablePrimaryKeyJoinColumnAnnotations()); > } > >- protected Iterator<NestableAnnotation> primaryKeyJoinColumnAnnotations_() { >+ protected Iterator<NestablePrimaryKeyJoinColumnAnnotation> nestablePrimaryKeyJoinColumnAnnotations() { >+ return new SubIteratorWrapper<NestableAnnotation, NestablePrimaryKeyJoinColumnAnnotation>(this.nestablePrimaryKeyJoinColumnAnnotations_()); >+ } >+ >+ protected Iterator<NestableAnnotation> nestablePrimaryKeyJoinColumnAnnotations_() { > return this.getResourcePersistentAttribute().annotations(PrimaryKeyJoinColumnAnnotation.ANNOTATION_NAME, PrimaryKeyJoinColumnsAnnotation.ANNOTATION_NAME); > } > >@@ -330,7 +336,7 @@ > return this.getRelationshipMapping().getName(); > } > >- public PersistentAttribute getPersistentAttribute() { >+ protected PersistentAttribute getPersistentAttribute() { > return this.getRelationshipMapping().getPersistentAttribute(); > } > >@@ -375,7 +381,7 @@ > } > > public JptValidator buildColumnValidator(NamedColumn column, NamedColumnTextRangeResolver textRangeResolver) { >- return new OneToOnePrimaryKeyJoinColumnValidator((BaseJoinColumn) column, this, (BaseJoinColumnTextRangeResolver) textRangeResolver); >+ return new OneToOnePrimaryKeyJoinColumnValidator(this.getPersistentAttribute(), (BaseJoinColumn) column, this, (BaseJoinColumnTextRangeResolver) textRangeResolver); > } > > protected JavaRelationshipMapping getRelationshipMapping() { >Index: src/org/eclipse/jpt/jpa/core/internal/context/orm/AbstractEntityMappings.java >=================================================================== >RCS file: /cvsroot/webtools/org.eclipse.jpa/components/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/AbstractEntityMappings.java,v >retrieving revision 1.2 >diff -u -r1.2 AbstractEntityMappings.java >--- src/org/eclipse/jpt/jpa/core/internal/context/orm/AbstractEntityMappings.java 28 Apr 2011 02:00:42 -0000 1.2 >+++ src/org/eclipse/jpt/jpa/core/internal/context/orm/AbstractEntityMappings.java 11 May 2011 14:49:39 -0000 >@@ -9,9 +9,7 @@ > ******************************************************************************/ > package org.eclipse.jpt.jpa.core.internal.context.orm; > >-import java.util.ArrayList; > import java.util.Comparator; >-import java.util.Iterator; > import java.util.List; > import java.util.Vector; > import org.eclipse.core.runtime.content.IContentType; >@@ -19,7 +17,6 @@ > import org.eclipse.jdt.core.IType; > import org.eclipse.jpt.common.core.utility.TextRange; > import org.eclipse.jpt.common.utility.internal.CollectionTools; >-import org.eclipse.jpt.common.utility.internal.StringTools; > import org.eclipse.jpt.common.utility.internal.Tools; > import org.eclipse.jpt.common.utility.internal.iterables.CompositeIterable; > import org.eclipse.jpt.common.utility.internal.iterables.EmptyIterable; >@@ -31,11 +28,9 @@ > import org.eclipse.jpt.jpa.core.JpaStructureNode; > import org.eclipse.jpt.jpa.core.JptJpaCorePlugin; > import org.eclipse.jpt.jpa.core.context.AccessType; >-import org.eclipse.jpt.jpa.core.context.Generator; > import org.eclipse.jpt.jpa.core.context.MappingFileRoot; > import org.eclipse.jpt.jpa.core.context.PersistentType; > import org.eclipse.jpt.jpa.core.context.orm.EntityMappings; >-import org.eclipse.jpt.jpa.core.context.orm.OrmGenerator; > import org.eclipse.jpt.jpa.core.context.orm.OrmIdClassReference; > import org.eclipse.jpt.jpa.core.context.orm.OrmPersistenceUnitMetadata; > import org.eclipse.jpt.jpa.core.context.orm.OrmPersistentType; >@@ -868,11 +863,15 @@ > > // ********** validation ********** > >+ /** >+ * The generators are validated in the persistence unit. >+ * @see org.eclipse.jpt.jpa.core.internal.context.persistence.AbstractPersistenceUnit#validateGenerators(List, IReporter) >+ */ > @Override > public void validate(List<IMessage> messages, IReporter reporter) { > super.validate(messages, reporter); > this.validateVersion(messages); >- this.validateGenerators(messages); >+ // generators are validated in the persistence unit > this.queryContainer.validate(messages, reporter); > for (OrmPersistentType ormPersistentType : this.getPersistentTypes()) { > this.validatePersistentType(ormPersistentType, messages, reporter); >@@ -903,50 +902,6 @@ > return JptJpaCorePlugin.ORM_XML_CONTENT_TYPE; > } > >- protected void validateGenerators(List<IMessage> messages) { >- for (OrmGenerator localGenerator : this.getGenerators()) { >- String name = localGenerator.getName(); >- if (StringTools.stringIsEmpty(name)) { >- messages.add( >- DefaultJpaValidationMessages.buildMessage( >- IMessage.HIGH_SEVERITY, >- JpaValidationMessages.GENERATOR_NAME_UNDEFINED, >- new String[] {}, >- localGenerator, >- localGenerator.getNameTextRange() >- )); >- } else { >- List<String> reportedNames = new ArrayList<String>(); >- for (Iterator<Generator> globalGenerators = this.getPersistenceUnit().generators(); globalGenerators.hasNext(); ) { >- if (localGenerator.duplicates(globalGenerators.next()) && !reportedNames.contains(name)) { >- messages.add( >- DefaultJpaValidationMessages.buildMessage( >- IMessage.HIGH_SEVERITY, >- JpaValidationMessages.GENERATOR_DUPLICATE_NAME, >- new String[] {localGenerator.getName()}, >- localGenerator, >- localGenerator.getNameTextRange() >- ) >- ); >- reportedNames.add(name); >- } >- } >- } >- } >- } >- >- /** >- * Return all the generators, table and sequence. >- */ >- @SuppressWarnings("unchecked") >- protected Iterable<OrmGenerator> getGenerators() { >- return new CompositeIterable<OrmGenerator>( >- this.getTableGenerators(), >- this.getSequenceGenerators() >- ); >- } >- >- > protected void validatePersistentType(OrmPersistentType persistentType, List<IMessage> messages, IReporter reporter) { > try { > persistentType.validate(messages, reporter); >Index: src/org/eclipse/jpt/jpa/core/internal/context/orm/AbstractOrmEntity.java >=================================================================== >RCS file: /cvsroot/webtools/org.eclipse.jpa/components/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/AbstractOrmEntity.java,v >retrieving revision 1.6 >diff -u -r1.6 AbstractOrmEntity.java >--- src/org/eclipse/jpt/jpa/core/internal/context/orm/AbstractOrmEntity.java 28 Apr 2011 02:00:42 -0000 1.6 >+++ src/org/eclipse/jpt/jpa/core/internal/context/orm/AbstractOrmEntity.java 11 May 2011 14:49:39 -0000 >@@ -1800,9 +1800,8 @@ > } > > protected void validateDuplicateEntityNames(List<IMessage> messages) { >- HashBag<String> javaEntityNamesExclOverridden = new HashBag<String>(); >- CollectionTools.addAll(javaEntityNamesExclOverridden, this.getPersistenceUnit().javaEntityNamesExclOverridden()); >- Map<String, Set<String>> map =this.getPersistenceUnit().mapEntityNameToClassNames(); >+ HashBag<String> javaEntityNamesExclOverridden = CollectionTools.bag(this.getPersistenceUnit().javaEntityNamesExclOverridden()); >+ Map<String, Set<String>> map = this.getPersistenceUnit().mapEntityNameToClassNames(); > Set<String> classNames = map.get(this.getName()); > // Check whether or not this entity name has duplicates among the orm entities defined with different classes > if (((classNames != null) && (classNames.size() > 1)) || >Index: src/org/eclipse/jpt/jpa/core/internal/context/orm/AbstractOrmGenerator.java >=================================================================== >RCS file: /cvsroot/webtools/org.eclipse.jpa/components/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/AbstractOrmGenerator.java,v >retrieving revision 1.2 >diff -u -r1.2 AbstractOrmGenerator.java >--- src/org/eclipse/jpt/jpa/core/internal/context/orm/AbstractOrmGenerator.java 28 Apr 2011 02:00:42 -0000 1.2 >+++ src/org/eclipse/jpt/jpa/core/internal/context/orm/AbstractOrmGenerator.java 11 May 2011 14:49:39 -0000 >@@ -9,15 +9,21 @@ > ******************************************************************************/ > package org.eclipse.jpt.jpa.core.internal.context.orm; > >+import java.util.List; > import org.eclipse.jpt.common.core.utility.TextRange; >+import org.eclipse.jpt.common.utility.internal.StringTools; > import org.eclipse.jpt.jpa.core.context.Generator; > import org.eclipse.jpt.jpa.core.context.XmlContextNode; > import org.eclipse.jpt.jpa.core.context.orm.OrmGenerator; > import org.eclipse.jpt.jpa.core.internal.context.MappingTools; >+import org.eclipse.jpt.jpa.core.internal.validation.DefaultJpaValidationMessages; >+import org.eclipse.jpt.jpa.core.internal.validation.JpaValidationMessages; > import org.eclipse.jpt.jpa.core.resource.orm.XmlGenerator; > import org.eclipse.jpt.jpa.db.Catalog; > import org.eclipse.jpt.jpa.db.Schema; > import org.eclipse.jpt.jpa.db.SchemaContainer; >+import org.eclipse.wst.validation.internal.provisional.core.IMessage; >+import org.eclipse.wst.validation.internal.provisional.core.IReporter; > > /** > * <code>orm.xml</code> sequence or table generator >@@ -61,7 +67,6 @@ > super.update(); > this.setDefaultInitialValue(this.buildDefaultInitialValue()); > this.setDefaultAllocationSize(this.buildDefaultAllocationSize()); >- this.getPersistenceUnit().addGenerator(this); > } > > >@@ -153,7 +158,24 @@ > } > > >- // ********** text ranges ********** >+ // ********** validation ********** >+ >+ @Override >+ public void validate(List<IMessage> messages, IReporter reporter) { >+ super.validate(messages, reporter); >+ >+ if (StringTools.stringIsEmpty(this.name)){ >+ messages.add( >+ DefaultJpaValidationMessages.buildMessage( >+ IMessage.HIGH_SEVERITY, >+ JpaValidationMessages.GENERATOR_NAME_UNDEFINED, >+ EMPTY_STRING_ARRAY, >+ this, >+ this.getNameTextRange() >+ ) >+ ); >+ } >+ } > > public TextRange getValidationTextRange() { > TextRange textRange = this.xmlGenerator.getValidationTextRange(); >Index: src/org/eclipse/jpt/jpa/core/internal/context/orm/AbstractOrmMultiRelationshipMapping.java >=================================================================== >RCS file: /cvsroot/webtools/org.eclipse.jpa/components/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/AbstractOrmMultiRelationshipMapping.java,v >retrieving revision 1.2 >diff -u -r1.2 AbstractOrmMultiRelationshipMapping.java >--- src/org/eclipse/jpt/jpa/core/internal/context/orm/AbstractOrmMultiRelationshipMapping.java 28 Apr 2011 02:00:42 -0000 1.2 >+++ src/org/eclipse/jpt/jpa/core/internal/context/orm/AbstractOrmMultiRelationshipMapping.java 11 May 2011 14:49:39 -0000 >@@ -715,10 +715,6 @@ > return AbstractOrmMultiRelationshipMapping.this.getRelationship().getStrategy(); > } > >- protected String getMappingName() { >- return AbstractOrmMultiRelationshipMapping.this.getName(); >- } >- > protected OrmPersistentAttribute getPersistentAttribute() { > return AbstractOrmMultiRelationshipMapping.this.getPersistentAttribute(); > } >@@ -732,7 +728,7 @@ > implements OrmColumn.Owner > { > public String getDefaultColumnName() { >- return this.getMappingName() + "_KEY"; //$NON-NLS-1$ >+ return AbstractOrmMultiRelationshipMapping.this.getName() + "_KEY"; //$NON-NLS-1$ > } > > public boolean tableNameIsInvalid(String tableName) { >Index: src/org/eclipse/jpt/jpa/core/internal/context/orm/AbstractOrmQuery.java >=================================================================== >RCS file: /cvsroot/webtools/org.eclipse.jpa/components/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/AbstractOrmQuery.java,v >retrieving revision 1.3 >diff -u -r1.3 AbstractOrmQuery.java >--- src/org/eclipse/jpt/jpa/core/internal/context/orm/AbstractOrmQuery.java 28 Apr 2011 02:00:42 -0000 1.3 >+++ src/org/eclipse/jpt/jpa/core/internal/context/orm/AbstractOrmQuery.java 11 May 2011 14:49:39 -0000 >@@ -9,6 +9,7 @@ > ******************************************************************************/ > package org.eclipse.jpt.jpa.core.internal.context.orm; > >+import java.util.List; > import java.util.Vector; > import org.eclipse.jpt.common.core.utility.TextRange; > import org.eclipse.jpt.common.utility.internal.StringTools; >@@ -22,10 +23,14 @@ > import org.eclipse.jpt.jpa.core.context.orm.OrmQueryHint; > import org.eclipse.jpt.jpa.core.internal.context.ContextContainerTools; > import org.eclipse.jpt.jpa.core.internal.context.MappingTools; >+import org.eclipse.jpt.jpa.core.internal.validation.DefaultJpaValidationMessages; >+import org.eclipse.jpt.jpa.core.internal.validation.JpaValidationMessages; > import org.eclipse.jpt.jpa.core.resource.orm.OrmFactory; > import org.eclipse.jpt.jpa.core.resource.orm.XmlQuery; > import org.eclipse.jpt.jpa.core.resource.orm.XmlQueryHint; > import org.eclipse.persistence.jpa.jpql.ExpressionTools; >+import org.eclipse.wst.validation.internal.provisional.core.IMessage; >+import org.eclipse.wst.validation.internal.provisional.core.IReporter; > > /** > * <code>orm.xml</code> query >@@ -66,7 +71,6 @@ > public void update() { > super.update(); > this.updateNodes(this.getHints()); >- this.getPersistenceUnit().addQuery(this); > } > > >@@ -225,24 +229,46 @@ > } > > >- // ********** misc ********** >+ // ********** validation ********** > > @Override >- public XmlContextNode getParent() { >- return (XmlContextNode) super.getParent(); >- } >- >- public X getXmlQuery() { >- return this.xmlQuery; >+ public void validate(List<IMessage> messages, IReporter reporter) { >+ super.validate(messages, reporter); >+ this.validateName(messages); >+ this.validateQuery(messages, reporter); >+ } >+ >+ protected void validateName(List<IMessage> messages) { >+ if (StringTools.stringIsEmpty(this.name)) { >+ messages.add( >+ DefaultJpaValidationMessages.buildMessage( >+ IMessage.HIGH_SEVERITY, >+ JpaValidationMessages.QUERY_NAME_UNDEFINED, >+ EMPTY_STRING_ARRAY, >+ this, >+ this.getNameTextRange() >+ ) >+ ); >+ } > } > >- public boolean overrides(Query other) { >- return MappingTools.nodeOverrides(this, other, PRECEDENCE_TYPE_LIST); >+ protected void validateQuery(List<IMessage> messages, IReporter reporter) { >+ if (StringTools.stringIsEmpty(this.query)){ >+ messages.add( >+ DefaultJpaValidationMessages.buildMessage( >+ IMessage.HIGH_SEVERITY, >+ JpaValidationMessages.QUERY_STATEMENT_UNDEFINED, >+ new String[] {this.name}, >+ this, >+ this.getNameTextRange() >+ ) >+ ); >+ } else { >+ this.validateQuery_(messages, reporter); >+ } > } > >- public boolean duplicates(Query other) { >- return MappingTools.nodesAreDuplicates(this, other); >- } >+ protected abstract void validateQuery_(List<IMessage> messages, IReporter reporter); > > public TextRange getValidationTextRange() { > TextRange textRange = this.xmlQuery.getValidationTextRange(); >@@ -257,8 +283,28 @@ > return this.getValidationTextRange(this.xmlQuery.getQueryTextRange()); > } > >+ >+ // ********** misc ********** >+ >+ @Override >+ public XmlContextNode getParent() { >+ return (XmlContextNode) super.getParent(); >+ } >+ >+ public X getXmlQuery() { >+ return this.xmlQuery; >+ } >+ >+ public boolean overrides(Query other) { >+ return MappingTools.nodeOverrides(this, other, PRECEDENCE_TYPE_LIST); >+ } >+ >+ public boolean duplicates(Query other) { >+ return MappingTools.nodesAreDuplicates(this, other); >+ } >+ > @Override > public void toString(StringBuilder sb) { > sb.append(this.name); > } >-} >\ No newline at end of file >+} >Index: src/org/eclipse/jpt/jpa/core/internal/context/orm/AbstractOrmVersionMapping.java >=================================================================== >RCS file: /cvsroot/webtools/org.eclipse.jpa/components/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/AbstractOrmVersionMapping.java,v >retrieving revision 1.2 >diff -u -r1.2 AbstractOrmVersionMapping.java >--- src/org/eclipse/jpt/jpa/core/internal/context/orm/AbstractOrmVersionMapping.java 25 Feb 2011 21:42:36 -0000 1.2 >+++ src/org/eclipse/jpt/jpa/core/internal/context/orm/AbstractOrmVersionMapping.java 11 May 2011 14:49:39 -0000 >@@ -1,5 +1,5 @@ > /******************************************************************************* >- * Copyright (c) 2007, 2010 Oracle. All rights reserved. >+ * Copyright (c) 2007, 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. >@@ -320,10 +320,10 @@ > super.validate(messages, reporter); > this.column.validate(messages, reporter); > this.converter.validate(messages, reporter); >- this.validateAttributeType(messages, reporter); >+ this.validateAttributeType(messages); > } > >- protected void validateAttributeType(List<IMessage> messages, IReporter reporter) { >+ protected void validateAttributeType(List<IMessage> messages) { > if (!ArrayTools.contains(VERSION_MAPPING_SUPPORTED_TYPES, this.getPersistentAttribute().getTypeName())) { > messages.add( > DefaultJpaValidationMessages.buildMessage( >Index: src/org/eclipse/jpt/jpa/core/internal/context/orm/GenericOrmIdClassReference.java >=================================================================== >RCS file: /cvsroot/webtools/org.eclipse.jpa/components/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/GenericOrmIdClassReference.java,v >retrieving revision 1.3 >diff -u -r1.3 GenericOrmIdClassReference.java >--- src/org/eclipse/jpt/jpa/core/internal/context/orm/GenericOrmIdClassReference.java 28 Apr 2011 02:00:42 -0000 1.3 >+++ src/org/eclipse/jpt/jpa/core/internal/context/orm/GenericOrmIdClassReference.java 11 May 2011 14:49:39 -0000 >@@ -344,7 +344,7 @@ > DefaultJpaValidationMessages.buildMessage( > IMessage.HIGH_SEVERITY, > JpaValidationMessages.TYPE_MAPPING_ID_CLASS_NAME_EMPTY, >- new String[] {}, >+ EMPTY_STRING_ARRAY, > this, > this.getValidationTextRange() > ) >Index: src/org/eclipse/jpt/jpa/core/internal/context/orm/GenericOrmMappingJoinColumnRelationshipStrategy.java >=================================================================== >RCS file: /cvsroot/webtools/org.eclipse.jpa/components/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/GenericOrmMappingJoinColumnRelationshipStrategy.java,v >retrieving revision 1.1 >diff -u -r1.1 GenericOrmMappingJoinColumnRelationshipStrategy.java >--- src/org/eclipse/jpt/jpa/core/internal/context/orm/GenericOrmMappingJoinColumnRelationshipStrategy.java 6 Feb 2011 02:07:19 -0000 1.1 >+++ src/org/eclipse/jpt/jpa/core/internal/context/orm/GenericOrmMappingJoinColumnRelationshipStrategy.java 11 May 2011 14:49:39 -0000 >@@ -158,7 +158,7 @@ > } > > public JptValidator buildColumnValidator(NamedColumn column, NamedColumnTextRangeResolver textRangeResolver) { >- return new JoinColumnValidator(getPersistentAttribute(), (JoinColumn) column, this, (JoinColumnTextRangeResolver) textRangeResolver, new EntityTableDescriptionProvider()); >+ return new JoinColumnValidator(this.getPersistentAttribute(), (JoinColumn) column, this, (JoinColumnTextRangeResolver) textRangeResolver, new EntityTableDescriptionProvider()); > } > } > } >Index: src/org/eclipse/jpt/jpa/core/internal/context/orm/GenericOrmMappingJoinTableRelationshipStrategy.java >=================================================================== >RCS file: /cvsroot/webtools/org.eclipse.jpa/components/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/GenericOrmMappingJoinTableRelationshipStrategy.java,v >retrieving revision 1.1 >diff -u -r1.1 GenericOrmMappingJoinTableRelationshipStrategy.java >--- src/org/eclipse/jpt/jpa/core/internal/context/orm/GenericOrmMappingJoinTableRelationshipStrategy.java 6 Feb 2011 02:07:18 -0000 1.1 >+++ src/org/eclipse/jpt/jpa/core/internal/context/orm/GenericOrmMappingJoinTableRelationshipStrategy.java 11 May 2011 14:49:39 -0000 >@@ -59,6 +59,6 @@ > } > > public JptValidator buildTableValidator(Table table, TableTextRangeResolver textRangeResolver) { >- return new JoinTableValidator(getPersistentAttribute(), (JoinTable) table, textRangeResolver); >+ return new JoinTableValidator(this.getPersistentAttribute(), (JoinTable) table, textRangeResolver); > } > } >Index: src/org/eclipse/jpt/jpa/core/internal/context/orm/GenericOrmPrimaryKeyJoinColumnRelationshipStrategy.java >=================================================================== >RCS file: /cvsroot/webtools/org.eclipse.jpa/components/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/GenericOrmPrimaryKeyJoinColumnRelationshipStrategy.java,v >retrieving revision 1.1 >diff -u -r1.1 GenericOrmPrimaryKeyJoinColumnRelationshipStrategy.java >--- src/org/eclipse/jpt/jpa/core/internal/context/orm/GenericOrmPrimaryKeyJoinColumnRelationshipStrategy.java 6 Feb 2011 02:07:19 -0000 1.1 >+++ src/org/eclipse/jpt/jpa/core/internal/context/orm/GenericOrmPrimaryKeyJoinColumnRelationshipStrategy.java 11 May 2011 14:49:39 -0000 >@@ -292,7 +292,7 @@ > return this.getRelationshipMapping().getName(); > } > >- public PersistentAttribute getPersistentAttribute() { >+ protected PersistentAttribute getPersistentAttribute() { > return this.getRelationshipMapping().getPersistentAttribute(); > } > >Index: src/org/eclipse/jpt/jpa/core/internal/context/persistence/AbstractPersistenceUnit.java >=================================================================== >RCS file: /cvsroot/webtools/org.eclipse.jpa/components/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/persistence/AbstractPersistenceUnit.java,v >retrieving revision 1.3 >diff -u -r1.3 AbstractPersistenceUnit.java >--- src/org/eclipse/jpt/jpa/core/internal/context/persistence/AbstractPersistenceUnit.java 28 Apr 2011 02:00:43 -0000 1.3 >+++ src/org/eclipse/jpt/jpa/core/internal/context/persistence/AbstractPersistenceUnit.java 11 May 2011 14:49:39 -0000 >@@ -20,7 +20,6 @@ > import java.util.Map; > import java.util.Set; > import java.util.Vector; >- > import org.eclipse.core.resources.IFile; > import org.eclipse.core.resources.IFolder; > import org.eclipse.core.runtime.CoreException; >@@ -44,7 +43,6 @@ > import org.eclipse.jpt.common.utility.internal.iterables.LiveCloneListIterable; > import org.eclipse.jpt.common.utility.internal.iterables.SubIterableWrapper; > import org.eclipse.jpt.common.utility.internal.iterables.TransformationIterable; >-import org.eclipse.jpt.common.utility.internal.iterators.CloneIterator; > import org.eclipse.jpt.common.utility.internal.iterators.EmptyListIterator; > import org.eclipse.jpt.common.utility.internal.iterators.FilteringIterator; > import org.eclipse.jpt.common.utility.internal.iterators.TransformationIterator; >@@ -52,15 +50,28 @@ > import org.eclipse.jpt.jpa.core.JpaStructureNode; > import org.eclipse.jpt.jpa.core.JptJpaCorePlugin; > import org.eclipse.jpt.jpa.core.context.AccessType; >+import org.eclipse.jpt.jpa.core.context.AttributeMapping; > import org.eclipse.jpt.jpa.core.context.Embeddable; > import org.eclipse.jpt.jpa.core.context.Entity; > import org.eclipse.jpt.jpa.core.context.Generator; >+import org.eclipse.jpt.jpa.core.context.GeneratorContainer; >+import org.eclipse.jpt.jpa.core.context.IdMapping; >+import org.eclipse.jpt.jpa.core.context.MappingFile; > import org.eclipse.jpt.jpa.core.context.MappingFilePersistenceUnitDefaults; > import org.eclipse.jpt.jpa.core.context.MappingFilePersistenceUnitMetadata; > import org.eclipse.jpt.jpa.core.context.PersistentAttribute; > import org.eclipse.jpt.jpa.core.context.PersistentType; > import org.eclipse.jpt.jpa.core.context.Query; >+import org.eclipse.jpt.jpa.core.context.QueryContainer; >+import org.eclipse.jpt.jpa.core.context.ReadOnlyPersistentAttribute; > import org.eclipse.jpt.jpa.core.context.TypeMapping; >+import org.eclipse.jpt.jpa.core.context.java.JavaGenerator; >+import org.eclipse.jpt.jpa.core.context.java.JavaQuery; >+import org.eclipse.jpt.jpa.core.context.orm.EntityMappings; >+import org.eclipse.jpt.jpa.core.context.orm.OrmGenerator; >+import org.eclipse.jpt.jpa.core.context.orm.OrmPersistentType; >+import org.eclipse.jpt.jpa.core.context.orm.OrmQuery; >+import org.eclipse.jpt.jpa.core.context.orm.OrmXml; > import org.eclipse.jpt.jpa.core.context.persistence.ClassRef; > import org.eclipse.jpt.jpa.core.context.persistence.JarFileRef; > import org.eclipse.jpt.jpa.core.context.persistence.MappingFileRef; >@@ -192,18 +203,6 @@ > this.initializeMetamodelFiles(); > } > >- /** >- * These lists are just copies of what is distributed across the context >- * model; so, if they have (virtually) changed, the resulting update has >- * already been triggered. We don't need to trigger another one here. >- */ >- @Override >- protected void addNonUpdateAspectNamesTo(Set<String> nonUpdateAspectNames) { >- super.addNonUpdateAspectNamesTo(nonUpdateAspectNames); >- nonUpdateAspectNames.add(GENERATORS_COLLECTION); >- nonUpdateAspectNames.add(QUERIES_COLLECTION); >- } >- > > // ********** synchronize/update ********** > >@@ -233,32 +232,10 @@ > this.setSpecifiedValidationMode_(this.buildSpecifiedValidationMode()); > } > >- // TODO bjv calculate generators and queries directly... >- /** >- * The 'generators' and 'queries' collections are simply cleared out with >- * each "update" and completely rebuilt as the "update" cascades through >- * the persistence unit. When the persistence unit's "update" is >- * complete, the collections have been populated and we fire change events. >- * <p> >- * Note: Clearing and rebuilding 'generators' and 'queries' should work OK >- * since JPA project "synchronization" is single-threaded. >- * (Either the it takes place synchronously on a single thread or >- * asynchronously in jobs that are synchronized via scheduling rules.) >- * <p> >- * See calls to the following:<ul> >- * <li>{@link #addGenerator(Generator)} >- * <li>{@link #addQuery(Query)} >- * </ul> >- * [see bug 311093 before attempting to change how this works] >- */ > @Override > public void update() { > super.update(); > >- // see method comment above >- this.generators.clear(); >- this.queries.clear(); >- > this.setDefaultTransactionType(this.buildDefaultTransactionType()); > > // update specified class refs before mapping file refs because of >@@ -279,12 +256,11 @@ > > this.updatePersistenceUnitMetadata(); > >+ this.setGenerators(this.buildGenerators()); >+ this.setQueries(this.buildQueries()); >+ > this.setDefaultSharedCacheMode(this.buildDefaultSharedCacheMode()); > this.setDefaultValidationMode(this.buildDefaultValidationMode()); >- >- // see method comment above >- this.fireCollectionChanged(GENERATORS_COLLECTION, this.generators); >- this.fireCollectionChanged(QUERIES_COLLECTION, this.queries); > } > > >@@ -478,7 +454,7 @@ > } > }; > } >- >+ > protected ListIterable<MappingFileRef> getMappingFileRefs() { > return (this.impliedMappingFileRef == null) ? > this.getSpecifiedMappingFileRefs() : >@@ -711,16 +687,16 @@ > public int jarFileRefsSize() { > return this.jarFileRefs.size(); > } >- >- protected Iterator<String> jarFileNames() { >- return new TransformationIterator<JarFileRef, String>(this.jarFileRefs()) { >+ >+ protected Iterable<String> getJarFileNames() { >+ return new TransformationIterable<JarFileRef, String>(this.getJarFileRefs()) { > @Override > protected String transform(JarFileRef jarFileRef) { > return jarFileRef.getFileName(); > } > }; > } >- >+ > public JarFileRef addJarFileRef(String fileName) { > return this.addJarFileRef(this.jarFileRefs.size(), fileName); > } >@@ -832,15 +808,18 @@ > return this.specifiedClassRefs.size() + this.impliedClassRefs.size(); > } > >- protected Iterator<String> classRefNames() { >- return new TransformationIterator<ClassRef, String>(this.classRefs()) { >+ /** >+ * Return the class ref names, both specified and implied. >+ */ >+ protected Iterable<String> getClassRefNames() { >+ return new TransformationIterable<ClassRef, String>(this.getClassRefs()) { > @Override > protected String transform(ClassRef classRef) { > return classRef.getClassName(); > } > }; > } >- >+ > > // ********** specified class refs ********** > >@@ -1573,340 +1552,474 @@ > > public Iterable<String> getUniqueGeneratorNames() { > HashSet<String> names = new HashSet<String>(this.generators.size()); >- this.addNonNullGeneratorNamesTo(names); >+ this.addNonEmptyGeneratorNamesTo(names); > return names; > } > >- protected void addNonNullGeneratorNamesTo(Set<String> names) { >+ protected void addNonEmptyGeneratorNamesTo(Set<String> names) { > for (Generator generator : this.getGenerators()) { > String generatorName = generator.getName(); >- if (generatorName != null) { >+ if (StringTools.stringIsNotEmpty(generatorName)) { > names.add(generatorName); > } > } > } > >- >- // ********** queries ********** >- >- public Iterator<Query> queries() { >- return new CloneIterator<Query>(this.queries); >- } >- >- public int queriesSize() { >- return this.queries.size(); >+ protected void setGenerators(Iterable<Generator> generators) { >+ this.synchronizeCollection(generators, this.generators, GENERATORS_COLLECTION); > } > >- public void addQuery(Query query) { >- this.queries.add(query); >- } >+ /** >+ * We only hold "active" generators; i.e. the mapping file generators and >+ * the Java generators that are not "overridden" by mapping file >+ * generators (by generator name). >+ */ >+ protected Iterable<Generator> buildGenerators() { >+ ArrayList<Generator> generatorList = new ArrayList<Generator>(); > >+ this.addMappingFileGeneratorsTo(generatorList); > >- // ********** validation ********** >+ HashMap<String, ArrayList<Generator>> mappingFileGenerators = this.mapGeneratorsByName(this.getMappingFileGenerators()); >+ HashMap<String, ArrayList<Generator>> javaGenerators = this.mapGeneratorsByName(this.getJavaGenerators()); >+ for (Map.Entry<String, ArrayList<Generator>> javaGeneratorEntry : javaGenerators.entrySet()) { >+ if (mappingFileGenerators.get(javaGeneratorEntry.getKey()) == null) { >+ generatorList.addAll(javaGeneratorEntry.getValue()); >+ } >+ } > >- @Override >- public void validate(List<IMessage> messages, IReporter reporter) { >- super.validate(messages, reporter); >- this.validateMappingFiles(messages, reporter); >- this.validateClassRefs(messages, reporter); >- this.validateJarFileRefs(messages, reporter); >- this.validateProperties(messages, reporter); >+ return generatorList; > } > >- protected void validateMappingFiles(List<IMessage> messages, IReporter reporter) { >- this.checkForMultiplePersistenceUnitMetadata(messages); >- this.checkForDuplicateMappingFiles(messages); >- for (MappingFileRef mappingFileRef : this.getMappingFileRefs()) { >- mappingFileRef.validate(messages, reporter); >- } >+ protected Iterable<Generator> getMappingFileGenerators() { >+ ArrayList<Generator> generatorList = new ArrayList<Generator>(); >+ this.addMappingFileGeneratorsTo(generatorList); >+ return generatorList; > } > >- protected void checkForMultiplePersistenceUnitMetadata(List<IMessage> messages) { >- boolean first = true; >+ protected void addMappingFileGeneratorsTo(ArrayList<Generator> generatorList) { > for (MappingFileRef mappingFileRef : this.getMappingFileRefs()) { >- if (mappingFileRef.persistenceUnitMetadataExists()) { >- if (first) { >- first = false; >- } else { >- messages.add( >- DefaultJpaValidationMessages.buildMessage( >- IMessage.NORMAL_SEVERITY, >- JpaValidationMessages.MAPPING_FILE_EXTRANEOUS_PERSISTENCE_UNIT_METADATA, >- new String[] {mappingFileRef.getFileName()}, >- mappingFileRef >- ) >- ); >+ MappingFile mappingFile = mappingFileRef.getMappingFile(); >+ // TODO bjv - bogus cast - need to add API to MappingFileRef? >+ if (mappingFile instanceof OrmXml) { >+ EntityMappings entityMappings = ((OrmXml) mappingFile).getRoot(); >+ if (entityMappings != null) { >+ CollectionTools.addAll(generatorList, entityMappings.getSequenceGenerators()); >+ CollectionTools.addAll(generatorList, entityMappings.getTableGenerators()); > } > } > } >+ this.addGeneratorsTo(this.getMappingFilePersistentTypes(), generatorList); > } > >- protected void checkForDuplicateMappingFiles(List<IMessage> messages) { >- HashBag<String> fileNames = new HashBag<String>(); >- CollectionTools.addAll(fileNames, this.mappingFileRefNames()); >- for (MappingFileRef mappingFileRef : this.getMappingFileRefs()) { >- String fileName = mappingFileRef.getFileName(); >- if (fileNames.count(fileName) > 1) { >- messages.add( >- DefaultJpaValidationMessages.buildMessage( >- IMessage.HIGH_SEVERITY, >- JpaValidationMessages.PERSISTENCE_UNIT_DUPLICATE_MAPPING_FILE, >- new String[] {fileName}, >- mappingFileRef, >- mappingFileRef.getValidationTextRange() >- ) >- ); >- } >- } >+ /** >+ * Include "overridden" Java generators. >+ */ >+ protected Iterable<Generator> getJavaGenerators() { >+ ArrayList<Generator> generatorList = new ArrayList<Generator>(); >+ this.addJavaGeneratorsTo(generatorList); >+ return generatorList; > } > >- protected void validateClassRefs(List<IMessage> messages, IReporter reporter) { >- this.checkForDuplicateClasses(messages); >- for (Iterator<ClassRef> stream = this.classRefs(); stream.hasNext(); ) { >- stream.next().validate(messages, reporter); >- } >+ /** >+ * Include "overridden" Java generators. >+ */ >+ protected void addJavaGeneratorsTo(ArrayList<Generator> generatorList) { >+ this.addGeneratorsTo(this.getAllJavaPersistentTypesUnique(), generatorList); > } > >- protected void checkForDuplicateClasses(List<IMessage> messages) { >- HashBag<String> javaClassNames = new HashBag<String>(); >- CollectionTools.addAll(javaClassNames, this.classRefNames()); >- for (Iterator<ClassRef> stream = this.classRefs(); stream.hasNext(); ) { >- ClassRef classRef = stream.next(); >- String javaClassName = classRef.getClassName(); >- if ((javaClassName != null) && (javaClassNames.count(javaClassName) > 1)) { >- messages.add( >- DefaultJpaValidationMessages.buildMessage( >- IMessage.HIGH_SEVERITY, >- JpaValidationMessages.PERSISTENCE_UNIT_DUPLICATE_CLASS, >- new String[] {javaClassName}, >- classRef, >- classRef.getValidationTextRange() >- ) >- ); >+ // TODO bjv - bogus casts - need to delegate... >+ protected void addGeneratorsTo(Iterable<PersistentType> persistentTypes, ArrayList<Generator> generatorList) { >+ for (PersistentType persistentType : persistentTypes) { >+ TypeMapping typeMapping = persistentType.getMapping(); >+ if (typeMapping instanceof Entity) { >+ this.addGeneratorsTo(((Entity) typeMapping).getGeneratorContainer(), generatorList); >+ } >+ for (ReadOnlyPersistentAttribute persistentAttribute : CollectionTools.iterable(persistentType.attributes())) { >+ AttributeMapping attributeMapping = persistentAttribute.getMapping(); >+ if (attributeMapping instanceof IdMapping) { >+ this.addGeneratorsTo(((IdMapping) attributeMapping).getGeneratorContainer(), generatorList); >+ } > } > } > } > >- protected void validateJarFileRefs(List<IMessage> messages, IReporter reporter) { >- this.checkForDuplicateJarFileRefs(messages); >- for (JarFileRef each : CollectionTools.iterable(this.jarFileRefs())) { >- each.validate(messages, reporter); >+ protected void addGeneratorsTo(GeneratorContainer generatorContainer, ArrayList<Generator> generatorList) { >+ Generator generator = generatorContainer.getSequenceGenerator(); >+ if (generator != null) { >+ generatorList.add(generator); >+ } >+ generator = generatorContainer.getTableGenerator(); >+ if (generator != null) { >+ generatorList.add(generator); > } > } > >- protected void checkForDuplicateJarFileRefs(List<IMessage> messages) { >- HashBag<String> jarFileNames = new HashBag<String>(); >- CollectionTools.addAll(jarFileNames, this.jarFileNames()); >- for (JarFileRef jarFileRef : CollectionTools.iterable(this.jarFileRefs())) { >- String jarFileName = jarFileRef.getFileName(); >- if ((jarFileName != null) && (jarFileNames.count(jarFileName) > 1)) { >- messages.add( >- DefaultJpaValidationMessages.buildMessage( >- IMessage.HIGH_SEVERITY, >- JpaValidationMessages.PERSISTENCE_UNIT_DUPLICATE_JAR_FILE, >- new String[] {jarFileName}, >- jarFileRef, >- jarFileRef.getValidationTextRange() >- ) >- ); >+ protected HashMap<String, ArrayList<Generator>> mapGeneratorsByName(Iterable<Generator> generatorList) { >+ HashMap<String, ArrayList<Generator>> map = new HashMap<String, ArrayList<Generator>>(); >+ for (Generator generator : generatorList) { >+ String generatorName = generator.getName(); >+ ArrayList<Generator> list = map.get(generatorName); >+ if (list == null) { >+ list = new ArrayList<Generator>(); >+ map.put(generatorName, list); > } >+ list.add(generator); > } >+ return map; > } > >- protected void validateProperties(@SuppressWarnings("unused") List<IMessage> messages, @SuppressWarnings("unused") IReporter reporter) { >- // do nothing by default >- } >- >- public boolean validatesAgainstDatabase() { >- return this.connectionProfileIsActive(); >- } >- >- public TextRange getValidationTextRange() { >- TextRange textRange = this.xmlPersistenceUnit.getValidationTextRange(); >- return (textRange != null) ? textRange : this.getPersistence().getValidationTextRange(); >- } > >- // ********** refactoring ********** >+ // ********** queries ********** > >- public Iterable<DeleteEdit> createDeleteTypeEdits(final IType type) { >- return new CompositeIterable<DeleteEdit>( >- new TransformationIterable<ClassRef, Iterable<DeleteEdit>>(this.getSpecifiedClassRefs()) { >- @Override >- protected Iterable<DeleteEdit> transform(ClassRef classRef) { >- return classRef.createDeleteTypeEdits(type); >- } >- } >- ); >+ public Iterator<Query> queries() { >+ return this.getQueries().iterator(); > } > >- public Iterable<DeleteEdit> createDeleteMappingFileEdits(final IFile file) { >- return new CompositeIterable<DeleteEdit>( >- new TransformationIterable<MappingFileRef, Iterable<DeleteEdit>>(this.getSpecifiedMappingFileRefs()) { >- @Override >- protected Iterable<DeleteEdit> transform(MappingFileRef mappingFileRef) { >- return mappingFileRef.createDeleteMappingFileEdits(file); >- } >- } >- ); >+ protected Iterable<Query> getQueries() { >+ return new LiveCloneIterable<Query>(this.queries); > } > >- @SuppressWarnings("unchecked") >- public Iterable<ReplaceEdit> createRenameTypeEdits(IType originalType, String newName) { >- return new CompositeIterable<ReplaceEdit>( >- this.createSpecifiedClassRefRenameTypeEdits(originalType, newName), >- this.createPersistenceUnitPropertiesRenameTypeEdits(originalType, newName)); >+ public int queriesSize() { >+ return this.queries.size(); > } > >- protected Iterable<ReplaceEdit> createSpecifiedClassRefRenameTypeEdits(final IType originalType, final String newName) { >- return new CompositeIterable<ReplaceEdit>( >- new TransformationIterable<ClassRef, Iterable<ReplaceEdit>>(this.getSpecifiedClassRefs()) { >- @Override >- protected Iterable<ReplaceEdit> transform(ClassRef classRef) { >- return classRef.createRenameTypeEdits(originalType, newName); >- } >- } >- ); >+ public void addQuery(Query query) { >+ this.queries.add(query); > } > >- protected Iterable<ReplaceEdit> createPersistenceUnitPropertiesRenameTypeEdits(IType originalType, String newName) { >- return this.options.createRenameTypeEdits(originalType, newName); >+ protected void setQueries(Iterable<Query> queries) { >+ this.synchronizeCollection(queries, this.queries, QUERIES_COLLECTION); > } > >- @SuppressWarnings("unchecked") >- public Iterable<ReplaceEdit> createMoveTypeEdits(IType originalType, IPackageFragment newPackage) { >- return new CompositeIterable<ReplaceEdit>( >- this.createSpecifiedClassRefMoveTypeEdits(originalType, newPackage), >- this.createPersistenceUnitPropertiesMoveTypeEdits(originalType, newPackage)); >- } >+ /** >+ * We only hold "active" queries; i.e. the mapping file queries and >+ * the Java queries that are not "overridden" by mapping file >+ * queries (by query name). >+ */ >+ protected Iterable<Query> buildQueries() { >+ ArrayList<Query> queryList = new ArrayList<Query>(); > >- protected Iterable<ReplaceEdit> createSpecifiedClassRefMoveTypeEdits(final IType originalType, final IPackageFragment newPackage) { >- return new CompositeIterable<ReplaceEdit>( >- new TransformationIterable<ClassRef, Iterable<ReplaceEdit>>(this.getSpecifiedClassRefs()) { >- @Override >- protected Iterable<ReplaceEdit> transform(ClassRef classRef) { >- return classRef.createMoveTypeEdits(originalType, newPackage); >- } >+ this.addMappingFileQueriesTo(queryList); >+ >+ HashMap<String, ArrayList<Query>> mappingFileQueries = this.mapQueriesByName(this.getMappingFileQueries()); >+ HashMap<String, ArrayList<Query>> javaQueries = this.mapQueriesByName(this.getJavaQueries()); >+ for (Map.Entry<String, ArrayList<Query>> javaQueryEntry : javaQueries.entrySet()) { >+ if (mappingFileQueries.get(javaQueryEntry.getKey()) == null) { >+ queryList.addAll(javaQueryEntry.getValue()); > } >- ); >- } >+ } > >- protected Iterable<ReplaceEdit> createPersistenceUnitPropertiesMoveTypeEdits(IType originalType, IPackageFragment newPackage) { >- return this.options.createMoveTypeEdits(originalType, newPackage); >+ return queryList; > } > >- >- @SuppressWarnings("unchecked") >- public Iterable<ReplaceEdit> createRenamePackageEdits(IPackageFragment originalPackage, String newName) { >- return new CompositeIterable<ReplaceEdit>( >- this.createSpecifiedClassRefRenamePackageEdits(originalPackage, newName), >- this.createPersistenceUnitPropertiesRenamePackageEdits(originalPackage, newName)); >+ protected Iterable<Query> getMappingFileQueries() { >+ ArrayList<Query> queryList = new ArrayList<Query>(); >+ this.addMappingFileQueriesTo(queryList); >+ return queryList; > } > >- protected Iterable<ReplaceEdit> createSpecifiedClassRefRenamePackageEdits(final IPackageFragment originalPackage, final String newName) { >- return new CompositeIterable<ReplaceEdit>( >- new TransformationIterable<ClassRef, Iterable<ReplaceEdit>>(this.getSpecifiedClassRefs()) { >- @Override >- protected Iterable<ReplaceEdit> transform(ClassRef classRef) { >- return classRef.createRenamePackageEdits(originalPackage, newName); >+ protected void addMappingFileQueriesTo(ArrayList<Query> queryList) { >+ for (MappingFileRef mappingFileRef : this.getMappingFileRefs()) { >+ MappingFile mappingFile = mappingFileRef.getMappingFile(); >+ // TODO bjv - bogus cast - need to add API to MappingFileRef? >+ if (mappingFile instanceof OrmXml) { >+ EntityMappings entityMappings = ((OrmXml) mappingFile).getRoot(); >+ if (entityMappings != null) { >+ this.addQueriesTo(entityMappings.getQueryContainer(), queryList); > } > } >- ); >+ } >+ this.addMappingFileQueriesTo(this.getMappingFilePersistentTypes(), queryList); > } > >- protected Iterable<ReplaceEdit> createPersistenceUnitPropertiesRenamePackageEdits(IPackageFragment originalPackage, String newName) { >- return this.options.createRenamePackageEdits(originalPackage, newName); >+ // TODO bjv - bogus casts - need to delegate... >+ protected void addMappingFileQueriesTo(Iterable<PersistentType> persistentTypes, ArrayList<Query> queryList) { >+ for (PersistentType persistentType : persistentTypes) { >+ TypeMapping typeMapping = persistentType.getMapping(); >+ if (typeMapping instanceof Entity) { >+ this.addQueriesTo(((Entity) typeMapping).getQueryContainer(), queryList); >+ } >+ // spec does not allow queries to be defined on mapped superclasses in orm.xml (huh?) >+ } > } > >- public Iterable<ReplaceEdit> createRenameFolderEdits(final IFolder originalFolder, final String newName) { >- return this.createMappingFileRefRenameFolderEdits(originalFolder, newName); >+ /** >+ * Include "overridden" Java queries. >+ */ >+ protected Iterable<Query> getJavaQueries() { >+ ArrayList<Query> queryList = new ArrayList<Query>(); >+ this.addJavaQueriesTo(queryList); >+ return queryList; > } > >- protected Iterable<ReplaceEdit> createMappingFileRefRenameFolderEdits(final IFolder originalFolder, final String newName) { >- return new CompositeIterable<ReplaceEdit>( >- new TransformationIterable<MappingFileRef, Iterable<ReplaceEdit>>(this.getSpecifiedMappingFileRefs()) { >- @Override >- protected Iterable<ReplaceEdit> transform(MappingFileRef mappingFileRef) { >- return mappingFileRef.createRenameFolderEdits(originalFolder, newName); >- } >- } >- ); >+ /** >+ * Include "overridden" Java queries. >+ */ >+ protected void addJavaQueriesTo(ArrayList<Query> queryList) { >+ this.addJavaQueriesTo(this.getAllJavaPersistentTypesUnique(), queryList); > } > >- public Iterable<ReplaceEdit> createRenameMappingFileEdits(final IFile originalFile, final String newName) { >- return new CompositeIterable<ReplaceEdit>( >- new TransformationIterable<MappingFileRef, Iterable<ReplaceEdit>>(this.getMappingFileRefs()) { >- @Override >- protected Iterable<ReplaceEdit> transform(MappingFileRef mappingFileRef) { >- return mappingFileRef.createRenameMappingFileEdits(originalFile, newName); >- } >+ // TODO bjv - bogus casts - need to delegate... >+ protected void addJavaQueriesTo(Iterable<PersistentType> persistentTypes, ArrayList<Query> queryList) { >+ for (PersistentType persistentType : persistentTypes) { >+ TypeMapping typeMapping = persistentType.getMapping(); >+ if (typeMapping instanceof Entity) { >+ this.addQueriesTo(((Entity) typeMapping).getQueryContainer(), queryList); > } >- ); >+// TODO not yet supported by Dali >+// else if (typeMapping instanceof MappedSuperclass) { >+// this.addQueriesTo(((MappedSuperclass) typeMapping).getQueryContainer(), queryList); >+// } >+ } > } > >- public int findInsertLocationForMappingFileRef() { >- return this.xmlPersistenceUnit.getLocationToInsertMappingFileRef(); >+ protected void addQueriesTo(QueryContainer queryContainer, ArrayList<Query> queryList) { >+ CollectionTools.addAll(queryList, queryContainer.namedQueries()); >+ CollectionTools.addAll(queryList, queryContainer.namedNativeQueries()); > } > >- public Iterable<ReplaceEdit> createMoveMappingFileEdits(final IFile originalFile, final IPath runtineDestination) { >- return new CompositeIterable<ReplaceEdit>( >- new TransformationIterable<MappingFileRef, Iterable<ReplaceEdit>>(this.getMappingFileRefs()) { >- @Override >- protected Iterable<ReplaceEdit> transform(MappingFileRef mappingFileRef) { >- return mappingFileRef.createMoveMappingFileEdits(originalFile, runtineDestination); >- } >+ protected HashMap<String, ArrayList<Query>> mapQueriesByName(Iterable<Query> queryList) { >+ HashMap<String, ArrayList<Query>> map = new HashMap<String, ArrayList<Query>>(); >+ for (Query query : queryList) { >+ String queryName = query.getName(); >+ ArrayList<Query> list = map.get(queryName); >+ if (list == null) { >+ list = new ArrayList<Query>(); >+ map.put(queryName, list); > } >- ); >+ list.add(query); >+ } >+ return map; > } > >- public Iterable<ReplaceEdit> createMoveFolderEdits(final IFolder originalFolder, final IPath runtimeDestination) { >- return this.createMappingFileRefMoveFolderReplaceEdits(originalFolder, runtimeDestination); >+ >+ // ********** persistent types ********** >+ >+ @SuppressWarnings("unchecked") >+ public Iterable<PersistentType> getPersistentTypes() { >+ return new CompositeIterable<PersistentType>( >+ this.getMappingFilePersistentTypes(), >+ this.getJavaPersistentTypes() >+ ); > } > >- protected Iterable<ReplaceEdit> createMappingFileRefMoveFolderReplaceEdits(final IFolder originalFolder, final IPath runtimeDestination) { >- return new CompositeIterable<ReplaceEdit>( >- new TransformationIterable<MappingFileRef, Iterable<ReplaceEdit>>(this.getSpecifiedMappingFileRefs()) { >- @Override >- protected Iterable<ReplaceEdit> transform(MappingFileRef mappingFileRef) { >- return mappingFileRef.createMoveFolderEdits(originalFolder, runtimeDestination); >- } >+ protected Iterable<PersistentType> getMappingFilePersistentTypes() { >+ return new CompositeIterable<PersistentType>(this.getMappingFilePersistentTypeLists()); >+ } >+ >+ protected Iterable<Iterable<? extends PersistentType>> getMappingFilePersistentTypeLists() { >+ return new TransformationIterable<PersistentTypeContainer, Iterable<? extends PersistentType>>( >+ this.getMappingFileRefs(), >+ PersistentTypeContainer.TRANSFORMER >+ ); >+ } >+ >+ /** >+ * Return the non-<code>null</code> mapping file Java persistent types; >+ * i.e. the Java persistent types corresponding to the mapping file >+ * persistent types that are not marked "metadata complete". >+ * @see #getAllJavaPersistentTypesUnique() >+ */ >+ protected Iterable<PersistentType> getMappingFileJavaPersistentTypes() { >+ return new FilteringIterable<PersistentType>( >+ this.getMappingFileJavaPersistentTypes_(), >+ NotNullFilter.<PersistentType>instance() >+ ); >+ } >+ >+ /** >+ * The returned list will contain a <code>null</code> for each mapping file >+ * persistent type that does not correspond to an existing Java type or is >+ * marked "metadata complete". >+ * @see #getMappingFileJavaPersistentTypes() >+ */ >+ // TODO bjv remove - bogus cast to OrmPersistentType - probably need to add API to MappingFile >+ // getOverriddenPersistentTypes()? >+ protected Iterable<PersistentType> getMappingFileJavaPersistentTypes_() { >+ return new TransformationIterable<PersistentType, PersistentType>(this.getMappingFilePersistentTypes()) { >+ @Override >+ protected PersistentType transform(PersistentType mappingFilePersistentType) { >+ return (mappingFilePersistentType instanceof OrmPersistentType) ? >+ this.transform((OrmPersistentType) mappingFilePersistentType) : >+ null; >+ } >+ protected PersistentType transform(OrmPersistentType mappingFilePersistentType) { >+ return mappingFilePersistentType.getMapping().isMetadataComplete() ? >+ null : >+ mappingFilePersistentType.getJavaPersistentType(); > } >- ); >+ }; > } > >- // ********** misc ********** >+ /** >+ * Return the persistence unit's Java persistent types, as specified by >+ * the class refs (both specified and implied) and jar files. >+ * There can be duplicate types, and any of them may be overridden by a >+ * mapping file persistence type. >+ * @see #getMappingFilePersistentTypes() >+ */ >+ @SuppressWarnings("unchecked") >+ protected Iterable<PersistentType> getJavaPersistentTypes() { >+ return new CompositeIterable<PersistentType>( >+ this.getClassRefPersistentTypes(), >+ this.getJarFilePersistentTypes() >+ ); >+ } > >- public XmlPersistenceUnit getXmlPersistenceUnit() { >- return this.xmlPersistenceUnit; >+ /** >+ * Return the non-<code>null</code> class ref persistent types, >+ * both specified and implied. >+ */ >+ protected Iterable<PersistentType> getClassRefPersistentTypes() { >+ return new FilteringIterable<PersistentType>( >+ this.getClassRefPersistentTypes_(), >+ NotNullFilter.<PersistentType>instance() >+ ); > } > >- public JpaStructureNode getStructureNode(int textOffset) { >- for (Iterator<JarFileRef> stream = this.jarFileRefs(); stream.hasNext(); ) { >- JarFileRef jarFileRef = stream.next(); >- if (jarFileRef.containsOffset(textOffset)) { >- return jarFileRef; >+ /** >+ * Both specified and implied. May contain <code>null</code>s. >+ * @see #getClassRefPersistentTypes() >+ */ >+ protected Iterable<PersistentType> getClassRefPersistentTypes_() { >+ return new TransformationIterable<ClassRef, PersistentType>(this.getClassRefs()) { >+ @Override >+ protected PersistentType transform(ClassRef classRef) { >+ return classRef.getJavaPersistentType(); > } >+ }; >+ } >+ >+ /** >+ * We only get <em>annotated</em> types from jar files. >+ */ >+ protected Iterable<PersistentType> getJarFilePersistentTypes() { >+ return new CompositeIterable<PersistentType>(this.getJarFilePersistentTypeLists()); >+ } >+ >+ /** >+ * We only get <em>annotated</em> types from jar files. >+ */ >+ protected Iterable<Iterable<? extends PersistentType>> getJarFilePersistentTypeLists() { >+ return new TransformationIterable<PersistentTypeContainer, Iterable<? extends PersistentType>>( >+ this.getJarFileRefs(), >+ PersistentTypeContainer.TRANSFORMER >+ ); >+ } >+ >+ public PersistentType getPersistentType(String typeName) { >+ if (typeName == null) { >+ return null; > } >+ // search order is significant(?) > for (MappingFileRef mappingFileRef : this.getMappingFileRefs()) { >- if (mappingFileRef.containsOffset(textOffset)) { >- return mappingFileRef; >+ PersistentType persistentType = mappingFileRef.getPersistentType(typeName); >+ if (persistentType != null) { >+ return persistentType; > } > } >- for (Iterator<ClassRef> stream = this.classRefs(); stream.hasNext(); ) { >- ClassRef classRef = stream.next(); >- if (classRef.containsOffset(textOffset)) { >- return classRef; >+ for (ClassRef classRef : this.getClassRefs()) { >+ if (classRef.isFor(typeName)) { >+ return classRef.getJavaPersistentType(); > } > } >- return this; >+ for (JarFileRef jarFileRef : this.getJarFileRefs()) { >+ PersistentType persistentType = jarFileRef.getPersistentType(typeName); >+ if (persistentType != null) { >+ return persistentType; >+ } >+ } >+ return null; >+ } >+ >+ /** >+ * Ignore implied class refs and jar files. >+ */ >+ public boolean specifiesPersistentType(String typeName) { >+ for (ClassRef classRef : this.getSpecifiedClassRefs()) { >+ if (classRef.isFor(typeName)) { >+ return true; >+ } >+ } >+ for (MappingFileRef mappingFileRef : this.getMappingFileRefs()) { >+ if (mappingFileRef.getPersistentType(typeName) != null) { >+ return true; >+ } >+ } >+ return false; >+ } >+ >+ /** >+ * Return a list of <em>all</em> the persistence unit's Java persistent >+ * types (including those referenced by the mapping files that are not >+ * marked "metadata complete") with those with duplicate names removed. >+ * Although this may not always be true, assume persistent types with >+ * the same name reference the same Java type. (<strong>NB:</strong> >+ * It's possible that a Java class in a jar file has the same name as a >+ * Java class in the project and they be different....) >+ * <p> >+ * This is really only useful for the calculation of generators and queries, >+ * which can be defined in Java annotations but still be "active" even >+ * though their corresponding Java types/attributes have been overridden in >+ * a mapping file. >+ * <p> >+ * The order of precedence:<ul> >+ * <li>mapping files >+ * <li>persistence unit class refs >+ * <li>jar files >+ * </ul> >+ */ >+ protected Iterable<PersistentType> getAllJavaPersistentTypesUnique() { >+ // order is significant(?) >+ HashMap<String, PersistentType> map = new HashMap<String, PersistentType>(); >+ this.addPersistentTypesTo(this.getJarFilePersistentTypes(), map); >+ this.addPersistentTypesTo(this.getClassRefPersistentTypes(), map); >+ this.addPersistentTypesTo(this.getMappingFileJavaPersistentTypes(), map); >+ return map.values(); >+ } >+ >+ /** >+ * Add the specified persistent types to >+ * the specified map keyed by persistent type name. >+ */ >+ protected void addPersistentTypesTo(Iterable<? extends PersistentType> persistentTypes, HashMap<String, PersistentType> persistentTypeMap) { >+ for (PersistentType pt : persistentTypes) { >+ String ptName = pt.getName(); >+ if (ptName != null) { >+ persistentTypeMap.put(ptName, pt); >+ } >+ } >+ } >+ >+ >+ // ********** type mappings ********** >+ >+ public Entity getEntity(String typeName) { >+ TypeMapping typeMapping = this.getTypeMapping(typeName); >+ return (typeMapping instanceof Entity) ? (Entity) typeMapping : null; >+ } >+ >+ public Embeddable getEmbeddable(String typeName) { >+ TypeMapping typeMapping = this.getTypeMapping(typeName); >+ return (typeMapping instanceof Embeddable) ? (Embeddable) typeMapping : null; >+ } >+ >+ // TODO bjv - this should probably *not* return Java type mappings when PU is "metadata complete"... >+ protected TypeMapping getTypeMapping(String typeName) { >+ PersistentType persistentType = this.getPersistentType(typeName); >+ return (persistentType == null) ? null : persistentType.getMapping(); > } > >- // ------------------- all entities ----------------- > public Iterable<Entity> getEntities() { >- return new SubIterableWrapper<TypeMapping, Entity>(this.getEntities_()); >+ return this.filterToEntities(this.getTypeMappings()); > } > >- protected Iterable<TypeMapping> getEntities_() { >- return new FilteringIterable<TypeMapping>(this.getTypeMappings()) { >+ protected Iterable<Entity> filterToEntities(Iterable<TypeMapping> typeMappings) { >+ return new SubIterableWrapper<TypeMapping, Entity>(this.filterToEntities_(typeMappings)); >+ } >+ >+ protected Iterable<TypeMapping> filterToEntities_(Iterable<TypeMapping> typeMappings) { >+ return new FilteringIterable<TypeMapping>(typeMappings) { > @Override > protected boolean accept(TypeMapping typeMapping) { > return typeMapping instanceof Entity; >@@ -1914,6 +2027,7 @@ > }; > } > >+ // TODO bjv - this should probably *not* return Java type mappings when PU is "metadata complete"... > protected Iterable<TypeMapping> getTypeMappings() { > return new TransformationIterable<PersistentType, TypeMapping>(this.getPersistentTypes()) { > @Override >@@ -1923,6 +2037,54 @@ > }; > } > >+ >+ // ********** mapping file type mappings ********** >+ >+ /** >+ * Return a map of the entities defined in the persistence unit's mapping files, >+ * keyed by entity name. Since there can be (erroneously) duplicate entity >+ * names, each entity name is mapped to a <em>list</em> of entities. >+ */ >+ protected HashMap<String, ArrayList<Entity>> mapMappingFileEntitiesByName() { >+ return this.mapTypeMappingsByName(this.getMappingFileEntities()); >+ } >+ >+ protected <M extends TypeMapping> HashMap<String, ArrayList<M>> mapTypeMappingsByName(Iterable<M> typeMappings) { >+ HashMap<String, ArrayList<M>> map = new HashMap<String, ArrayList<M>>(); >+ for (M typeMapping : typeMappings) { >+ String typeMappingName = typeMapping.getName(); >+ ArrayList<M> list = map.get(typeMappingName); >+ if (list == null) { >+ list = new ArrayList<M>(); >+ map.put(typeMappingName, list); >+ } >+ list.add(typeMapping); >+ } >+ return map; >+ } >+ >+ /** >+ * Return all the entities defined in the persistence unit's mapping files >+ * (i.e. excluding the Java entities). >+ */ >+ protected Iterable<Entity> getMappingFileEntities() { >+ return this.filterToEntities(this.getMappingFileTypeMappings()); >+ } >+ >+ /** >+ * Return all the type mappings defined in the persistence unit's mapping >+ * files (i.e. excluding the Java type mappings). >+ */ >+ protected Iterable<TypeMapping> getMappingFileTypeMappings() { >+ return new TransformationIterable<PersistentType, TypeMapping>(this.getMappingFilePersistentTypes()) { >+ @Override >+ protected TypeMapping transform(PersistentType persistentType) { >+ return persistentType.getMapping(); >+ } >+ }; >+ } >+ >+ // TODO remove VVVVVVVVVVVVVVVVV > public Iterable<String> getOrmMappedClassNames() { > return new TransformationIterable<PersistentType, String>(this.getMappingFilePersistentTypes()) { > @Override >@@ -1932,242 +2094,501 @@ > }; > } > >- // ------------------ orm entities -------------------- >- public Map<String, Set<String>> mapEntityNameToClassNames() { >- HashSet<String> classNames = new HashSet<String>(); >- Map<String, Set<String>> map = new HashMap<String, Set<String>>(); >- for (String entityName : this.getFilteredEntityNames()) { >- CollectionTools.addAll(classNames, getFilteredOrmClassNames(entityName)); >- map.put(entityName, classNames); >+ public Map<String, Set<String>> mapEntityNameToClassNames() { >+ HashMap<String, ArrayList<Entity>> mappingFileEntitiesByName = this.mapMappingFileEntitiesByName(); >+ HashMap<String, Set<String>> map = new HashMap<String, Set<String>>(mappingFileEntitiesByName.size()); >+ for (Map.Entry<String, ArrayList<Entity>> entry : mappingFileEntitiesByName.entrySet()) { >+ String entityName = entry.getKey(); >+ ArrayList<Entity> entities = entry.getValue(); >+ HashSet<String> entityClassNames = new HashSet<String>(entities.size()); >+ for (Entity entity : entities) { >+ entityClassNames.add(entity.getPersistentType().getName()); >+ } >+ map.put(entityName, entityClassNames); >+ } >+ return map; >+ } >+ >+ public Iterator<String> ormEntityNames() { >+ return this.getMappingFileEntityNames().iterator(); >+ } >+ >+ protected Iterable<String> getMappingFileEntityNames() { >+ return new TransformationIterable<Entity, String>(this.getMappingFileEntities()) { >+ @Override >+ protected String transform(Entity entity) { >+ return entity.getName(); >+ } >+ }; >+ } >+ >+ public Iterable<Entity> getOrmEntities() { >+ return this.getMappingFileEntities(); >+ } >+ // remove ^^^^^^^^^^^^^^^^^ >+ >+ >+ // ********** Java type mappings ********** >+ >+ // TODO remove VVVVVVVVVVVVVVVVV >+ /** >+ * These may be overridden in the mapping files. >+ * @see #getJavaPersistentTypes() >+ */ >+ public Iterable<Entity> getJavaEntities() { >+ return this.filterToEntities(this.getJavaTypeMappings()); >+ } >+ >+ /** >+ * These may be overridden in the mapping files. >+ * @see #getJavaPersistentTypes() >+ */ >+ protected Iterable<TypeMapping> getJavaTypeMappings() { >+ return new TransformationIterable<PersistentType, TypeMapping>(this.getJavaPersistentTypes()) { >+ @Override >+ protected TypeMapping transform(PersistentType persistentType) { >+ return persistentType.getMapping(); >+ } >+ }; >+ } >+ >+ protected Iterator<String> javaEntityClassNames(){ >+ return new TransformationIterator<Entity, String>(this.getJavaEntities()) { >+ @Override >+ protected String transform(Entity javaEntity) { >+ return javaEntity.getPersistentType().getName(); >+ } >+ }; >+ } >+ >+ public Iterator<String> javaEntityNamesExclOverridden() { >+ HashSet<String> ormMappedClassNames = CollectionTools.set(this.getOrmMappedClassNames()); >+ List<String> javaEntityNamesExclOverridden = new ArrayList<String>(); >+ for (Iterator<String> javaEntityClassNames = this.javaEntityClassNames(); javaEntityClassNames.hasNext();){ >+ String javaEntityClassName = javaEntityClassNames.next(); >+ if (!ormMappedClassNames.contains(javaEntityClassName)) { >+ javaEntityNamesExclOverridden.add((this.getEntity(javaEntityClassName)).getName()); >+ } >+ } >+ return javaEntityNamesExclOverridden.iterator(); >+ } >+ >+ public Iterator<String> javaEntityNames(){ >+ return new TransformationIterator<Entity, String>(this.getJavaEntities()) { >+ @Override >+ protected String transform(Entity javaEntity) { >+ return javaEntity.getName(); >+ } >+ }; >+ } >+ // remove ^^^^^^^^^^^^^^^^^ >+ >+ >+ // ********** misc ********** >+ >+ public XmlPersistenceUnit getXmlPersistenceUnit() { >+ return this.xmlPersistenceUnit; >+ } >+ >+ public JpaStructureNode getStructureNode(int textOffset) { >+ for (JarFileRef jarFileRef : this.getJarFileRefs()) { >+ if (jarFileRef.containsOffset(textOffset)) { >+ return jarFileRef; >+ } >+ } >+ for (MappingFileRef mappingFileRef : this.getMappingFileRefs()) { >+ if (mappingFileRef.containsOffset(textOffset)) { >+ return mappingFileRef; >+ } >+ } >+ for (ClassRef classRef : this.getClassRefs()) { >+ if (classRef.containsOffset(textOffset)) { >+ return classRef; >+ } >+ } >+ return this; >+ } >+ >+ public boolean containsOffset(int textOffset) { >+ return (this.xmlPersistenceUnit != null) && this.xmlPersistenceUnit.containsOffset(textOffset); >+ } >+ >+ @Override >+ public void toString(StringBuilder sb) { >+ super.toString(sb); >+ sb.append(this.name); >+ } >+ >+ >+ // ********** validation ********** >+ >+ @Override >+ public void validate(List<IMessage> messages, IReporter reporter) { >+ super.validate(messages, reporter); >+ this.validateMappingFiles(messages, reporter); >+ this.validateClassRefs(messages, reporter); >+ this.validateJarFileRefs(messages, reporter); >+ this.validateProperties(messages, reporter); >+ this.validateGenerators(messages, reporter); >+ this.validateQueries(messages, reporter); >+ } >+ >+ protected void validateMappingFiles(List<IMessage> messages, IReporter reporter) { >+ this.checkForMultiplePersistenceUnitMetadata(messages); >+ this.checkForDuplicateMappingFiles(messages); >+ for (MappingFileRef mappingFileRef : this.getMappingFileRefs()) { >+ mappingFileRef.validate(messages, reporter); >+ } >+ } >+ >+ protected void checkForMultiplePersistenceUnitMetadata(List<IMessage> messages) { >+ boolean first = true; >+ for (MappingFileRef mappingFileRef : this.getMappingFileRefs()) { >+ if (mappingFileRef.persistenceUnitMetadataExists()) { >+ if (first) { >+ first = false; >+ } else { >+ messages.add( >+ DefaultJpaValidationMessages.buildMessage( >+ IMessage.NORMAL_SEVERITY, >+ JpaValidationMessages.MAPPING_FILE_EXTRANEOUS_PERSISTENCE_UNIT_METADATA, >+ new String[] {mappingFileRef.getFileName()}, >+ mappingFileRef >+ ) >+ ); >+ } >+ } >+ } >+ } >+ >+ protected void checkForDuplicateMappingFiles(List<IMessage> messages) { >+ HashBag<String> fileNames = CollectionTools.bag(this.mappingFileRefNames()); >+ for (MappingFileRef mappingFileRef : this.getMappingFileRefs()) { >+ String fileName = mappingFileRef.getFileName(); >+ if (fileNames.count(fileName) > 1) { >+ messages.add( >+ DefaultJpaValidationMessages.buildMessage( >+ IMessage.HIGH_SEVERITY, >+ JpaValidationMessages.PERSISTENCE_UNIT_DUPLICATE_MAPPING_FILE, >+ new String[] {fileName}, >+ mappingFileRef, >+ mappingFileRef.getValidationTextRange() >+ ) >+ ); >+ } >+ } >+ } >+ >+ protected void validateClassRefs(List<IMessage> messages, IReporter reporter) { >+ this.checkForDuplicateClasses(messages); >+ for (ClassRef classRef : this.getClassRefs()) { >+ classRef.validate(messages, reporter); >+ } >+ } >+ >+ protected void checkForDuplicateClasses(List<IMessage> messages) { >+ HashBag<String> javaClassNames = CollectionTools.bag(this.getClassRefNames()); >+ for (ClassRef classRef : this.getClassRefs()) { >+ String javaClassName = classRef.getClassName(); >+ if ((javaClassName != null) && (javaClassNames.count(javaClassName) > 1)) { >+ messages.add( >+ DefaultJpaValidationMessages.buildMessage( >+ IMessage.HIGH_SEVERITY, >+ JpaValidationMessages.PERSISTENCE_UNIT_DUPLICATE_CLASS, >+ new String[] {javaClassName}, >+ classRef, >+ classRef.getValidationTextRange() >+ ) >+ ); >+ } >+ } >+ } >+ >+ protected void validateJarFileRefs(List<IMessage> messages, IReporter reporter) { >+ this.checkForDuplicateJarFileRefs(messages); >+ for (JarFileRef jarFileRef : this.getJarFileRefs()) { >+ jarFileRef.validate(messages, reporter); >+ } >+ } >+ >+ protected void checkForDuplicateJarFileRefs(List<IMessage> messages) { >+ HashBag<String> jarFileNames = CollectionTools.bag(this.getJarFileNames()); >+ for (JarFileRef jarFileRef : this.getJarFileRefs()) { >+ String jarFileName = jarFileRef.getFileName(); >+ if ((jarFileName != null) && (jarFileNames.count(jarFileName) > 1)) { >+ messages.add( >+ DefaultJpaValidationMessages.buildMessage( >+ IMessage.HIGH_SEVERITY, >+ JpaValidationMessages.PERSISTENCE_UNIT_DUPLICATE_JAR_FILE, >+ new String[] {jarFileName}, >+ jarFileRef, >+ jarFileRef.getValidationTextRange() >+ ) >+ ); >+ } >+ } >+ } >+ >+ protected void validateProperties(@SuppressWarnings("unused") List<IMessage> messages, @SuppressWarnings("unused") IReporter reporter) { >+ // do nothing by default >+ } >+ >+ /** >+ * We validate generators here because Java persistent types that are >+ * overridden in the <code>orm.xml</code> file are >+ * not validated, but they may contain generators that are still "active" >+ * and need to be validated >+ * (i.e. a generator is <em>not</em> overridden when its entity or ID >+ * mapping is overridden in the <code>orm.xml</code> file). >+ * <p> >+ * <strong>NB:</strong> <em>Any</em> <code>orm.xml</code> generator can >+ * override <em>any</em> Java generator with the same name; they need not >+ * be defined on the same entity or ID mapping. Just a bit inconsistent with >+ * the typical "override" in JPA.... >+ */ >+ protected void validateGenerators(List<IMessage> messages, IReporter reporter) { >+ this.checkForDuplicateGenerators(messages); >+ for (Generator generator : this.getGenerators()) { >+ this.validate(generator, messages, reporter); >+ } >+ } >+ >+ protected void checkForDuplicateGenerators(List<IMessage> messages) { >+ HashMap<String, ArrayList<Generator>> generatorsByName = this.mapGeneratorsByName(this.getGenerators()); >+ for (ArrayList<Generator> dups : generatorsByName.values()) { >+ if (dups.size() > 1) { >+ for (Generator dup : dups) { >+ messages.add( >+ DefaultJpaValidationMessages.buildMessage( >+ IMessage.HIGH_SEVERITY, >+ JpaValidationMessages.GENERATOR_DUPLICATE_NAME, >+ new String[] {dup.getName()}, >+ dup, >+ this.extractNameTextRange(dup) >+ ) >+ ); >+ } >+ } >+ } >+ } >+ >+ // TODO bjv isn't it obvious? >+ protected TextRange extractNameTextRange(Generator generator) { >+ return (generator instanceof OrmGenerator) ? >+ ((OrmGenerator) generator).getNameTextRange() : >+ ((JavaGenerator) generator).getNameTextRange(null); >+ } >+ >+ // TODO bjv isn't it obvious? >+ protected void validate(Generator generator, List<IMessage> messages, IReporter reporter) { >+ if (generator instanceof OrmGenerator) { >+ ((OrmGenerator) generator).validate(messages, reporter); >+ } else { >+ ((JavaGenerator) generator).validate(messages, reporter, null); > } >- return map; > } >- >- private Iterable<String> getFilteredOrmClassNames(String entityName){ >- List<String> classNames = new ArrayList<String>(); >- for (PersistentType persistentType: this.getFilteredOrmPersistentTypes()) { >- if (StringTools.stringsAreEqual(persistentType.getMapping().getName(), entityName)) { >- classNames.add(persistentType.getName()); >- } >+ >+ /** >+ * <strong>NB:</strong> We validate queries here. >+ * @see #validateGenerators(List, IReporter) >+ */ >+ protected void validateQueries(List<IMessage> messages, IReporter reporter) { >+ this.checkForDuplicateQueries(messages); >+ for (Query query : this.getQueries()) { >+ this.validate(query, messages, reporter); > } >- return classNames; >- } >- >- private Iterable<String> getFilteredEntityNames() { >- return new TransformationIterable<PersistentType, String>(this.getFilteredOrmPersistentTypes()) { >- @Override >- protected String transform(PersistentType persistentType) { >- return persistentType.getMapping().getName(); >- } >- }; > } >- >- private Iterable<PersistentType> getFilteredOrmPersistentTypes(){ >- List<PersistentType> filteredPersistentType = new ArrayList<PersistentType>(); >- HashBag<String> ormEntityNames = new HashBag<String>(); >- CollectionTools.addAll(ormEntityNames, this.ormEntityNames()); >- for (PersistentType persistentType : this.getOrmEntityPersistentTypes()) { >- if (ormEntityNames.count(persistentType.getMapping().getName()) > 1) { >- filteredPersistentType.add(persistentType); >+ >+ protected void checkForDuplicateQueries(List<IMessage> messages) { >+ HashMap<String, ArrayList<Query>> queriesByName = this.mapQueriesByName(this.getQueries()); >+ for (ArrayList<Query> dups : queriesByName.values()) { >+ if (dups.size() > 1) { >+ for (Query dup : dups) { >+ messages.add( >+ DefaultJpaValidationMessages.buildMessage( >+ IMessage.HIGH_SEVERITY, >+ JpaValidationMessages.QUERY_DUPLICATE_NAME, >+ new String[] {dup.getName()}, >+ dup, >+ this.extractNameTextRange(dup) >+ ) >+ ); >+ } > } > } >- return filteredPersistentType; > } > >- protected Iterator<String> ormEntityClassNames() { >- return new TransformationIterator<PersistentType, String>(this.getOrmEntityPersistentTypes()) { >- @Override >- protected String transform(PersistentType persistentType) { >- return persistentType.getName(); >- } >- }; >+ // TODO bjv isn't it obvious? >+ protected TextRange extractNameTextRange(Query query) { >+ return (query instanceof OrmQuery) ? >+ ((OrmQuery) query).getNameTextRange() : >+ ((JavaQuery) query).getNameTextRange(null); > } >- >- public Iterator<String> ormEntityNames() { >- return new TransformationIterator<PersistentType, String>(this.getOrmEntityPersistentTypes()) { >- @Override >- protected String transform(PersistentType persistentType) { >- return persistentType.getMapping().getName(); >- } >- }; >+ >+ // TODO bjv isn't it obvious? >+ protected void validate(Query query, List<IMessage> messages, IReporter reporter) { >+ if (query instanceof OrmQuery) { >+ ((OrmQuery) query).validate(messages, reporter); >+ } else { >+ ((JavaQuery) query).validate(messages, reporter, null); >+ } > } >- >- public Iterable<Entity> getOrmEntities(){ >- return new SubIterableWrapper<PersistentType, Entity>(this.getOrmEntityPersistentTypes()); >+ >+ public boolean validatesAgainstDatabase() { >+ return this.connectionProfileIsActive(); > } >- >- private Iterable<PersistentType> getOrmEntityPersistentTypes() { >- return (this.getOrmPersistentTypes(org.eclipse.jpt.jpa.core.MappingKeys.ENTITY_TYPE_MAPPING_KEY)); >+ >+ public TextRange getValidationTextRange() { >+ TextRange textRange = this.xmlPersistenceUnit.getValidationTextRange(); >+ return (textRange != null) ? textRange : this.getPersistence().getValidationTextRange(); > } > >- protected Iterable<PersistentType> getOrmPersistentTypes(final String mappingKey) { >- return new FilteringIterable<PersistentType>(this.getMappingFilePersistentTypes()) { >- @Override >- protected boolean accept(PersistentType persistentType) { >- return persistentType.getMappingKey() == mappingKey; >+ >+ // ********** refactoring ********** >+ >+ public Iterable<DeleteEdit> createDeleteTypeEdits(final IType type) { >+ return new CompositeIterable<DeleteEdit>( >+ new TransformationIterable<ClassRef, Iterable<DeleteEdit>>(this.getSpecifiedClassRefs()) { >+ @Override >+ protected Iterable<DeleteEdit> transform(ClassRef classRef) { >+ return classRef.createDeleteTypeEdits(type); >+ } > } >- }; >+ ); > } >- >- //--------------- java entities ----------------- >- protected Iterator<String> javaEntityClassNames(){ >- return new TransformationIterator<Entity, String>(this.getJavaEntities()) { >- @Override >- protected String transform(Entity javaEntity) { >- return javaEntity.getPersistentType().getName(); >+ >+ public Iterable<DeleteEdit> createDeleteMappingFileEdits(final IFile file) { >+ return new CompositeIterable<DeleteEdit>( >+ new TransformationIterable<MappingFileRef, Iterable<DeleteEdit>>(this.getSpecifiedMappingFileRefs()) { >+ @Override >+ protected Iterable<DeleteEdit> transform(MappingFileRef mappingFileRef) { >+ return mappingFileRef.createDeleteMappingFileEdits(file); >+ } > } >- }; >+ ); > } > >- public Iterator<String> javaEntityNamesExclOverridden() { >- HashBag<String> ormMappedClassNames = new HashBag<String>(); >- CollectionTools.addAll(ormMappedClassNames, this.getOrmMappedClassNames()); >- List<String> javaEntityNamesExclOverridden = new ArrayList<String>(); >- for (Iterator<String> javaEntityClassNames = this.javaEntityClassNames(); javaEntityClassNames.hasNext();){ >- String javaEntityClassName = javaEntityClassNames.next(); >- if (!ormMappedClassNames.contains(javaEntityClassName)) { >- javaEntityNamesExclOverridden.add((this.getEntity(javaEntityClassName)).getName()); >- } >- } >- return javaEntityNamesExclOverridden.iterator(); >+ @SuppressWarnings("unchecked") >+ public Iterable<ReplaceEdit> createRenameTypeEdits(IType originalType, String newName) { >+ return new CompositeIterable<ReplaceEdit>( >+ this.createSpecifiedClassRefRenameTypeEdits(originalType, newName), >+ this.createPersistenceUnitPropertiesRenameTypeEdits(originalType, newName)); > } > >- public Iterator<String> javaEntityNames(){ >- return new TransformationIterator<Entity, String>(this.getJavaEntities()) { >- @Override >- protected String transform(Entity javaEntity) { >- return javaEntity.getName(); >+ protected Iterable<ReplaceEdit> createSpecifiedClassRefRenameTypeEdits(final IType originalType, final String newName) { >+ return new CompositeIterable<ReplaceEdit>( >+ new TransformationIterable<ClassRef, Iterable<ReplaceEdit>>(this.getSpecifiedClassRefs()) { >+ @Override >+ protected Iterable<ReplaceEdit> transform(ClassRef classRef) { >+ return classRef.createRenameTypeEdits(originalType, newName); >+ } > } >- }; >+ ); > } > >- public Iterable<Entity> getJavaEntities(){ >- return new SubIterableWrapper<TypeMapping, Entity>(this.getJavaEntities_()); >- } >- >- protected Iterable<TypeMapping> getJavaEntities_(){ >- return new FilteringIterable<TypeMapping>(this.getJavaTypeMappings()){ >- @Override >- protected boolean accept(TypeMapping typeMapping) { >- return typeMapping instanceof Entity; >- } >- }; >+ protected Iterable<ReplaceEdit> createPersistenceUnitPropertiesRenameTypeEdits(IType originalType, String newName) { >+ return this.options.createRenameTypeEdits(originalType, newName); > } >- >- private Iterable<? extends TypeMapping> getJavaTypeMappings() { >- return new TransformationIterable<PersistentType, TypeMapping>(this.getNonNullClassPersistentTypes()) { >- @Override >- protected TypeMapping transform(PersistentType persistentType) { >- return persistentType.getMapping(); >- } >- }; >- } >- >+ > @SuppressWarnings("unchecked") >- public Iterable<PersistentType> getPersistentTypes() { >- return new CompositeIterable<PersistentType>( >- this.getMappingFilePersistentTypes(), >- this.getNonNullClassPersistentTypes(), >- this.getJarFilePersistentTypes() >- ); >+ public Iterable<ReplaceEdit> createMoveTypeEdits(IType originalType, IPackageFragment newPackage) { >+ return new CompositeIterable<ReplaceEdit>( >+ this.createSpecifiedClassRefMoveTypeEdits(originalType, newPackage), >+ this.createPersistenceUnitPropertiesMoveTypeEdits(originalType, newPackage)); > } > >- protected Iterable<PersistentType> getMappingFilePersistentTypes() { >- return new CompositeIterable<PersistentType>(this.getMappingFilePersistentTypeLists()); >+ protected Iterable<ReplaceEdit> createSpecifiedClassRefMoveTypeEdits(final IType originalType, final IPackageFragment newPackage) { >+ return new CompositeIterable<ReplaceEdit>( >+ new TransformationIterable<ClassRef, Iterable<ReplaceEdit>>(this.getSpecifiedClassRefs()) { >+ @Override >+ protected Iterable<ReplaceEdit> transform(ClassRef classRef) { >+ return classRef.createMoveTypeEdits(originalType, newPackage); >+ } >+ } >+ ); > } > >- protected Iterable<Iterable<? extends PersistentType>> getMappingFilePersistentTypeLists() { >- return new TransformationIterable<PersistentTypeContainer, Iterable<? extends PersistentType>>( >- this.getMappingFileRefs(), >- PersistentTypeContainer.TRANSFORMER >- ); >+ protected Iterable<ReplaceEdit> createPersistenceUnitPropertiesMoveTypeEdits(IType originalType, IPackageFragment newPackage) { >+ return this.options.createMoveTypeEdits(originalType, newPackage); > } > >- protected Iterable<PersistentType> getNonNullClassPersistentTypes() { >- return new FilteringIterable<PersistentType>(this.getClassPersistentTypes(), NotNullFilter.<PersistentType>instance()); >+ >+ @SuppressWarnings("unchecked") >+ public Iterable<ReplaceEdit> createRenamePackageEdits(IPackageFragment originalPackage, String newName) { >+ return new CompositeIterable<ReplaceEdit>( >+ this.createSpecifiedClassRefRenamePackageEdits(originalPackage, newName), >+ this.createPersistenceUnitPropertiesRenamePackageEdits(originalPackage, newName)); > } > >- protected Iterable<PersistentType> getClassPersistentTypes() { >- return new TransformationIterable<ClassRef, PersistentType>(this.getClassRefs()) { >- @Override >- protected PersistentType transform(ClassRef classRef) { >- return classRef.getJavaPersistentType(); >+ protected Iterable<ReplaceEdit> createSpecifiedClassRefRenamePackageEdits(final IPackageFragment originalPackage, final String newName) { >+ return new CompositeIterable<ReplaceEdit>( >+ new TransformationIterable<ClassRef, Iterable<ReplaceEdit>>(this.getSpecifiedClassRefs()) { >+ @Override >+ protected Iterable<ReplaceEdit> transform(ClassRef classRef) { >+ return classRef.createRenamePackageEdits(originalPackage, newName); >+ } > } >- }; >+ ); > } > >- protected Iterable<PersistentType> getJarFilePersistentTypes() { >- return new CompositeIterable<PersistentType>(this.getJarFilePersistentTypeLists()); >+ protected Iterable<ReplaceEdit> createPersistenceUnitPropertiesRenamePackageEdits(IPackageFragment originalPackage, String newName) { >+ return this.options.createRenamePackageEdits(originalPackage, newName); > } > >- protected Iterable<Iterable<? extends PersistentType>> getJarFilePersistentTypeLists() { >- return new TransformationIterable<PersistentTypeContainer, Iterable<? extends PersistentType>>( >- this.getJarFileRefs(), >- PersistentTypeContainer.TRANSFORMER >- ); >+ public Iterable<ReplaceEdit> createRenameFolderEdits(final IFolder originalFolder, final String newName) { >+ return this.createMappingFileRefRenameFolderEdits(originalFolder, newName); > } > >- public PersistentType getPersistentType(String typeName) { >- if (typeName == null) { >- return null; >- } >- for (MappingFileRef mappingFileRef : this.getMappingFileRefs()) { >- PersistentType persistentType = mappingFileRef.getPersistentType(typeName); >- if (persistentType != null) { >- return persistentType; >- } >- } >- for (ClassRef classRef : this.getClassRefs()) { >- if (classRef.isFor(typeName)) { >- return classRef.getJavaPersistentType(); >- } >- } >- for (JarFileRef jarFileRef : this.getJarFileRefs()) { >- PersistentType persistentType = jarFileRef.getPersistentType(typeName); >- if (persistentType != null) { >- return persistentType; >+ protected Iterable<ReplaceEdit> createMappingFileRefRenameFolderEdits(final IFolder originalFolder, final String newName) { >+ return new CompositeIterable<ReplaceEdit>( >+ new TransformationIterable<MappingFileRef, Iterable<ReplaceEdit>>(this.getSpecifiedMappingFileRefs()) { >+ @Override >+ protected Iterable<ReplaceEdit> transform(MappingFileRef mappingFileRef) { >+ return mappingFileRef.createRenameFolderEdits(originalFolder, newName); >+ } > } >- } >- return null; >+ ); > } > >- public boolean specifiesPersistentType(String className) { >- for (ClassRef classRef : this.getSpecifiedClassRefs()) { >- if (classRef.isFor(className)) { >- return true; >- } >- } >- for (MappingFileRef mappingFileRef : this.getMappingFileRefs()) { >- if (mappingFileRef.getPersistentType(className) != null) { >- return true; >+ public Iterable<ReplaceEdit> createRenameMappingFileEdits(final IFile originalFile, final String newName) { >+ return new CompositeIterable<ReplaceEdit>( >+ new TransformationIterable<MappingFileRef, Iterable<ReplaceEdit>>(this.getMappingFileRefs()) { >+ @Override >+ protected Iterable<ReplaceEdit> transform(MappingFileRef mappingFileRef) { >+ return mappingFileRef.createRenameMappingFileEdits(originalFile, newName); >+ } > } >- } >- return false; >- } >- >- public Entity getEntity(String typeName) { >- TypeMapping typeMapping = this.getTypeMapping(typeName); >- return (typeMapping instanceof Entity) ? (Entity) typeMapping : null; >+ ); > } > >- public Embeddable getEmbeddable(String typeName) { >- TypeMapping typeMapping = this.getTypeMapping(typeName); >- return (typeMapping instanceof Embeddable) ? (Embeddable) typeMapping : null; >+ public int findInsertLocationForMappingFileRef() { >+ return this.xmlPersistenceUnit.getLocationToInsertMappingFileRef(); > } > >- protected TypeMapping getTypeMapping(String typeName) { >- PersistentType persistentType = this.getPersistentType(typeName); >- return (persistentType == null) ? null : persistentType.getMapping(); >+ public Iterable<ReplaceEdit> createMoveMappingFileEdits(final IFile originalFile, final IPath runtineDestination) { >+ return new CompositeIterable<ReplaceEdit>( >+ new TransformationIterable<MappingFileRef, Iterable<ReplaceEdit>>(this.getMappingFileRefs()) { >+ @Override >+ protected Iterable<ReplaceEdit> transform(MappingFileRef mappingFileRef) { >+ return mappingFileRef.createMoveMappingFileEdits(originalFile, runtineDestination); >+ } >+ } >+ ); > } > >- public boolean containsOffset(int textOffset) { >- return (this.xmlPersistenceUnit != null) && this.xmlPersistenceUnit.containsOffset(textOffset); >+ public Iterable<ReplaceEdit> createMoveFolderEdits(final IFolder originalFolder, final IPath runtimeDestination) { >+ return this.createMappingFileRefMoveFolderReplaceEdits(originalFolder, runtimeDestination); > } > >- @Override >- public void toString(StringBuilder sb) { >- super.toString(sb); >- sb.append(this.name); >+ protected Iterable<ReplaceEdit> createMappingFileRefMoveFolderReplaceEdits(final IFolder originalFolder, final IPath runtimeDestination) { >+ return new CompositeIterable<ReplaceEdit>( >+ new TransformationIterable<MappingFileRef, Iterable<ReplaceEdit>>(this.getSpecifiedMappingFileRefs()) { >+ @Override >+ protected Iterable<ReplaceEdit> transform(MappingFileRef mappingFileRef) { >+ return mappingFileRef.createMoveFolderEdits(originalFolder, runtimeDestination); >+ } >+ } >+ ); > } > > >@@ -2209,16 +2630,17 @@ > // if we have persistent types with the same name in multiple locations, > // the last one we encounter wins (i.e. the classes in the orm.xml take > // precedence) >- HashMap<String, PersistentType2_0> allPersistentTypes = new HashMap<String, PersistentType2_0>(); >- this.addPersistentTypesTo_(this.getJarFileRefs(), allPersistentTypes); >- this.addPersistentTypesTo(this.getNonNullClassPersistentTypes(), allPersistentTypes); >- this.addPersistentTypesTo_(this.getMappingFileRefs(), allPersistentTypes); >+ HashMap<String, PersistentType> allPersistentTypes = new HashMap<String, PersistentType>(); >+ this.addPersistentTypesTo(this.getJarFilePersistentTypes(), allPersistentTypes); >+ this.addPersistentTypesTo(this.getClassRefPersistentTypes(), allPersistentTypes); >+ this.addPersistentTypesTo(this.getMappingFilePersistentTypes(), allPersistentTypes); > > // build a list of the top-level types and a tree of their associated > // member types etc. > ArrayList<MetamodelSourceType> topLevelTypes = new ArrayList<MetamodelSourceType>(allPersistentTypes.size()); > HashMap<String, Collection<MetamodelSourceType>> memberTypeTree = new HashMap<String, Collection<MetamodelSourceType>>(); >- for (PersistentType2_0 type : allPersistentTypes.values()) { >+ for (PersistentType type1_0 : allPersistentTypes.values()) { >+ PersistentType2_0 type = (PersistentType2_0) type1_0; > String declaringTypeName = type.getDeclaringTypeName(); > MetamodelSourceType memberType = type; > while (true) { >@@ -2238,7 +2660,7 @@ > // move out to the member type's declaring type > String memberTypeName = declaringTypeName; > // check for a context persistent type >- memberType = allPersistentTypes.get(memberTypeName); >+ memberType = (PersistentType2_0) allPersistentTypes.get(memberTypeName); > if (memberType != null) { > break; // stop - this will be processed in the outer 'for' loop > } >@@ -2309,20 +2731,6 @@ > } > } > >- protected void addPersistentTypesTo_(Iterable<? extends PersistentTypeContainer> ptContainers, HashMap<String, PersistentType2_0> persistentTypeMap) { >- for (PersistentTypeContainer ptContainer : ptContainers) { >- this.addPersistentTypesTo(ptContainer.getPersistentTypes(), persistentTypeMap); >- } >- } >- >- protected void addPersistentTypesTo(Iterable<? extends PersistentType> persistentTypes, HashMap<String, PersistentType2_0> persistentTypeMap) { >- for (PersistentType persistentType : persistentTypes) { >- if (persistentType.getName() != null) { >- persistentTypeMap.put(persistentType.getName(), (PersistentType2_0) persistentType); >- } >- } >- } >- > protected MetamodelSourceType selectSourceType(Iterable<MetamodelSourceType> types, String typeName) { > if (types != null) { > for (MetamodelSourceType type : types) { >Index: src/org/eclipse/jpt/jpa/core/internal/jpa1/context/AbstractNamedColumnValidator.java >=================================================================== >RCS file: /cvsroot/webtools/org.eclipse.jpa/components/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/AbstractNamedColumnValidator.java,v >retrieving revision 1.2 >diff -u -r1.2 AbstractNamedColumnValidator.java >--- src/org/eclipse/jpt/jpa/core/internal/jpa1/context/AbstractNamedColumnValidator.java 28 Apr 2011 02:00:42 -0000 1.2 >+++ src/org/eclipse/jpt/jpa/core/internal/jpa1/context/AbstractNamedColumnValidator.java 11 May 2011 14:49:39 -0000 >@@ -10,13 +10,15 @@ > package org.eclipse.jpt.jpa.core.internal.jpa1.context; > > import java.util.List; >+import org.eclipse.jpt.common.utility.internal.StringTools; >+import org.eclipse.jpt.jpa.core.context.BaseColumn; > import org.eclipse.jpt.jpa.core.context.NamedColumn; > import org.eclipse.jpt.jpa.core.context.PersistentAttribute; >+import org.eclipse.jpt.jpa.core.internal.context.BaseColumnTextRangeResolver; > import org.eclipse.jpt.jpa.core.internal.context.JptValidator; > import org.eclipse.jpt.jpa.core.internal.context.NamedColumnTextRangeResolver; >-import org.eclipse.jpt.jpa.core.internal.jpa1.context.BaseColumnTableValidator.NullTableDescriptionProvider; >-import org.eclipse.jpt.jpa.core.internal.jpa1.context.BaseColumnTableValidator.TableDescriptionProvider; > import org.eclipse.jpt.jpa.core.internal.validation.DefaultJpaValidationMessages; >+import org.eclipse.jpt.jpa.core.internal.validation.JpaValidationMessages; > import org.eclipse.jpt.jpa.db.Table; > import org.eclipse.wst.validation.internal.provisional.core.IMessage; > import org.eclipse.wst.validation.internal.provisional.core.IReporter; >@@ -30,9 +32,10 @@ > > protected final R textRangeResolver; > >+ protected final TableDescriptionProvider tableDescriptionProvider; >+ > protected final TableValidator tableValidator; > >- protected final TableDescriptionProvider tableDescriptionProvider; > > protected AbstractNamedColumnValidator( > C column, >@@ -51,31 +54,23 @@ > PersistentAttribute persistentAttribute, > C column, > R textRangeResolver) { >- this(persistentAttribute, column, textRangeResolver, new NullTableDescriptionProvider()); >+ this(persistentAttribute, column, textRangeResolver, TableDescriptionProvider.Null.instance()); > } > > protected AbstractNamedColumnValidator( > PersistentAttribute persistentAttribute, > C column, > R textRangeResolver, >- TableDescriptionProvider provider) { >+ TableDescriptionProvider tableDescriptionProvider) { > this.persistentAttribute = persistentAttribute; > this.column = column; > this.textRangeResolver = textRangeResolver; >- this.tableDescriptionProvider = provider; >+ this.tableDescriptionProvider = tableDescriptionProvider; > this.tableValidator = this.buildTableValidator(); > } > > protected TableValidator buildTableValidator() { >- return new NullTableValidator(); >- } >- >- protected boolean attributeIsVirtual() { >- return (this.persistentAttribute != null) && this.persistentAttribute.isVirtual(); >- } >- >- protected String getPersistentAttributeName() { >- return this.persistentAttribute.getName(); >+ return TableValidator.Null.instance(); > } > > public boolean validate(List<IMessage> messages, IReporter reporter) { >@@ -94,7 +89,7 @@ > } > > protected IMessage buildUnresolvedNameMessage() { >- return this.attributeIsVirtual() ? >+ return this.persistentAttribute.isVirtual() ? > this.buildVirtualAttributeUnresolvedNameMessage() : > this.buildUnresolvedNameMessage(this.getUnresolvedNameMessage()); > } >@@ -119,7 +114,7 @@ > IMessage.HIGH_SEVERITY, > this.getVirtualAttributeUnresolvedNameMessage(), > new String[] { >- this.getPersistentAttributeName(), >+ this.persistentAttribute.getName(), > this.column.getName(), > this.column.getDbTable().getName() > }, >@@ -137,16 +132,121 @@ > extends JptValidator > { > boolean tableNameIsInvalid(); >+ >+ final class Null >+ implements TableValidator >+ { >+ private static final TableValidator INSTANCE = new Null(); >+ public static TableValidator instance() { >+ return INSTANCE; >+ } >+ // ensure single instance >+ private Null() { >+ super(); >+ } >+ public boolean validate(List<IMessage> messages, IReporter reporter) { >+ return true; >+ } >+ public boolean tableNameIsInvalid() { >+ return false; >+ } >+ @Override >+ public String toString() { >+ return StringTools.buildToStringClassName(this.getClass()); >+ } >+ } >+ } >+ >+ public interface TableDescriptionProvider { >+ String getColumnTableDescriptionMessage(); >+ >+ final class Null >+ implements TableDescriptionProvider >+ { >+ private static final TableDescriptionProvider INSTANCE = new Null(); >+ public static TableDescriptionProvider instance() { >+ return INSTANCE; >+ } >+ // ensure single instance >+ private Null() { >+ super(); >+ } >+ public String getColumnTableDescriptionMessage() { >+ throw new UnsupportedOperationException(); >+ } >+ @Override >+ public String toString() { >+ return StringTools.buildToStringClassName(this.getClass()); >+ } >+ } > } > >- public static class NullTableValidator >+ protected class BaseColumnTableValidator > implements TableValidator > { >- public boolean validate(List<IMessage> messages, IReporter reporter) { >- return true; >+ protected BaseColumnTableValidator() { >+ super(); >+ } >+ >+ protected BaseColumn getColumn() { >+ return (BaseColumn) AbstractNamedColumnValidator.this.column; > } >+ >+ protected BaseColumnTextRangeResolver getTextRangeResolver() { >+ return (BaseColumnTextRangeResolver) AbstractNamedColumnValidator.this.textRangeResolver; >+ } >+ > public boolean tableNameIsInvalid() { >+ return this.getColumn().tableNameIsInvalid(); >+ } >+ >+ public boolean validate(List<IMessage> messages, IReporter reporter) { >+ messages.add(this.buildTableNotValidMessage()); > return false; > } >+ >+ protected IMessage buildTableNotValidMessage() { >+ if (AbstractNamedColumnValidator.this.persistentAttribute.isVirtual()) { >+ return this.buildVirtualAttributeTableNotValidMessage(); >+ } >+ return DefaultJpaValidationMessages.buildMessage( >+ IMessage.HIGH_SEVERITY, >+ this.getColumnTableNotValidMessage(), >+ new String[] { >+ this.getColumn().getTable(), >+ this.getColumn().getName(), >+ this.getColumnTableDescriptionMessage() >+ }, >+ this.getColumn(), >+ this.getTextRangeResolver().getTableTextRange() >+ ); >+ } >+ >+ protected String getColumnTableNotValidMessage() { >+ return JpaValidationMessages.COLUMN_TABLE_NOT_VALID; >+ } >+ >+ protected String getColumnTableDescriptionMessage() { >+ return AbstractNamedColumnValidator.this.tableDescriptionProvider.getColumnTableDescriptionMessage(); >+ } >+ >+ protected IMessage buildVirtualAttributeTableNotValidMessage() { >+ return DefaultJpaValidationMessages.buildMessage( >+ IMessage.HIGH_SEVERITY, >+ this.getVirtualAttributeColumnTableNotValidMessage(), >+ new String[] { >+ AbstractNamedColumnValidator.this.persistentAttribute.getName(), >+ this.getColumn().getTable(), >+ this.getColumn().getName(), >+ this.getColumnTableDescriptionMessage() >+ }, >+ this.getColumn(), >+ this.getTextRangeResolver().getTableTextRange() >+ ); >+ } >+ >+ protected String getVirtualAttributeColumnTableNotValidMessage() { >+ return JpaValidationMessages.VIRTUAL_ATTRIBUTE_COLUMN_TABLE_NOT_VALID; >+ } > } > } >Index: src/org/eclipse/jpt/jpa/core/internal/jpa1/context/AbstractPersistentAttributeValidator.java >=================================================================== >RCS file: /cvsroot/webtools/org.eclipse.jpa/components/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/AbstractPersistentAttributeValidator.java,v >retrieving revision 1.2 >diff -u -r1.2 AbstractPersistentAttributeValidator.java >--- src/org/eclipse/jpt/jpa/core/internal/jpa1/context/AbstractPersistentAttributeValidator.java 28 Apr 2011 02:00:42 -0000 1.2 >+++ src/org/eclipse/jpt/jpa/core/internal/jpa1/context/AbstractPersistentAttributeValidator.java 11 May 2011 14:49:39 -0000 >@@ -46,27 +46,6 @@ > > protected abstract void validateMappedAttribute(List<IMessage> messages); > >- protected boolean attributeIsField() { >- return (this.javaPersistentAttribute != null) && >- this.javaPersistentAttribute.isField(); >- } >- >- protected boolean attributeIsProperty() { >- return (this.javaPersistentAttribute != null) && >- this.javaPersistentAttribute.isProperty(); >- } >- >- protected boolean attributeIsFinal() { >- return (this.javaPersistentAttribute != null) && >- this.javaPersistentAttribute.isFinal(); >- } >- >- protected boolean attributeIsPublic() { >- return (this.javaPersistentAttribute != null) && >- this.javaPersistentAttribute.isPublic(); >- } >- >- > protected IMessage buildAttributeMessage(String msgID) { > return DefaultJpaValidationMessages.buildMessage( > IMessage.HIGH_SEVERITY, >Index: src/org/eclipse/jpt/jpa/core/internal/jpa1/context/AbstractTableValidator.java >=================================================================== >RCS file: /cvsroot/webtools/org.eclipse.jpa/components/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/AbstractTableValidator.java,v >retrieving revision 1.2 >diff -u -r1.2 AbstractTableValidator.java >--- src/org/eclipse/jpt/jpa/core/internal/jpa1/context/AbstractTableValidator.java 28 Apr 2011 02:00:42 -0000 1.2 >+++ src/org/eclipse/jpt/jpa/core/internal/jpa1/context/AbstractTableValidator.java 11 May 2011 14:49:39 -0000 >@@ -21,7 +21,6 @@ > public abstract class AbstractTableValidator > implements JptValidator > { >- > protected final PersistentAttribute persistentAttribute; > > protected final Table table; >@@ -52,14 +51,6 @@ > return this.textRangeResolver; > } > >- protected boolean attributeIsVirtual() { >- return (this.persistentAttribute != null) && this.persistentAttribute.isVirtual(); >- } >- >- protected String getPersistentAttributeName() { >- return this.persistentAttribute.getName(); >- } >- > public boolean validate(List<IMessage> messages, IReporter reporter) { > return this.validatesAgainstDatabase() && > this.validateAgainstDatabase(messages); >@@ -90,7 +81,7 @@ > } > > protected IMessage buildUnresolvedCatalogMessage() { >- return this.attributeIsVirtual() ? >+ return this.persistentAttribute.isVirtual() ? > this.buildVirtualAttributeUnresolvedCatalogMessage() : > this.buildUnresolvedCatalogMessage(this.getUnresolvedCatalogMessage()); > } >@@ -101,7 +92,10 @@ > return DefaultJpaValidationMessages.buildMessage( > IMessage.HIGH_SEVERITY, > message, >- new String[] {this.table.getCatalog(), this.table.getName()}, >+ new String[] { >+ this.table.getCatalog(), >+ this.table.getName() >+ }, > this.table, > this.textRangeResolver.getCatalogTextRange() > ); >@@ -111,7 +105,11 @@ > return DefaultJpaValidationMessages.buildMessage( > IMessage.HIGH_SEVERITY, > this.getVirtualAttributeUnresolvedCatalogMessage(), >- new String[] {this.getPersistentAttributeName(), this.table.getCatalog(), this.table.getName()}, >+ new String[] { >+ this.persistentAttribute.getName(), >+ this.table.getCatalog(), >+ this.table.getName() >+ }, > this.table, > this.textRangeResolver.getCatalogTextRange() > ); >@@ -120,7 +118,7 @@ > protected abstract String getVirtualAttributeUnresolvedCatalogMessage(); > > protected IMessage buildUnresolvedSchemaMessage() { >- return this.attributeIsVirtual() ? >+ return this.persistentAttribute.isVirtual() ? > this.buildVirtualAttributeUnresolvedSchemaMessage() : > this.buildUnresolvedSchemaMessage(this.getUnresolvedSchemaMessage()); > } >@@ -131,7 +129,10 @@ > return DefaultJpaValidationMessages.buildMessage( > IMessage.HIGH_SEVERITY, > message, >- new String[] {this.table.getSchema(), this.table.getName()}, >+ new String[] { >+ this.table.getSchema(), >+ this.table.getName() >+ }, > this.table, > this.textRangeResolver.getSchemaTextRange() > ); >@@ -141,7 +142,11 @@ > return DefaultJpaValidationMessages.buildMessage( > IMessage.HIGH_SEVERITY, > this.getVirtualAttributeUnresolvedSchemaMessage(), >- new String[] {this.getPersistentAttributeName(), this.table.getSchema(), this.table.getName()}, >+ new String[] { >+ this.persistentAttribute.getName(), >+ this.table.getSchema(), >+ this.table.getName() >+ }, > this.table, > this.textRangeResolver.getSchemaTextRange() > ); >@@ -150,7 +155,7 @@ > protected abstract String getVirtualAttributeUnresolvedSchemaMessage(); > > protected IMessage buildUnresolvedNameMessage() { >- return this.attributeIsVirtual() ? >+ return this.persistentAttribute.isVirtual() ? > this.buildVirtualAttributeUnresolvedNameMessage() : > this.buildUnresolvedNameMessage(this.getUnresolvedNameMessage()); > } >@@ -171,12 +176,14 @@ > return DefaultJpaValidationMessages.buildMessage( > IMessage.HIGH_SEVERITY, > this.getVirtualAttributeUnresolvedNameMessage(), >- new String[] {this.getPersistentAttributeName(), this.table.getName()}, >+ new String[] { >+ this.persistentAttribute.getName(), >+ this.table.getName() >+ }, > this.table, > this.textRangeResolver.getNameTextRange() > ); > } > > protected abstract String getVirtualAttributeUnresolvedNameMessage(); >- > } >Index: src/org/eclipse/jpt/jpa/core/internal/jpa1/context/AssociationOverrideInverseJoinColumnValidator.java >=================================================================== >RCS file: /cvsroot/webtools/org.eclipse.jpa/components/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/AssociationOverrideInverseJoinColumnValidator.java,v >retrieving revision 1.1 >diff -u -r1.1 AssociationOverrideInverseJoinColumnValidator.java >--- src/org/eclipse/jpt/jpa/core/internal/jpa1/context/AssociationOverrideInverseJoinColumnValidator.java 6 Feb 2011 02:07:24 -0000 1.1 >+++ src/org/eclipse/jpt/jpa/core/internal/jpa1/context/AssociationOverrideInverseJoinColumnValidator.java 11 May 2011 14:49:39 -0000 >@@ -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. >@@ -13,7 +13,6 @@ > import org.eclipse.jpt.jpa.core.context.JoinColumn; > import org.eclipse.jpt.jpa.core.context.PersistentAttribute; > import org.eclipse.jpt.jpa.core.internal.context.JoinColumnTextRangeResolver; >-import org.eclipse.jpt.jpa.core.internal.jpa1.context.BaseColumnTableValidator.TableDescriptionProvider; > import org.eclipse.jpt.jpa.core.internal.validation.DefaultJpaValidationMessages; > import org.eclipse.jpt.jpa.core.internal.validation.JpaValidationMessages; > import org.eclipse.wst.validation.internal.provisional.core.IMessage; >@@ -46,7 +45,7 @@ > > @Override > protected TableValidator buildTableValidator() { >- return new AssociationOverrideInverseJoinColumnTableValidator(this.persistentAttribute, this.column, this.textRangeResolver, this.tableDescriptionProvider); >+ return new TableValidator(); > } > > @Override >@@ -76,10 +75,11 @@ > IMessage.HIGH_SEVERITY, > this.getVirtualAttributeUnresolvedNameMessage(), > new String[] { >- this.getPersistentAttributeName(), >+ this.persistentAttribute.getName(), > this.override.getName(), > this.column.getName(), >- this.column.getDbTable().getName()}, >+ this.column.getDbTable().getName() >+ }, > this.column, > this.textRangeResolver.getNameTextRange() > ); >@@ -117,7 +117,7 @@ > IMessage.HIGH_SEVERITY, > this.getVirtualAttributeUnresolvedReferencedColumnNameMessage(), > new String[] { >- this.getPersistentAttributeName(), >+ this.persistentAttribute.getName(), > this.override.getName(), > this.column.getReferencedColumnName(), > this.column.getReferencedColumnDbTable().getName() >@@ -155,7 +155,7 @@ > IMessage.HIGH_SEVERITY, > this.getVirtualAttributeUnspecifiedNameMultipleJoinColumnsMessage(), > new String[] { >- this.getPersistentAttributeName(), >+ this.persistentAttribute.getName(), > this.override.getName() > }, > this.column, >@@ -191,7 +191,7 @@ > IMessage.HIGH_SEVERITY, > this.getVirtualAttributeUnspecifiedReferencedColumnNameMultipleJoinColumnsMessage(), > new String[] { >- this.getPersistentAttributeName(), >+ this.persistentAttribute.getName(), > this.override.getName() > }, > this.column, >@@ -205,19 +205,15 @@ > } > > >- public class AssociationOverrideInverseJoinColumnTableValidator >- extends InverseJoinColumnTableValidator >+ public class TableValidator >+ extends InverseJoinColumnValidator.TableValidator > { >- protected AssociationOverrideInverseJoinColumnTableValidator( >- PersistentAttribute persistentAttribute, >- JoinColumn column, >- JoinColumnTextRangeResolver textRangeResolver, >- TableDescriptionProvider provider) { >- super(persistentAttribute, column, textRangeResolver, provider); >+ protected TableValidator() { >+ super(); > } > > @Override >- public IMessage buildTableNotValidMessage() { >+ protected IMessage buildTableNotValidMessage() { > return AssociationOverrideInverseJoinColumnValidator.this.override.isVirtual() ? > this.buildVirtualOverrideColumnTableNotValidMessage() : > super.buildTableNotValidMessage(); >@@ -229,12 +225,12 @@ > this.getVirtualOverrideColumnTableNotValidMessage(), > new String[] { > AssociationOverrideInverseJoinColumnValidator.this.override.getName(), >- this.column.getTable(), >- this.column.getName(), >+ this.getColumn().getTable(), >+ this.getColumn().getName(), > this.getColumnTableDescriptionMessage() > }, >- this.column, >- this.textRangeResolver.getTableTextRange() >+ this.getColumn(), >+ this.getTextRangeResolver().getTableTextRange() > ); > } > >@@ -248,14 +244,14 @@ > IMessage.HIGH_SEVERITY, > this.getVirtualAttributeColumnTableNotValidMessage(), > new String[] { >- this.getPersistentAttributeName(), >+ AssociationOverrideInverseJoinColumnValidator.this.persistentAttribute.getName(), > AssociationOverrideInverseJoinColumnValidator.this.override.getName(), >- this.column.getTable(), >- this.column.getName(), >+ this.getColumn().getTable(), >+ this.getColumn().getName(), > this.getColumnTableDescriptionMessage() > }, >- this.column, >- this.textRangeResolver.getTableTextRange() >+ this.getColumn(), >+ this.getTextRangeResolver().getTableTextRange() > ); > } > >Index: src/org/eclipse/jpt/jpa/core/internal/jpa1/context/AssociationOverrideJoinColumnValidator.java >=================================================================== >RCS file: /cvsroot/webtools/org.eclipse.jpa/components/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/AssociationOverrideJoinColumnValidator.java,v >retrieving revision 1.1 >diff -u -r1.1 AssociationOverrideJoinColumnValidator.java >--- src/org/eclipse/jpt/jpa/core/internal/jpa1/context/AssociationOverrideJoinColumnValidator.java 6 Feb 2011 02:07:24 -0000 1.1 >+++ src/org/eclipse/jpt/jpa/core/internal/jpa1/context/AssociationOverrideJoinColumnValidator.java 11 May 2011 14:49:39 -0000 >@@ -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. >@@ -13,7 +13,6 @@ > import org.eclipse.jpt.jpa.core.context.JoinColumn; > import org.eclipse.jpt.jpa.core.context.PersistentAttribute; > import org.eclipse.jpt.jpa.core.internal.context.JoinColumnTextRangeResolver; >-import org.eclipse.jpt.jpa.core.internal.jpa1.context.BaseColumnTableValidator.TableDescriptionProvider; > import org.eclipse.jpt.jpa.core.internal.validation.DefaultJpaValidationMessages; > import org.eclipse.jpt.jpa.core.internal.validation.JpaValidationMessages; > import org.eclipse.wst.validation.internal.provisional.core.IMessage; >@@ -47,7 +46,7 @@ > > @Override > protected TableValidator buildTableValidator() { >- return new AssociationOverrideJoinColumnTableValidator(this.persistentAttribute, this.column, this.textRangeResolver, this.tableDescriptionProvider); >+ return new TableValidator(); > } > > @Override >@@ -77,7 +76,7 @@ > IMessage.HIGH_SEVERITY, > this.getVirtualAttributeUnresolvedNameMessage(), > new String[] { >- this.getPersistentAttributeName(), >+ this.persistentAttribute.getName(), > this.override.getName(), > this.column.getName(), > this.column.getDbTable().getName() >@@ -119,7 +118,7 @@ > IMessage.HIGH_SEVERITY, > this.getVirtualAttributeUnresolvedReferencedColumnNameMessage(), > new String[] { >- this.getPersistentAttributeName(), >+ this.persistentAttribute.getName(), > this.override.getName(), > this.column.getReferencedColumnName(), > this.column.getReferencedColumnDbTable().getName() >@@ -157,7 +156,7 @@ > IMessage.HIGH_SEVERITY, > this.getVirtualAttributeUnspecifiedNameMultipleJoinColumnsMessage(), > new String[] { >- this.getPersistentAttributeName(), >+ this.persistentAttribute.getName(), > this.override.getName() > }, > this.column, >@@ -193,7 +192,7 @@ > IMessage.HIGH_SEVERITY, > this.getVirtualAttributeUnspecifiedReferencedColumnNameMultipleJoinColumnsMessage(), > new String[] { >- this.getPersistentAttributeName(), >+ this.persistentAttribute.getName(), > this.override.getName() > }, > this.column, >@@ -207,19 +206,15 @@ > } > > >- public class AssociationOverrideJoinColumnTableValidator >- extends JoinColumnTableValidator >+ protected class TableValidator >+ extends JoinColumnValidator.TableValidator > { >- protected AssociationOverrideJoinColumnTableValidator( >- PersistentAttribute persistentAttribute, >- JoinColumn column, >- JoinColumnTextRangeResolver textRangeResolver, >- TableDescriptionProvider provider) { >- super(persistentAttribute, column, textRangeResolver, provider); >+ protected TableValidator() { >+ super(); > } > > @Override >- public IMessage buildTableNotValidMessage() { >+ protected IMessage buildTableNotValidMessage() { > return AssociationOverrideJoinColumnValidator.this.override.isVirtual() ? > this.buildVirtualOverrideColumnTableNotValidMessage() : > super.buildTableNotValidMessage(); >@@ -231,12 +226,12 @@ > this.getVirtualOverrideColumnTableNotValidMessage(), > new String[] { > AssociationOverrideJoinColumnValidator.this.override.getName(), >- this.column.getTable(), >- this.column.getName(), >+ this.getColumn().getTable(), >+ this.getColumn().getName(), > this.getColumnTableDescriptionMessage() > }, >- this.column, >- this.textRangeResolver.getTableTextRange() >+ this.getColumn(), >+ this.getTextRangeResolver().getTableTextRange() > ); > } > >@@ -250,14 +245,14 @@ > IMessage.HIGH_SEVERITY, > this.getVirtualAttributeColumnTableNotValidMessage(), > new String[] { >- this.getPersistentAttributeName(), >+ AssociationOverrideJoinColumnValidator.this.persistentAttribute.getName(), > AssociationOverrideJoinColumnValidator.this.override.getName(), >- this.column.getTable(), >- this.column.getName(), >+ this.getColumn().getTable(), >+ this.getColumn().getName(), > this.getColumnTableDescriptionMessage() > }, >- this.column, >- this.textRangeResolver.getTableTextRange() >+ this.getColumn(), >+ this.getTextRangeResolver().getTableTextRange() > ); > } > >Index: src/org/eclipse/jpt/jpa/core/internal/jpa1/context/AssociationOverrideJoinTableValidator.java >=================================================================== >RCS file: /cvsroot/webtools/org.eclipse.jpa/components/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/AssociationOverrideJoinTableValidator.java,v >retrieving revision 1.1 >diff -u -r1.1 AssociationOverrideJoinTableValidator.java >--- src/org/eclipse/jpt/jpa/core/internal/jpa1/context/AssociationOverrideJoinTableValidator.java 6 Feb 2011 02:07:25 -0000 1.1 >+++ src/org/eclipse/jpt/jpa/core/internal/jpa1/context/AssociationOverrideJoinTableValidator.java 11 May 2011 14:49:39 -0000 >@@ -1,13 +1,12 @@ > /******************************************************************************* >- * 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 >- *******************************************************************************/ >+ * 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. >+ * >+ * Contributors: >+ * Oracle - initial API and implementation >+ ******************************************************************************/ > package org.eclipse.jpt.jpa.core.internal.jpa1.context; > > import org.eclipse.jpt.jpa.core.context.AssociationOverride; >@@ -18,7 +17,8 @@ > import org.eclipse.jpt.jpa.core.internal.validation.JpaValidationMessages; > import org.eclipse.wst.validation.internal.provisional.core.IMessage; > >-public class AssociationOverrideJoinTableValidator extends AbstractJoinTableValidator >+public class AssociationOverrideJoinTableValidator >+ extends AbstractJoinTableValidator > { > private final AssociationOverride override; > >@@ -41,17 +41,19 @@ > > @Override > protected IMessage buildUnresolvedNameMessage() { >- if (this.override.isVirtual()) { >- return this.buildVirtualOverrideUnresolvedNameMessage(); >- } >- return super.buildUnresolvedNameMessage(); >+ return this.override.isVirtual() ? >+ this.buildVirtualOverrideUnresolvedNameMessage() : >+ super.buildUnresolvedNameMessage(); > } > > protected IMessage buildVirtualOverrideUnresolvedNameMessage() { > return DefaultJpaValidationMessages.buildMessage( > IMessage.HIGH_SEVERITY, > JpaValidationMessages.VIRTUAL_ASSOCIATION_OVERRIDE_JOIN_TABLE_UNRESOLVED_NAME, >- new String[] {this.override.getName(), this.getTable().getName()}, >+ new String[] { >+ this.override.getName(), >+ this.getTable().getName() >+ }, > this.getTable(), > this.getTextRangeResolver().getNameTextRange() > ); >@@ -59,17 +61,19 @@ > > @Override > protected IMessage buildUnresolvedCatalogMessage() { >- if (this.override.isVirtual()) { >- return this.buildVirtualOverrideUnresolvedCatalogMessage(); >- } >- return super.buildUnresolvedCatalogMessage(); >+ return this.override.isVirtual() ? >+ this.buildVirtualOverrideUnresolvedCatalogMessage() : >+ super.buildUnresolvedCatalogMessage(); > } > > protected IMessage buildVirtualOverrideUnresolvedCatalogMessage() { > return DefaultJpaValidationMessages.buildMessage( > IMessage.HIGH_SEVERITY, > JpaValidationMessages.VIRTUAL_ASSOCIATION_OVERRIDE_JOIN_TABLE_UNRESOLVED_CATALOG, >- new String[] {this.override.getName(), this.getTable().getCatalog()}, >+ new String[] { >+ this.override.getName(), >+ this.getTable().getCatalog() >+ }, > this.getTable(), > this.getTextRangeResolver().getCatalogTextRange() > ); >@@ -77,17 +81,19 @@ > > @Override > protected IMessage buildUnresolvedSchemaMessage() { >- if (this.override.isVirtual()) { >- return this.buildVirtualOverrideUnresolvedSchemaMessage(); >- } >- return super.buildUnresolvedSchemaMessage(); >+ return this.override.isVirtual() ? >+ this.buildVirtualOverrideUnresolvedSchemaMessage() : >+ super.buildUnresolvedSchemaMessage(); > } > > protected IMessage buildVirtualOverrideUnresolvedSchemaMessage() { > return DefaultJpaValidationMessages.buildMessage( > IMessage.HIGH_SEVERITY, > JpaValidationMessages.VIRTUAL_ASSOCIATION_OVERRIDE_JOIN_TABLE_UNRESOLVED_SCHEMA, >- new String[] {this.override.getName(), this.getTable().getSchema()}, >+ new String[] { >+ this.override.getName(), >+ this.getTable().getSchema() >+ }, > this.getTable(), > this.getTextRangeResolver().getSchemaTextRange() > ); >Index: src/org/eclipse/jpt/jpa/core/internal/jpa1/context/AttributeOverrideColumnValidator.java >=================================================================== >RCS file: /cvsroot/webtools/org.eclipse.jpa/components/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/AttributeOverrideColumnValidator.java,v >retrieving revision 1.1 >diff -u -r1.1 AttributeOverrideColumnValidator.java >--- src/org/eclipse/jpt/jpa/core/internal/jpa1/context/AttributeOverrideColumnValidator.java 6 Feb 2011 02:07:24 -0000 1.1 >+++ src/org/eclipse/jpt/jpa/core/internal/jpa1/context/AttributeOverrideColumnValidator.java 11 May 2011 14:49:39 -0000 >@@ -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. >@@ -13,7 +13,6 @@ > import org.eclipse.jpt.jpa.core.context.BaseColumn; > import org.eclipse.jpt.jpa.core.context.PersistentAttribute; > import org.eclipse.jpt.jpa.core.internal.context.BaseColumnTextRangeResolver; >-import org.eclipse.jpt.jpa.core.internal.jpa1.context.BaseColumnTableValidator.TableDescriptionProvider; > import org.eclipse.jpt.jpa.core.internal.validation.DefaultJpaValidationMessages; > import org.eclipse.jpt.jpa.core.internal.validation.JpaValidationMessages; > import org.eclipse.wst.validation.internal.provisional.core.IMessage; >@@ -44,7 +43,7 @@ > > @Override > protected TableValidator buildTableValidator() { >- return new AttributeOverrideColumnTableValidator(this.persistentAttribute, this.column, this.textRangeResolver, this.tableDescriptionProvider); >+ return new TableValidator(); > } > > @Override >@@ -78,7 +77,7 @@ > IMessage.HIGH_SEVERITY, > this.getVirtualAttributeUnresolvedNameMessage(), > new String[] { >- this.getPersistentAttributeName(), >+ this.persistentAttribute.getName(), > this.override.getName(), > this.column.getName(), > this.column.getDbTable().getName() >@@ -94,19 +93,15 @@ > } > > >- public class AttributeOverrideColumnTableValidator >+ protected class TableValidator > extends BaseColumnTableValidator > { >- protected AttributeOverrideColumnTableValidator( >- PersistentAttribute persistentAttribute, >- BaseColumn column, >- BaseColumnTextRangeResolver textRangeResolver, >- TableDescriptionProvider provider) { >- super(persistentAttribute, column, textRangeResolver, provider); >+ protected TableValidator() { >+ super(); > } > > @Override >- public IMessage buildTableNotValidMessage() { >+ protected IMessage buildTableNotValidMessage() { > return AttributeOverrideColumnValidator.this.override.isVirtual() ? > this.buildVirtualOverrideColumnTableNotValidMessage() : > super.buildTableNotValidMessage(); >@@ -118,12 +113,12 @@ > this.getVirtualOverrideColumnTableNotValidMessage(), > new String[] { > AttributeOverrideColumnValidator.this.override.getName(), >- this.column.getTable(), >- this.column.getName(), >+ this.getColumn().getTable(), >+ this.getColumn().getName(), > this.getColumnTableDescriptionMessage() > }, >- this.column, >- this.textRangeResolver.getTableTextRange() >+ this.getColumn(), >+ this.getTextRangeResolver().getTableTextRange() > ); > } > >@@ -137,14 +132,14 @@ > IMessage.HIGH_SEVERITY, > this.getVirtualAttributeColumnTableNotValidMessage(), > new String[] { >- this.getPersistentAttributeName(), >+ AttributeOverrideColumnValidator.this.persistentAttribute.getName(), > AttributeOverrideColumnValidator.this.override.getName(), >- this.column.getTable(), >- this.column.getName(), >+ this.getColumn().getTable(), >+ this.getColumn().getName(), > this.getColumnTableDescriptionMessage() > }, >- this.column, >- this.textRangeResolver.getTableTextRange() >+ this.getColumn(), >+ this.getTextRangeResolver().getTableTextRange() > ); > } > >Index: src/org/eclipse/jpt/jpa/core/internal/jpa1/context/BaseColumnTableValidator.java >=================================================================== >RCS file: src/org/eclipse/jpt/jpa/core/internal/jpa1/context/BaseColumnTableValidator.java >diff -N src/org/eclipse/jpt/jpa/core/internal/jpa1/context/BaseColumnTableValidator.java >--- src/org/eclipse/jpt/jpa/core/internal/jpa1/context/BaseColumnTableValidator.java 6 Feb 2011 02:07:24 -0000 1.1 >+++ /dev/null 1 Jan 1970 00:00:00 -0000 >@@ -1,116 +0,0 @@ >-/******************************************************************************* >- * 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.jpa.core.internal.jpa1.context; >- >-import java.util.List; >-import org.eclipse.jpt.jpa.core.context.BaseColumn; >-import org.eclipse.jpt.jpa.core.context.PersistentAttribute; >-import org.eclipse.jpt.jpa.core.internal.context.BaseColumnTextRangeResolver; >-import org.eclipse.jpt.jpa.core.internal.jpa1.context.AbstractNamedColumnValidator.TableValidator; >-import org.eclipse.jpt.jpa.core.internal.validation.DefaultJpaValidationMessages; >-import org.eclipse.jpt.jpa.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; >- } >- >- protected boolean isPersistentAttributeVirtual() { >- return (this.persistentAttribute != null) && this.persistentAttribute.isVirtual(); >- } >- >- protected String getPersistentAttributeName() { >- return this.persistentAttribute.getName(); >- } >- >- public boolean tableNameIsInvalid() { >- return this.column.tableNameIsInvalid(); >- } >- >- public boolean validate(List<IMessage> messages, IReporter reporter) { >- messages.add(this.buildTableNotValidMessage()); >- return false; >- } >- >- public IMessage buildTableNotValidMessage() { >- if (this.isPersistentAttributeVirtual()) { >- return this.buildVirtualAttributeTableNotValidMessage(); >- } >- return DefaultJpaValidationMessages.buildMessage( >- IMessage.HIGH_SEVERITY, >- this.getColumnTableNotValidMessage(), >- new String[] { >- this.column.getTable(), >- this.column.getName(), >- this.getColumnTableDescriptionMessage() >- }, >- this.column, >- this.textRangeResolver.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[] { >- this.getPersistentAttributeName(), >- this.column.getTable(), >- this.column.getName(), >- this.getColumnTableDescriptionMessage() >- }, >- this.column, >- this.textRangeResolver.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(); >- } >- } >-} >Index: src/org/eclipse/jpt/jpa/core/internal/jpa1/context/BaseJoinColumnValidator.java >=================================================================== >RCS file: /cvsroot/webtools/org.eclipse.jpa/components/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/BaseJoinColumnValidator.java,v >retrieving revision 1.2 >diff -u -r1.2 BaseJoinColumnValidator.java >--- src/org/eclipse/jpt/jpa/core/internal/jpa1/context/BaseJoinColumnValidator.java 28 Apr 2011 02:00:42 -0000 1.2 >+++ src/org/eclipse/jpt/jpa/core/internal/jpa1/context/BaseJoinColumnValidator.java 11 May 2011 14:49:39 -0000 >@@ -14,7 +14,6 @@ > import org.eclipse.jpt.jpa.core.context.BaseJoinColumn; > import org.eclipse.jpt.jpa.core.context.PersistentAttribute; > import org.eclipse.jpt.jpa.core.internal.context.BaseJoinColumnTextRangeResolver; >-import org.eclipse.jpt.jpa.core.internal.jpa1.context.BaseColumnTableValidator.TableDescriptionProvider; > import org.eclipse.jpt.jpa.core.internal.validation.DefaultJpaValidationMessages; > import org.eclipse.wst.validation.internal.provisional.core.IMessage; > >@@ -79,7 +78,7 @@ > } > > protected IMessage buildUnresolvedReferencedColumnNameMessage() { >- return this.attributeIsVirtual() ? >+ return this.persistentAttribute.isVirtual() ? > this.buildVirtualAttributeUnresolvedReferencedColumnNameMessage() : > this.buildUnresolvedReferencedColumnNameMessage(this.getUnresolvedReferencedColumnNameMessage()); > } >@@ -104,7 +103,7 @@ > IMessage.HIGH_SEVERITY, > this.getVirtualAttributeUnresolvedReferencedColumnNameMessage(), > new String[] { >- this.getPersistentAttributeName(), >+ this.persistentAttribute.getName(), > this.column.getReferencedColumnName(), > this.column.getReferencedColumnDbTable().getName() > }, >@@ -116,7 +115,7 @@ > protected abstract String getVirtualAttributeUnresolvedReferencedColumnNameMessage(); > > protected IMessage buildUnspecifiedNameMultipleJoinColumnsMessage() { >- return this.attributeIsVirtual() ? >+ return this.persistentAttribute.isVirtual() ? > this.buildVirtualAttributeUnspecifiedNameMultipleJoinColumnsMessage() : > this.buildUnspecifiedNameMultipleJoinColumnsMessage(this.getUnspecifiedNameMultipleJoinColumnsMessage()); > } >@@ -137,7 +136,7 @@ > return DefaultJpaValidationMessages.buildMessage( > IMessage.HIGH_SEVERITY, > this.getVirtualAttributeUnspecifiedNameMultipleJoinColumnsMessage(), >- new String[] {this.getPersistentAttributeName()}, >+ new String[] {this.persistentAttribute.getName()}, > this.column, > this.textRangeResolver.getNameTextRange() > ); >@@ -146,7 +145,7 @@ > protected abstract String getVirtualAttributeUnspecifiedNameMultipleJoinColumnsMessage(); > > protected IMessage buildUnspecifiedReferencedColumnNameMultipleJoinColumnsMessage() { >- return this.attributeIsVirtual() ? >+ return this.persistentAttribute.isVirtual() ? > this.buildVirtualAttributeUnspecifiedReferencedColumnNameMultipleJoinColumnsMessage() : > this.buildUnspecifiedReferencedColumnNameMultipleJoinColumnsMessage(this.getUnspecifiedReferencedColumnNameMultipleJoinColumnsMessage()); > } >@@ -167,7 +166,7 @@ > return DefaultJpaValidationMessages.buildMessage( > IMessage.HIGH_SEVERITY, > this.getVirtualAttributeUnspecifiedReferencedColumnNameMultipleJoinColumnsMessage(), >- new String[] {this.getPersistentAttributeName()}, >+ new String[] {this.persistentAttribute.getName()}, > this.column, > this.textRangeResolver.getReferencedColumnNameTextRange() > ); >Index: src/org/eclipse/jpt/jpa/core/internal/jpa1/context/CollectionTableTableDescriptionProvider.java >=================================================================== >RCS file: /cvsroot/webtools/org.eclipse.jpa/components/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/CollectionTableTableDescriptionProvider.java,v >retrieving revision 1.1 >diff -u -r1.1 CollectionTableTableDescriptionProvider.java >--- src/org/eclipse/jpt/jpa/core/internal/jpa1/context/CollectionTableTableDescriptionProvider.java 6 Feb 2011 02:07:24 -0000 1.1 >+++ src/org/eclipse/jpt/jpa/core/internal/jpa1/context/CollectionTableTableDescriptionProvider.java 11 May 2011 14:49:39 -0000 >@@ -1,12 +1,20 @@ >+/******************************************************************************* >+ * 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. >+ * >+ * Contributors: >+ * Oracle - initial API and implementation >+ ******************************************************************************/ > package org.eclipse.jpt.jpa.core.internal.jpa1.context; > >-import org.eclipse.jpt.jpa.core.internal.jpa1.context.BaseColumnTableValidator.TableDescriptionProvider; > import org.eclipse.jpt.jpa.core.internal.validation.JpaValidationDescriptionMessages; > >-public class CollectionTableTableDescriptionProvider implements TableDescriptionProvider >+public class CollectionTableTableDescriptionProvider >+ implements AbstractNamedColumnValidator.TableDescriptionProvider > { > public String getColumnTableDescriptionMessage() { > return JpaValidationDescriptionMessages.DOES_NOT_MATCH_COLLECTION_TABLE; > } >- > } >Index: src/org/eclipse/jpt/jpa/core/internal/jpa1/context/EntityTableDescriptionProvider.java >=================================================================== >RCS file: /cvsroot/webtools/org.eclipse.jpa/components/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/EntityTableDescriptionProvider.java,v >retrieving revision 1.1 >diff -u -r1.1 EntityTableDescriptionProvider.java >--- src/org/eclipse/jpt/jpa/core/internal/jpa1/context/EntityTableDescriptionProvider.java 6 Feb 2011 02:07:25 -0000 1.1 >+++ src/org/eclipse/jpt/jpa/core/internal/jpa1/context/EntityTableDescriptionProvider.java 11 May 2011 14:49:39 -0000 >@@ -1,12 +1,20 @@ >+/******************************************************************************* >+ * 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. >+ * >+ * Contributors: >+ * Oracle - initial API and implementation >+ ******************************************************************************/ > package org.eclipse.jpt.jpa.core.internal.jpa1.context; > >-import org.eclipse.jpt.jpa.core.internal.jpa1.context.BaseColumnTableValidator.TableDescriptionProvider; > import org.eclipse.jpt.jpa.core.internal.validation.JpaValidationDescriptionMessages; > >-public class EntityTableDescriptionProvider implements TableDescriptionProvider >+public class EntityTableDescriptionProvider >+ implements AbstractNamedColumnValidator.TableDescriptionProvider > { > public String getColumnTableDescriptionMessage() { > return JpaValidationDescriptionMessages.NOT_VALID_FOR_THIS_ENTITY; > } >- > } >Index: src/org/eclipse/jpt/jpa/core/internal/jpa1/context/GenericPersistentAttributeValidator.java >=================================================================== >RCS file: /cvsroot/webtools/org.eclipse.jpa/components/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/GenericPersistentAttributeValidator.java,v >retrieving revision 1.2 >diff -u -r1.2 GenericPersistentAttributeValidator.java >--- src/org/eclipse/jpt/jpa/core/internal/jpa1/context/GenericPersistentAttributeValidator.java 28 Apr 2011 02:00:42 -0000 1.2 >+++ src/org/eclipse/jpt/jpa/core/internal/jpa1/context/GenericPersistentAttributeValidator.java 11 May 2011 14:49:39 -0000 >@@ -27,19 +27,26 @@ > > @Override > protected void validateMappedAttribute(List<IMessage> messages) { >- if (this.attributeIsField()) { >- if (this.attributeIsFinal()) { >- messages.add(this.buildAttributeMessage(JpaValidationMessages.PERSISTENT_ATTRIBUTE_FINAL_FIELD)); >- } >- if (this.attributeIsPublic()) { >- messages.add(this.buildAttributeMessage(JpaValidationMessages.PERSISTENT_ATTRIBUTE_PUBLIC_FIELD)); >- } >+ if (this.javaPersistentAttribute.isField()) { >+ this.validateMappedField(messages); >+ } else { >+ this.validateMappedProperty(messages); > } >- else if (this.attributeIsProperty()) { >- //TODO need to check both the getter and the setter >- if (this.attributeIsFinal()) { >- messages.add(this.buildAttributeMessage(JpaValidationMessages.PERSISTENT_ATTRIBUTE_FINAL_GETTER)); >- } >+ } >+ >+ protected void validateMappedField(List<IMessage> messages) { >+ if (this.javaPersistentAttribute.isFinal()) { >+ messages.add(this.buildAttributeMessage(JpaValidationMessages.PERSISTENT_ATTRIBUTE_FINAL_FIELD)); >+ } >+ if (this.javaPersistentAttribute.isPublic()) { >+ messages.add(this.buildAttributeMessage(JpaValidationMessages.PERSISTENT_ATTRIBUTE_PUBLIC_FIELD)); >+ } >+ } >+ >+ protected void validateMappedProperty(List<IMessage> messages) { >+ //TODO need to check both the getter and the setter >+ if (this.javaPersistentAttribute.isFinal()) { >+ messages.add(this.buildAttributeMessage(JpaValidationMessages.PERSISTENT_ATTRIBUTE_FINAL_GETTER)); > } > } > } >Index: src/org/eclipse/jpt/jpa/core/internal/jpa1/context/InverseJoinColumnValidator.java >=================================================================== >RCS file: /cvsroot/webtools/org.eclipse.jpa/components/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/InverseJoinColumnValidator.java,v >retrieving revision 1.1 >diff -u -r1.1 InverseJoinColumnValidator.java >--- src/org/eclipse/jpt/jpa/core/internal/jpa1/context/InverseJoinColumnValidator.java 6 Feb 2011 02:07:25 -0000 1.1 >+++ src/org/eclipse/jpt/jpa/core/internal/jpa1/context/InverseJoinColumnValidator.java 11 May 2011 14:49:39 -0000 >@@ -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. >@@ -12,7 +12,6 @@ > import org.eclipse.jpt.jpa.core.context.JoinColumn; > import org.eclipse.jpt.jpa.core.context.PersistentAttribute; > import org.eclipse.jpt.jpa.core.internal.context.JoinColumnTextRangeResolver; >-import org.eclipse.jpt.jpa.core.internal.jpa1.context.BaseColumnTableValidator.TableDescriptionProvider; > import org.eclipse.jpt.jpa.core.internal.validation.JpaValidationMessages; > > public class InverseJoinColumnValidator >@@ -37,7 +36,7 @@ > > @Override > protected TableValidator buildTableValidator() { >- return new InverseJoinColumnTableValidator(this.persistentAttribute, this.column, this.textRangeResolver, this.tableDescriptionProvider); >+ return new TableValidator(); > } > > @Override >@@ -80,15 +79,11 @@ > return JpaValidationMessages.VIRTUAL_ATTRIBUTE_INVERSE_JOIN_COLUMN_REFERENCED_COLUMN_NAME_MUST_BE_SPECIFIED_MULTIPLE_JOIN_COLUMNS; > } > >- public static class InverseJoinColumnTableValidator >+ protected class TableValidator > extends BaseColumnTableValidator > { >- public InverseJoinColumnTableValidator( >- PersistentAttribute persistentAttribute, >- JoinColumn column, >- JoinColumnTextRangeResolver textRangeResolver, >- TableDescriptionProvider provider) { >- super(persistentAttribute, column, textRangeResolver, provider); >+ protected TableValidator() { >+ super(); > } > > @Override >Index: src/org/eclipse/jpt/jpa/core/internal/jpa1/context/JoinColumnValidator.java >=================================================================== >RCS file: /cvsroot/webtools/org.eclipse.jpa/components/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/JoinColumnValidator.java,v >retrieving revision 1.1 >diff -u -r1.1 JoinColumnValidator.java >--- src/org/eclipse/jpt/jpa/core/internal/jpa1/context/JoinColumnValidator.java 6 Feb 2011 02:07:24 -0000 1.1 >+++ src/org/eclipse/jpt/jpa/core/internal/jpa1/context/JoinColumnValidator.java 11 May 2011 14:49:39 -0000 >@@ -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. >@@ -12,7 +12,6 @@ > import org.eclipse.jpt.jpa.core.context.JoinColumn; > import org.eclipse.jpt.jpa.core.context.PersistentAttribute; > import org.eclipse.jpt.jpa.core.internal.context.JoinColumnTextRangeResolver; >-import org.eclipse.jpt.jpa.core.internal.jpa1.context.BaseColumnTableValidator.TableDescriptionProvider; > import org.eclipse.jpt.jpa.core.internal.validation.JpaValidationMessages; > > public class JoinColumnValidator >@@ -37,7 +36,7 @@ > > @Override > protected TableValidator buildTableValidator() { >- return new JoinColumnTableValidator(this.persistentAttribute, this.column, this.textRangeResolver, this.tableDescriptionProvider); >+ return new TableValidator(); > } > > @Override >@@ -80,15 +79,11 @@ > return JpaValidationMessages.VIRTUAL_ATTRIBUTE_JOIN_COLUMN_REFERENCED_COLUMN_NAME_MUST_BE_SPECIFIED_MULTIPLE_JOIN_COLUMNS; > } > >- public static class JoinColumnTableValidator >+ protected class TableValidator > extends BaseColumnTableValidator > { >- public JoinColumnTableValidator( >- PersistentAttribute persistentAttribute, >- JoinColumn column, >- JoinColumnTextRangeResolver textRangeResolver, >- TableDescriptionProvider provider) { >- super(persistentAttribute, column, textRangeResolver, provider); >+ protected TableValidator() { >+ super(); > } > > @Override >Index: src/org/eclipse/jpt/jpa/core/internal/jpa1/context/JoinTableTableDescriptionProvider.java >=================================================================== >RCS file: /cvsroot/webtools/org.eclipse.jpa/components/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/JoinTableTableDescriptionProvider.java,v >retrieving revision 1.1 >diff -u -r1.1 JoinTableTableDescriptionProvider.java >--- src/org/eclipse/jpt/jpa/core/internal/jpa1/context/JoinTableTableDescriptionProvider.java 6 Feb 2011 02:07:24 -0000 1.1 >+++ src/org/eclipse/jpt/jpa/core/internal/jpa1/context/JoinTableTableDescriptionProvider.java 11 May 2011 14:49:39 -0000 >@@ -1,12 +1,20 @@ >+/******************************************************************************* >+ * 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. >+ * >+ * Contributors: >+ * Oracle - initial API and implementation >+ ******************************************************************************/ > package org.eclipse.jpt.jpa.core.internal.jpa1.context; > >-import org.eclipse.jpt.jpa.core.internal.jpa1.context.BaseColumnTableValidator.TableDescriptionProvider; > import org.eclipse.jpt.jpa.core.internal.validation.JpaValidationDescriptionMessages; > >-public class JoinTableTableDescriptionProvider implements TableDescriptionProvider >+public class JoinTableTableDescriptionProvider >+ implements AbstractNamedColumnValidator.TableDescriptionProvider > { > public String getColumnTableDescriptionMessage() { > return JpaValidationDescriptionMessages.DOES_NOT_MATCH_JOIN_TABLE; > } >- > } >Index: src/org/eclipse/jpt/jpa/core/internal/jpa1/context/JoinTableValidator.java >=================================================================== >RCS file: /cvsroot/webtools/org.eclipse.jpa/components/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/JoinTableValidator.java,v >retrieving revision 1.1 >diff -u -r1.1 JoinTableValidator.java >--- src/org/eclipse/jpt/jpa/core/internal/jpa1/context/JoinTableValidator.java 6 Feb 2011 02:07:25 -0000 1.1 >+++ src/org/eclipse/jpt/jpa/core/internal/jpa1/context/JoinTableValidator.java 11 May 2011 14:49:39 -0000 >@@ -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. >@@ -14,12 +14,9 @@ > import org.eclipse.jpt.jpa.core.internal.context.TableTextRangeResolver; > import org.eclipse.jpt.jpa.core.internal.validation.JpaValidationMessages; > >-public class JoinTableValidator extends AbstractJoinTableValidator >+public class JoinTableValidator >+ extends AbstractJoinTableValidator > { >- public JoinTableValidator(JoinTable table, TableTextRangeResolver textRangeResolver) { >- super(table, textRangeResolver); >- } >- > public JoinTableValidator(PersistentAttribute persistentAttribute, JoinTable table, TableTextRangeResolver textRangeResolver) { > super(persistentAttribute, table, textRangeResolver); > } >Index: src/org/eclipse/jpt/jpa/core/internal/jpa1/context/MapKeyAttributeOverrideColumnValidator.java >=================================================================== >RCS file: /cvsroot/webtools/org.eclipse.jpa/components/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/MapKeyAttributeOverrideColumnValidator.java,v >retrieving revision 1.1 >diff -u -r1.1 MapKeyAttributeOverrideColumnValidator.java >--- src/org/eclipse/jpt/jpa/core/internal/jpa1/context/MapKeyAttributeOverrideColumnValidator.java 6 Feb 2011 02:07:24 -0000 1.1 >+++ src/org/eclipse/jpt/jpa/core/internal/jpa1/context/MapKeyAttributeOverrideColumnValidator.java 11 May 2011 14:49:39 -0000 >@@ -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. >@@ -13,21 +13,12 @@ > import org.eclipse.jpt.jpa.core.context.BaseColumn; > import org.eclipse.jpt.jpa.core.context.PersistentAttribute; > import org.eclipse.jpt.jpa.core.internal.context.BaseColumnTextRangeResolver; >-import org.eclipse.jpt.jpa.core.internal.jpa1.context.BaseColumnTableValidator.TableDescriptionProvider; > import org.eclipse.jpt.jpa.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, >@@ -38,7 +29,7 @@ > > @Override > protected TableValidator buildTableValidator() { >- return new MapKeyAttributeOverrideColumnTableValidator(this.persistentAttribute, this.column, this.textRangeResolver, this.tableDescriptionProvider); >+ return new TableValidator(); > } > > @Override >@@ -52,15 +43,11 @@ > } > > >- public class MapKeyAttributeOverrideColumnTableValidator >- extends AttributeOverrideColumnTableValidator >+ protected class TableValidator >+ extends AttributeOverrideColumnValidator.TableValidator > { >- protected MapKeyAttributeOverrideColumnTableValidator( >- PersistentAttribute persistentAttribute, >- BaseColumn column, >- BaseColumnTextRangeResolver textRangeResolver, >- TableDescriptionProvider provider) { >- super(persistentAttribute, column, textRangeResolver, provider); >+ protected TableValidator() { >+ super(); > } > > @Override >Index: src/org/eclipse/jpt/jpa/core/internal/jpa1/context/MapKeyAttributeOverrideValidator.java >=================================================================== >RCS file: /cvsroot/webtools/org.eclipse.jpa/components/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/MapKeyAttributeOverrideValidator.java,v >retrieving revision 1.1 >diff -u -r1.1 MapKeyAttributeOverrideValidator.java >--- src/org/eclipse/jpt/jpa/core/internal/jpa1/context/MapKeyAttributeOverrideValidator.java 6 Feb 2011 02:07:25 -0000 1.1 >+++ src/org/eclipse/jpt/jpa/core/internal/jpa1/context/MapKeyAttributeOverrideValidator.java 11 May 2011 14:49:39 -0000 >@@ -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. >@@ -19,14 +19,6 @@ > extends AttributeOverrideValidator > { > public MapKeyAttributeOverrideValidator( >- AttributeOverride override, >- AttributeOverrideContainer container, >- OverrideTextRangeResolver textRangeResolver, >- OverrideDescriptionProvider overrideDescriptionProvider) { >- super(override, container, textRangeResolver, overrideDescriptionProvider); >- } >- >- public MapKeyAttributeOverrideValidator( > PersistentAttribute persistentAttribute, > AttributeOverride override, > AttributeOverrideContainer container, >Index: src/org/eclipse/jpt/jpa/core/internal/jpa1/context/MapKeyColumnValidator.java >=================================================================== >RCS file: /cvsroot/webtools/org.eclipse.jpa/components/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/MapKeyColumnValidator.java,v >retrieving revision 1.1 >diff -u -r1.1 MapKeyColumnValidator.java >--- src/org/eclipse/jpt/jpa/core/internal/jpa1/context/MapKeyColumnValidator.java 6 Feb 2011 02:07:25 -0000 1.1 >+++ src/org/eclipse/jpt/jpa/core/internal/jpa1/context/MapKeyColumnValidator.java 11 May 2011 14:49:39 -0000 >@@ -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. >@@ -12,20 +12,11 @@ > import org.eclipse.jpt.jpa.core.context.BaseColumn; > import org.eclipse.jpt.jpa.core.context.PersistentAttribute; > import org.eclipse.jpt.jpa.core.internal.context.BaseColumnTextRangeResolver; >-import org.eclipse.jpt.jpa.core.internal.jpa1.context.BaseColumnTableValidator.TableDescriptionProvider; > import org.eclipse.jpt.jpa.core.internal.validation.JpaValidationMessages; > > public class MapKeyColumnValidator > extends AbstractNamedColumnValidator<BaseColumn, BaseColumnTextRangeResolver> > { >- >- public MapKeyColumnValidator( >- BaseColumn column, >- BaseColumnTextRangeResolver textRangeResolver, >- TableDescriptionProvider provider) { >- super(column, textRangeResolver, provider); >- } >- > public MapKeyColumnValidator( > PersistentAttribute persistentAttribute, > BaseColumn column, >@@ -36,7 +27,7 @@ > > @Override > protected TableValidator buildTableValidator() { >- return new MapKeyColumnTableValidator(this.persistentAttribute, this.column, this.textRangeResolver, this.tableDescriptionProvider); >+ return new TableValidator(); > } > > @Override >@@ -49,15 +40,11 @@ > return JpaValidationMessages.VIRTUAL_ATTRIBUTE_MAP_KEY_COLUMN_UNRESOLVED_NAME; > } > >- public static class MapKeyColumnTableValidator >+ protected class TableValidator > extends BaseColumnTableValidator > { >- protected MapKeyColumnTableValidator( >- PersistentAttribute persistentAttribute, >- BaseColumn column, >- BaseColumnTextRangeResolver textRangeResolver, >- TableDescriptionProvider provider) { >- super(persistentAttribute, column, textRangeResolver, provider); >+ protected TableValidator() { >+ super(); > } > > @Override >Index: src/org/eclipse/jpt/jpa/core/internal/jpa1/context/NamedColumnValidator.java >=================================================================== >RCS file: /cvsroot/webtools/org.eclipse.jpa/components/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/NamedColumnValidator.java,v >retrieving revision 1.1 >diff -u -r1.1 NamedColumnValidator.java >--- src/org/eclipse/jpt/jpa/core/internal/jpa1/context/NamedColumnValidator.java 6 Feb 2011 02:07:24 -0000 1.1 >+++ src/org/eclipse/jpt/jpa/core/internal/jpa1/context/NamedColumnValidator.java 11 May 2011 14:49:39 -0000 >@@ -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. >@@ -12,7 +12,6 @@ > import org.eclipse.jpt.jpa.core.context.BaseColumn; > import org.eclipse.jpt.jpa.core.context.PersistentAttribute; > import org.eclipse.jpt.jpa.core.internal.context.BaseColumnTextRangeResolver; >-import org.eclipse.jpt.jpa.core.internal.jpa1.context.BaseColumnTableValidator.TableDescriptionProvider; > import org.eclipse.jpt.jpa.core.internal.validation.JpaValidationMessages; > > public class NamedColumnValidator >@@ -36,7 +35,7 @@ > > @Override > protected TableValidator buildTableValidator() { >- return new BaseColumnTableValidator(this.persistentAttribute, this.column, this.textRangeResolver, this.tableDescriptionProvider); >+ return new BaseColumnTableValidator(); > } > > @Override >Index: src/org/eclipse/jpt/jpa/core/internal/jpa1/context/OneToOnePrimaryKeyJoinColumnValidator.java >=================================================================== >RCS file: /cvsroot/webtools/org.eclipse.jpa/components/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/OneToOnePrimaryKeyJoinColumnValidator.java,v >retrieving revision 1.1 >diff -u -r1.1 OneToOnePrimaryKeyJoinColumnValidator.java >--- src/org/eclipse/jpt/jpa/core/internal/jpa1/context/OneToOnePrimaryKeyJoinColumnValidator.java 6 Feb 2011 02:07:24 -0000 1.1 >+++ src/org/eclipse/jpt/jpa/core/internal/jpa1/context/OneToOnePrimaryKeyJoinColumnValidator.java 11 May 2011 14:49:39 -0000 >@@ -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. >@@ -18,13 +18,6 @@ > extends PrimaryKeyJoinColumnValidator > { > public OneToOnePrimaryKeyJoinColumnValidator( >- BaseJoinColumn column, >- BaseJoinColumn.Owner owner, >- BaseJoinColumnTextRangeResolver textRangeResolver) { >- super(column, owner, textRangeResolver); >- } >- >- public OneToOnePrimaryKeyJoinColumnValidator( > PersistentAttribute persistentAttribute, > BaseJoinColumn column, > BaseJoinColumn.Owner owner, >Index: src/org/eclipse/jpt/jpa/core/internal/jpa1/context/OverrideValidator.java >=================================================================== >RCS file: /cvsroot/webtools/org.eclipse.jpa/components/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/OverrideValidator.java,v >retrieving revision 1.2 >diff -u -r1.2 OverrideValidator.java >--- src/org/eclipse/jpt/jpa/core/internal/jpa1/context/OverrideValidator.java 26 Apr 2011 21:36:54 -0000 1.2 >+++ src/org/eclipse/jpt/jpa/core/internal/jpa1/context/OverrideValidator.java 11 May 2011 14:49:39 -0000 >@@ -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. >@@ -56,14 +56,6 @@ > this.overrideDescriptionProvider = overrideDescriptionProvider; > } > >- protected boolean persistentAttributeIsVirtual() { >- return (this.persistentAttribute != null) && this.persistentAttribute.isVirtual(); >- } >- >- protected String getPersistentAttributeName() { >- return this.persistentAttribute.getName(); >- } >- > protected String getOverrideDescriptionMessage() { > return this.overrideDescriptionProvider.getOverrideDescriptionMessage(); > } >@@ -115,7 +107,7 @@ > if (this.override.isVirtual()) { > return this.buildVirtualUnresolvedNameMessage(); > } >- if (this.persistentAttributeIsVirtual()) { >+ if (this.persistentAttribute.isVirtual()) { > return this.buildVirtualAttributeUnresolvedNameMessage(); > } > return this.buildUnresolvedNameMessage(this.getUnresolvedNameMessage()); >@@ -158,7 +150,7 @@ > IMessage.HIGH_SEVERITY, > this.getVirtualAttributeUnresolvedNameMessage(), > new String[] { >- this.getPersistentAttributeName(), >+ this.persistentAttribute.getName(), > this.override.getName(), > this.getOverrideDescriptionMessage(), > this.container.getOverridableTypeMapping().getName() >Index: src/org/eclipse/jpt/jpa/core/internal/jpa1/context/PrimaryKeyJoinColumnValidator.java >=================================================================== >RCS file: /cvsroot/webtools/org.eclipse.jpa/components/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/PrimaryKeyJoinColumnValidator.java,v >retrieving revision 1.1 >diff -u -r1.1 PrimaryKeyJoinColumnValidator.java >--- src/org/eclipse/jpt/jpa/core/internal/jpa1/context/PrimaryKeyJoinColumnValidator.java 6 Feb 2011 02:07:24 -0000 1.1 >+++ src/org/eclipse/jpt/jpa/core/internal/jpa1/context/PrimaryKeyJoinColumnValidator.java 11 May 2011 14:49:39 -0000 >@@ -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. >@@ -12,7 +12,6 @@ > import org.eclipse.jpt.jpa.core.context.BaseJoinColumn; > import org.eclipse.jpt.jpa.core.context.PersistentAttribute; > import org.eclipse.jpt.jpa.core.internal.context.BaseJoinColumnTextRangeResolver; >-import org.eclipse.jpt.jpa.core.internal.jpa1.context.BaseColumnTableValidator.NullTableDescriptionProvider; > import org.eclipse.jpt.jpa.core.internal.validation.JpaValidationMessages; > import org.eclipse.wst.validation.internal.provisional.core.IMessage; > >@@ -23,7 +22,7 @@ > BaseJoinColumn column, > BaseJoinColumn.Owner owner, > BaseJoinColumnTextRangeResolver textRangeResolver) { >- super(column, owner, textRangeResolver, new NullTableDescriptionProvider()); >+ super(column, owner, textRangeResolver, TableDescriptionProvider.Null.instance()); > } > > protected PrimaryKeyJoinColumnValidator( >@@ -31,7 +30,7 @@ > BaseJoinColumn column, > BaseJoinColumn.Owner owner, > BaseJoinColumnTextRangeResolver textRangeResolver) { >- super(persistentAttribute, column, owner, textRangeResolver, new NullTableDescriptionProvider()); >+ super(persistentAttribute, column, owner, textRangeResolver, TableDescriptionProvider.Null.instance()); > } > > @Override >Index: src/org/eclipse/jpt/jpa/core/internal/jpa1/context/RelationshipStrategyTableDescriptionProvider.java >=================================================================== >RCS file: /cvsroot/webtools/org.eclipse.jpa/components/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/RelationshipStrategyTableDescriptionProvider.java,v >retrieving revision 1.1 >diff -u -r1.1 RelationshipStrategyTableDescriptionProvider.java >--- src/org/eclipse/jpt/jpa/core/internal/jpa1/context/RelationshipStrategyTableDescriptionProvider.java 6 Feb 2011 02:07:24 -0000 1.1 >+++ src/org/eclipse/jpt/jpa/core/internal/jpa1/context/RelationshipStrategyTableDescriptionProvider.java 11 May 2011 14:49:39 -0000 >@@ -10,10 +10,9 @@ > package org.eclipse.jpt.jpa.core.internal.jpa1.context; > > import org.eclipse.jpt.jpa.core.context.RelationshipStrategy; >-import org.eclipse.jpt.jpa.core.internal.jpa1.context.BaseColumnTableValidator.TableDescriptionProvider; > > public class RelationshipStrategyTableDescriptionProvider >- implements TableDescriptionProvider >+ implements AbstractNamedColumnValidator.TableDescriptionProvider > { > private final RelationshipStrategy relationshipStrategy; > >@@ -25,5 +24,4 @@ > public String getColumnTableDescriptionMessage() { > return this.relationshipStrategy.getColumnTableNotValidDescription(); > } >- > } >Index: src/org/eclipse/jpt/jpa/core/internal/jpa1/context/java/AbstractJavaOverrideContainer.java >=================================================================== >RCS file: /cvsroot/webtools/org.eclipse.jpa/components/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/java/AbstractJavaOverrideContainer.java,v >retrieving revision 1.3 >diff -u -r1.3 AbstractJavaOverrideContainer.java >--- src/org/eclipse/jpt/jpa/core/internal/jpa1/context/java/AbstractJavaOverrideContainer.java 28 Apr 2011 02:00:43 -0000 1.3 >+++ src/org/eclipse/jpt/jpa/core/internal/jpa1/context/java/AbstractJavaOverrideContainer.java 11 May 2011 14:49:39 -0000 >@@ -67,7 +67,7 @@ > R extends JavaReadOnlyOverride, > S extends JavaOverride, > V extends JavaVirtualOverride, >- A extends OverrideAnnotation >+ A extends OverrideAnnotation & NestableAnnotation > > > extends AbstractJavaJpaContextNode > implements JavaOverrideContainer >Index: src/org/eclipse/jpt/jpa/core/internal/jpa1/context/java/GenericJavaAssociationOverrideContainer.java >=================================================================== >RCS file: /cvsroot/webtools/org.eclipse.jpa/components/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/java/GenericJavaAssociationOverrideContainer.java,v >retrieving revision 1.1 >diff -u -r1.1 GenericJavaAssociationOverrideContainer.java >--- src/org/eclipse/jpt/jpa/core/internal/jpa1/context/java/GenericJavaAssociationOverrideContainer.java 6 Feb 2011 02:07:16 -0000 1.1 >+++ src/org/eclipse/jpt/jpa/core/internal/jpa1/context/java/GenericJavaAssociationOverrideContainer.java 11 May 2011 14:49:40 -0000 >@@ -25,6 +25,7 @@ > import org.eclipse.jpt.jpa.core.internal.context.TableTextRangeResolver; > import org.eclipse.jpt.jpa.core.resource.java.AssociationOverrideAnnotation; > import org.eclipse.jpt.jpa.core.resource.java.AssociationOverridesAnnotation; >+import org.eclipse.jpt.jpa.core.resource.java.NestableAssociationOverrideAnnotation; > > /** > * Java attribute override container >@@ -35,7 +36,7 @@ > JavaReadOnlyAssociationOverride, > JavaAssociationOverride, > JavaVirtualAssociationOverride, >- AssociationOverrideAnnotation >+ NestableAssociationOverrideAnnotation > > > implements JavaAssociationOverrideContainer > { >@@ -52,12 +53,12 @@ > return this.owner.resolveOverriddenRelationship(associationOverrideName); > } > >- public JptValidator buildJoinTableJoinColumnValidator(AssociationOverride override, JoinColumn column, org.eclipse.jpt.jpa.core.context.JoinColumn.Owner owner, JoinColumnTextRangeResolver textRangeResolver) { >- return this.owner.buildJoinTableJoinColumnValidator(override, column, owner, textRangeResolver); >+ public JptValidator buildJoinTableJoinColumnValidator(AssociationOverride override, JoinColumn column, org.eclipse.jpt.jpa.core.context.JoinColumn.Owner o, JoinColumnTextRangeResolver textRangeResolver) { >+ return this.owner.buildJoinTableJoinColumnValidator(override, column, o, textRangeResolver); > } > >- public JptValidator buildJoinTableInverseJoinColumnValidator(AssociationOverride override, JoinColumn column, org.eclipse.jpt.jpa.core.context.JoinColumn.Owner owner, JoinColumnTextRangeResolver textRangeResolver) { >- return this.owner.buildJoinTableInverseJoinColumnValidator(override, column, owner, textRangeResolver); >+ public JptValidator buildJoinTableInverseJoinColumnValidator(AssociationOverride override, JoinColumn column, org.eclipse.jpt.jpa.core.context.JoinColumn.Owner o, JoinColumnTextRangeResolver textRangeResolver) { >+ return this.owner.buildJoinTableInverseJoinColumnValidator(override, column, o, textRangeResolver); > } > > public JptValidator buildTableValidator(AssociationOverride override, Table table, TableTextRangeResolver textRangeResolver) { >@@ -75,7 +76,7 @@ > } > > @Override >- protected JavaAssociationOverride buildSpecifiedOverride(AssociationOverrideAnnotation overrideAnnotation) { >+ protected JavaAssociationOverride buildSpecifiedOverride(NestableAssociationOverrideAnnotation overrideAnnotation) { > return this.getJpaFactory().buildJavaAssociationOverride(this, overrideAnnotation); > } > >Index: src/org/eclipse/jpt/jpa/core/internal/jpa1/context/java/GenericJavaAttributeOverrideContainer.java >=================================================================== >RCS file: /cvsroot/webtools/org.eclipse.jpa/components/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/java/GenericJavaAttributeOverrideContainer.java,v >retrieving revision 1.1 >diff -u -r1.1 GenericJavaAttributeOverrideContainer.java >--- src/org/eclipse/jpt/jpa/core/internal/jpa1/context/java/GenericJavaAttributeOverrideContainer.java 6 Feb 2011 02:07:16 -0000 1.1 >+++ src/org/eclipse/jpt/jpa/core/internal/jpa1/context/java/GenericJavaAttributeOverrideContainer.java 11 May 2011 14:49:40 -0000 >@@ -1,5 +1,5 @@ > /******************************************************************************* >- * Copyright (c) 2009, 2010 Oracle. All rights reserved. >+ * Copyright (c) 2009, 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. >@@ -17,6 +17,7 @@ > import org.eclipse.jpt.jpa.core.context.java.JavaVirtualAttributeOverride; > import org.eclipse.jpt.jpa.core.resource.java.AttributeOverrideAnnotation; > import org.eclipse.jpt.jpa.core.resource.java.AttributeOverridesAnnotation; >+import org.eclipse.jpt.jpa.core.resource.java.NestableAttributeOverrideAnnotation; > > /** > * Java attribute override container >@@ -27,7 +28,7 @@ > JavaReadOnlyAttributeOverride, > JavaAttributeOverride, > JavaVirtualAttributeOverride, >- AttributeOverrideAnnotation >+ NestableAttributeOverrideAnnotation > > > implements JavaAttributeOverrideContainer > { >@@ -51,7 +52,7 @@ > } > > @Override >- protected JavaAttributeOverride buildSpecifiedOverride(AttributeOverrideAnnotation overrideAnnotation) { >+ protected JavaAttributeOverride buildSpecifiedOverride(NestableAttributeOverrideAnnotation overrideAnnotation) { > return this.getJpaFactory().buildJavaAttributeOverride(this, overrideAnnotation); > } > >Index: src/org/eclipse/jpt/jpa/core/internal/jpa1/context/java/GenericJavaEmbeddedMapping.java >=================================================================== >RCS file: /cvsroot/webtools/org.eclipse.jpa/components/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/java/GenericJavaEmbeddedMapping.java,v >retrieving revision 1.1 >diff -u -r1.1 GenericJavaEmbeddedMapping.java >--- src/org/eclipse/jpt/jpa/core/internal/jpa1/context/java/GenericJavaEmbeddedMapping.java 6 Feb 2011 02:07:16 -0000 1.1 >+++ src/org/eclipse/jpt/jpa/core/internal/jpa1/context/java/GenericJavaEmbeddedMapping.java 11 May 2011 14:49:40 -0000 >@@ -262,23 +262,27 @@ > } > > public JptValidator buildValidator(Override_ override, OverrideContainer container, OverrideTextRangeResolver textRangeResolver) { >- return new AssociationOverrideValidator((AssociationOverride) override, (AssociationOverrideContainer) container, textRangeResolver, new EmbeddableOverrideDescriptionProvider()); >+ return new AssociationOverrideValidator(this.getPersistentAttribute(), (AssociationOverride) override, (AssociationOverrideContainer) container, textRangeResolver, new EmbeddableOverrideDescriptionProvider()); > } > > public JptValidator buildColumnValidator(Override_ override, BaseColumn column, BaseColumn.Owner owner, BaseColumnTextRangeResolver textRangeResolver) { >- return new AssociationOverrideJoinColumnValidator((AssociationOverride) override, (JoinColumn) column, (JoinColumn.Owner) owner, (JoinColumnTextRangeResolver) textRangeResolver, new EntityTableDescriptionProvider()); >+ return new AssociationOverrideJoinColumnValidator(this.getPersistentAttribute(), (AssociationOverride) override, (JoinColumn) column, (JoinColumn.Owner) owner, (JoinColumnTextRangeResolver) textRangeResolver, new EntityTableDescriptionProvider()); > } > > public JptValidator buildJoinTableJoinColumnValidator(AssociationOverride override, JoinColumn column, JoinColumn.Owner owner, JoinColumnTextRangeResolver textRangeResolver) { >- return new AssociationOverrideJoinColumnValidator(override, column, owner, textRangeResolver, new JoinTableTableDescriptionProvider()); >+ return new AssociationOverrideJoinColumnValidator(this.getPersistentAttribute(), override, column, owner, textRangeResolver, new JoinTableTableDescriptionProvider()); > } > > public JptValidator buildJoinTableInverseJoinColumnValidator(AssociationOverride override, JoinColumn column, JoinColumn.Owner owner, JoinColumnTextRangeResolver textRangeResolver) { >- return new AssociationOverrideInverseJoinColumnValidator(override, column, owner, textRangeResolver, new JoinTableTableDescriptionProvider()); >+ return new AssociationOverrideInverseJoinColumnValidator(this.getPersistentAttribute(), override, column, owner, textRangeResolver, new JoinTableTableDescriptionProvider()); > } > > public JptValidator buildTableValidator(AssociationOverride override, Table table, TableTextRangeResolver textRangeResolver) { >- return new AssociationOverrideJoinTableValidator(override, (JoinTable) table, textRangeResolver); >+ return new AssociationOverrideJoinTableValidator(this.getPersistentAttribute(), override, (JoinTable) table, textRangeResolver); >+ } >+ >+ protected JavaPersistentAttribute getPersistentAttribute() { >+ return GenericJavaEmbeddedMapping.this.getPersistentAttribute(); > } > } > } >Index: src/org/eclipse/jpt/jpa/core/internal/jpa1/context/java/GenericJavaGeneratorContainer.java >=================================================================== >RCS file: /cvsroot/webtools/org.eclipse.jpa/components/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/java/GenericJavaGeneratorContainer.java,v >retrieving revision 1.2 >diff -u -r1.2 GenericJavaGeneratorContainer.java >--- src/org/eclipse/jpt/jpa/core/internal/jpa1/context/java/GenericJavaGeneratorContainer.java 28 Apr 2011 02:00:43 -0000 1.2 >+++ src/org/eclipse/jpt/jpa/core/internal/jpa1/context/java/GenericJavaGeneratorContainer.java 11 May 2011 14:49:40 -0000 >@@ -9,22 +9,17 @@ > ******************************************************************************/ > package org.eclipse.jpt.jpa.core.internal.jpa1.context.java; > >-import java.util.ArrayList; > import java.util.Iterator; > import java.util.List; > import org.eclipse.jdt.core.dom.CompilationUnit; > import org.eclipse.jpt.common.core.utility.TextRange; > import org.eclipse.jpt.common.utility.Filter; >-import org.eclipse.jpt.common.utility.internal.StringTools; >-import org.eclipse.jpt.jpa.core.context.Generator; >-import org.eclipse.jpt.jpa.core.context.java.JavaGenerator; > import org.eclipse.jpt.jpa.core.context.java.JavaGeneratorContainer; >+import org.eclipse.jpt.jpa.core.context.java.JavaIdMapping; > import org.eclipse.jpt.jpa.core.context.java.JavaJpaContextNode; > import org.eclipse.jpt.jpa.core.context.java.JavaSequenceGenerator; > import org.eclipse.jpt.jpa.core.context.java.JavaTableGenerator; > import org.eclipse.jpt.jpa.core.internal.context.java.AbstractJavaJpaContextNode; >-import org.eclipse.jpt.jpa.core.internal.validation.DefaultJpaValidationMessages; >-import org.eclipse.jpt.jpa.core.internal.validation.JpaValidationMessages; > import org.eclipse.jpt.jpa.core.resource.java.SequenceGeneratorAnnotation; > import org.eclipse.jpt.jpa.core.resource.java.TableGeneratorAnnotation; > import org.eclipse.wst.validation.internal.provisional.core.IMessage; >@@ -108,7 +103,7 @@ > } > > protected JavaSequenceGenerator buildSequenceGenerator(SequenceGeneratorAnnotation sequenceGeneratorAnnotation) { >- return this.getJpaFactory().buildJavaSequenceGenerator(this, sequenceGeneratorAnnotation); >+ return this.isVirtual() ? null : this.getJpaFactory().buildJavaSequenceGenerator(this, sequenceGeneratorAnnotation); > } > > protected void syncSequenceGenerator() { >@@ -171,7 +166,7 @@ > } > > protected JavaTableGenerator buildTableGenerator(TableGeneratorAnnotation tableGeneratorAnnotation) { >- return this.getJpaFactory().buildJavaTableGenerator(this, tableGeneratorAnnotation); >+ return this.isVirtual() ? null : this.getJpaFactory().buildJavaTableGenerator(this, tableGeneratorAnnotation); > } > > protected void syncTableGenerator() { >@@ -222,58 +217,14 @@ > > // ********** validation ********** > >+ /** >+ * The generators are validated in the persistence unit. >+ * @see org.eclipse.jpt.jpa.core.internal.context.persistence.AbstractPersistenceUnit#validateGenerators(List, IReporter) >+ */ > @Override > public void validate(List<IMessage> messages, IReporter reporter, CompilationUnit astRoot) { > super.validate(messages, reporter, astRoot); >- this.validateGenerators(messages, astRoot); >- } >- >- protected void validateGenerators(List<IMessage> messages, CompilationUnit astRoot) { >- for (JavaGenerator localGenerator : this.getGenerators()) { >- String name = localGenerator.getName(); >- if (StringTools.stringIsEmpty(name)){ >- messages.add( >- DefaultJpaValidationMessages.buildMessage( >- IMessage.HIGH_SEVERITY, >- JpaValidationMessages.GENERATOR_NAME_UNDEFINED, >- new String[] {}, >- localGenerator, >- localGenerator.getNameTextRange(astRoot) >- ) >- ); >- } else { >- List<String> reportedNames = new ArrayList<String>(); >- for (Iterator<Generator> globalGenerators = this.getPersistenceUnit().generators(); globalGenerators.hasNext(); ) { >- if (localGenerator.duplicates(globalGenerators.next()) && !reportedNames.contains(name)) { >- messages.add( >- DefaultJpaValidationMessages.buildMessage( >- IMessage.HIGH_SEVERITY, >- JpaValidationMessages.GENERATOR_DUPLICATE_NAME, >- new String[] {name}, >- localGenerator, >- localGenerator.getNameTextRange(astRoot) >- ) >- ); >- reportedNames.add(name); >- } >- } >- } >- } >- } >- >- protected Iterable<JavaGenerator> getGenerators() { >- ArrayList<JavaGenerator> generators = new ArrayList<JavaGenerator>(); >- this.addGeneratorsTo(generators); >- return generators; >- } >- >- protected void addGeneratorsTo(ArrayList<JavaGenerator> generators) { >- if (this.sequenceGenerator != null) { >- generators.add(this.sequenceGenerator); >- } >- if (this.tableGenerator != null) { >- generators.add(this.tableGenerator); >- } >+ // generators are validated in the persistence unit > } > > public TextRange getValidationTextRange(CompilationUnit astRoot) { >@@ -292,4 +243,19 @@ > public JavaJpaContextNode getParent() { > return (JavaJpaContextNode) super.getParent(); > } >+ >+ /** >+ * Return whether the container is <em>virtual</em> and, as a result, does >+ * not have either a sequence or table generator. As of JPA 2.0, this is >+ * only true when the container's parent is a virtual ID mapping. >+ */ >+ // TODO bjv need to add API to JavaGeneratorContainer.Owner >+ protected boolean isVirtual() { >+ JavaJpaContextNode p = this.getParent(); >+ if (p instanceof JavaIdMapping) { >+ JavaIdMapping idMapping = (JavaIdMapping) p; >+ return idMapping.getPersistentAttribute().isVirtual(); >+ } >+ return false; >+ } > } >Index: src/org/eclipse/jpt/jpa/core/internal/jpa1/context/java/GenericJavaMappingJoinTableRelationshipStrategy.java >=================================================================== >RCS file: /cvsroot/webtools/org.eclipse.jpa/components/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/java/GenericJavaMappingJoinTableRelationshipStrategy.java,v >retrieving revision 1.1 >diff -u -r1.1 GenericJavaMappingJoinTableRelationshipStrategy.java >--- src/org/eclipse/jpt/jpa/core/internal/jpa1/context/java/GenericJavaMappingJoinTableRelationshipStrategy.java 6 Feb 2011 02:07:16 -0000 1.1 >+++ src/org/eclipse/jpt/jpa/core/internal/jpa1/context/java/GenericJavaMappingJoinTableRelationshipStrategy.java 11 May 2011 14:49:40 -0000 >@@ -12,9 +12,10 @@ > import org.eclipse.jdt.core.dom.CompilationUnit; > import org.eclipse.jpt.common.core.utility.TextRange; > import org.eclipse.jpt.jpa.core.context.JoinColumn; >+import org.eclipse.jpt.jpa.core.context.JoinColumn.Owner; > import org.eclipse.jpt.jpa.core.context.JoinTable; >+import org.eclipse.jpt.jpa.core.context.PersistentAttribute; > import org.eclipse.jpt.jpa.core.context.Table; >-import org.eclipse.jpt.jpa.core.context.JoinColumn.Owner; > import org.eclipse.jpt.jpa.core.context.java.JavaMappingJoinTableRelationship; > import org.eclipse.jpt.jpa.core.internal.context.JoinColumnTextRangeResolver; > import org.eclipse.jpt.jpa.core.internal.context.JptValidator; >@@ -83,15 +84,19 @@ > return this.getRelationship().getValidationTextRange(astRoot); > } > >+ protected PersistentAttribute getPersistentAttribute() { >+ return this.getRelationshipMapping().getPersistentAttribute(); >+ } >+ > public JptValidator buildTableValidator(Table table, TableTextRangeResolver textRangeResolver) { >- return new JoinTableValidator((JoinTable) table, textRangeResolver); >+ return new JoinTableValidator(this.getPersistentAttribute(), (JoinTable) table, textRangeResolver); > } > > public JptValidator buildJoinTableJoinColumnValidator(JoinColumn column, JoinColumn.Owner owner, JoinColumnTextRangeResolver textRangeResolver) { >- return new JoinColumnValidator(column, owner, textRangeResolver, new JoinTableTableDescriptionProvider()); >+ return new JoinColumnValidator(this.getPersistentAttribute(), column, owner, textRangeResolver, new JoinTableTableDescriptionProvider()); > } > > public JptValidator buildJoinTableInverseJoinColumnValidator(JoinColumn column, Owner owner, JoinColumnTextRangeResolver textRangeResolver) { >- return new InverseJoinColumnValidator(column, owner, textRangeResolver, new JoinTableTableDescriptionProvider()); >+ return new InverseJoinColumnValidator(this.getPersistentAttribute(), column, owner, textRangeResolver, new JoinTableTableDescriptionProvider()); > } > } >Index: src/org/eclipse/jpt/jpa/core/internal/jpa1/context/java/GenericJavaNamedNativeQuery.java >=================================================================== >RCS file: /cvsroot/webtools/org.eclipse.jpa/components/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/java/GenericJavaNamedNativeQuery.java,v >retrieving revision 1.1 >diff -u -r1.1 GenericJavaNamedNativeQuery.java >--- src/org/eclipse/jpt/jpa/core/internal/jpa1/context/java/GenericJavaNamedNativeQuery.java 6 Feb 2011 02:07:16 -0000 1.1 >+++ src/org/eclipse/jpt/jpa/core/internal/jpa1/context/java/GenericJavaNamedNativeQuery.java 11 May 2011 14:49:40 -0000 >@@ -1,5 +1,5 @@ > /******************************************************************************* >- * Copyright (c) 2007, 2010 Oracle. All rights reserved. >+ * Copyright (c) 2007, 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. >@@ -9,10 +9,14 @@ > ******************************************************************************/ > package org.eclipse.jpt.jpa.core.internal.jpa1.context.java; > >+import java.util.List; >+import org.eclipse.jdt.core.dom.CompilationUnit; > import org.eclipse.jpt.jpa.core.context.java.JavaJpaContextNode; > import org.eclipse.jpt.jpa.core.context.java.JavaNamedNativeQuery; > import org.eclipse.jpt.jpa.core.internal.context.java.AbstractJavaQuery; > import org.eclipse.jpt.jpa.core.resource.java.NamedNativeQueryAnnotation; >+import org.eclipse.wst.validation.internal.provisional.core.IMessage; >+import org.eclipse.wst.validation.internal.provisional.core.IReporter; > > /** > * <code>orm.xml</code> named native query >@@ -82,4 +86,11 @@ > this.firePropertyChanged(RESULT_SET_MAPPING_PROPERTY, old, resultSetMapping); > } > >+ >+ // ********** validation ********** >+ >+ @Override >+ protected void validateQuery_(List<IMessage> messages, IReporter reporter, CompilationUnit astRoot) { >+ // nothing yet >+ } > } >Index: src/org/eclipse/jpt/jpa/core/internal/jpa1/context/java/GenericJavaNamedQuery.java >=================================================================== >RCS file: /cvsroot/webtools/org.eclipse.jpa/components/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/java/GenericJavaNamedQuery.java,v >retrieving revision 1.2 >diff -u -r1.2 GenericJavaNamedQuery.java >--- src/org/eclipse/jpt/jpa/core/internal/jpa1/context/java/GenericJavaNamedQuery.java 12 Apr 2011 22:12:47 -0000 1.2 >+++ src/org/eclipse/jpt/jpa/core/internal/jpa1/context/java/GenericJavaNamedQuery.java 11 May 2011 14:49:40 -0000 >@@ -33,14 +33,9 @@ > > // ********** validation ********** > >- /** >- * {@inheritDoc} >- */ > @Override >- public void validate(List<IMessage> messages, IReporter reporter, CompilationUnit astRoot) { >- super.validate(messages, reporter, astRoot); >- >+ protected void validateQuery_(List<IMessage> messages, IReporter reporter, CompilationUnit astRoot) { > JpaJpqlQueryHelper helper = new JpaJpqlQueryHelper(); >- helper.validate(this, this.getQuery(), this.getQueryAnnotation().getQueryTextRange(astRoot), 1, messages); >+ helper.validate(this, this.query, this.getQueryAnnotation().getQueryTextRange(astRoot), 1, messages); > } >-} >\ No newline at end of file >+} >Index: src/org/eclipse/jpt/jpa/core/internal/jpa1/context/java/GenericJavaOrderable.java >=================================================================== >RCS file: /cvsroot/webtools/org.eclipse.jpa/components/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/java/GenericJavaOrderable.java,v >retrieving revision 1.1 >diff -u -r1.1 GenericJavaOrderable.java >--- src/org/eclipse/jpt/jpa/core/internal/jpa1/context/java/GenericJavaOrderable.java 6 Feb 2011 02:07:16 -0000 1.1 >+++ src/org/eclipse/jpt/jpa/core/internal/jpa1/context/java/GenericJavaOrderable.java 11 May 2011 14:49:40 -0000 >@@ -1,5 +1,5 @@ > /******************************************************************************* >- * Copyright (c) 2009, 2010 Oracle. All rights reserved. >+ * Copyright (c) 2009, 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. >@@ -476,7 +476,7 @@ > } > > public JptValidator buildColumnValidator(NamedColumn column, NamedColumnTextRangeResolver textRangeResolver) { >- return new OrderColumnValidator((OrderColumn2_0) column, textRangeResolver); >+ return new OrderColumnValidator(this.getPersistentAttribute(), (OrderColumn2_0) column, textRangeResolver); > } > > protected JavaPersistentAttribute getPersistentAttribute() { >Index: src/org/eclipse/jpt/jpa/core/internal/jpa1/context/java/GenericJavaQueryContainer.java >=================================================================== >RCS file: /cvsroot/webtools/org.eclipse.jpa/components/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/java/GenericJavaQueryContainer.java,v >retrieving revision 1.3 >diff -u -r1.3 GenericJavaQueryContainer.java >--- src/org/eclipse/jpt/jpa/core/internal/jpa1/context/java/GenericJavaQueryContainer.java 28 Apr 2011 02:00:43 -0000 1.3 >+++ src/org/eclipse/jpt/jpa/core/internal/jpa1/context/java/GenericJavaQueryContainer.java 11 May 2011 14:49:40 -0000 >@@ -9,7 +9,6 @@ > ******************************************************************************/ > package org.eclipse.jpt.jpa.core.internal.jpa1.context.java; > >-import java.util.ArrayList; > import java.util.Iterator; > import java.util.List; > import java.util.ListIterator; >@@ -17,28 +16,25 @@ > import org.eclipse.jdt.core.dom.CompilationUnit; > import org.eclipse.jpt.common.core.utility.TextRange; > import org.eclipse.jpt.common.utility.internal.CollectionTools; >-import org.eclipse.jpt.common.utility.internal.StringTools; > import org.eclipse.jpt.common.utility.internal.iterables.ListIterable; > import org.eclipse.jpt.common.utility.internal.iterables.LiveCloneListIterable; >-import org.eclipse.jpt.common.utility.internal.iterables.SubIterableWrapper; >-import org.eclipse.jpt.common.utility.internal.iterators.CompositeIterator; >+import org.eclipse.jpt.common.utility.internal.iterators.SubIteratorWrapper; >+import org.eclipse.jpt.common.utility.internal.iterators.SuperIteratorWrapper; > import org.eclipse.jpt.jpa.core.context.NamedNativeQuery; > import org.eclipse.jpt.jpa.core.context.NamedQuery; >-import org.eclipse.jpt.jpa.core.context.Query; > import org.eclipse.jpt.jpa.core.context.java.JavaJpaContextNode; > import org.eclipse.jpt.jpa.core.context.java.JavaNamedNativeQuery; > import org.eclipse.jpt.jpa.core.context.java.JavaNamedQuery; >-import org.eclipse.jpt.jpa.core.context.java.JavaQuery; > import org.eclipse.jpt.jpa.core.context.java.JavaQueryContainer; > import org.eclipse.jpt.jpa.core.internal.context.ContextContainerTools; > import org.eclipse.jpt.jpa.core.internal.context.java.AbstractJavaJpaContextNode; >-import org.eclipse.jpt.jpa.core.internal.validation.DefaultJpaValidationMessages; >-import org.eclipse.jpt.jpa.core.internal.validation.JpaValidationMessages; > import org.eclipse.jpt.jpa.core.resource.java.NamedNativeQueriesAnnotation; > import org.eclipse.jpt.jpa.core.resource.java.NamedNativeQueryAnnotation; > import org.eclipse.jpt.jpa.core.resource.java.NamedQueriesAnnotation; > import org.eclipse.jpt.jpa.core.resource.java.NamedQueryAnnotation; > import org.eclipse.jpt.jpa.core.resource.java.NestableAnnotation; >+import org.eclipse.jpt.jpa.core.resource.java.NestableNamedNativeQueryAnnotation; >+import org.eclipse.jpt.jpa.core.resource.java.NestableNamedQueryAnnotation; > import org.eclipse.wst.validation.internal.provisional.core.IMessage; > import org.eclipse.wst.validation.internal.provisional.core.IReporter; > >@@ -143,12 +139,18 @@ > } > > protected Iterable<NamedQueryAnnotation> getNamedQueryAnnotations() { >- return new SubIterableWrapper<NestableAnnotation, NamedQueryAnnotation>( >- CollectionTools.iterable(this.namedQueryAnnotations()) >- ); >+ return CollectionTools.iterable(this.namedQueryAnnotations()); > } > >- protected Iterator<NestableAnnotation> namedQueryAnnotations() { >+ protected Iterator<NamedQueryAnnotation> namedQueryAnnotations() { >+ return new SuperIteratorWrapper<NamedQueryAnnotation>(this.nestableNamedQueryAnnotations()); >+ } >+ >+ protected Iterator<NestableNamedQueryAnnotation> nestableNamedQueryAnnotations() { >+ return new SubIteratorWrapper<NestableAnnotation, NestableNamedQueryAnnotation>(this.nestableNamedQueryAnnotations_()); >+ } >+ >+ protected Iterator<NestableAnnotation> nestableNamedQueryAnnotations_() { > return this.owner.getResourceAnnotatedElement().annotations(NamedQueryAnnotation.ANNOTATION_NAME, NamedQueriesAnnotation.ANNOTATION_NAME); > } > >@@ -253,12 +255,18 @@ > } > > protected Iterable<NamedNativeQueryAnnotation> getNamedNativeQueryAnnotations() { >- return new SubIterableWrapper<NestableAnnotation, NamedNativeQueryAnnotation>( >- CollectionTools.iterable(this.namedNativeQueryAnnotations()) >- ); >+ return CollectionTools.iterable(this.namedNativeQueryAnnotations()); >+ } >+ >+ protected Iterator<NamedNativeQueryAnnotation> namedNativeQueryAnnotations() { >+ return new SuperIteratorWrapper<NamedNativeQueryAnnotation>(this.nestableNamedNativeQueryAnnotations()); >+ } >+ >+ protected Iterator<NestableNamedNativeQueryAnnotation> nestableNamedNativeQueryAnnotations() { >+ return new SubIteratorWrapper<NestableAnnotation, NestableNamedNativeQueryAnnotation>(this.nestableNamedNativeQueryAnnotations_()); > } > >- protected Iterator<NestableAnnotation> namedNativeQueryAnnotations() { >+ protected Iterator<NestableAnnotation> nestableNamedNativeQueryAnnotations_() { > return this.owner.getResourceAnnotatedElement().annotations(NamedNativeQueryAnnotation.ANNOTATION_NAME, NamedNativeQueriesAnnotation.ANNOTATION_NAME); > } > >@@ -305,65 +313,14 @@ > > // ********** validation ********** > >+ /** >+ * The queries are validated in the persistence unit. >+ * @see org.eclipse.jpt.jpa.core.internal.context.persistence.AbstractPersistenceUnit#validateQueries(List, IReporter) >+ */ > @Override > public void validate(List<IMessage> messages, IReporter reporter, CompilationUnit astRoot) { > super.validate(messages, reporter, astRoot); >- this.validateQueries(messages, reporter, astRoot); >- } >- >- protected void validateQueries(List<IMessage> messages, IReporter reporter, CompilationUnit astRoot) { >- for (Iterator<JavaQuery> localQueries = this.queries(); localQueries.hasNext(); ) { >- JavaQuery localQuery = localQueries.next(); >- String name = localQuery.getName(); >- if (StringTools.stringIsEmpty(name)){ >- messages.add( >- DefaultJpaValidationMessages.buildMessage( >- IMessage.HIGH_SEVERITY, >- JpaValidationMessages.QUERY_NAME_UNDEFINED, >- new String[] {}, >- localQuery, >- localQuery.getNameTextRange(astRoot) >- ) >- ); >- } else { >- List<String> reportedNames = new ArrayList<String>(); >- for (Iterator<Query> globalQueries = this.getPersistenceUnit().queries(); globalQueries.hasNext(); ) { >- if (localQuery.duplicates(globalQueries.next()) && !reportedNames.contains(name)) { >- messages.add( >- DefaultJpaValidationMessages.buildMessage( >- IMessage.HIGH_SEVERITY, >- JpaValidationMessages.QUERY_DUPLICATE_NAME, >- new String[] {name}, >- localQuery, >- localQuery.getNameTextRange(astRoot) >- ) >- ); >- reportedNames.add(name); >- } >- } >- } >- String query = localQuery.getQuery(); >- if (StringTools.stringIsEmpty(query)){ >- messages.add( >- DefaultJpaValidationMessages.buildMessage( >- IMessage.HIGH_SEVERITY, >- JpaValidationMessages.QUERY_STATEMENT_UNDEFINED, >- new String[] {name}, >- localQuery, >- localQuery.getNameTextRange(astRoot) >- ) >- ); >- } >- else { >- localQuery.validate(messages, reporter, astRoot); >- } >- } >- } >- >- >- @SuppressWarnings("unchecked") >- public Iterator<JavaQuery> queries() { >- return new CompositeIterator<JavaQuery>(this.namedNativeQueries(), this.namedQueries()); >+ // queries are validated in the persistence unit > } > > public TextRange getValidationTextRange(CompilationUnit astRoot) { >Index: src/org/eclipse/jpt/jpa/core/internal/jpa1/context/java/GenericJavaTemporalConverter.java >=================================================================== >RCS file: /cvsroot/webtools/org.eclipse.jpa/components/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/java/GenericJavaTemporalConverter.java,v >retrieving revision 1.3 >diff -u -r1.3 GenericJavaTemporalConverter.java >--- src/org/eclipse/jpt/jpa/core/internal/jpa1/context/java/GenericJavaTemporalConverter.java 28 Apr 2011 02:00:43 -0000 1.3 >+++ src/org/eclipse/jpt/jpa/core/internal/jpa1/context/java/GenericJavaTemporalConverter.java 11 May 2011 14:49:40 -0000 >@@ -110,7 +110,7 @@ > DefaultJpaValidationMessages.buildMessage( > IMessage.HIGH_SEVERITY, > JpaValidationMessages.PERSISTENT_ATTRIBUTE_ELEMENT_COLLECTION_INVALID_VALUE_TYPE, >- new String[] {}, >+ EMPTY_STRING_ARRAY, > this, > this.getValidationTextRange(astRoot) > ) >@@ -123,7 +123,7 @@ > DefaultJpaValidationMessages.buildMessage( > IMessage.HIGH_SEVERITY, > JpaValidationMessages.PERSISTENT_ATTRIBUTE_INVALID_TEMPORAL_MAPPING_TYPE, >- new String[] {}, >+ EMPTY_STRING_ARRAY, > this, > this.getValidationTextRange(astRoot) > ) >Index: src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/GenericOrmGeneratorContainer.java >=================================================================== >RCS file: /cvsroot/webtools/org.eclipse.jpa/components/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/GenericOrmGeneratorContainer.java,v >retrieving revision 1.2 >diff -u -r1.2 GenericOrmGeneratorContainer.java >--- src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/GenericOrmGeneratorContainer.java 28 Apr 2011 02:00:42 -0000 1.2 >+++ src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/GenericOrmGeneratorContainer.java 11 May 2011 14:49:40 -0000 >@@ -9,20 +9,13 @@ > ******************************************************************************/ > package org.eclipse.jpt.jpa.core.internal.jpa1.context.orm; > >-import java.util.ArrayList; >-import java.util.Iterator; > import java.util.List; > import org.eclipse.jpt.common.core.utility.TextRange; >-import org.eclipse.jpt.common.utility.internal.StringTools; >-import org.eclipse.jpt.jpa.core.context.Generator; > import org.eclipse.jpt.jpa.core.context.XmlContextNode; >-import org.eclipse.jpt.jpa.core.context.orm.OrmGenerator; > import org.eclipse.jpt.jpa.core.context.orm.OrmGeneratorContainer; > import org.eclipse.jpt.jpa.core.context.orm.OrmSequenceGenerator; > import org.eclipse.jpt.jpa.core.context.orm.OrmTableGenerator; > import org.eclipse.jpt.jpa.core.internal.context.orm.AbstractOrmXmlContextNode; >-import org.eclipse.jpt.jpa.core.internal.validation.DefaultJpaValidationMessages; >-import org.eclipse.jpt.jpa.core.internal.validation.JpaValidationMessages; > import org.eclipse.jpt.jpa.core.resource.orm.OrmFactory; > import org.eclipse.jpt.jpa.core.resource.orm.XmlGeneratorContainer; > import org.eclipse.jpt.jpa.core.resource.orm.XmlSequenceGenerator; >@@ -200,58 +193,14 @@ > > // ********** validation ********** > >+ /** >+ * The generators are validated in the persistence unit. >+ * @see org.eclipse.jpt.jpa.core.internal.context.persistence.AbstractPersistenceUnit#validateGenerators(List, IReporter) >+ */ > @Override > public void validate(List<IMessage> messages, IReporter reporter) { > super.validate(messages, reporter); >- this.validateGenerators(messages); >- } >- >- protected void validateGenerators(List<IMessage> messages) { >- for (OrmGenerator localGenerator : this.getGenerators()) { >- String name = localGenerator.getName(); >- if (StringTools.stringIsEmpty(name)){ >- messages.add( >- DefaultJpaValidationMessages.buildMessage( >- IMessage.HIGH_SEVERITY, >- JpaValidationMessages.GENERATOR_NAME_UNDEFINED, >- new String[] {}, >- localGenerator, >- localGenerator.getNameTextRange() >- ) >- ); >- } else { >- List<String> reportedNames = new ArrayList<String>(); >- for (Iterator<Generator> globalGenerators = this.getPersistenceUnit().generators(); globalGenerators.hasNext(); ) { >- if (localGenerator.duplicates(globalGenerators.next()) && !reportedNames.contains(name)) { >- messages.add( >- DefaultJpaValidationMessages.buildMessage( >- IMessage.HIGH_SEVERITY, >- JpaValidationMessages.GENERATOR_DUPLICATE_NAME, >- new String[] {name}, >- localGenerator, >- localGenerator.getNameTextRange() >- ) >- ); >- reportedNames.add(name); >- } >- } >- } >- } >- } >- >- protected Iterable<OrmGenerator> getGenerators() { >- ArrayList<OrmGenerator> generators = new ArrayList<OrmGenerator>(); >- this.addGeneratorsTo(generators); >- return generators; >- } >- >- protected void addGeneratorsTo(ArrayList<OrmGenerator> generators) { >- if (this.sequenceGenerator != null) { >- generators.add(this.sequenceGenerator); >- } >- if (this.tableGenerator != null) { >- generators.add(this.tableGenerator); >- } >+ // generators are validated in the persistence unit > } > > public TextRange getValidationTextRange() { >Index: src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/GenericOrmNamedNativeQuery.java >=================================================================== >RCS file: /cvsroot/webtools/org.eclipse.jpa/components/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/GenericOrmNamedNativeQuery.java,v >retrieving revision 1.1 >diff -u -r1.1 GenericOrmNamedNativeQuery.java >--- src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/GenericOrmNamedNativeQuery.java 6 Feb 2011 02:07:13 -0000 1.1 >+++ src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/GenericOrmNamedNativeQuery.java 11 May 2011 14:49:40 -0000 >@@ -1,5 +1,5 @@ > /******************************************************************************* >- * Copyright (c) 2007, 2010 Oracle. All rights reserved. >+ * Copyright (c) 2007, 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. >@@ -9,10 +9,13 @@ > ******************************************************************************/ > package org.eclipse.jpt.jpa.core.internal.jpa1.context.orm; > >+import java.util.List; > import org.eclipse.jpt.jpa.core.context.XmlContextNode; > import org.eclipse.jpt.jpa.core.context.orm.OrmNamedNativeQuery; > import org.eclipse.jpt.jpa.core.internal.context.orm.AbstractOrmQuery; > import org.eclipse.jpt.jpa.core.resource.orm.XmlNamedNativeQuery; >+import org.eclipse.wst.validation.internal.provisional.core.IMessage; >+import org.eclipse.wst.validation.internal.provisional.core.IReporter; > > /** > * <code>orm.xml</code> named native query >@@ -82,4 +85,11 @@ > this.firePropertyChanged(RESULT_SET_MAPPING_PROPERTY, old, resultSetMapping); > } > >+ >+ // ********** validation ********** >+ >+ @Override >+ protected void validateQuery_(List<IMessage> messages, IReporter reporter) { >+ // nothing yet >+ } > } >Index: src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/GenericOrmNamedQuery.java >=================================================================== >RCS file: /cvsroot/webtools/org.eclipse.jpa/components/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/GenericOrmNamedQuery.java,v >retrieving revision 1.2 >diff -u -r1.2 GenericOrmNamedQuery.java >--- src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/GenericOrmNamedQuery.java 12 Apr 2011 22:12:47 -0000 1.2 >+++ src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/GenericOrmNamedQuery.java 11 May 2011 14:49:40 -0000 >@@ -9,7 +9,6 @@ > ******************************************************************************/ > package org.eclipse.jpt.jpa.core.internal.jpa1.context.orm; > >-import java.util.List; > import org.eclipse.jpt.jpa.core.context.XmlContextNode; > import org.eclipse.jpt.jpa.core.context.orm.OrmNamedQuery; > import org.eclipse.jpt.jpa.core.internal.context.orm.AbstractOrmQuery; >@@ -30,19 +29,15 @@ > super(parent, resourceNamedQuery); > } > >+ > // ********** validation ********** > >- /** >- * {@inheritDoc} >- */ > @Override >- public void validate(List<IMessage> messages, IReporter reporter) { >- super.validate(messages, reporter); >- >+ protected void validateQuery_(java.util.List<IMessage> messages, IReporter reporter) { > // Convert the literal escape characters into actual escape characters >- String jpqlQuery = ExpressionTools.unescape(this.getQuery(), new int[1]); >+ String jpqlQuery = ExpressionTools.unescape(this.query, new int[1]); > > JpaJpqlQueryHelper helper = new JpaJpqlQueryHelper(); > helper.validate(this, jpqlQuery, this.getQueryTextRange(), 0, messages); > } >-} >\ No newline at end of file >+} >Index: src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/GenericOrmPersistentType.java >=================================================================== >RCS file: /cvsroot/webtools/org.eclipse.jpa/components/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/GenericOrmPersistentType.java,v >retrieving revision 1.3 >diff -u -r1.3 GenericOrmPersistentType.java >--- src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/GenericOrmPersistentType.java 28 Apr 2011 02:00:42 -0000 1.3 >+++ src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/GenericOrmPersistentType.java 11 May 2011 14:49:40 -0000 >@@ -182,10 +182,9 @@ > // ********** name ********** > > public String getName() { >- if (this.javaPersistentType != null) { >- return this.javaPersistentType.getName(); >- } >- return this.convertMappingClassName(this.mapping.getClass_()); >+ return (this.javaPersistentType != null) ? >+ this.javaPersistentType.getName() : >+ this.convertMappingClassName(this.mapping.getClass_()); > } > > public String getSimpleName(){ >Index: src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/GenericOrmQueryContainer.java >=================================================================== >RCS file: /cvsroot/webtools/org.eclipse.jpa/components/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/GenericOrmQueryContainer.java,v >retrieving revision 1.3 >diff -u -r1.3 GenericOrmQueryContainer.java >--- src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/GenericOrmQueryContainer.java 28 Apr 2011 02:00:42 -0000 1.3 >+++ src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/GenericOrmQueryContainer.java 11 May 2011 14:49:40 -0000 >@@ -9,29 +9,21 @@ > ******************************************************************************/ > package org.eclipse.jpt.jpa.core.internal.jpa1.context.orm; > >-import java.util.ArrayList; >-import java.util.Iterator; > import java.util.List; > import java.util.ListIterator; > import java.util.Vector; > import org.eclipse.jpt.common.core.utility.TextRange; >-import org.eclipse.jpt.common.utility.internal.StringTools; >-import org.eclipse.jpt.common.utility.internal.iterables.CompositeIterable; > import org.eclipse.jpt.common.utility.internal.iterables.ListIterable; > import org.eclipse.jpt.common.utility.internal.iterables.LiveCloneIterable; > import org.eclipse.jpt.common.utility.internal.iterables.LiveCloneListIterable; > import org.eclipse.jpt.jpa.core.context.NamedNativeQuery; > import org.eclipse.jpt.jpa.core.context.NamedQuery; >-import org.eclipse.jpt.jpa.core.context.Query; > import org.eclipse.jpt.jpa.core.context.XmlContextNode; > import org.eclipse.jpt.jpa.core.context.orm.OrmNamedNativeQuery; > import org.eclipse.jpt.jpa.core.context.orm.OrmNamedQuery; >-import org.eclipse.jpt.jpa.core.context.orm.OrmQuery; > import org.eclipse.jpt.jpa.core.context.orm.OrmQueryContainer; > import org.eclipse.jpt.jpa.core.internal.context.ContextContainerTools; > import org.eclipse.jpt.jpa.core.internal.context.orm.AbstractOrmXmlContextNode; >-import org.eclipse.jpt.jpa.core.internal.validation.DefaultJpaValidationMessages; >-import org.eclipse.jpt.jpa.core.internal.validation.JpaValidationMessages; > import org.eclipse.jpt.jpa.core.resource.orm.OrmFactory; > import org.eclipse.jpt.jpa.core.resource.orm.XmlNamedNativeQuery; > import org.eclipse.jpt.jpa.core.resource.orm.XmlNamedQuery; >@@ -296,69 +288,14 @@ > > // ********** validation ********** > >+ /** >+ * The queries are validated in the persistence unit. >+ * @see org.eclipse.jpt.jpa.core.internal.context.persistence.AbstractPersistenceUnit#validateQueries(List, IReporter) >+ */ > @Override > public void validate(List<IMessage> messages, IReporter reporter) { > super.validate(messages, reporter); >- this.validateQueries(messages, reporter); >- } >- >- protected void validateQueries(List<IMessage> messages, IReporter reporter) { >- for (OrmQuery localQuery : this.getQueries()) { >- String name = localQuery.getName(); >- if (StringTools.stringIsEmpty(name)){ >- messages.add( >- DefaultJpaValidationMessages.buildMessage( >- IMessage.HIGH_SEVERITY, >- JpaValidationMessages.QUERY_NAME_UNDEFINED, >- new String[] {}, >- localQuery, >- localQuery.getNameTextRange() >- ) >- ); >- } else { >- List<String> reportedNames = new ArrayList<String>(); >- for (Iterator<Query> globalQueries = this.getPersistenceUnit().queries(); globalQueries.hasNext(); ) { >- Query globalQuery = globalQueries.next(); >- if (localQuery.duplicates(globalQuery) && !reportedNames.contains(name)) { >- messages.add( >- DefaultJpaValidationMessages.buildMessage( >- IMessage.HIGH_SEVERITY, >- JpaValidationMessages.QUERY_DUPLICATE_NAME, >- new String[] {name}, >- localQuery, >- localQuery.getNameTextRange()) >- ); >- reportedNames.add(name); >- } >- } >- } >- String query = localQuery.getQuery(); >- if (StringTools.stringIsEmpty(query)){ >- messages.add( >- DefaultJpaValidationMessages.buildMessage( >- IMessage.HIGH_SEVERITY, >- JpaValidationMessages.QUERY_STATEMENT_UNDEFINED, >- new String[] {name}, >- localQuery, >- localQuery.getNameTextRange() >- ) >- ); >- } >- else { >- localQuery.validate(messages, reporter); >- } >- } >- } >- >- /** >- * Return all the queries, named and named native. >- */ >- @SuppressWarnings("unchecked") >- protected Iterable<OrmQuery> getQueries() { >- return new CompositeIterable<OrmQuery>( >- this.getNamedQueries(), >- this.getNamedNativeQueries() >- ); >+ // queries are validated in the persistence unit > } > > public TextRange getValidationTextRange() { >Index: src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/GenericOrmTemporalConverter.java >=================================================================== >RCS file: /cvsroot/webtools/org.eclipse.jpa/components/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/GenericOrmTemporalConverter.java,v >retrieving revision 1.3 >diff -u -r1.3 GenericOrmTemporalConverter.java >--- src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/GenericOrmTemporalConverter.java 28 Apr 2011 02:00:42 -0000 1.3 >+++ src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/GenericOrmTemporalConverter.java 11 May 2011 14:49:40 -0000 >@@ -106,7 +106,7 @@ > DefaultJpaValidationMessages.buildMessage( > IMessage.HIGH_SEVERITY, > JpaValidationMessages.PERSISTENT_ATTRIBUTE_ELEMENT_COLLECTION_INVALID_VALUE_TYPE, >- new String[] {}, >+ EMPTY_STRING_ARRAY, > this, > this.getValidationTextRange() > ) >@@ -119,7 +119,7 @@ > DefaultJpaValidationMessages.buildMessage( > IMessage.HIGH_SEVERITY, > JpaValidationMessages.PERSISTENT_ATTRIBUTE_INVALID_TEMPORAL_MAPPING_TYPE, >- new String[] {}, >+ EMPTY_STRING_ARRAY, > this, > this.getValidationTextRange() > ) >Index: src/org/eclipse/jpt/jpa/core/internal/jpa2/context/CollectionTableValidator.java >=================================================================== >RCS file: /cvsroot/webtools/org.eclipse.jpa/components/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/context/CollectionTableValidator.java,v >retrieving revision 1.1 >diff -u -r1.1 CollectionTableValidator.java >--- src/org/eclipse/jpt/jpa/core/internal/jpa2/context/CollectionTableValidator.java 6 Feb 2011 02:07:19 -0000 1.1 >+++ src/org/eclipse/jpt/jpa/core/internal/jpa2/context/CollectionTableValidator.java 11 May 2011 14:49:40 -0000 >@@ -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. >@@ -15,12 +15,9 @@ > import org.eclipse.jpt.jpa.core.internal.validation.JpaValidationMessages; > import org.eclipse.jpt.jpa.core.jpa2.context.CollectionTable2_0; > >-public class CollectionTableValidator extends AbstractTableValidator >+public class CollectionTableValidator >+ extends AbstractTableValidator > { >- public CollectionTableValidator(CollectionTable2_0 table, TableTextRangeResolver textRangeResolver) { >- super(table, textRangeResolver); >- } >- > public CollectionTableValidator(PersistentAttribute persistentAttribute, CollectionTable2_0 table, TableTextRangeResolver textRangeResolver) { > super(persistentAttribute, table, textRangeResolver); > } >Index: src/org/eclipse/jpt/jpa/core/internal/jpa2/context/OrderColumnValidator.java >=================================================================== >RCS file: /cvsroot/webtools/org.eclipse.jpa/components/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/context/OrderColumnValidator.java,v >retrieving revision 1.1 >diff -u -r1.1 OrderColumnValidator.java >--- src/org/eclipse/jpt/jpa/core/internal/jpa2/context/OrderColumnValidator.java 6 Feb 2011 02:07:19 -0000 1.1 >+++ src/org/eclipse/jpt/jpa/core/internal/jpa2/context/OrderColumnValidator.java 11 May 2011 14:49:40 -0000 >@@ -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. >@@ -19,12 +19,6 @@ > extends AbstractNamedColumnValidator<OrderColumn2_0, NamedColumnTextRangeResolver> > { > public OrderColumnValidator( >- OrderColumn2_0 column, >- NamedColumnTextRangeResolver textRangeResolver) { >- super(column, textRangeResolver); >- } >- >- public OrderColumnValidator( > PersistentAttribute persistentAttribute, > OrderColumn2_0 column, > NamedColumnTextRangeResolver textRangeResolver) { >Index: src/org/eclipse/jpt/jpa/core/internal/jpa2/context/java/AbstractJavaElementCollectionMapping2_0.java >=================================================================== >RCS file: /cvsroot/webtools/org.eclipse.jpa/components/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/context/java/AbstractJavaElementCollectionMapping2_0.java,v >retrieving revision 1.5 >diff -u -r1.5 AbstractJavaElementCollectionMapping2_0.java >--- src/org/eclipse/jpt/jpa/core/internal/jpa2/context/java/AbstractJavaElementCollectionMapping2_0.java 28 Apr 2011 02:00:42 -0000 1.5 >+++ src/org/eclipse/jpt/jpa/core/internal/jpa2/context/java/AbstractJavaElementCollectionMapping2_0.java 11 May 2011 14:49:40 -0000 >@@ -393,7 +393,7 @@ > implements Table.Owner > { > public JptValidator buildTableValidator(Table table, TableTextRangeResolver textRangeResolver) { >- return new CollectionTableValidator((CollectionTable2_0) table, textRangeResolver); >+ return new CollectionTableValidator(AbstractJavaElementCollectionMapping2_0.this.getPersistentAttribute(), (CollectionTable2_0) table, textRangeResolver); > } > } > >@@ -1041,6 +1041,16 @@ > // ********** misc ********** > > @Override >+ public JavaPersistentAttribute2_0 getParent() { >+ return (JavaPersistentAttribute2_0) super.getParent(); >+ } >+ >+ @Override >+ public JavaPersistentAttribute2_0 getPersistentAttribute() { >+ return (JavaPersistentAttribute2_0) super.getPersistentAttribute(); >+ } >+ >+ @Override > protected JpaFactory2_0 getJpaFactory() { > return (JpaFactory2_0) super.getJpaFactory(); > } >@@ -1119,7 +1129,7 @@ > > @Override > protected String getMetamodelFieldTypeName() { >- return ((JavaPersistentAttribute2_0) this.getPersistentAttribute()).getMetamodelContainerFieldTypeName(); >+ return this.getPersistentAttribute().getMetamodelContainerFieldTypeName(); > } > > @Override >@@ -1134,7 +1144,7 @@ > } > > protected void addMetamodelFieldMapKeyTypeArgumentNameTo(ArrayList<String> typeArgumentNames) { >- String keyTypeName = ((JavaPersistentAttribute2_0) this.getPersistentAttribute()).getMetamodelContainerFieldMapKeyTypeName(); >+ String keyTypeName = this.getPersistentAttribute().getMetamodelContainerFieldMapKeyTypeName(); > if (keyTypeName != null) { > typeArgumentNames.add(keyTypeName); > } >@@ -1346,6 +1356,10 @@ > protected JavaCollectionTable2_0 getCollectionTable() { > return AbstractJavaElementCollectionMapping2_0.this.getCollectionTable(); > } >+ >+ protected JavaPersistentAttribute2_0 getPersistentAttribute() { >+ return AbstractJavaElementCollectionMapping2_0.this.getPersistentAttribute(); >+ } > } > > >@@ -1368,7 +1382,7 @@ > } > > public JptValidator buildColumnValidator(NamedColumn column, NamedColumnTextRangeResolver textRangeResolver) { >- return new NamedColumnValidator((BaseColumn) column, (BaseColumnTextRangeResolver) textRangeResolver, new CollectionTableTableDescriptionProvider()); >+ return new NamedColumnValidator(this.getPersistentAttribute(), (BaseColumn) column, (BaseColumnTextRangeResolver) textRangeResolver, new CollectionTableTableDescriptionProvider()); > } > } > >@@ -1392,7 +1406,7 @@ > } > > public JptValidator buildColumnValidator(NamedColumn column, NamedColumnTextRangeResolver textRangeResolver) { >- return new MapKeyColumnValidator((BaseColumn) column, (BaseColumnTextRangeResolver) textRangeResolver, new CollectionTableTableDescriptionProvider()); >+ return new MapKeyColumnValidator(this.getPersistentAttribute(), (BaseColumn) column, (BaseColumnTextRangeResolver) textRangeResolver, new CollectionTableTableDescriptionProvider()); > } > } > >@@ -1425,18 +1439,6 @@ > } > return ! overrideName.startsWith(MapKeyAttributeOverrideContainerOwner.RELEVANT_PREFIX_); > } >- >- protected JavaPersistentAttribute getPersistentAttribute() { >- return AbstractJavaElementCollectionMapping2_0.this.getPersistentAttribute(); >- } >- >- public JptValidator buildValidator(Override_ override, OverrideContainer container, OverrideTextRangeResolver textRangeResolver) { >- return new AssociationOverrideValidator((AssociationOverride) override, (AssociationOverrideContainer) container, textRangeResolver, new EmbeddableOverrideDescriptionProvider()); >- } >- >- public JptValidator buildColumnValidator(Override_ override, BaseColumn column, BaseColumn.Owner columnOwner, BaseColumnTextRangeResolver textRangeResolver) { >- return new AssociationOverrideJoinColumnValidator((AssociationOverride) override, (JoinColumn) column, (JoinColumn.Owner) columnOwner, (JoinColumnTextRangeResolver) textRangeResolver, new CollectionTableTableDescriptionProvider()); >- } > } > > >@@ -1455,14 +1457,12 @@ > return MappingTools.resolveOverriddenColumn(this.getOverridableTypeMapping(), attributeName); > } > >- @Override > public JptValidator buildValidator(Override_ override, OverrideContainer container, OverrideTextRangeResolver textRangeResolver) { >- return new AttributeOverrideValidator((AttributeOverride) override, (AttributeOverrideContainer) container, textRangeResolver, new EmbeddableOverrideDescriptionProvider()); >+ return new AttributeOverrideValidator(this.getPersistentAttribute(), (AttributeOverride) override, (AttributeOverrideContainer) container, textRangeResolver, new EmbeddableOverrideDescriptionProvider()); > } > >- @Override > public JptValidator buildColumnValidator(Override_ override, BaseColumn column, BaseColumn.Owner columnOwner, BaseColumnTextRangeResolver textRangeResolver) { >- return new AttributeOverrideColumnValidator((AttributeOverride) override, column, textRangeResolver, new CollectionTableTableDescriptionProvider()); >+ return new AttributeOverrideColumnValidator(this.getPersistentAttribute(), (AttributeOverride) override, column, textRangeResolver, new CollectionTableTableDescriptionProvider()); > } > } > >@@ -1482,14 +1482,12 @@ > return MappingTools.resolveOverriddenRelationship(this.getOverridableTypeMapping(), attributeName); > } > >- @Override > public JptValidator buildValidator(Override_ override, OverrideContainer container, OverrideTextRangeResolver textRangeResolver) { >- return new AssociationOverrideValidator((AssociationOverride) override, (AssociationOverrideContainer) container, textRangeResolver, new EmbeddableOverrideDescriptionProvider()); >+ return new AssociationOverrideValidator(this.getPersistentAttribute(), (AssociationOverride) override, (AssociationOverrideContainer) container, textRangeResolver, new EmbeddableOverrideDescriptionProvider()); > } > >- @Override > public JptValidator buildColumnValidator(Override_ override, BaseColumn column, BaseColumn.Owner columnOwner, BaseColumnTextRangeResolver textRangeResolver) { >- return new AssociationOverrideJoinColumnValidator((AssociationOverride) override, (JoinColumn) column, (JoinColumn.Owner) columnOwner, (JoinColumnTextRangeResolver) textRangeResolver, new CollectionTableTableDescriptionProvider()); >+ return new AssociationOverrideJoinColumnValidator(this.getPersistentAttribute(), (AssociationOverride) override, (JoinColumn) column, (JoinColumn.Owner) columnOwner, (JoinColumnTextRangeResolver) textRangeResolver, new CollectionTableTableDescriptionProvider()); > } > > public JptValidator buildJoinTableJoinColumnValidator(AssociationOverride override, JoinColumn column, JoinColumn.Owner owner, JoinColumnTextRangeResolver textRangeResolver) { >@@ -1546,11 +1544,11 @@ > } > > public JptValidator buildValidator(Override_ override, OverrideContainer container, OverrideTextRangeResolver textRangeResolver) { >- return new MapKeyAttributeOverrideValidator((AttributeOverride) override, (AttributeOverrideContainer) container, textRangeResolver, new EmbeddableOverrideDescriptionProvider()); >+ return new MapKeyAttributeOverrideValidator(this.getPersistentAttribute(), (AttributeOverride) override, (AttributeOverrideContainer) container, textRangeResolver, new EmbeddableOverrideDescriptionProvider()); > } > > public JptValidator buildColumnValidator(Override_ override, BaseColumn column, BaseColumn.Owner columnOwner, BaseColumnTextRangeResolver textRangeResolver) { >- return new MapKeyAttributeOverrideColumnValidator((AttributeOverride) override, column, textRangeResolver, new CollectionTableTableDescriptionProvider()); >+ return new MapKeyAttributeOverrideColumnValidator(this.getPersistentAttribute(), (AttributeOverride) override, column, textRangeResolver, new CollectionTableTableDescriptionProvider()); > } > } > } >Index: src/org/eclipse/jpt/jpa/core/internal/jpa2/context/java/GenericJavaCollectionTable2_0.java >=================================================================== >RCS file: /cvsroot/webtools/org.eclipse.jpa/components/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/context/java/GenericJavaCollectionTable2_0.java,v >retrieving revision 1.1 >diff -u -r1.1 GenericJavaCollectionTable2_0.java >--- src/org/eclipse/jpt/jpa/core/internal/jpa2/context/java/GenericJavaCollectionTable2_0.java 6 Feb 2011 02:07:24 -0000 1.1 >+++ src/org/eclipse/jpt/jpa/core/internal/jpa2/context/java/GenericJavaCollectionTable2_0.java 11 May 2011 14:49:40 -0000 >@@ -1,5 +1,5 @@ > /******************************************************************************* >- * Copyright (c) 2009, 2010 Oracle. All rights reserved. >+ * Copyright (c) 2009, 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. >@@ -163,7 +163,7 @@ > //return GenericJavaCollectionTable2_0.this.getParent().getName(); > } > >- public PersistentAttribute getPersistentAttribute() { >+ protected PersistentAttribute getPersistentAttribute() { > return GenericJavaCollectionTable2_0.this.getElementCollectionMapping().getPersistentAttribute(); > } > >@@ -172,7 +172,7 @@ > } > > public JptValidator buildColumnValidator(NamedColumn column, NamedColumnTextRangeResolver textRangeResolver) { >- return new JoinColumnValidator((JoinColumn) column, this, (JoinColumnTextRangeResolver) textRangeResolver, new CollectionTableTableDescriptionProvider()); >+ return new JoinColumnValidator(this.getPersistentAttribute(), (JoinColumn) column, this, (JoinColumnTextRangeResolver) textRangeResolver, new CollectionTableTableDescriptionProvider()); > } > } > } >Index: src/org/eclipse/jpt/jpa/core/internal/jpa2/context/java/GenericJavaNamedQuery2_0.java >=================================================================== >RCS file: /cvsroot/webtools/org.eclipse.jpa/components/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/context/java/GenericJavaNamedQuery2_0.java,v >retrieving revision 1.2 >diff -u -r1.2 GenericJavaNamedQuery2_0.java >--- src/org/eclipse/jpt/jpa/core/internal/jpa2/context/java/GenericJavaNamedQuery2_0.java 12 Apr 2011 22:12:47 -0000 1.2 >+++ src/org/eclipse/jpt/jpa/core/internal/jpa2/context/java/GenericJavaNamedQuery2_0.java 11 May 2011 14:49:40 -0000 >@@ -95,14 +95,9 @@ > > // ********** validation ********** > >- /** >- * {@inheritDoc} >- */ > @Override >- public void validate(List<IMessage> messages, IReporter reporter, CompilationUnit astRoot) { >- super.validate(messages, reporter, astRoot); >- >+ protected void validateQuery_(List<IMessage> messages, IReporter reporter, CompilationUnit astRoot) { > JpaJpqlQueryHelper helper = new JpaJpqlQueryHelper(); >- helper.validate(this, this.getQuery(), this.getQueryAnnotation().getQueryTextRange(astRoot), 1, messages); >+ helper.validate(this, this.query, this.getQueryAnnotation().getQueryTextRange(astRoot), 1, messages); > } >-} >\ No newline at end of file >+} >Index: src/org/eclipse/jpt/jpa/core/internal/jpa2/context/java/GenericJavaOverrideJoinTableRelationshipStrategy2_0.java >=================================================================== >RCS file: /cvsroot/webtools/org.eclipse.jpa/components/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/context/java/GenericJavaOverrideJoinTableRelationshipStrategy2_0.java,v >retrieving revision 1.1 >diff -u -r1.1 GenericJavaOverrideJoinTableRelationshipStrategy2_0.java >--- src/org/eclipse/jpt/jpa/core/internal/jpa2/context/java/GenericJavaOverrideJoinTableRelationshipStrategy2_0.java 6 Feb 2011 02:07:24 -0000 1.1 >+++ src/org/eclipse/jpt/jpa/core/internal/jpa2/context/java/GenericJavaOverrideJoinTableRelationshipStrategy2_0.java 11 May 2011 14:49:40 -0000 >@@ -89,14 +89,14 @@ > } > > public JptValidator buildTableValidator(Table table, TableTextRangeResolver textRangeResolver) { >- return new AssociationOverrideJoinTableValidator(this.getRelationship().getAssociationOverride(), (JoinTable) table, textRangeResolver); >+ return new AssociationOverrideJoinTableValidator(this.getAssociationOverride(), (JoinTable) table, textRangeResolver); > } > > public JptValidator buildJoinTableJoinColumnValidator(JoinColumn column, JoinColumn.Owner owner, JoinColumnTextRangeResolver textRangeResolver) { >- return new AssociationOverrideJoinColumnValidator(this.getRelationship().getAssociationOverride(), column, owner, textRangeResolver, new JoinTableTableDescriptionProvider()); >+ return new AssociationOverrideJoinColumnValidator(this.getAssociationOverride(), column, owner, textRangeResolver, new JoinTableTableDescriptionProvider()); > } > > public JptValidator buildJoinTableInverseJoinColumnValidator(JoinColumn column, JoinColumn.Owner owner, JoinColumnTextRangeResolver textRangeResolver) { >- return new AssociationOverrideInverseJoinColumnValidator(this.getRelationship().getAssociationOverride(), column, owner, textRangeResolver, new JoinTableTableDescriptionProvider()); >+ return new AssociationOverrideInverseJoinColumnValidator(this.getAssociationOverride(), column, owner, textRangeResolver, new JoinTableTableDescriptionProvider()); > } > } >Index: src/org/eclipse/jpt/jpa/core/internal/jpa2/context/orm/GenericOrmNamedQuery2_0.java >=================================================================== >RCS file: /cvsroot/webtools/org.eclipse.jpa/components/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/context/orm/GenericOrmNamedQuery2_0.java,v >retrieving revision 1.2 >diff -u -r1.2 GenericOrmNamedQuery2_0.java >--- src/org/eclipse/jpt/jpa/core/internal/jpa2/context/orm/GenericOrmNamedQuery2_0.java 12 Apr 2011 22:12:47 -0000 1.2 >+++ src/org/eclipse/jpt/jpa/core/internal/jpa2/context/orm/GenericOrmNamedQuery2_0.java 11 May 2011 14:49:40 -0000 >@@ -9,7 +9,6 @@ > ******************************************************************************/ > package org.eclipse.jpt.jpa.core.internal.jpa2.context.orm; > >-import java.util.List; > import org.eclipse.jpt.jpa.core.context.XmlContextNode; > import org.eclipse.jpt.jpa.core.internal.context.orm.AbstractOrmQuery; > import org.eclipse.jpt.jpa.core.internal.jpql.JpaJpqlQueryHelper; >@@ -94,17 +93,12 @@ > > // ********** validation ********** > >- /** >- * {@inheritDoc} >- */ > @Override >- public void validate(List<IMessage> messages, IReporter reporter) { >- super.validate(messages, reporter); >- >+ protected void validateQuery_(java.util.List<IMessage> messages, IReporter reporter) { > // Convert the literal escape characters into actual escape characters >- String jpqlQuery = ExpressionTools.unescape(this.getQuery(), new int[1]); >+ String jpqlQuery = ExpressionTools.unescape(this.query, new int[1]); > > JpaJpqlQueryHelper helper = new JpaJpqlQueryHelper(); > helper.validate(this, jpqlQuery, this.getQueryTextRange(), 0, messages); > } >-} >\ No newline at end of file >+} >Index: src/org/eclipse/jpt/jpa/core/internal/resource/java/binary/BinaryNode.java >=================================================================== >RCS file: /cvsroot/webtools/org.eclipse.jpa/components/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/binary/BinaryNode.java,v >retrieving revision 1.1 >diff -u -r1.1 BinaryNode.java >--- src/org/eclipse/jpt/jpa/core/internal/resource/java/binary/BinaryNode.java 6 Feb 2011 02:07:22 -0000 1.1 >+++ src/org/eclipse/jpt/jpa/core/internal/resource/java/binary/BinaryNode.java 11 May 2011 14:49:40 -0000 >@@ -1,5 +1,5 @@ > /******************************************************************************* >- * Copyright (c) 2009, 2010 Oracle. All rights reserved. >+ * Copyright (c) 2009, 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. >@@ -24,7 +24,6 @@ > public abstract class BinaryNode > extends AbstractJavaResourceNode > { >- > // ********** construction ********** > > protected BinaryNode(JavaResourceNode parent) { >@@ -48,7 +47,7 @@ > } > > public TextRange getTextRange(CompilationUnit astRoot) { >- throw new UnsupportedOperationException(); >+ return null; > } > > public void initialize(CompilationUnit astRoot) { >@@ -58,5 +57,4 @@ > public void synchronizeWith(CompilationUnit astRoot) { > throw new UnsupportedOperationException(); > } >- > } >Index: src/org/eclipse/jpt/jpa/core/internal/resource/java/source/SourceAnnotatedElement.java >=================================================================== >RCS file: /cvsroot/webtools/org.eclipse.jpa/components/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/source/SourceAnnotatedElement.java,v >retrieving revision 1.1 >diff -u -r1.1 SourceAnnotatedElement.java >--- src/org/eclipse/jpt/jpa/core/internal/resource/java/source/SourceAnnotatedElement.java 6 Feb 2011 02:07:13 -0000 1.1 >+++ src/org/eclipse/jpt/jpa/core/internal/resource/java/source/SourceAnnotatedElement.java 11 May 2011 14:49:40 -0000 >@@ -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. >@@ -364,15 +364,17 @@ > } > > public TextRange getTextRange(CompilationUnit astRoot) { >- return this.fullTextRange(astRoot); >- } >- >- private TextRange fullTextRange(CompilationUnit astRoot) { >- return this.buildTextRange(this.annotatedElement.getBodyDeclaration(astRoot)); >+ // the AST is null for virtual Java attributes >+ // TODO remove the AST null check once we start storing text ranges >+ // in the resource model >+ return (astRoot == null) ? null : this.buildTextRange(this.annotatedElement.getBodyDeclaration(astRoot)); > } > > public TextRange getNameTextRange(CompilationUnit astRoot) { >- return this.annotatedElement.getNameTextRange(astRoot); >+ // the AST is null for virtual Java attributes >+ // TODO remove the AST null check once we start storing text ranges >+ // in the resource model >+ return (astRoot == null) ? null : this.annotatedElement.getNameTextRange(astRoot); > } > > private Annotation selectAnnotationNamed(Iterable<Annotation> list, String annotationName) { >Index: src/org/eclipse/jpt/jpa/core/internal/resource/java/source/SourceCompilationUnit.java >=================================================================== >RCS file: /cvsroot/webtools/org.eclipse.jpa/components/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/source/SourceCompilationUnit.java,v >retrieving revision 1.1 >diff -u -r1.1 SourceCompilationUnit.java >--- src/org/eclipse/jpt/jpa/core/internal/resource/java/source/SourceCompilationUnit.java 6 Feb 2011 02:07:14 -0000 1.1 >+++ src/org/eclipse/jpt/jpa/core/internal/resource/java/source/SourceCompilationUnit.java 11 May 2011 14:49:40 -0000 >@@ -1,5 +1,5 @@ > /******************************************************************************* >- * Copyright (c) 2007, 2010 Oracle. All rights reserved. >+ * Copyright (c) 2007, 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. >@@ -107,7 +107,8 @@ > // ********** JavaResourceNode implementation ********** > > public TextRange getTextRange(CompilationUnit astRoot) { >- return null; >+ // since this is the entire file, point to the top of the file >+ return TextRange.Empty.instance(); > } > > >Index: src/org/eclipse/jpt/jpa/core/internal/resource/java/source/SourceGeneratorAnnotation.java >=================================================================== >RCS file: /cvsroot/webtools/org.eclipse.jpa/components/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/source/SourceGeneratorAnnotation.java,v >retrieving revision 1.1 >diff -u -r1.1 SourceGeneratorAnnotation.java >--- src/org/eclipse/jpt/jpa/core/internal/resource/java/source/SourceGeneratorAnnotation.java 6 Feb 2011 02:07:13 -0000 1.1 >+++ src/org/eclipse/jpt/jpa/core/internal/resource/java/source/SourceGeneratorAnnotation.java 11 May 2011 14:49:40 -0000 >@@ -1,5 +1,5 @@ > /******************************************************************************* >- * Copyright (c) 2007, 2010 Oracle. All rights reserved. >+ * Copyright (c) 2007, 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. >@@ -32,6 +32,7 @@ > final DeclarationAnnotationElementAdapter<String> nameDeclarationAdapter; > final AnnotationElementAdapter<String> nameAdapter; > String name; >+ TextRange nameTextRange; > > final DeclarationAnnotationElementAdapter<Integer> initialValueDeclarationAdapter; > final AnnotationElementAdapter<Integer> initialValueAdapter; >@@ -62,12 +63,14 @@ > > public void initialize(CompilationUnit astRoot) { > this.name = this.buildName(astRoot); >+ this.nameTextRange = this.buildNameTextRange(astRoot); > this.initialValue = this.buildInitialValue(astRoot); > this.allocationSize = this.buildAllocationSize(astRoot); > } > > public void synchronizeWith(CompilationUnit astRoot) { > this.syncName(this.buildName(astRoot)); >+ this.nameTextRange = this.buildNameTextRange(astRoot); > this.syncInitialValue(this.buildInitialValue(astRoot)); > this.syncAllocationSize(this.buildAllocationSize(astRoot)); > } >@@ -111,6 +114,10 @@ > } > > public TextRange getNameTextRange(CompilationUnit astRoot) { >+ return this.nameTextRange; >+ } >+ >+ private TextRange buildNameTextRange(CompilationUnit astRoot) { > return this.getElementTextRange(this.nameDeclarationAdapter, astRoot); > } > >@@ -182,5 +189,4 @@ > static DeclarationAnnotationElementAdapter<Integer> buildIntegerAdapter(DeclarationAnnotationAdapter annotationAdapter, String elementName) { > return new ConversionDeclarationAnnotationElementAdapter<Integer>(annotationAdapter, elementName, NumberIntegerExpressionConverter.instance()); > } >- > } >Index: src/org/eclipse/jpt/jpa/core/internal/resource/java/source/SourceQueryAnnotation.java >=================================================================== >RCS file: /cvsroot/webtools/org.eclipse.jpa/components/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/source/SourceQueryAnnotation.java,v >retrieving revision 1.1 >diff -u -r1.1 SourceQueryAnnotation.java >--- src/org/eclipse/jpt/jpa/core/internal/resource/java/source/SourceQueryAnnotation.java 6 Feb 2011 02:07:13 -0000 1.1 >+++ src/org/eclipse/jpt/jpa/core/internal/resource/java/source/SourceQueryAnnotation.java 11 May 2011 14:49:40 -0000 >@@ -1,5 +1,5 @@ > /******************************************************************************* >- * Copyright (c) 2007, 2010 Oracle. All rights reserved. >+ * Copyright (c) 2007, 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. >@@ -46,10 +46,12 @@ > DeclarationAnnotationElementAdapter<String> nameDeclarationAdapter; > AnnotationElementAdapter<String> nameAdapter; > String name; >+ TextRange nameTextRange; > > DeclarationAnnotationElementAdapter<String> queryDeclarationAdapter; > AnnotationElementAdapter<String> queryAdapter; > String query; >+ TextRange queryTextRange; > > final Vector<NestableQueryHintAnnotation> hints = new Vector<NestableQueryHintAnnotation>(); > final HintsAnnotationContainer hintsContainer = new HintsAnnotationContainer(); >@@ -65,13 +67,17 @@ > > public void initialize(CompilationUnit astRoot) { > this.name = this.buildName(astRoot); >+ this.nameTextRange = this.buildNameTextRange(astRoot); > this.query = this.buildQuery(astRoot); >+ this.queryTextRange = this.buildQueryTextRange(astRoot); > AnnotationContainerTools.initialize(this.hintsContainer, astRoot); > } > > public void synchronizeWith(CompilationUnit astRoot) { > this.syncName(this.buildName(astRoot)); >+ this.nameTextRange = this.buildNameTextRange(astRoot); > this.syncQuery(this.buildQuery(astRoot)); >+ this.queryTextRange = this.buildQueryTextRange(astRoot); > AnnotationContainerTools.synchronize(this.hintsContainer, astRoot); > } > >@@ -101,6 +107,10 @@ > } > > public TextRange getNameTextRange(CompilationUnit astRoot) { >+ return this.nameTextRange; >+ } >+ >+ private TextRange buildNameTextRange(CompilationUnit astRoot) { > return this.getElementTextRange(this.nameDeclarationAdapter, astRoot); > } > >@@ -137,6 +147,10 @@ > } > > public TextRange getQueryTextRange(CompilationUnit astRoot) { >+ return this.queryTextRange; >+ } >+ >+ private TextRange buildQueryTextRange(CompilationUnit astRoot) { > return this.getElementTextRange(this.queryDeclarationAdapter, astRoot); > } > >@@ -346,6 +360,5 @@ > public String toString() { > return StringTools.buildToStringFor(this); > } >- > } > } >#P org.eclipse.jpt.jpa.core.tests >Index: src/org/eclipse/jpt/jpa/core/tests/internal/context/orm/OrmIdMappingTests.java >=================================================================== >RCS file: /cvsroot/webtools/org.eclipse.jpa/components/jpa/tests/org.eclipse.jpt.jpa.core.tests/src/org/eclipse/jpt/jpa/core/tests/internal/context/orm/OrmIdMappingTests.java,v >retrieving revision 1.1 >diff -u -r1.1 OrmIdMappingTests.java >--- src/org/eclipse/jpt/jpa/core/tests/internal/context/orm/OrmIdMappingTests.java 6 Feb 2011 02:33:02 -0000 1.1 >+++ src/org/eclipse/jpt/jpa/core/tests/internal/context/orm/OrmIdMappingTests.java 11 May 2011 14:49:43 -0000 >@@ -1,5 +1,5 @@ > /******************************************************************************* >- * Copyright (c) 2007, 2010 Oracle. All rights reserved. >+ * Copyright (c) 2007, 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. >@@ -481,20 +481,27 @@ > GeneratedValue generatedValue = idMapping.getGeneratedValue(); > assertEquals("myTableGenerator", generatedValue.getSpecifiedGenerator()); > assertEquals(GenerationType.TABLE, generatedValue.getSpecifiedStrategy()); >- >+ >+// >>> I'm going to argue there is no such thing as a "virtual" generator, >+// since a Java generator is *not* overridden when its ID mapping (or entity) >+// is overridden in the orm.xml file - both the orm.xml ID mapping and the >+// Java mapping can define an "active" generator as long as they have different >+// names ~bjv > TableGenerator tableGenerator = idMapping.getGeneratorContainer().getTableGenerator(); >- assertEquals("myTableGenerator", tableGenerator.getName()); >- assertEquals("myTable", tableGenerator.getSpecifiedTable()); >- assertEquals("myCatalog", tableGenerator.getSpecifiedCatalog()); >- assertEquals("mySchema", tableGenerator.getSpecifiedSchema()); >- assertEquals("myPkColumnName", tableGenerator.getSpecifiedPkColumnName()); >- assertEquals("myPkColumnValue", tableGenerator.getSpecifiedPkColumnValue()); >- assertEquals("myValueColumnName", tableGenerator.getSpecifiedValueColumnName()); >- assertEquals(Integer.valueOf(1), tableGenerator.getSpecifiedInitialValue()); >- assertEquals(Integer.valueOf(1), tableGenerator.getSpecifiedAllocationSize()); >+ assertNull(tableGenerator); >+// assertEquals("myTableGenerator", tableGenerator.getName()); >+// assertEquals("myTable", tableGenerator.getSpecifiedTable()); >+// assertEquals("myCatalog", tableGenerator.getSpecifiedCatalog()); >+// assertEquals("mySchema", tableGenerator.getSpecifiedSchema()); >+// assertEquals("myPkColumnName", tableGenerator.getSpecifiedPkColumnName()); >+// assertEquals("myPkColumnValue", tableGenerator.getSpecifiedPkColumnValue()); >+// assertEquals("myValueColumnName", tableGenerator.getSpecifiedValueColumnName()); >+// assertEquals(Integer.valueOf(1), tableGenerator.getSpecifiedInitialValue()); >+// assertEquals(Integer.valueOf(1), tableGenerator.getSpecifiedAllocationSize()); > > SequenceGenerator sequenceGenerator = idMapping.getGeneratorContainer().getSequenceGenerator(); >- assertEquals("mySequenceGenerator", sequenceGenerator.getName()); >+ assertNull(sequenceGenerator); >+// assertEquals("mySequenceGenerator", sequenceGenerator.getName()); > } > > public void testVirtualMappingMetadataCompleteTrue() throws Exception { >Index: src/org/eclipse/jpt/jpa/core/tests/internal/context/orm/OrmTableGeneratorTests.java >=================================================================== >RCS file: /cvsroot/webtools/org.eclipse.jpa/components/jpa/tests/org.eclipse.jpt.jpa.core.tests/src/org/eclipse/jpt/jpa/core/tests/internal/context/orm/OrmTableGeneratorTests.java,v >retrieving revision 1.1 >diff -u -r1.1 OrmTableGeneratorTests.java >--- src/org/eclipse/jpt/jpa/core/tests/internal/context/orm/OrmTableGeneratorTests.java 6 Feb 2011 02:33:02 -0000 1.1 >+++ src/org/eclipse/jpt/jpa/core/tests/internal/context/orm/OrmTableGeneratorTests.java 11 May 2011 14:49:43 -0000 >@@ -1,5 +1,5 @@ > /******************************************************************************* >- * Copyright (c) 2007, 2010 Oracle. All rights reserved. >+ * Copyright (c) 2007, 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. >@@ -577,21 +577,27 @@ > JavaTableGenerator javaTableGenerator = javaIdMapping.getGeneratorContainer().addTableGenerator(); > javaTableGenerator.setName("TABLE_GENERATOR"); > >+// >>> I'm going to argue there is no such thing as a "virtual" generator, >+// since a Java generator is *not* overridden when its ID mapping (or entity) >+// is overridden in the orm.xml file - both the orm.xml ID mapping and the >+// Java mapping can define an "active" generator as long as they have different >+// names ~bjv > TableGenerator tableGenerator = virtualIdMapping.getGeneratorContainer().getTableGenerator(); >- Iterator<UniqueConstraint> uniqueConstraints = tableGenerator.getUniqueConstraints().iterator(); >- assertFalse(uniqueConstraints.hasNext()); >- >+ assertNull(tableGenerator); >+// Iterator<UniqueConstraint> uniqueConstraints = tableGenerator.getUniqueConstraints().iterator(); >+// assertFalse(uniqueConstraints.hasNext()); > > javaTableGenerator.addUniqueConstraint().addColumnName("FOO"); > javaTableGenerator.addUniqueConstraint().addColumnName("BAR"); > javaTableGenerator.addUniqueConstraint().addColumnName("BAZ"); > >- uniqueConstraints = tableGenerator.getUniqueConstraints().iterator(); >- assertTrue(uniqueConstraints.hasNext()); >- assertEquals("FOO", uniqueConstraints.next().getColumnNames().iterator().next()); >- assertEquals("BAR", uniqueConstraints.next().getColumnNames().iterator().next()); >- assertEquals("BAZ", uniqueConstraints.next().getColumnNames().iterator().next()); >- assertFalse(uniqueConstraints.hasNext()); >+ assertNull(tableGenerator); >+// uniqueConstraints = tableGenerator.getUniqueConstraints().iterator(); >+// assertTrue(uniqueConstraints.hasNext()); >+// assertEquals("FOO", uniqueConstraints.next().getColumnNames().iterator().next()); >+// assertEquals("BAR", uniqueConstraints.next().getColumnNames().iterator().next()); >+// assertEquals("BAZ", uniqueConstraints.next().getColumnNames().iterator().next()); >+// assertFalse(uniqueConstraints.hasNext()); > > OrmIdMapping ormIdMapping = (OrmIdMapping) virtualAttribute.convertToSpecified().getMapping(); > >@@ -600,5 +606,4 @@ > > assertEquals(0, ormTableGenerator2.getUniqueConstraintsSize()); > } >- >-} >\ No newline at end of file >+} >#P org.eclipse.jpt.jpa.eclipselink.core >Index: src/org/eclipse/jpt/jpa/eclipselink/core/context/persistence/EclipseLinkPersistenceUnit.java >=================================================================== >RCS file: /cvsroot/webtools/org.eclipse.jpa/components/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/context/persistence/EclipseLinkPersistenceUnit.java,v >retrieving revision 1.2 >diff -u -r1.2 EclipseLinkPersistenceUnit.java >--- src/org/eclipse/jpt/jpa/eclipselink/core/context/persistence/EclipseLinkPersistenceUnit.java 19 Apr 2011 15:00:35 -0000 1.2 >+++ src/org/eclipse/jpt/jpa/eclipselink/core/context/persistence/EclipseLinkPersistenceUnit.java 11 May 2011 14:49:45 -0000 >@@ -467,7 +467,7 @@ > DefaultEclipseLinkJpaValidationMessages.buildMessage( > IMessage.HIGH_SEVERITY, > EclipseLinkJpaValidationMessages.SESSION_LOGGER_CLASS_NOT_SPECIFIED, >- new String[] {}, >+ EMPTY_STRING_ARRAY, > this.getPersistenceUnit(), > loggerProperty.getValidationTextRange() > ) >@@ -508,7 +508,7 @@ > DefaultEclipseLinkJpaValidationMessages.buildMessage( > IMessage.HIGH_SEVERITY, > EclipseLinkJpaValidationMessages.EXCEPTION_HANDLER_CLASS_NOT_SPECIFIED, >- new String[] {}, >+ EMPTY_STRING_ARRAY, > this.getPersistenceUnit(), > handlerProperty.getValidationTextRange() > ) >@@ -564,7 +564,7 @@ > DefaultEclipseLinkJpaValidationMessages.buildMessage( > IMessage.HIGH_SEVERITY, > EclipseLinkJpaValidationMessages.SESSION_PROFILER_CLASS_NOT_SPECIFIED, >- new String[] {}, >+ EMPTY_STRING_ARRAY, > this.getPersistenceUnit(), > profilerProperty.getValidationTextRange() > ) >@@ -616,7 +616,7 @@ > DefaultEclipseLinkJpaValidationMessages.buildMessage( > IMessage.HIGH_SEVERITY, > EclipseLinkJpaValidationMessages.SESSION_CUSTOMIZER_CLASS_NOT_SPECIFIED, >- new String[] {}, >+ EMPTY_STRING_ARRAY, > this.getPersistenceUnit(), > property.getValidationTextRange() > ) >Index: src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/java/JavaEclipseLinkConverter.java >=================================================================== >RCS file: /cvsroot/webtools/org.eclipse.jpa/components/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/java/JavaEclipseLinkConverter.java,v >retrieving revision 1.3 >diff -u -r1.3 JavaEclipseLinkConverter.java >--- src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/java/JavaEclipseLinkConverter.java 28 Apr 2011 02:00:36 -0000 1.3 >+++ src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/java/JavaEclipseLinkConverter.java 11 May 2011 14:49:45 -0000 >@@ -238,7 +238,7 @@ > DefaultEclipseLinkJpaValidationMessages.buildMessage( > IMessage.HIGH_SEVERITY, > EclipseLinkJpaValidationMessages.CONVERTER_NAME_UNDEFINED, >- new String[] {}, >+ EMPTY_STRING_ARRAY, > this, > this.getNameTextRange(astRoot) > )); >Index: src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/java/JavaEclipseLinkVersionMapping.java >=================================================================== >RCS file: /cvsroot/webtools/org.eclipse.jpa/components/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/java/JavaEclipseLinkVersionMapping.java,v >retrieving revision 1.2 >diff -u -r1.2 JavaEclipseLinkVersionMapping.java >--- src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/java/JavaEclipseLinkVersionMapping.java 25 Feb 2011 21:42:38 -0000 1.2 >+++ src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/java/JavaEclipseLinkVersionMapping.java 11 May 2011 14:49:45 -0000 >@@ -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. >@@ -78,7 +78,7 @@ > } > > @Override >- protected void validateAttributeType(List<IMessage> messages, IReporter reporter, CompilationUnit astRoot) { >+ protected void validateAttributeType(List<IMessage> messages, CompilationUnit astRoot) { > if (!ArrayTools.contains(VERSION_MAPPING_SUPPORTED_TYPES, this.getPersistentAttribute().getTypeName())) { > messages.add( > DefaultEclipseLinkJpaValidationMessages.buildMessage( >Index: src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/orm/OrmEclipseLinkConverter.java >=================================================================== >RCS file: /cvsroot/webtools/org.eclipse.jpa/components/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/orm/OrmEclipseLinkConverter.java,v >retrieving revision 1.3 >diff -u -r1.3 OrmEclipseLinkConverter.java >--- src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/orm/OrmEclipseLinkConverter.java 28 Apr 2011 02:00:36 -0000 1.3 >+++ src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/orm/OrmEclipseLinkConverter.java 11 May 2011 14:49:45 -0000 >@@ -127,7 +127,7 @@ > DefaultEclipseLinkJpaValidationMessages.buildMessage( > IMessage.HIGH_SEVERITY, > EclipseLinkJpaValidationMessages.CONVERTER_NAME_UNDEFINED, >- new String[] {}, >+ EMPTY_STRING_ARRAY, > this, > this.getNameTextRange() > )); >Index: src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/orm/OrmEclipseLinkCustomizer.java >=================================================================== >RCS file: /cvsroot/webtools/org.eclipse.jpa/components/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/orm/OrmEclipseLinkCustomizer.java,v >retrieving revision 1.3 >diff -u -r1.3 OrmEclipseLinkCustomizer.java >--- src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/orm/OrmEclipseLinkCustomizer.java 28 Apr 2011 02:00:36 -0000 1.3 >+++ src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/orm/OrmEclipseLinkCustomizer.java 11 May 2011 14:49:45 -0000 >@@ -250,7 +250,7 @@ > DefaultEclipseLinkJpaValidationMessages.buildMessage( > IMessage.HIGH_SEVERITY, > EclipseLinkJpaValidationMessages.DESCRIPTOR_CUSTOMIZER_CLASS_NOT_SPECIFIED, >- new String[] {}, >+ EMPTY_STRING_ARRAY, > this, > this.getTypeMapping().getValidationTextRange() > ) >Index: src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/orm/OrmEclipseLinkVersionMapping.java >=================================================================== >RCS file: /cvsroot/webtools/org.eclipse.jpa/components/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/orm/OrmEclipseLinkVersionMapping.java,v >retrieving revision 1.2 >diff -u -r1.2 OrmEclipseLinkVersionMapping.java >--- src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/orm/OrmEclipseLinkVersionMapping.java 25 Feb 2011 21:42:38 -0000 1.2 >+++ src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/orm/OrmEclipseLinkVersionMapping.java 11 May 2011 14:49:45 -0000 >@@ -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. >@@ -79,7 +79,7 @@ > } > > @Override >- protected void validateAttributeType(List<IMessage> messages, IReporter reporter) { >+ protected void validateAttributeType(List<IMessage> messages) { > if (!ArrayTools.contains(VERSION_MAPPING_SUPPORTED_TYPES, this.getPersistentAttribute().getTypeName())) { > messages.add( > DefaultEclipseLinkJpaValidationMessages.buildMessage( >#P org.eclipse.jpt.jpa.ui >Index: src/org/eclipse/jpt/jpa/ui/internal/details/GeneratedValueComposite.java >=================================================================== >RCS file: /cvsroot/webtools/org.eclipse.jpa/components/jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/details/GeneratedValueComposite.java,v >retrieving revision 1.2 >diff -u -r1.2 GeneratedValueComposite.java >--- src/org/eclipse/jpt/jpa/ui/internal/details/GeneratedValueComposite.java 9 Mar 2011 18:34:21 -0000 1.2 >+++ src/org/eclipse/jpt/jpa/ui/internal/details/GeneratedValueComposite.java 11 May 2011 14:49:47 -0000 >@@ -1,5 +1,5 @@ > /******************************************************************************* >- * Copyright (c) 2007, 2010 Oracle. All rights reserved. >+ * Copyright (c) 2007, 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. >@@ -10,18 +10,27 @@ > package org.eclipse.jpt.jpa.ui.internal.details; > > import java.util.Collection; >+import java.util.Iterator; > import org.eclipse.jpt.common.ui.internal.widgets.EnumFormComboViewer; > import org.eclipse.jpt.common.ui.internal.widgets.Pane; >+import org.eclipse.jpt.common.utility.Filter; >+import org.eclipse.jpt.common.utility.internal.StringTools; > import org.eclipse.jpt.common.utility.internal.model.value.CollectionAspectAdapter; >+import org.eclipse.jpt.common.utility.internal.model.value.FilteringCollectionValueModel; >+import org.eclipse.jpt.common.utility.internal.model.value.ItemPropertyListValueModelAdapter; > import org.eclipse.jpt.common.utility.internal.model.value.PropertyAspectAdapter; >+import org.eclipse.jpt.common.utility.internal.model.value.SetCollectionValueModel; > import org.eclipse.jpt.common.utility.internal.model.value.SortedListValueModelAdapter; >+import org.eclipse.jpt.common.utility.internal.model.value.TransformationListValueModel; > import org.eclipse.jpt.common.utility.model.value.CollectionValueModel; > import org.eclipse.jpt.common.utility.model.value.ListValueModel; > import org.eclipse.jpt.common.utility.model.value.PropertyValueModel; > import org.eclipse.jpt.common.utility.model.value.WritablePropertyValueModel; > import org.eclipse.jpt.jpa.core.context.GeneratedValue; > import org.eclipse.jpt.jpa.core.context.GenerationType; >+import org.eclipse.jpt.jpa.core.context.Generator; > import org.eclipse.jpt.jpa.core.context.IdMapping; >+import org.eclipse.jpt.jpa.core.context.JpaNamedContextNode; > import org.eclipse.jpt.jpa.core.context.persistence.PersistenceUnit; > import org.eclipse.jpt.jpa.ui.internal.JpaHelpContextIds; > import org.eclipse.swt.widgets.Composite; >@@ -74,7 +83,7 @@ > addLabeledEditableCombo( > container, > JptUiDetailsMessages.GeneratedValueComposite_generatorName, >- buildGeneraterNameListHolder(), >+ buildSortedGeneraterNamesModel(), > buildGeneratorNameHolder(), > JpaHelpContextIds.MAPPING_GENERATED_VALUE_GENERATOR_NAME > ); >@@ -117,7 +126,7 @@ > > @Override > protected void setValue(GenerationType value) { >- retrieveGeneratedValue().setSpecifiedStrategy(value); >+ getGeneratedValueForUpdate().setSpecifiedStrategy(value); > } > }; > } >@@ -147,7 +156,7 @@ > if (value.length() == 0) { > return; > } >- retrieveGeneratedValue().setSpecifiedGenerator(value); >+ getGeneratedValueForUpdate().setSpecifiedGenerator(value); > } > > @Override >@@ -160,15 +169,43 @@ > }; > } > >- protected ListValueModel<String> buildGeneraterNameListHolder() { >- return new SortedListValueModelAdapter<String>(this.buildGeneratorNamesModel()); >+ protected ListValueModel<String> buildSortedGeneraterNamesModel() { >+ return new SortedListValueModelAdapter<String>(this.buildUniqueGeneratorNamesModel()); >+ } >+ >+ protected CollectionValueModel<String> buildUniqueGeneratorNamesModel() { >+ return new SetCollectionValueModel<String>(this.buildGeneratorNamesModel()); > } > > protected CollectionValueModel<String> buildGeneratorNamesModel() { >- return new CollectionAspectAdapter<PersistenceUnit, String>(this.buildPersistenceUnitModel(), PersistenceUnit.GENERATORS_COLLECTION) { >+ return new FilteringCollectionValueModel<String>(this.buildGeneratorNamesModel_(), NON_EMPTY_STRING_FILTER); >+ } >+ >+ protected static final Filter<String> NON_EMPTY_STRING_FILTER = >+ new Filter<String>() { >+ public boolean accept(String string) { >+ return StringTools.stringIsNotEmpty(string); >+ } >+ }; >+ >+ protected ListValueModel<String> buildGeneratorNamesModel_() { >+ return new TransformationListValueModel<Generator, String>(this.buildGeneratorsModel()) { >+ @Override >+ protected String transformItem_(Generator generator) { >+ return generator.getName(); >+ } >+ }; >+ } >+ >+ protected ListValueModel<Generator> buildGeneratorsModel() { >+ return new ItemPropertyListValueModelAdapter<Generator>(this.buildGeneratorsModel_(), JpaNamedContextNode.NAME_PROPERTY); >+ } >+ >+ protected CollectionValueModel<Generator> buildGeneratorsModel_() { >+ return new CollectionAspectAdapter<PersistenceUnit, Generator>(this.buildPersistenceUnitModel(), PersistenceUnit.GENERATORS_COLLECTION) { > @Override >- protected Iterable<String> getIterable() { >- return this.subject.getUniqueGeneratorNames(); >+ protected Iterator<Generator> iterator_() { >+ return this.subject.generators(); > } > @Override > protected int size_() { >@@ -186,7 +223,7 @@ > }; > } > >- private GeneratedValue retrieveGeneratedValue() { >+ /* CU private */ GeneratedValue getGeneratedValueForUpdate() { > GeneratedValue generatedValue = getSubject().getGeneratedValue(); > > if (generatedValue == null) {
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 336296
: 195369