From 7fa5766eb78c542d54f7f7dfff4757e607ec30fd Mon Sep 17 00:00:00 2001
From: tle
Date: Tue, 20 Dec 2011 23:21:27 +0000
Subject: Hermes JPQL parser 2 integration (needs EclipseLink 2.4.0) - patch
from Pascal
---
.../org.eclipse.jpt.jpa.core/META-INF/MANIFEST.MF | 5 +-
.../src/org/eclipse/jpt/jpa/core/JpaPlatform.java | 58 +--
.../core/internal/AbstractJpaJpqlQueryHelper.java | 99 +++++
.../core/internal/GenericJpaJpqlQueryHelper.java | 50 +++
.../jpt/jpa/core/internal/GenericJpaPlatform.java | 16 +-
.../core/internal/GenericJpaPlatformFactory.java | 21 +-
.../jpa1/context/java/GenericJavaNamedQuery.java | 7 +-
.../jpa1/context/orm/GenericOrmNamedQuery.java | 6 +-
.../jpa2/Generic2_0JpaJpqlQueryHelper.java | 51 +++
.../jpa2/Generic2_0JpaPlatformFactory.java | 15 +-
.../context/java/GenericJavaNamedQuery2_0.java | 7 +-
.../jpa2/context/orm/GenericOrmNamedQuery2_0.java | 8 +-
.../jpa/core/internal/jpql/ClassConstructor.java | 143 -------
.../jpt/jpa/core/internal/jpql/IJpaType.java | 38 --
.../jpa/core/internal/jpql/JavaConstructor.java | 99 -----
.../jpt/jpa/core/internal/jpql/JavaType.java | 246 ------------
.../core/internal/jpql/JavaTypeDeclaration.java | 271 -------------
.../jpt/jpa/core/internal/jpql/JpaConstructor.java | 140 -------
.../jpt/jpa/core/internal/jpql/JpaEmbeddable.java | 63 ---
.../jpt/jpa/core/internal/jpql/JpaEntity.java | 110 ------
.../jpa/core/internal/jpql/JpaJpqlQueryHelper.java | 240 -----------
.../jpt/jpa/core/internal/jpql/JpaManagedType.java | 134 -------
.../core/internal/jpql/JpaManagedTypeProvider.java | 293 --------------
.../core/internal/jpql/JpaMappedSuperclass.java | 63 ---
.../jpt/jpa/core/internal/jpql/JpaMapping.java | 269 -------------
.../jpa/core/internal/jpql/JpaNullManagedType.java | 112 ------
.../jpa/core/internal/jpql/JpaPersistenceUnit.java | 40 --
.../jpt/jpa/core/internal/jpql/JpaQuery.java | 115 ------
.../jpt/jpa/core/internal/jpql/JpaType.java | 430 --------------------
.../jpa/core/internal/jpql/JpaTypeDeclaration.java | 105 -----
.../jpa/core/internal/jpql/JpaTypeRepository.java | 404 -------------------
.../jpt/jpa/core/internal/jpql/SimpleType.java | 138 -------
.../jpt/jpa/core/jpql/JpaJpqlQueryHelper.java | 256 ++++++++++++
.../jpt/jpa/core/jpql/spi/ClassConstructor.java | 148 +++++++
.../jpt/jpa/core/jpql/spi/GenericJpaMapping.java | 42 ++
.../jpa/core/jpql/spi/GenericMappingBuilder.java | 48 +++
.../eclipse/jpt/jpa/core/jpql/spi/IJpaType.java | 43 ++
.../jpt/jpa/core/jpql/spi/JavaConstructor.java | 104 +++++
.../eclipse/jpt/jpa/core/jpql/spi/JavaType.java | 252 ++++++++++++
.../jpt/jpa/core/jpql/spi/JavaTypeDeclaration.java | 276 +++++++++++++
.../jpt/jpa/core/jpql/spi/JpaConstructor.java | 145 +++++++
.../jpt/jpa/core/jpql/spi/JpaEmbeddable.java | 75 ++++
.../eclipse/jpt/jpa/core/jpql/spi/JpaEntity.java | 122 ++++++
.../jpt/jpa/core/jpql/spi/JpaManagedType.java | 179 +++++++++
.../jpa/core/jpql/spi/JpaManagedTypeProvider.java | 297 ++++++++++++++
.../jpt/jpa/core/jpql/spi/JpaMappedSuperclass.java | 75 ++++
.../eclipse/jpt/jpa/core/jpql/spi/JpaMapping.java | 318 +++++++++++++++
.../jpt/jpa/core/jpql/spi/JpaNullManagedType.java | 118 ++++++
.../eclipse/jpt/jpa/core/jpql/spi/JpaQuery.java | 121 ++++++
.../org/eclipse/jpt/jpa/core/jpql/spi/JpaType.java | 437 +++++++++++++++++++++
.../jpt/jpa/core/jpql/spi/JpaTypeDeclaration.java | 110 ++++++
.../jpt/jpa/core/jpql/spi/JpaTypeRepository.java | 409 +++++++++++++++++++
.../eclipse/jpt/jpa/core/jpql/spi/SimpleType.java | 144 +++++++
.../.classpath | 1 +
.../META-INF/MANIFEST.MF | 2 +
.../AbstractEclipseLinkJpaJpqlQueryHelper.java | 99 +++++
.../internal/EclipseLink1_1JpaJpqlQueryHelper.java | 49 +++
.../internal/EclipseLink1_1JpaPlatformFactory.java | 19 +-
.../internal/EclipseLink1_2JpaJpqlQueryHelper.java | 49 +++
.../internal/EclipseLink1_2JpaPlatformFactory.java | 19 +-
.../internal/EclipseLink2_0JpaJpqlQueryHelper.java | 49 +++
.../internal/EclipseLink2_0JpaPlatformFactory.java | 13 +-
.../internal/EclipseLink2_1JpaJpqlQueryHelper.java | 49 +++
.../internal/EclipseLink2_1JpaPlatformFactory.java | 31 +-
.../internal/EclipseLink2_2JpaJpqlQueryHelper.java | 49 +++
.../internal/EclipseLink2_2JpaPlatformFactory.java | 31 +-
.../internal/EclipseLink2_3JpaJpqlQueryHelper.java | 49 +++
.../internal/EclipseLink2_3JpaPlatformFactory.java | 21 +-
.../internal/EclipseLink2_4JpaJpqlQueryHelper.java | 49 +++
.../internal/EclipseLink2_4JpaPlatformFactory.java | 11 +-
.../internal/EclipseLinkJpaJpqlQueryHelper.java | 49 +++
.../internal/EclipseLinkJpaPlatformFactory.java | 23 +-
.../core/jpql/spi/EclipseLinkMapping.java | 113 ++++++
.../core/jpql/spi/EclipseLinkMappingBuilder.java | 49 +++
.../org.eclipse.jpt.jpa.ui/META-INF/MANIFEST.MF | 2 +-
.../jpql/JpaJpqlContentProposalProvider.java | 49 ++-
.../jpql/JpqlCompletionProposalComputer.java | 63 +--
.../ui/internal/jpql/JpqlIdentifierMessages.java | 6 +-
.../META-INF/MANIFEST.MF | 1 +
.../extension/resource/TestJpaJpqlQueryHelper.java | 86 ++++
.../extension/resource/TestJpaPlatformFactory.java | 19 +-
81 files changed, 4919 insertions(+), 3646 deletions(-)
create mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/AbstractJpaJpqlQueryHelper.java
create mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/GenericJpaJpqlQueryHelper.java
create mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/Generic2_0JpaJpqlQueryHelper.java
delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpql/ClassConstructor.java
delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpql/IJpaType.java
delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpql/JavaConstructor.java
delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpql/JavaType.java
delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpql/JavaTypeDeclaration.java
delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpql/JpaConstructor.java
delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpql/JpaEmbeddable.java
delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpql/JpaEntity.java
delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpql/JpaJpqlQueryHelper.java
delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpql/JpaManagedType.java
delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpql/JpaManagedTypeProvider.java
delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpql/JpaMappedSuperclass.java
delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpql/JpaMapping.java
delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpql/JpaNullManagedType.java
delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpql/JpaPersistenceUnit.java
delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpql/JpaQuery.java
delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpql/JpaType.java
delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpql/JpaTypeDeclaration.java
delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpql/JpaTypeRepository.java
delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpql/SimpleType.java
create mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/jpql/JpaJpqlQueryHelper.java
create mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/jpql/spi/ClassConstructor.java
create mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/jpql/spi/GenericJpaMapping.java
create mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/jpql/spi/GenericMappingBuilder.java
create mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/jpql/spi/IJpaType.java
create mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/jpql/spi/JavaConstructor.java
create mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/jpql/spi/JavaType.java
create mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/jpql/spi/JavaTypeDeclaration.java
create mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/jpql/spi/JpaConstructor.java
create mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/jpql/spi/JpaEmbeddable.java
create mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/jpql/spi/JpaEntity.java
create mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/jpql/spi/JpaManagedType.java
create mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/jpql/spi/JpaManagedTypeProvider.java
create mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/jpql/spi/JpaMappedSuperclass.java
create mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/jpql/spi/JpaMapping.java
create mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/jpql/spi/JpaNullManagedType.java
create mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/jpql/spi/JpaQuery.java
create mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/jpql/spi/JpaType.java
create mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/jpql/spi/JpaTypeDeclaration.java
create mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/jpql/spi/JpaTypeRepository.java
create mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/jpql/spi/SimpleType.java
create mode 100644 jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/AbstractEclipseLinkJpaJpqlQueryHelper.java
create mode 100644 jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/EclipseLink1_1JpaJpqlQueryHelper.java
create mode 100644 jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/EclipseLink1_2JpaJpqlQueryHelper.java
create mode 100644 jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/EclipseLink2_0JpaJpqlQueryHelper.java
create mode 100644 jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/EclipseLink2_1JpaJpqlQueryHelper.java
create mode 100644 jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/EclipseLink2_2JpaJpqlQueryHelper.java
create mode 100644 jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/EclipseLink2_3JpaJpqlQueryHelper.java
create mode 100644 jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/EclipseLink2_4JpaJpqlQueryHelper.java
create mode 100644 jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/EclipseLinkJpaJpqlQueryHelper.java
create mode 100644 jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/jpql/spi/EclipseLinkMapping.java
create mode 100644 jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/jpql/spi/EclipseLinkMappingBuilder.java
create mode 100644 jpa/tests/org.eclipse.jpt.jpa.core.tests.extension.resource/src/org/eclipse/jpt/jpa/core/tests/extension/resource/TestJpaJpqlQueryHelper.java
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/META-INF/MANIFEST.MF b/jpa/plugins/org.eclipse.jpt.jpa.core/META-INF/MANIFEST.MF
index d691ef0d6f..bf3b9657c4 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/META-INF/MANIFEST.MF
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/META-INF/MANIFEST.MF
@@ -25,7 +25,7 @@ Require-Bundle: org.eclipse.core.commands;bundle-version="[3.4.0,4.0.0)",
org.eclipse.jst.common.project.facet.core;bundle-version="[1.3.100,2.0.0)",
org.eclipse.jst.j2ee;bundle-version="[1.1.200,2.0.0)",
org.eclipse.jst.j2ee.core;bundle-version="[1.1.200,2.0.0)",
- org.eclipse.persistence.jpa.jpql;bundle-version="[1.0.0, 2.0.0)",
+ org.eclipse.persistence.jpa.jpql;bundle-version="[2.0.0, 3.0.0)",
org.eclipse.wst.common.emf;bundle-version="[1.1.200,2.0.0)",
org.eclipse.wst.common.emfworkbench.integration;bundle-version="[1.1.200,2.0.0)",
org.eclipse.wst.common.frameworks;bundle-version="[1.1.200,2.0.0)",
@@ -63,7 +63,6 @@ Export-Package: org.eclipse.jpt.jpa.core,
org.eclipse.jpt.jpa.core.internal.jpa2.resource.java;x-internal:=true,
org.eclipse.jpt.jpa.core.internal.jpa2.resource.java.binary;x-internal:=true,
org.eclipse.jpt.jpa.core.internal.jpa2.resource.java.source;x-internal:=true,
- org.eclipse.jpt.jpa.core.internal.jpql;x-friends:="org.eclipse.jpt.jpa.ui",
org.eclipse.jpt.jpa.core.internal.libprov;x-internal:=true,
org.eclipse.jpt.jpa.core.internal.libval;x-internal:=true,
org.eclipse.jpt.jpa.core.internal.operations;x-internal:=true,
@@ -87,6 +86,8 @@ Export-Package: org.eclipse.jpt.jpa.core,
org.eclipse.jpt.jpa.core.jpa2.context.persistence.connection,
org.eclipse.jpt.jpa.core.jpa2.context.persistence.options,
org.eclipse.jpt.jpa.core.jpa2.resource.java,
+ org.eclipse.jpt.jpa.core.jpql,
+ org.eclipse.jpt.jpa.core.jpql.spi,
org.eclipse.jpt.jpa.core.libprov,
org.eclipse.jpt.jpa.core.platform,
org.eclipse.jpt.jpa.core.resource,
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/JpaPlatform.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/JpaPlatform.java
index 6eae60b1d3..84492737ae 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/JpaPlatform.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/JpaPlatform.java
@@ -3,12 +3,14 @@
* 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;
+import org.eclipse.jpt.jpa.core.jpql.JpaJpqlQueryHelper;
+
import org.eclipse.core.resources.IFile;
import org.eclipse.core.runtime.content.IContentType;
import org.eclipse.jpt.common.core.AnnotationProvider;
@@ -21,13 +23,13 @@ import org.eclipse.jpt.jpa.core.platform.JpaPlatformDescription;
import org.eclipse.jpt.jpa.db.ConnectionProfileFactory;
/**
- * This interface is to be implemented by a JPA vendor to provide extensions to
+ * This interface is to be implemented by a JPA vendor to provide extensions to
* the core JPA model. The core JPA model will provide functionality for JPA
* spec annotations in Java, persistence.xml
and mapping
* (orm.xml
) files.
- * The org.eclipse.jpt.jpa.core.generic
extension supplies
- * resource models for those file types. As another vendor option you
- * will have to supply those resource models as well or different ones
+ * The org.eclipse.jpt.jpa.core.generic
extension supplies
+ * resource models for those file types. As another vendor option you
+ * will have to supply those resource models as well or different ones
* as necessary. In the extension point you actually provide a
* {@link JpaPlatformFactory} that will build the JPA platform.
*
@@ -40,8 +42,8 @@ import org.eclipse.jpt.jpa.db.ConnectionProfileFactory;
* See the org.eclipse.jpt.jpa.core.jpaPlatforms
extension point.
* @see JpaPlatformFactory
* @see JpaPlatformProvider
- *
- * @version 3.0
+ *
+ * @version 3.1
* @since 2.0
*/
public interface JpaPlatform
@@ -52,18 +54,18 @@ public interface JpaPlatform
* Get the ID for this platform
*/
String getId();
-
+
/**
* Return the description for this platform
*/
JpaPlatformDescription getDescription();
-
+
/**
- * Get the version object for this platform.
+ * Get the version object for this platform.
*/
Version getJpaVersion();
-
-
+
+
// ********** factory **********
/**
@@ -121,15 +123,15 @@ public interface JpaPlatform
*/
IterableAbstractJpaJpqlQueryHelper
.
+ *
+ * @param jpqlGrammar The grammar that defines how to parse a JPQL query
+ */
+ protected AbstractJpaJpqlQueryHelper(JPQLGrammar jpqlGrammar) {
+ super(jpqlGrammar);
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ protected AbstractContentAssistVisitor buildContentAssistVisitor(JPQLQueryContext queryContext) {
+ return new DefaultContentAssistVisitor(queryContext);
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ protected AbstractGrammarValidator buildGrammarValidator(JPQLQueryContext queryContext) {
+ return new DefaultGrammarValidator(queryContext);
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ protected JPQLQueryContext buildJPQLQueryContext(JPQLGrammar jpqlGrammar) {
+ return new DefaultJPQLQueryContext(jpqlGrammar);
+ }
+
+ protected IMappingBuilderGenericJpaJpqlQueryHelper
.
+ */
+ private GenericJpaJpqlQueryHelper() {
+ super(JPQLGrammar1_0.instance());
+ }
+
+ /**
+ * Returns the singleton instance of this helper.
+ *
+ * @return The singleton instance of this helper
+ */
+ public static JpaJpqlQueryHelper instance() {
+ return INSTANCE;
+ }
+}
\ No newline at end of file
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/GenericJpaPlatform.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/GenericJpaPlatform.java
index 405d0914aa..141a270b2f 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/GenericJpaPlatform.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/GenericJpaPlatform.java
@@ -9,6 +9,8 @@
******************************************************************************/
package org.eclipse.jpt.jpa.core.internal;
+import org.eclipse.jpt.jpa.core.jpql.JpaJpqlQueryHelper;
+
import org.eclipse.core.resources.IFile;
import org.eclipse.core.runtime.content.IContentType;
import org.eclipse.jpt.common.core.AnnotationProvider;
@@ -53,8 +55,10 @@ public class GenericJpaPlatform
private final JpaPlatformVariation jpaVariation;
+ private final JpaJpqlQueryHelper jpqlQueryHelper;
+
- public GenericJpaPlatform(String id, Version jpaVersion, JpaFactory jpaFactory, AnnotationProvider annotationProvider, JpaPlatformProvider platformProvider, JpaPlatformVariation jpaVariation) {
+ public GenericJpaPlatform(String id, Version jpaVersion, JpaFactory jpaFactory, AnnotationProvider annotationProvider, JpaPlatformProvider platformProvider, JpaPlatformVariation jpaVariation, JpaJpqlQueryHelper jpqlQueryHelper) {
super();
this.id = id;
this.jpaVersion = jpaVersion;
@@ -62,6 +66,7 @@ public class GenericJpaPlatform
this.annotationProvider = annotationProvider;
this.jpaVariation = jpaVariation;
this.platformProvider = platformProvider;
+ this.jpqlQueryHelper = jpqlQueryHelper;
}
@@ -195,4 +200,11 @@ public class GenericJpaPlatform
public JpaPlatformVariation getJpaVariation() {
return this.jpaVariation;
}
-}
+
+
+ // ********** Hermes integration **********
+
+ public JpaJpqlQueryHelper getJpqlQueryHelper() {
+ return jpqlQueryHelper;
+ }
+}
\ No newline at end of file
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/GenericJpaPlatformFactory.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/GenericJpaPlatformFactory.java
index c3cacc7ae6..fc25535ca5 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/GenericJpaPlatformFactory.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/GenericJpaPlatformFactory.java
@@ -3,7 +3,7 @@
* 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
******************************************************************************/
@@ -30,22 +30,23 @@ public class GenericJpaPlatformFactory
public GenericJpaPlatformFactory() {
super();
}
-
+
public JpaPlatform buildJpaPlatform(String id) {
return new GenericJpaPlatform(
id,
this.buildJpaVersion(),
- new GenericJpaFactory(),
+ new GenericJpaFactory(),
new JpaAnnotationProvider(GenericJpaAnnotationDefinitionProvider.instance()),
- GenericJpaPlatformProvider.instance(),
- this.buildJpaPlatformVariation());
+ GenericJpaPlatformProvider.instance(),
+ this.buildJpaPlatformVariation(),
+ GenericJpaJpqlQueryHelper.instance());
}
-
-
+
+
private JpaPlatform.Version buildJpaVersion() {
return new SimpleVersion(JpaFacet.VERSION_1_0.getVersionString());
}
-
+
protected JpaPlatformVariation buildJpaPlatformVariation() {
return new JpaPlatformVariation() {
public Supported getTablePerConcreteClassInheritanceIsSupported() {
@@ -74,7 +75,7 @@ public class GenericJpaPlatformFactory
public String getVersion() {
return this.getJpaVersion();
}
-
+
public String getJpaVersion() {
return this.jpaVersion;
}
@@ -85,7 +86,7 @@ public class GenericJpaPlatformFactory
public boolean isCompatibleWithJpaVersion(String version) {
return JPA_VERSION_COMPARATOR.compare(this.jpaVersion, version) >= 0;
}
-
+
@Override
public String toString() {
return "JPA version: " + this.getJpaVersion(); //$NON-NLS-1$
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/java/GenericJavaNamedQuery.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/java/GenericJavaNamedQuery.java
index 156ebd7c89..f3d72e898e 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/java/GenericJavaNamedQuery.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/java/GenericJavaNamedQuery.java
@@ -9,13 +9,14 @@
******************************************************************************/
package org.eclipse.jpt.jpa.core.internal.jpa1.context.java;
+import org.eclipse.jpt.jpa.core.jpql.JpaJpqlQueryHelper;
+
import java.util.List;
import org.eclipse.jdt.core.dom.CompilationUnit;
import org.eclipse.jpt.jpa.core.context.NamedQuery;
import org.eclipse.jpt.jpa.core.context.java.JavaJpaContextNode;
import org.eclipse.jpt.jpa.core.context.java.JavaNamedQuery;
import org.eclipse.jpt.jpa.core.internal.context.java.AbstractJavaQuery;
-import org.eclipse.jpt.jpa.core.internal.jpql.JpaJpqlQueryHelper;
import org.eclipse.jpt.jpa.core.resource.java.NamedQueryAnnotation;
import org.eclipse.wst.validation.internal.provisional.core.IMessage;
import org.eclipse.wst.validation.internal.provisional.core.IReporter;
@@ -36,7 +37,7 @@ public class GenericJavaNamedQuery
@Override
protected void validateQuery_(ListGeneric2_0JpaJpqlQueryHelper
.
+ */
+ private Generic2_0JpaJpqlQueryHelper() {
+ super(JPQLGrammar2_0.instance());
+ }
+
+ /**
+ * Returns the singleton instance of this helper.
+ *
+ * @return The singleton instance of this helper
+ */
+ public static JpaJpqlQueryHelper instance() {
+ return INSTANCE;
+ }
+}
\ No newline at end of file
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/Generic2_0JpaPlatformFactory.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/Generic2_0JpaPlatformFactory.java
index 6a0db9b94a..f555be49ef 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/Generic2_0JpaPlatformFactory.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/Generic2_0JpaPlatformFactory.java
@@ -3,7 +3,7 @@
* 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
******************************************************************************/
@@ -13,9 +13,9 @@ import org.eclipse.jpt.jpa.core.JpaFacet;
import org.eclipse.jpt.jpa.core.JpaPlatform;
import org.eclipse.jpt.jpa.core.JpaPlatformFactory;
import org.eclipse.jpt.jpa.core.JpaPlatformVariation;
-import org.eclipse.jpt.jpa.core.internal.JpaAnnotationProvider;
import org.eclipse.jpt.jpa.core.internal.GenericJpaPlatform;
import org.eclipse.jpt.jpa.core.internal.GenericJpaPlatformFactory.SimpleVersion;
+import org.eclipse.jpt.jpa.core.internal.JpaAnnotationProvider;
/**
* All the state in the JPA platform should be "static" (i.e. unchanging once
@@ -30,8 +30,8 @@ public class Generic2_0JpaPlatformFactory
public Generic2_0JpaPlatformFactory() {
super();
}
-
-
+
+
public JpaPlatform buildJpaPlatform(String id) {
return new GenericJpaPlatform(
id,
@@ -39,13 +39,14 @@ public class Generic2_0JpaPlatformFactory
new GenericJpaFactory2_0(),
new JpaAnnotationProvider(Generic2_0JpaAnnotationDefinitionProvider.instance()),
Generic2_0JpaPlatformProvider.instance(),
- this.buildJpaPlatformVariation());
+ this.buildJpaPlatformVariation(),
+ Generic2_0JpaJpqlQueryHelper.instance());
}
-
+
private JpaPlatform.Version buildJpaVersion() {
return new SimpleVersion(JpaFacet.VERSION_2_0.getVersionString());
}
-
+
protected JpaPlatformVariation buildJpaPlatformVariation() {
return new JpaPlatformVariation() {
//table_per_class inheritance support is optional in the 2.0 spec
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/context/java/GenericJavaNamedQuery2_0.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/context/java/GenericJavaNamedQuery2_0.java
index 3314c4ab02..270975f862 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/context/java/GenericJavaNamedQuery2_0.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/context/java/GenericJavaNamedQuery2_0.java
@@ -9,13 +9,14 @@
*******************************************************************************/
package org.eclipse.jpt.jpa.core.internal.jpa2.context.java;
+import org.eclipse.jpt.jpa.core.jpql.JpaJpqlQueryHelper;
+
import java.util.List;
import org.eclipse.jdt.core.dom.CompilationUnit;
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.internal.context.java.AbstractJavaQuery;
-import org.eclipse.jpt.jpa.core.internal.jpql.JpaJpqlQueryHelper;
import org.eclipse.jpt.jpa.core.jpa2.context.LockModeType2_0;
import org.eclipse.jpt.jpa.core.jpa2.context.java.JavaNamedQuery2_0;
import org.eclipse.jpt.jpa.core.jpa2.resource.java.NamedQuery2_0Annotation;
@@ -99,7 +100,7 @@ public class GenericJavaNamedQuery2_0
@Override
protected void validateQuery_(ListClassConstructor
.
- *
- * @param type The declaring type of this constructor
- * @param methodInfo The information of the constructor
- */
- ClassConstructor(JpaType type, IMethod method) {
- super();
- this.type = type;
- this.method = method;
- }
-
- private ITypeDeclaration[] buildParameterTypes() {
-
- BindingKey bindingKey = new BindingKey(method.getKey());
- String signature = bindingKey.toSignature();
-
- int count = Signature.getParameterCount(signature);
- ITypeDeclaration[] typeDeclarations = new ITypeDeclaration[count];
- int index = 0;
-
- for (String parameterType : Signature.getParameterTypes(signature)) {
-
- // 1. Retrieve the parameter type (without the type parameters)
- String parameterTypeName = Signature.getTypeErasure(parameterType);
-
- // 3. Convert the type signature to a dot-based name
- parameterTypeName = Signature.toString(parameterTypeName);
-
- // 4. Create the ITypeDeclaration
- typeDeclarations[index++] = new JpaTypeDeclaration(
- getTypeRepository().getType(parameterTypeName),
- buildTypeParameters(parameterType),
- Signature.getArrayCount(parameterType)
- );
- }
-
- return typeDeclarations;
- }
-
- private ITypeDeclaration[] buildTypeParameters(String signature) {
-
- String[] typeParameters = Signature.getTypeArguments(signature);
- ITypeDeclaration[] generics = new ITypeDeclaration[typeParameters.length];
-
- for (int index = 0; index < typeParameters.length; index++) {
- String typeParameter = typeParameters[index];
-
- // 1. Retrieve the parameter type (without the wild cards)
- switch (Signature.getTypeSignatureKind(typeParameter)) {
- case Signature.WILDCARD_TYPE_SIGNATURE: {
- typeParameter = typeParameter.substring(1);
- }
- }
-
- if (typeParameter.length() == 0) {
- generics[index] = getTypeRepository().getTypeHelper().objectTypeDeclaration();
- }
- else {
- String typeParameterName = Signature.getTypeErasure(typeParameter);
-
- // 3. Convert the type signature to a dot-based name
- typeParameterName = Signature.toString(typeParameterName);
-
- // 3. Retrieve the IType for the type parameter
- IType genericType = getTypeRepository().getType(typeParameterName);
-
- if (genericType.isResolvable()) {
- generics[index] = genericType.getTypeDeclaration();
- }
- else {
- generics[index] = getTypeRepository().getTypeHelper().objectTypeDeclaration();
- }
- }
- }
-
- return generics;
- }
-
- /**
- * {@inheritDoc}
- */
- public ITypeDeclaration[] getParameterTypes() {
- if (typeDeclarations == null) {
- typeDeclarations = buildParameterTypes();
- }
- return typeDeclarations;
- }
-
- private ITypeRepository getTypeRepository() {
- return type.getTypeRepository();
- }
-}
\ No newline at end of file
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpql/IJpaType.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpql/IJpaType.java
deleted file mode 100644
index 0d914a9e04..0000000000
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpql/IJpaType.java
+++ /dev/null
@@ -1,38 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2011 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0 and Eclipse Distribution License v. 1.0
- * which accompanies this distribution.
- * The Eclipse Public License is available at http://www.eclipse.org/legal/epl-v10.html
- * and the Eclipse Distribution License is available at
- * http://www.eclipse.org/org/documents/edl-v10.php.
- *
- * Contributors:
- * Oracle - initial API and implementation
- *
- ******************************************************************************/
-package org.eclipse.jpt.jpa.core.internal.jpql;
-
-import org.eclipse.persistence.jpa.jpql.spi.IType;
-
-/**
- * An internal interface used by all 3 implementations of {@link IType}.
- *
- * @see JavaType
- * @see JpaType
- * @see SimpleType
- *
- * @version 3.0
- * @since 3.0
- * @author Pascal Filion
- */
-interface IJpaType extends IType {
-
- /**
- * Manually sets the declaration of this {@link IType}, which gives the information about type
- * parameters, dimensionality, etc.
- *
- * @param typeDeclaration The external form of the type declaration
- */
- void setTypeDeclaration(JpaTypeDeclaration typeDeclaration);
-}
\ No newline at end of file
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpql/JavaConstructor.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpql/JavaConstructor.java
deleted file mode 100644
index 63a63a8d82..0000000000
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpql/JavaConstructor.java
+++ /dev/null
@@ -1,99 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2011 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0 and Eclipse Distribution License v. 1.0
- * which accompanies this distribution.
- * The Eclipse Public License is available at http://www.eclipse.org/legal/epl-v10.html
- * and the Eclipse Distribution License is available at
- * http://www.eclipse.org/org/documents/edl-v10.php.
- *
- * Contributors:
- * Oracle - initial API and implementation
- *
- ******************************************************************************/
-package org.eclipse.jpt.jpa.core.internal.jpql;
-
-import java.lang.reflect.Constructor;
-import java.lang.reflect.Type;
-import org.eclipse.persistence.jpa.jpql.spi.IConstructor;
-import org.eclipse.persistence.jpa.jpql.spi.IType;
-import org.eclipse.persistence.jpa.jpql.spi.ITypeDeclaration;
-import org.eclipse.persistence.jpa.jpql.spi.ITypeRepository;
-
-/**
- * The concrete implementation of {@link IConstructor} that is wrapping a Java constructor.
- *
- * @version 2.3
- * @since 2.3
- * @author Pascal Filion
- */
-final class JavaConstructor implements IConstructor {
-
- /**
- * The actual Java constructor.
- */
- private Constructor> constructor;
-
- /**
- * The cached {@link ITypeDeclaration parameter types}.
- */
- private ITypeDeclaration[] parameterTypes;
-
- /**
- * The declaring type of this constructor.
- */
- private JavaType type;
-
- /**
- * Creates a new JavaConstructor
.
- *
- * @param type The declaring type of this constructor
- * @param constructor The actual Java constructor
- */
- JavaConstructor(JavaType type, Constructor> constructor) {
- super();
- this.type = type;
- this.constructor = constructor;
- }
-
- private ITypeDeclaration[] buildParameterTypes() {
-
- Class>[] types = constructor.getParameterTypes();
- Type[] genericTypes = constructor.getGenericParameterTypes();
- ITypeDeclaration[] typeDeclarations = new ITypeDeclaration[types.length];
-
- for (int index = 0, count = types.length; index < count; index++) {
- typeDeclarations[index] = buildTypeDeclaration(types[index], genericTypes[index]);
- }
-
- return typeDeclarations;
- }
-
- private ITypeDeclaration buildTypeDeclaration(Class> javaType, Type genericType) {
- ITypeRepository typeRepository = getTypeRepository();
- IType type = typeRepository.getType(javaType);
- return new JavaTypeDeclaration(typeRepository, type, genericType, javaType.isArray());
- }
-
- /**
- * {@inheritDoc}
- */
- public ITypeDeclaration[] getParameterTypes() {
- if (parameterTypes == null) {
- parameterTypes = buildParameterTypes();
- }
- return parameterTypes;
- }
-
- private ITypeRepository getTypeRepository() {
- return type.getTypeRepository();
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- public String toString() {
- return constructor.toGenericString();
- }
-}
\ No newline at end of file
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpql/JavaType.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpql/JavaType.java
deleted file mode 100644
index 517e08caf1..0000000000
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpql/JavaType.java
+++ /dev/null
@@ -1,246 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2011 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0 and Eclipse Distribution License v. 1.0
- * which accompanies this distribution.
- * The Eclipse Public License is available at http://www.eclipse.org/legal/epl-v10.html
- * and the Eclipse Distribution License is available at
- * http://www.eclipse.org/org/documents/edl-v10.php.
- *
- * Contributors:
- * Oracle - initial API and implementation
- *
- ******************************************************************************/
-package org.eclipse.jpt.jpa.core.internal.jpql;
-
-import java.lang.annotation.Annotation;
-import java.lang.reflect.Constructor;
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.Collections;
-import org.eclipse.persistence.jpa.jpql.ExpressionTools;
-import org.eclipse.persistence.jpa.jpql.spi.IConstructor;
-import org.eclipse.persistence.jpa.jpql.spi.IType;
-import org.eclipse.persistence.jpa.jpql.spi.ITypeDeclaration;
-import org.eclipse.persistence.jpa.jpql.spi.ITypeRepository;
-
-/**
- * The concrete implementation of {@link IType} that is wrapping a Java type.
- *
- * @version 2.3
- * @since 2.3
- * @author Pascal Filion
- */
-final class JavaType implements IJpaType {
-
- /**
- * The cached {@link IConstructor IConstructors}.
- */
- private CollectionJavaType
.
- *
- * @param typeRepository The external form of a type repository
- * @param type The actual Java type wrapped by this class
- */
- JavaType(ITypeRepository typeRepository, Class> type) {
- super();
- this.type = type;
- this.typeName = type.getName();
- this.typeRepository = typeRepository;
- }
-
- private IConstructor buildConstructor(Constructor> constructor) {
- return new JavaConstructor(this, constructor);
- }
-
- private Collectionnull
is returned; then the class could not be resolved
- */
- Class> getType() {
- return type;
- }
-
- /**
- * {@inheritDoc}
- */
- public ITypeDeclaration getTypeDeclaration() {
- if (typeDeclaration == null) {
- typeDeclaration = new JavaTypeDeclaration(typeRepository, this, null, (type != null) ? type.isArray() : false);
- }
- return typeDeclaration;
- }
-
- /**
- * Returns the type repository for the application.
- *
- * @return The repository of {@link IType ITypes}
- */
- ITypeRepository getTypeRepository() {
- return typeRepository;
- }
-
- /**
- * {@inheritDoc}
- */
- public boolean hasAnnotation(Class extends Annotation> annotationType) {
- return type.isAnnotationPresent(annotationType);
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- public int hashCode() {
- return typeName.hashCode();
- }
-
- /**
- * {@inheritDoc}
- */
- public boolean isAssignableTo(IType type) {
-
- if (this == type) {
- return true;
- }
-
- // TODO
- if (type instanceof JavaType) {
- Class> otherType = ((JavaType) type).type;
- return otherType.isAssignableFrom(this.type);
- }
- else if (type instanceof JpaType) {
- // TODO
- return false;
- }
-
- return false;
- }
-
- /**
- * {@inheritDoc}
- */
- public boolean isEnum() {
- return (type != null) && type.isEnum();
- }
-
- /**
- * {@inheritDoc}
- */
- public boolean isResolvable() {
- return true;
- }
-
- /**
- * {@inheritDoc}
- */
- public void setTypeDeclaration(JpaTypeDeclaration typeDeclaration) {
- this.typeDeclaration = typeDeclaration;
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- public String toString() {
- return typeName;
- }
-}
\ No newline at end of file
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpql/JavaTypeDeclaration.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpql/JavaTypeDeclaration.java
deleted file mode 100644
index d33231a442..0000000000
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpql/JavaTypeDeclaration.java
+++ /dev/null
@@ -1,271 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2011 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0 and Eclipse Distribution License v. 1.0
- * which accompanies this distribution.
- * The Eclipse Public License is available at http://www.eclipse.org/legal/epl-v10.html
- * and the Eclipse Distribution License is available at
- * http://www.eclipse.org/org/documents/edl-v10.php.
- *
- * Contributors:
- * Oracle - initial API and implementation
- *
- ******************************************************************************/
-package org.eclipse.jpt.jpa.core.internal.jpql;
-
-import java.lang.reflect.GenericArrayType;
-import java.lang.reflect.ParameterizedType;
-import java.lang.reflect.Type;
-import java.lang.reflect.TypeVariable;
-import java.lang.reflect.WildcardType;
-import java.util.ArrayList;
-import java.util.List;
-import org.eclipse.persistence.jpa.jpql.spi.IType;
-import org.eclipse.persistence.jpa.jpql.spi.ITypeDeclaration;
-import org.eclipse.persistence.jpa.jpql.spi.ITypeRepository;
-
-/**
- * The concrete implementation of {@link ITypeDeclaration} that is wrapping the representation
- * of the declaration description of a type.
- *
- * @see IMapping
- * @see IType
- *
- * @version 2.3
- * @since 2.3
- * @author Pascal Filion
- */
-@SuppressWarnings("nls")
-final class JavaTypeDeclaration implements ITypeDeclaration {
-
- /**
- * Determines whether the type declaration represents an array.
- */
- private boolean array;
-
- /**
- * The actual type that contains the generics, if any is present.
- */
- private Object genericType;
-
- /**
- * The cached {@link ITypeDeclaration ITypeDeclarations} representing the generics of the {@link
- * Type}.
- */
- private ITypeDeclaration[] genericTypes;
-
- /**
- * The external form of the Java type.
- */
- private final IType type;
-
- /**
- * The repository of {@link IType ITypes}.
- */
- private ITypeRepository typeRepository;
-
- /**
- * Creates a new JavaTypeDeclaration
.
- *
- * @param typeRepository The repository of {@link IType ITypes}
- * @param type The external form of the Java type
- * @param genericType The actual type that contains the generics, if any is present
- * @param array Determines whether the type declaration represents an array
- */
- JavaTypeDeclaration(ITypeRepository typeRepository,
- IType type,
- Object genericType,
- boolean array) {
-
- super();
- this.type = type;
- this.array = array;
- this.genericType = genericType;
- this.typeRepository = typeRepository;
- }
-
- private String buildArrayTypeName(String arrayTypeName) {
-
- StringBuilder sb = new StringBuilder();
- int index = arrayTypeName.indexOf('[');
- int dimensionality = (arrayTypeName.length() - index) / 2;
- String typeName = arrayTypeName.substring(0, index);
-
- while (--dimensionality >= 0) {
- sb.append("[");
- }
-
- String elementType = elementType(typeName);
-
- sb.append(elementType);
- sb.append(typeName);
-
- if (elementType.equals("L")) {
- sb.append(";");
- }
-
- return sb.toString();
- }
-
- private ITypeDeclaration[] buildParameterTypes() {
-
- ListJpaConstructor
.
- *
- * @param type The type owning the constructor
- * @param constructor The design-time representation of a Java constructor
- */
- JpaConstructor(JpaType type, IMethodBinding constructor) {
- super();
- this.type = type;
- this.constructor = constructor;
- }
-
- private ITypeDeclaration buildTypeDeclaration(ITypeBinding parameterType) {
-
- boolean array = parameterType.isArray();
- String typeParameterName;
-
- if (array) {
- ITypeBinding componentType = parameterType.getComponentType();
-
- // JpaEmbeddable
.
- *
- * @param provider The provider of JPA managed types
- * @param embeddable The design-time model object wrapped by this class
- */
- JpaEmbeddable(JpaManagedTypeProvider provider, Embeddable embeddable) {
- super(provider, embeddable);
- }
-
- /**
- * {@inheritDoc}
- */
- public void accept(IManagedTypeVisitor visitor) {
- visitor.visit(this);
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- Embeddable getManagedType() {
- return (Embeddable) super.getManagedType();
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- public String toString() {
- return getType().getName();
- }
-}
\ No newline at end of file
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpql/JpaEntity.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpql/JpaEntity.java
deleted file mode 100644
index a3b251f9ed..0000000000
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpql/JpaEntity.java
+++ /dev/null
@@ -1,110 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2011 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0 and Eclipse Distribution License v. 1.0
- * which accompanies this distribution.
- * The Eclipse Public License is available at http://www.eclipse.org/legal/epl-v10.html
- * and the Eclipse Distribution License is available at
- * http://www.eclipse.org/org/documents/edl-v10.php.
- *
- * Contributors:
- * Oracle - initial API and implementation
- *
- ******************************************************************************/
-package org.eclipse.jpt.jpa.core.internal.jpql;
-
-import java.util.HashMap;
-import java.util.Map;
-import org.eclipse.jpt.common.utility.internal.iterables.ListIterable;
-import org.eclipse.jpt.jpa.core.context.Entity;
-import org.eclipse.jpt.jpa.core.context.NamedQuery;
-import org.eclipse.persistence.jpa.jpql.spi.IEntity;
-import org.eclipse.persistence.jpa.jpql.spi.IManagedTypeVisitor;
-import org.eclipse.persistence.jpa.jpql.spi.IQuery;
-
-/**
- * The concrete implementation of {@link IEntity} that is wrapping the design-time representation
- * of a JPA entity.
- *
- * @version 3.1
- * @since 3.0
- * @author Pascal Filion
- */
-final class JpaEntity extends JpaManagedType
- implements IEntity {
-
- /**
- * The cached used to quickly retrieve any queries that have been cached.
- */
- private MapJpaEntity
.
- *
- * @param provider The provider of JPA managed types
- * @param entity The design-time model object wrapped by this class
- */
- JpaEntity(JpaManagedTypeProvider provider, Entity entity) {
- super(provider, entity);
- }
-
- /**
- * {@inheritDoc}
- */
- public void accept(IManagedTypeVisitor visitor) {
- visitor.visit(this);
- }
-
- private IQuery buildQuery(JpaManagedTypeProvider provider, NamedQuery namedQuery) {
- return new JpaQuery(provider, namedQuery);
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- Entity getManagedType() {
- return (Entity) super.getManagedType();
- }
-
- /**
- * {@inheritDoc}
- */
- public String getName() {
- return getManagedType().getName();
- }
-
- /**
- * {@inheritDoc}
- */
- public IQuery getNamedQuery(String queryName) {
- initializeQueries();
- return queries.get(queryName);
- }
-
- private void initializeQueries() {
- if (queries == null) {
- queries = new HashMap
- *
- *
JpaQueryHelper
.
- */
- public JpaJpqlQueryHelper() {
- super();
- }
-
- /**
- * Calculates the start and end positions by adjusting them to be at the same position within
- * jpqlQuery, which may differ from parsedJpqlQuery since the parsed tree does
- * not keep track of multiple whitespace. The range is also increased if the start and end
- * positions are the same.
- *
- * @param problem The {@link JPQLQueryProblem problem} that was found in the JPQL query, which is
- * either a grammatical or semantic problem
- * @param parsedJpqlQuery The string representation of the parsed tree representation of the JPQL
- * query
- * @param actualQuery The actual JPQL query that was parsed and validated
- * @return The start and end positions, which may have been adjusted
- */
- public int[] buildPositions(JPQLQueryProblem problem, String parsedJpqlQuery, String actualQuery) {
-
- int startPosition = problem.getStartPosition();
- int endPosition = problem.getEndPosition();
-
- // If the start and end positions are the same, then expand the text range
- if (startPosition == endPosition) {
- startPosition = Math.max(startPosition - 1, 0);
- }
-
- // Reposition the cursor so it's correctly positioned in the actual query, which is the
- // since it may contains more than one whitespace for a single whitespace
- int newStartPosition = ExpressionTools.repositionCursor(parsedJpqlQuery, startPosition, actualQuery);
-
- if (newStartPosition != startPosition) {
- endPosition += (newStartPosition - startPosition);
- startPosition = newStartPosition;
- }
-
- return new int[] { startPosition, endPosition };
- }
-
- /**
- * Creates a new {@link IMessage} for the given {@link JPQLQueryProblem}.
- *
- * @param namedQuery The model object for which a new {@link IMessage} is creating describing the
- * problem
- * @param problem The {@link JPQLQueryProblem problem} that was found in the JPQL query, which is
- * either a grammatical or semantic problem
- * @param textRange The range of the JPQL query in the Java source file
- * @param parsedJpqlQuery The string representation of the parsed tree representation of the JPQL
- * query, which may differ from the actual JPQL query since it does not keep more than one
- * whitespace
- * @param actualQuery The actual JPQL query that was parsed and validated
- * @param offset This offset is used to move the start position
- * @return A new {@link IMessage} that has the required information to display the problem
- * underline and the error message in the Problems view
- */
- private IMessage buildProblem(NamedQuery namedQuery,
- TextRange textRange,
- JPQLQueryProblem problem,
- String parsedJpqlQuery,
- String actualQuery,
- int offset) {
-
- // Convert the positions from the parsed JPQL query to the actual JPQL query
- int[] positions = buildPositions(problem, parsedJpqlQuery, actualQuery);
-
- // Now convert the adjusted positions once again to be in the query where the escape
- // characters are in their literal forms
- int[] newStartPosition = { positions[0] };
- ExpressionTools.escape(actualQuery, newStartPosition);
- int escapeOffset = positions[0] - newStartPosition[0];
-
- positions[0] -= escapeOffset;
- positions[1] -= escapeOffset;
-
- // Create the text range of the problem
- textRange = new SimpleTextRange(
- textRange.getOffset() + positions[0] + offset,
- positions[1] - positions[0],
- textRange.getLineNumber()
- );
-
- // Now create the message
- IMessage message = DefaultJpaValidationMessages.buildMessage(
- severity(namedQuery),
- problem.getMessageKey(),
- problem.getMessageArguments(),
- namedQuery,
- textRange
- );
- message.setBundleName("jpa_jpql_validation");
- return message;
- }
-
- private JpaManagedTypeProvider buildProvider(NamedQuery query) {
- return new JpaManagedTypeProvider(query.getJpaProject(), query.getPersistenceUnit());
- }
-
- /**
- * Disposes the provider so the application metadata is not kept in memory.
- */
- public void disposeProvider() {
- managedTypeProvider = null;
- }
-
- /**
- * Sets the given named query and string representation of the JPQL query.
- *
- * @param namedQuery The model object where the JPQL query is stored
- * @param actualQuery The actual JPQL query, which can differ from the one owned by the model
- * object, which happens when the model is out of sync because it has not been updated yet
- */
- public void setQuery(NamedQuery namedQuery, String actualQuery) {
-
- if (managedTypeProvider == null) {
- managedTypeProvider = buildProvider(namedQuery);
- }
-
- IQuery query = new JpaQuery(managedTypeProvider, namedQuery, actualQuery);
- super.setQuery(query);
- }
-
- /**
- * Retrieve the severity that is associated to JPQL query validation, which cannot be retrieved
- * using the JPQL problem message key.
-
- * @param targetObject The object for which a new {@link IMessage} is creating describing the
- * problem
- * @return The global severity for validating JPQL queries
- */
- private int severity(Object targetObject) {
- return JpaValidationPreferences.getProblemSeverityPreference(
- targetObject,
- JpaValidationMessages.JPQL_QUERY_VALIDATION
- );
- }
-
- private boolean shouldValidate(NamedQuery namedQuery) {
- return JpaValidationPreferences.getProblemSeverityPreference(
- namedQuery,
- JpaValidationMessages.JPQL_QUERY_VALIDATION
- ) == -1;
- }
-
- /**
- * Validates the given {@link NamedQuery} by validating the JPQL query.
- *
- * @param namedQuery The JPQL query to validate
- * @param jpqlQuery The JPQL query, which might be different from what the model object since
- * the escape characters should not be in their literal forms (should have '\r' and not '\\r')
- * @param textRange The range of the JPQL query string within the document
- * @param offset This offset is used to move the start position
- * @param messages The list of {@link IMessage IMessages} that will be used to add validation
- * problems
- */
- public void validate(NamedQuery namedQuery,
- String jpqlQuery,
- TextRange textRange,
- int offset,
- ListJDeveloperManagedType
.
- *
- * @param managedType The provider of JPA managed types
- * @param mappedClass The design-time model object wrapped by this class
- */
- JpaManagedType(JpaManagedTypeProvider provider, TypeMapping managedType) {
- super();
- this.provider = provider;
- this.managedType = managedType;
- }
-
- private IMapping buildMapping(AttributeMapping mapping) {
- return new JpaMapping(this, mapping);
- }
-
- private MapJpaManagedTypeProvider
.
- *
- * @param jpaProject The project that gives access to the application's metadata
- * @param persistentTypeContainer The design-time provider of managed types
- */
- public JpaManagedTypeProvider(JpaProject jpaProject,
- PersistentTypeContainer persistentTypeContainer) {
-
- super();
- this.jpaProject = jpaProject;
- this.persistentTypeContainer = persistentTypeContainer;
- }
-
- /**
- * {@inheritDoc}
- */
- public IterableEntityCollector
.
- */
- EntityCollector() {
- super();
- entities = new ArrayListJpaMappedSuperclass
.
- *
- * @param provider The provider of JPA managed types
- * @param mappedSuperclass The design-time model object wrapped by this class
- */
- JpaMappedSuperclass(JpaManagedTypeProvider provider, MappedSuperclass mappedSuperclass) {
- super(provider, mappedSuperclass);
- }
-
- /**
- * {@inheritDoc}
- */
- public void accept(IManagedTypeVisitor visitor) {
- visitor.visit(this);
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- MappedSuperclass getManagedType() {
- return (MappedSuperclass) super.getManagedType();
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- public String toString() {
- return getType().getName();
- }
-}
\ No newline at end of file
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpql/JpaMapping.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpql/JpaMapping.java
deleted file mode 100644
index 8152bbdf67..0000000000
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpql/JpaMapping.java
+++ /dev/null
@@ -1,269 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2011 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0 and Eclipse Distribution License v. 1.0
- * which accompanies this distribution.
- * The Eclipse Public License is available at http://www.eclipse.org/legal/epl-v10.html
- * and the Eclipse Distribution License is available at
- * http://www.eclipse.org/org/documents/edl-v10.php.
- *
- * Contributors:
- * Oracle - initial API and implementation
- *
- ******************************************************************************/
-package org.eclipse.jpt.jpa.core.internal.jpql;
-
-import java.lang.annotation.Annotation;
-import java.util.List;
-import org.eclipse.jpt.common.core.resource.java.JavaResourceAttribute;
-import org.eclipse.jpt.common.utility.internal.CollectionTools;
-import org.eclipse.jpt.common.utility.internal.StringTools;
-import org.eclipse.jpt.common.utility.internal.iterables.TransformationIterable;
-import org.eclipse.jpt.jpa.core.MappingKeys;
-import org.eclipse.jpt.jpa.core.context.AttributeMapping;
-import org.eclipse.jpt.jpa.core.context.PersistentAttribute;
-import org.eclipse.jpt.jpa.core.context.java.JavaPersistentAttribute;
-import org.eclipse.jpt.jpa.core.jpa2.MappingKeys2_0;
-import org.eclipse.persistence.jpa.jpql.spi.IManagedType;
-import org.eclipse.persistence.jpa.jpql.spi.IMapping;
-import org.eclipse.persistence.jpa.jpql.spi.IMappingType;
-import org.eclipse.persistence.jpa.jpql.spi.IType;
-import org.eclipse.persistence.jpa.jpql.spi.ITypeDeclaration;
-
-/**
- * The concrete implementation of {@link IMapping} that is wrapping the design-time representation
- * of a mapping.
- *
- * @version 3.0
- * @since 3.0
- * @author Pascal Filion
- */
-@SuppressWarnings("nls")
-final class JpaMapping implements IMapping {
-
- /**
- * The design-time {@link AttributeMapping} wrapped by this class.
- */
- private final AttributeMapping mapping;
-
- /**
- * The type of the actual mapping.
- */
- private IMappingType mappingType;
-
- /**
- * The parent of this mapping.
- */
- private final JpaManagedType parent;
-
- /**
- * The {@link IType} of the property represented by the mapping.
- */
- private IType type;
-
- /**
- * The {@link ITypeDeclaration} of the property represented by the mapping.
- */
- private ITypeDeclaration typeDeclaration;
-
- /**
- * Creates a new JpaMapping
.
- *
- * @param parent The parent of this mapping
- * @param mapping The design-time {@link AttributeMapping} wrapped by this class
- */
- JpaMapping(JpaManagedType parent, AttributeMapping mapping) {
- super();
- this.parent = parent;
- this.mapping = mapping;
- }
-
- private ITypeDeclaration[] buildGenericTypeDeclarations() {
- JavaPersistentAttribute javaPersistentAttribute = mapping.getPersistentAttribute().getJavaPersistentAttribute();
- JavaResourceAttribute resource = javaPersistentAttribute.getResourceAttribute();
- ListJpaNullManagedType
.
- *
- * @param managedType The provider of JPA managed types
- * @param typeMapping The design-time model object wrapped by this class
- */
- JpaNullManagedType(JpaManagedTypeProvider provider, TypeMapping typeMapping) {
- super();
- this.provider = provider;
- this.typeMapping = typeMapping;
- }
-
- /**
- * {@inheritDoc}
- */
- public void accept(IManagedTypeVisitor visitor) {
- }
-
- /**
- * {@inheritDoc}
- */
- public int compareTo(IManagedType managedType) {
- return getType().getName().compareTo(managedType.getType().getName());
- }
-
- /**
- * {@inheritDoc}
- */
- public IMapping getMappingNamed(String name) {
- return null;
- }
-
- /**
- * {@inheritDoc}
- */
- public IManagedTypeProvider getProvider() {
- return provider;
- }
-
- /**
- * {@inheritDoc}
- */
- public IType getType() {
- if (type == null) {
- type = provider.getTypeRepository().getType(typeMapping.getPersistentType().getName());
- }
- return type;
- }
-
- /**
- * {@inheritDoc}
- */
- public IterableJpaPersistenceUnit
.
- *
- * @param jpaProject The project that gives access to the application's metadata
- * @param persistentUnit The design-time persistence unit
- */
- public JpaPersistenceUnit(JpaProject jpaProject, PersistenceUnit persistentUnit) {
- super(jpaProject, persistentUnit);
- }
-
-}
\ No newline at end of file
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpql/JpaQuery.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpql/JpaQuery.java
deleted file mode 100644
index 33ffb130ed..0000000000
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpql/JpaQuery.java
+++ /dev/null
@@ -1,115 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2011 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0 and Eclipse Distribution License v. 1.0
- * which accompanies this distribution.
- * The Eclipse Public License is available at http://www.eclipse.org/legal/epl-v10.html
- * and the Eclipse Distribution License is available at
- * http://www.eclipse.org/org/documents/edl-v10.php.
- *
- * Contributors:
- * Oracle - initial API and implementation
- *
- ******************************************************************************/
-package org.eclipse.jpt.jpa.core.internal.jpql;
-
-import org.eclipse.jpt.common.utility.internal.StringTools;
-import org.eclipse.jpt.jpa.core.context.NamedQuery;
-import org.eclipse.persistence.jpa.jpql.spi.IQuery;
-
-/**
- * The concrete implementation of {@link IQuery} that is wrapping the design-time representation
- * of a JPQL query.
- *
- * @version 3.1
- * @since 3.0
- * @author Pascal Filion
- */
-@SuppressWarnings("nls")
-public final class JpaQuery implements IQuery {
-
- /**
- * The actual JPQL query, which can differ from the one owned by the model object, which happens
- * when the model is out of sync because it has not been updated yet.
- */
- private String actualQuery;
-
- /**
- * The provider of managed types.
- */
- private JpaManagedTypeProvider provider;
-
- /**
- * The model object holding onto the JPQL query.
- */
- private NamedQuery query;
-
- /**
- * Creates a new JpaQuery
.
- *
- * @param provider The provider of managed types
- * @param query The model object of the JPQL query
- */
- public JpaQuery(JpaManagedTypeProvider provider, NamedQuery query) {
- this(provider, query, query.getQuery());
- }
-
- /**
- * Creates a new JpaQuery
.
- *
- * @param provider The provider of managed types
- * @param query The model object of the JPQL query
- * @param actualQuery The actual JPQL query, which can differ from the one owned by the model
- * object, which happens when the model is out of sync because it has not been updated yet
- */
- JpaQuery(JpaManagedTypeProvider provider, NamedQuery query, String actualQuery) {
- super();
- initialize(provider, query, actualQuery);
- }
-
- /**
- * {@inheritDoc}
- */
- public String getExpression() {
- return actualQuery;
- }
-
- /**
- * {@inheritDoc}
- */
- public JpaManagedTypeProvider getProvider() {
- return provider;
- }
-
- /**
- * Returns the encapsulated {@link NamedQuery}, which is the actual object.
- *
- * @return The design-time representation of a JPQL query
- */
- NamedQuery getQuery() {
- return query;
- }
-
- private void initialize(JpaManagedTypeProvider provider, NamedQuery query, String actualQuery) {
-
- this.query = query;
- this.provider = provider;
- this.actualQuery = actualQuery;
-
- if (this.actualQuery == null) {
- this.actualQuery = StringTools.EMPTY_STRING;
- }
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- public String toString() {
- StringBuilder sb = new StringBuilder();
- sb.append(super.toString());
- sb.append(", query=");
- sb.append(getExpression());
- return sb.toString();
- }
-}
\ No newline at end of file
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpql/JpaType.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpql/JpaType.java
deleted file mode 100644
index 3e12d029c6..0000000000
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpql/JpaType.java
+++ /dev/null
@@ -1,430 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2011 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0 and Eclipse Distribution License v. 1.0
- * which accompanies this distribution.
- * The Eclipse Public License is available at http://www.eclipse.org/legal/epl-v10.html
- * and the Eclipse Distribution License is available at
- * http://www.eclipse.org/org/documents/edl-v10.php.
- *
- * Contributors:
- * Oracle - initial API and implementation
- *
- ******************************************************************************/
-package org.eclipse.jpt.jpa.core.internal.jpql;
-
-import java.lang.annotation.Annotation;
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.Collections;
-import java.util.List;
-import org.eclipse.core.runtime.NullProgressMonitor;
-import org.eclipse.jdt.core.Flags;
-import org.eclipse.jdt.core.IField;
-import org.eclipse.jdt.core.IJavaElement;
-import org.eclipse.jdt.core.IMember;
-import org.eclipse.jdt.core.IMethod;
-import org.eclipse.jdt.core.IType;
-import org.eclipse.jdt.core.ITypeHierarchy;
-import org.eclipse.jdt.core.dom.AST;
-import org.eclipse.jdt.core.dom.ASTNode;
-import org.eclipse.jdt.core.dom.ASTParser;
-import org.eclipse.jdt.core.dom.AbstractTypeDeclaration;
-import org.eclipse.jdt.core.dom.AnonymousClassDeclaration;
-import org.eclipse.jdt.core.dom.ClassInstanceCreation;
-import org.eclipse.jdt.core.dom.CompilationUnit;
-import org.eclipse.jdt.core.dom.EnumConstantDeclaration;
-import org.eclipse.jdt.core.dom.IMethodBinding;
-import org.eclipse.jdt.core.dom.ITypeBinding;
-import org.eclipse.jdt.core.dom.NodeFinder;
-import org.eclipse.jpt.common.core.internal.utility.jdt.ASTTools;
-import org.eclipse.jpt.common.utility.internal.StringTools;
-import org.eclipse.jpt.jpa.core.JptJpaCorePlugin;
-import org.eclipse.persistence.jpa.jpql.ExpressionTools;
-import org.eclipse.persistence.jpa.jpql.spi.IConstructor;
-import org.eclipse.persistence.jpa.jpql.spi.ITypeDeclaration;
-
-/**
- * The concrete implementation of {@link org.eclipse.persistence.jpa.query.spi.IType IType} that is
- * wrapping the design-time representation of a Java type.
- *
- * @version 3.0
- * @since 3.0
- * @author Pascal Filion
- */
-final class JpaType implements IJpaType {
-
- /**
- * The cached collection of {@link IConstructor constructors}.
- */
- private CollectionJpaType
.
- *
- * @param typeRepository The external form of a type repository
- * @param type The design-time representation of a Java type
- */
- JpaType(JpaTypeRepository typeRepository, IType type) {
- super();
- this.type = type;
- this.typeName = type.getFullyQualifiedName();
- this.typeRepository = typeRepository;
- }
-
- private CompilationUnit buildCompilationUnit() {
-
- ASTParser parser = ASTParser.newParser(AST.JLS3);
- parser.setSource(type.getTypeRoot());
- parser.setIgnoreMethodBodies(true);
- parser.setResolveBindings(true);
- parser.setBindingsRecovery(true);
-
- return (CompilationUnit) parser.createAST(new NullProgressMonitor());
- }
-
- private CollectionJpaTypeDeclaration
.
- *
- * @param type The external form of the Java type
- * @param genericTypes The generics of the given type or an empty list if the type is not
- * parameterized
- */
- JpaTypeDeclaration(IType type, ITypeDeclaration[] genericTypes) {
- this(type, genericTypes, 0);
- }
-
- /**
- * Creates a new JpaTypeDeclaration
.
- *
- * @param type The external form of the Java type
- * @param genericTypes The generics of the given type or an empty list if the type is not
- * parameterized
- * @param dimensionality The dimensionality of the array or 0 if it's not an array
- */
- JpaTypeDeclaration(IType type, ITypeDeclaration[] genericTypes, int dimensionality) {
- super();
- this.type = type;
- this.genericTypes = genericTypes;
- this.dimensionality = dimensionality;
- }
-
- /**
- * {@inheritDoc}
- */
- public int getDimensionality() {
- return dimensionality;
- }
-
- /**
- * {@inheritDoc}
- */
- public IType getType() {
- return type;
- }
-
- /**
- * {@inheritDoc}
- */
- public ITypeDeclaration[] getTypeParameters() {
- return genericTypes;
- }
-
- /**
- * {@inheritDoc}
- */
- public boolean isArray() {
- return dimensionality > 0;
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- public String toString() {
- return type.getName();
- }
-}
\ No newline at end of file
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpql/JpaTypeRepository.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpql/JpaTypeRepository.java
deleted file mode 100644
index ece1dbd131..0000000000
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpql/JpaTypeRepository.java
+++ /dev/null
@@ -1,404 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2011 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0 and Eclipse Distribution License v. 1.0
- * which accompanies this distribution.
- * The Eclipse Public License is available at http://www.eclipse.org/legal/epl-v10.html
- * and the Eclipse Distribution License is available at
- * http://www.eclipse.org/org/documents/edl-v10.php.
- *
- * Contributors:
- * Oracle - initial API and implementation
- *
- ******************************************************************************/
-package org.eclipse.jpt.jpa.core.internal.jpql;
-
-import java.util.HashMap;
-import java.util.Map;
-import org.eclipse.core.resources.IResource;
-import org.eclipse.core.runtime.IPath;
-import org.eclipse.jdt.core.IJavaProject;
-import org.eclipse.jdt.core.IType;
-import org.eclipse.jdt.core.JavaModelException;
-import org.eclipse.persistence.jpa.jpql.TypeHelper;
-import org.eclipse.persistence.jpa.jpql.spi.ITypeDeclaration;
-import org.eclipse.persistence.jpa.jpql.spi.ITypeRepository;
-
-/**
- * The concrete implementation of {@link ITypeRepository} that is wrapping the design-time
- * representation of a type repository.
- *
- * @version 3.0
- * @since 3.0
- * @author Pascal Filion
- */
-@SuppressWarnings("nls")
-final class JpaTypeRepository implements ITypeRepository {
-
- /**
- * The Java project that gives access the design-time objects representing the Java types.
- */
- private final IJavaProject javaProject;
-
- /**
- * Keeps a map of the primitives for fast access.
- */
- private MapJpaTypeRepository
.
- *
- * @param javaProject The Java project that gives access the design-time objects representing
- * the Java types
- */
- JpaTypeRepository(IJavaProject javaProject) {
- super();
- this.javaProject = javaProject;
- this.types = new HashMapnull
otherwise
- */
- IType findType(String typeName) {
- try {
- return javaProject.findType(typeName);
- }
- catch (JavaModelException e) {
- return null;
- }
- }
-
- /**
- * {@inheritDoc}
- */
- public IJpaType getEnumType(String enumTypeName) {
-
- // Get the position of the last dot so the enum constant can be removed
- int lastDotIndex = enumTypeName.lastIndexOf(".");
-
- if (lastDotIndex == -1) {
- return null;
- }
-
- // Retrieve the fully qualified enum type name
- String typeName = enumTypeName.substring(0, lastDotIndex);
-
- // Attempt to load the enum type
- IType type = findType(typeName);
- IJpaType jpaType;
-
- if (type != null) {
- jpaType = buildType(type);
- }
- else {
- jpaType = loadInnerType(typeName);
- }
-
- return (jpaType != null) && jpaType.isEnum() ? jpaType : null;
- }
-
- /**
- * Returns the Java project, which gives access to the class path.
- *
- * @return The Java project, which gives access to the class path
- */
- IJavaProject getJavaProject() {
- return javaProject;
- }
-
- /**
- * {@inheritDoc}
- */
- public IJpaType getType(Class> javaClass) {
- IJpaType type = types.get(javaClass.getName());
- if (type == null) {
- type = buildType(javaClass);
- }
- return type;
- }
-
- /**
- * Retrieves the {@link IType} for the given {@link IResource}.
- *
- * @param resource The workspace location of the {@link IType} to retrieve
- * @return The design-time representation of a Java type
- */
- IType getType(IResource resource) {
- try {
- return (IType) javaProject.findElement((IPath) resource);
- }
- catch (Exception e) {
- return null;
- }
- }
-
- /**
- * {@inheritDoc}
- */
- public IJpaType getType(String typeName) {
-
- if (IJpaType.UNRESOLVABLE_TYPE == typeName) {
- return unresolvableType();
- }
-
- if (typeName.endsWith("[]")) {
- return loadArrayType(typeName);
- }
-
- if (typeName.charAt(0) == '[') {
- return loadJavaArrayType(typeName);
- }
-
- return loadTypeImp(typeName);
- }
-
- /**
- * {@inheritDoc}
- */
- public TypeHelper getTypeHelper() {
- if (typeHelper == null) {
- typeHelper = new TypeHelper(this);
- }
- return typeHelper;
- }
-
- private IJpaType loadArrayType(String typeName) {
-
- IJpaType type = types.get(typeName);
-
- if (type == null) {
- try {
- // Try to see if the type is a JDK class, otherwise, just use the type name
- // since IJpaType doesn't support array types
- String javaTypeName = convertToJavaArrayType(typeName);
- type = buildType(Class.forName(javaTypeName));
- }
- catch (Exception e) {
-
- int index = typeName.indexOf("[]");
- int dimensionality = (typeName.length() - index) / 2;
-
- type = getType(typeName.substring(0, index));
-
- type.setTypeDeclaration(
- new JpaTypeDeclaration(type, new ITypeDeclaration[0], dimensionality)
- );
- }
-
- types.put(typeName, type);
- }
-
- return type;
- }
-
- private IJpaType loadInnerType(String typeName) {
-
- while (true) {
-
- int index = typeName.lastIndexOf(".");
-
- if (index == -1) {
- return null;
- }
-
- typeName = buildInnerTypeName(typeName, index);
- IJpaType cachedType = types.get(typeName);
-
- if (cachedType != null) {
- return cachedType;
- }
-
- // Attempt to load the Java type
- IType type = findType(typeName);
-
- // A Java type exists, return it
- if (type != null) {
- return buildType(type);
- }
- }
- }
-
- private IJpaType loadJavaArrayType(String typeName) {
-
- IJpaType type = types.get(typeName);
-
- if (type == null) {
- try {
- // Try to see if the type is a JDK class, otherwise, just use the type name
- // since IJpaType doesn't support array types
- type = buildType(Class.forName(typeName));
- }
- catch (Exception e) {
-
- int index = typeName.lastIndexOf("[");
- int dimensionality = index / 2;
-
- type = getType(typeName.substring(index, typeName.endsWith(";") ? typeName.length() - 1 : typeName.length()));
-
- type.setTypeDeclaration(
- new JpaTypeDeclaration(type, new ITypeDeclaration[0], dimensionality)
- );
- }
-
- types.put(typeName, type);
- }
-
- return type;
- }
-
- private IJpaType loadTypeImp(String typeName) {
-
- IJpaType type = types.get(typeName);
-
- // The type was already cached, simply return it
- if (type != null) {
- return type;
- }
-
- // First check for primitive, they don't have a corresponding IJpaType
- Class> primitive = findPrimitive(typeName);
-
- if (primitive != null) {
- return buildType(primitive);
- }
-
- // Attempt to load the Java type
- IType iType = findType(typeName);
-
- // A Java type exists, return it
- if (iType != null) {
- return buildType(iType);
- }
-
- // Now try with a possible inner enum type
- type = loadInnerType(typeName);
-
- // No Java type exists, create a "null" IJpaType
- if (type == null) {
- type = buildType(typeName);
- }
-
- return type;
- }
-
- private IJpaType unresolvableType() {
- if (unresolvableType == null) {
- unresolvableType = new SimpleType(this, IJpaType.UNRESOLVABLE_TYPE);
- }
- return unresolvableType;
- }
-}
\ No newline at end of file
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpql/SimpleType.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpql/SimpleType.java
deleted file mode 100644
index b30248266e..0000000000
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpql/SimpleType.java
+++ /dev/null
@@ -1,138 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2011 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0 and Eclipse Distribution License v. 1.0
- * which accompanies this distribution.
- * The Eclipse Public License is available at http://www.eclipse.org/legal/epl-v10.html
- * and the Eclipse Distribution License is available at
- * http://www.eclipse.org/org/documents/edl-v10.php.
- *
- * Contributors:
- * Oracle - initial API and implementation
- *
- ******************************************************************************/
-package org.eclipse.jpt.jpa.core.internal.jpql;
-
-import java.lang.annotation.Annotation;
-import org.eclipse.jpt.common.utility.internal.StringTools;
-import org.eclipse.jpt.common.utility.internal.iterables.EmptyIterable;
-import org.eclipse.persistence.jpa.jpql.spi.IConstructor;
-import org.eclipse.persistence.jpa.jpql.spi.IType;
-import org.eclipse.persistence.jpa.jpql.spi.ITypeDeclaration;
-
-/**
- * The concrete implementation of {@link IType} that is wrapping the type name only.
- *
- * @version 3.0
- * @since 3.0
- * @author Pascal Filion
- */
-final class SimpleType implements IJpaType {
-
- /**
- * Caches the type hierarchy of the {@link IType} in order to prevent rebuilding it each time.
- */
- private ITypeDeclaration typeDeclaration;
-
- /**
- * The fully qualified name of the Java type.
- */
- private final String typeName;
-
- /**
- * The external form of a type repository.
- */
- private final JpaTypeRepository typeRepository;
-
- /**
- * Creates a new SimpleType
.
- *
- * @param typeName The fully qualified name of the Java type
- */
- SimpleType(JpaTypeRepository typeRepository, String typeName) {
- super();
- this.typeRepository = typeRepository;
- this.typeName = typeName;
- }
-
- /**
- * {@inheritDoc}
- */
- public Iterable
+ *
+ *
JpaQueryHelper
.
+ *
+ * @param jpqlGrammar The grammar that defines how to parse a JPQL query
+ */
+ protected JpaJpqlQueryHelper(JPQLGrammar jpqlGrammar) {
+ super(jpqlGrammar);
+ }
+
+ /**
+ * Calculates the start and end positions by adjusting them to be at the same position within
+ * jpqlQuery, which may differ from parsedJpqlQuery since the parsed tree does
+ * not keep track of multiple whitespace. The range is also increased if the start and end
+ * positions are the same.
+ *
+ * @param problem The {@link JPQLQueryProblem problem} that was found in the JPQL query, which is
+ * either a grammatical or semantic problem
+ * @param parsedJpqlQuery The string representation of the parsed tree representation of the JPQL
+ * query
+ * @param actualQuery The actual JPQL query that was parsed and validated
+ * @return The start and end positions, which may have been adjusted
+ */
+ public int[] buildPositions(JPQLQueryProblem problem, String parsedJpqlQuery, String actualQuery) {
+
+ int startPosition = problem.getStartPosition();
+ int endPosition = problem.getEndPosition();
+
+ // If the start and end positions are the same, then expand the text range
+ if (startPosition == endPosition) {
+ startPosition = Math.max(startPosition - 1, 0);
+ }
+
+ // Reposition the cursor so it's correctly positioned in the actual query, which is the
+ // since it may contains more than one whitespace for a single whitespace
+ int newStartPosition = ExpressionTools.repositionCursor(parsedJpqlQuery, startPosition, actualQuery);
+
+ if (newStartPosition != startPosition) {
+ endPosition += (newStartPosition - startPosition);
+ startPosition = newStartPosition;
+ }
+
+ return new int[] { startPosition, endPosition };
+ }
+
+ /**
+ * Creates a new {@link IMessage} for the given {@link JPQLQueryProblem}.
+ *
+ * @param namedQuery The model object for which a new {@link IMessage} is creating describing the
+ * problem
+ * @param problem The {@link JPQLQueryProblem problem} that was found in the JPQL query, which is
+ * either a grammatical or semantic problem
+ * @param textRange The range of the JPQL query in the Java source file
+ * @param parsedJpqlQuery The string representation of the parsed tree representation of the JPQL
+ * query, which may differ from the actual JPQL query since it does not keep more than one
+ * whitespace
+ * @param actualQuery The actual JPQL query that was parsed and validated
+ * @param offset This offset is used to move the start position
+ * @return A new {@link IMessage} that has the required information to display the problem
+ * underline and the error message in the Problems view
+ */
+ protected IMessage buildProblem(NamedQuery namedQuery,
+ TextRange textRange,
+ JPQLQueryProblem problem,
+ String parsedJpqlQuery,
+ String actualQuery,
+ int offset) {
+
+ // Convert the positions from the parsed JPQL query to the actual JPQL query
+ int[] positions = buildPositions(problem, parsedJpqlQuery, actualQuery);
+
+ // Now convert the adjusted positions once again to be in the query where the escape
+ // characters are in their literal forms
+ int[] newStartPosition = { positions[0] };
+ ExpressionTools.escape(actualQuery, newStartPosition);
+ int escapeOffset = positions[0] - newStartPosition[0];
+
+ positions[0] -= escapeOffset;
+ positions[1] -= escapeOffset;
+
+ // Create the text range of the problem
+ textRange = new SimpleTextRange(
+ textRange.getOffset() + positions[0] + offset,
+ positions[1] - positions[0],
+ textRange.getLineNumber()
+ );
+
+ // Now create the message
+ IMessage message = DefaultJpaValidationMessages.buildMessage(
+ severity(namedQuery),
+ problem.getMessageKey(),
+ problem.getMessageArguments(),
+ namedQuery,
+ textRange
+ );
+ message.setBundleName("jpa_jpql_validation");
+ return message;
+ }
+
+ /**
+ * Creates
+ *
+ * @param query
+ * @return
+ */
+ public abstract JpaManagedTypeProvider buildProvider(NamedQuery query);
+
+ /**
+ * Disposes the provider so the application metadata is not kept in memory.
+ */
+ public void disposeProvider() {
+ managedTypeProvider = null;
+ }
+
+ /**
+ * Sets the given named query and string representation of the JPQL query.
+ *
+ * @param namedQuery The model object where the JPQL query is stored
+ * @param actualQuery The actual JPQL query, which can differ from the one owned by the model
+ * object, which happens when the model is out of sync because it has not been updated yet
+ */
+ public void setQuery(NamedQuery namedQuery, String actualQuery) {
+
+ if (managedTypeProvider == null) {
+ managedTypeProvider = buildProvider(namedQuery);
+ }
+
+ IQuery query = new JpaQuery(managedTypeProvider, namedQuery, actualQuery);
+ super.setQuery(query);
+ }
+
+ /**
+ * Retrieve the severity that is associated to JPQL query validation, which cannot be retrieved
+ * using the JPQL problem message key.
+
+ * @param targetObject The object for which a new {@link IMessage} is creating describing the
+ * problem
+ * @return The global severity for validating JPQL queries
+ */
+ protected int severity(Object targetObject) {
+ return JpaValidationPreferences.getProblemSeverityPreference(
+ targetObject,
+ JpaValidationMessages.JPQL_QUERY_VALIDATION
+ );
+ }
+
+ protected boolean shouldValidate(NamedQuery namedQuery) {
+ return JpaValidationPreferences.getProblemSeverityPreference(
+ namedQuery,
+ JpaValidationMessages.JPQL_QUERY_VALIDATION
+ ) == -1;
+ }
+
+ /**
+ * Validates the given {@link NamedQuery} by validating the JPQL query.
+ *
+ * @param namedQuery The JPQL query to validate
+ * @param jpqlQuery The JPQL query, which might be different from what the model object since
+ * the escape characters should not be in their literal forms (should have '\r' and not '\\r')
+ * @param textRange The range of the JPQL query string within the document
+ * @param offset This offset is used to move the start position
+ * @param messages The list of {@link IMessage IMessages} that will be used to add validation
+ * problems
+ */
+ public void validate(NamedQuery namedQuery,
+ String jpqlQuery,
+ TextRange textRange,
+ int offset,
+ ListClassConstructor
.
+ *
+ * @param type The declaring type of this constructor
+ * @param methodInfo The information of the constructor
+ */
+ public ClassConstructor(JpaType type, IMethod method) {
+ super();
+ this.type = type;
+ this.method = method;
+ }
+
+ protected ITypeDeclaration[] buildParameterTypes() {
+
+ BindingKey bindingKey = new BindingKey(method.getKey());
+ String signature = bindingKey.toSignature();
+
+ int count = Signature.getParameterCount(signature);
+ ITypeDeclaration[] typeDeclarations = new ITypeDeclaration[count];
+ int index = 0;
+
+ for (String parameterType : Signature.getParameterTypes(signature)) {
+
+ // 1. Retrieve the parameter type (without the type parameters)
+ String parameterTypeName = Signature.getTypeErasure(parameterType);
+
+ // 3. Convert the type signature to a dot-based name
+ parameterTypeName = Signature.toString(parameterTypeName);
+
+ // 4. Create the ITypeDeclaration
+ typeDeclarations[index++] = new JpaTypeDeclaration(
+ getTypeRepository().getType(parameterTypeName),
+ buildTypeParameters(parameterType),
+ Signature.getArrayCount(parameterType)
+ );
+ }
+
+ return typeDeclarations;
+ }
+
+ protected ITypeDeclaration[] buildTypeParameters(String signature) {
+
+ String[] typeParameters = Signature.getTypeArguments(signature);
+ ITypeDeclaration[] generics = new ITypeDeclaration[typeParameters.length];
+
+ for (int index = 0; index < typeParameters.length; index++) {
+ String typeParameter = typeParameters[index];
+
+ // 1. Retrieve the parameter type (without the wild cards)
+ switch (Signature.getTypeSignatureKind(typeParameter)) {
+ case Signature.WILDCARD_TYPE_SIGNATURE: {
+ typeParameter = typeParameter.substring(1);
+ }
+ }
+
+ if (typeParameter.length() == 0) {
+ generics[index] = getTypeRepository().getTypeHelper().objectTypeDeclaration();
+ }
+ else {
+ String typeParameterName = Signature.getTypeErasure(typeParameter);
+
+ // 3. Convert the type signature to a dot-based name
+ typeParameterName = Signature.toString(typeParameterName);
+
+ // 3. Retrieve the IType for the type parameter
+ IType genericType = getTypeRepository().getType(typeParameterName);
+
+ if (genericType.isResolvable()) {
+ generics[index] = genericType.getTypeDeclaration();
+ }
+ else {
+ generics[index] = getTypeRepository().getTypeHelper().objectTypeDeclaration();
+ }
+ }
+ }
+
+ return generics;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public ITypeDeclaration[] getParameterTypes() {
+ if (typeDeclarations == null) {
+ typeDeclarations = buildParameterTypes();
+ }
+ return typeDeclarations;
+ }
+
+ protected ITypeRepository getTypeRepository() {
+ return type.getTypeRepository();
+ }
+}
\ No newline at end of file
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/jpql/spi/GenericJpaMapping.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/jpql/spi/GenericJpaMapping.java
new file mode 100644
index 0000000000..fc9cde27aa
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/jpql/spi/GenericJpaMapping.java
@@ -0,0 +1,42 @@
+/*******************************************************************************
+ * Copyright (c) 2011 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 and Eclipse Distribution License v. 1.0
+ * which accompanies this distribution.
+ * The Eclipse Public License is available at http://www.eclipse.org/legal/epl-v10.html
+ * and the Eclipse Distribution License is available at
+ * http://www.eclipse.org/org/documents/edl-v10.php.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ *
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.jpql.spi;
+
+import org.eclipse.jpt.jpa.core.context.AttributeMapping;
+import org.eclipse.persistence.jpa.jpql.spi.IManagedType;
+
+/**
+ * A default implementation of Hermes' {@link IMapping}.
+ *
+ * Provisional API: This interface is part of an interim API that is still under development and
+ * expected to change significantly before reaching stability. It is available at this early stage
+ * to solicit feedback from pioneering adopters on the understanding that any code that uses this
+ * API will almost certainly be broken (repeatedly) as the API evolves.
+ *
+ * @version 3.1
+ * @since 3.1
+ * @author Pascal Filion
+ */
+public class GenericJpaMapping extends JpaMapping {
+
+ /**
+ * Creates a new GenericJpaMapping
.
+ *
+ * @param parent The parent of this mapping
+ * @param mapping The design-time {@link AttributeMapping} wrapped by this class
+ */
+ public GenericJpaMapping(IManagedType parent, AttributeMapping mapping) {
+ super(parent, mapping);
+ }
+}
\ No newline at end of file
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/jpql/spi/GenericMappingBuilder.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/jpql/spi/GenericMappingBuilder.java
new file mode 100644
index 0000000000..c86f76e740
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/jpql/spi/GenericMappingBuilder.java
@@ -0,0 +1,48 @@
+/*******************************************************************************
+ * Copyright (c) 2011 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 and Eclipse Distribution License v. 1.0
+ * which accompanies this distribution.
+ * The Eclipse Public License is available at http://www.eclipse.org/legal/epl-v10.html
+ * and the Eclipse Distribution License is available at
+ * http://www.eclipse.org/org/documents/edl-v10.php.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ *
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.jpql.spi;
+
+import org.eclipse.jpt.jpa.core.context.AttributeMapping;
+import org.eclipse.persistence.jpa.jpql.spi.IManagedType;
+import org.eclipse.persistence.jpa.jpql.spi.IMapping;
+import org.eclipse.persistence.jpa.jpql.spi.IMappingBuilder;
+
+/**
+ * The default implementation of {@link IMappingBuilder}.
+ *
+ * Provisional API: This interface is part of an interim API that is still under development and
+ * expected to change significantly before reaching stability. It is available at this early stage
+ * to solicit feedback from pioneering adopters on the understanding that any code that uses this
+ * API will almost certainly be broken (repeatedly) as the API evolves.
+ *
+ * @version 3.1
+ * @since 3.1
+ * @author Pascal Filion
+ */
+public class GenericMappingBuilder implements IMappingBuilderGenericMappingBuilder
.
+ */
+ public GenericMappingBuilder() {
+ super();
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public IMapping buildMapping(IManagedType parent, AttributeMapping value) {
+ return new GenericJpaMapping(parent, value);
+ }
+}
\ No newline at end of file
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/jpql/spi/IJpaType.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/jpql/spi/IJpaType.java
new file mode 100644
index 0000000000..e7e102ef1e
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/jpql/spi/IJpaType.java
@@ -0,0 +1,43 @@
+/*******************************************************************************
+ * Copyright (c) 2011 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 and Eclipse Distribution License v. 1.0
+ * which accompanies this distribution.
+ * The Eclipse Public License is available at http://www.eclipse.org/legal/epl-v10.html
+ * and the Eclipse Distribution License is available at
+ * http://www.eclipse.org/org/documents/edl-v10.php.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ *
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.jpql.spi;
+
+import org.eclipse.persistence.jpa.jpql.spi.IType;
+
+/**
+ * An internal interface used by all 3 implementations of {@link IType}.
+ *
+ * Provisional API: This interface is part of an interim API that is still under development and
+ * expected to change significantly before reaching stability. It is available at this early stage
+ * to solicit feedback from pioneering adopters on the understanding that any code that uses this
+ * API will almost certainly be broken (repeatedly) as the API evolves.
+ *
+ * @see JavaType
+ * @see JpaType
+ * @see SimpleType
+ *
+ * @version 3.1
+ * @since 3.0
+ * @author Pascal Filion
+ */
+public interface IJpaType extends IType {
+
+ /**
+ * Manually sets the declaration of this {@link IType}, which gives the information about type
+ * parameters, dimensionality, etc.
+ *
+ * @param typeDeclaration The external form of the type declaration
+ */
+ void setTypeDeclaration(JpaTypeDeclaration typeDeclaration);
+}
\ No newline at end of file
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/jpql/spi/JavaConstructor.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/jpql/spi/JavaConstructor.java
new file mode 100644
index 0000000000..288940c2c1
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/jpql/spi/JavaConstructor.java
@@ -0,0 +1,104 @@
+/*******************************************************************************
+ * Copyright (c) 2011 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 and Eclipse Distribution License v. 1.0
+ * which accompanies this distribution.
+ * The Eclipse Public License is available at http://www.eclipse.org/legal/epl-v10.html
+ * and the Eclipse Distribution License is available at
+ * http://www.eclipse.org/org/documents/edl-v10.php.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ *
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.jpql.spi;
+
+import java.lang.reflect.Constructor;
+import java.lang.reflect.Type;
+import org.eclipse.persistence.jpa.jpql.spi.IConstructor;
+import org.eclipse.persistence.jpa.jpql.spi.IType;
+import org.eclipse.persistence.jpa.jpql.spi.ITypeDeclaration;
+import org.eclipse.persistence.jpa.jpql.spi.ITypeRepository;
+
+/**
+ * The concrete implementation of {@link IConstructor} that is wrapping a Java constructor.
+ *
+ * Provisional API: This interface is part of an interim API that is still under development and
+ * expected to change significantly before reaching stability. It is available at this early stage
+ * to solicit feedback from pioneering adopters on the understanding that any code that uses this
+ * API will almost certainly be broken (repeatedly) as the API evolves.
+ *
+ * @version 3.1
+ * @since 3.0
+ * @author Pascal Filion
+ */
+public class JavaConstructor implements IConstructor {
+
+ /**
+ * The actual Java constructor.
+ */
+ private Constructor> constructor;
+
+ /**
+ * The cached {@link ITypeDeclaration parameter types}.
+ */
+ private ITypeDeclaration[] parameterTypes;
+
+ /**
+ * The declaring type of this constructor.
+ */
+ private JavaType type;
+
+ /**
+ * Creates a new JavaConstructor
.
+ *
+ * @param type The declaring type of this constructor
+ * @param constructor The actual Java constructor
+ */
+ public JavaConstructor(JavaType type, Constructor> constructor) {
+ super();
+ this.type = type;
+ this.constructor = constructor;
+ }
+
+ protected ITypeDeclaration[] buildParameterTypes() {
+
+ Class>[] types = constructor.getParameterTypes();
+ Type[] genericTypes = constructor.getGenericParameterTypes();
+ ITypeDeclaration[] typeDeclarations = new ITypeDeclaration[types.length];
+
+ for (int index = 0, count = types.length; index < count; index++) {
+ typeDeclarations[index] = buildTypeDeclaration(types[index], genericTypes[index]);
+ }
+
+ return typeDeclarations;
+ }
+
+ protected ITypeDeclaration buildTypeDeclaration(Class> javaType, Type genericType) {
+ ITypeRepository typeRepository = getTypeRepository();
+ IType type = typeRepository.getType(javaType);
+ return new JavaTypeDeclaration(typeRepository, type, genericType, javaType.isArray());
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public ITypeDeclaration[] getParameterTypes() {
+ if (parameterTypes == null) {
+ parameterTypes = buildParameterTypes();
+ }
+ return parameterTypes;
+ }
+
+ protected ITypeRepository getTypeRepository() {
+ return type.getTypeRepository();
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public String toString() {
+ return constructor.toGenericString();
+ }
+}
\ No newline at end of file
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/jpql/spi/JavaType.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/jpql/spi/JavaType.java
new file mode 100644
index 0000000000..0ffb4ac60f
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/jpql/spi/JavaType.java
@@ -0,0 +1,252 @@
+/*******************************************************************************
+ * Copyright (c) 2011 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 and Eclipse Distribution License v. 1.0
+ * which accompanies this distribution.
+ * The Eclipse Public License is available at http://www.eclipse.org/legal/epl-v10.html
+ * and the Eclipse Distribution License is available at
+ * http://www.eclipse.org/org/documents/edl-v10.php.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ *
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.jpql.spi;
+
+import java.lang.annotation.Annotation;
+import java.lang.reflect.Constructor;
+import java.util.ArrayList;
+import java.util.Collection;
+import org.eclipse.persistence.jpa.jpql.ExpressionTools;
+import org.eclipse.persistence.jpa.jpql.spi.IConstructor;
+import org.eclipse.persistence.jpa.jpql.spi.IType;
+import org.eclipse.persistence.jpa.jpql.spi.ITypeDeclaration;
+import org.eclipse.persistence.jpa.jpql.spi.ITypeRepository;
+import org.eclipse.persistence.jpa.jpql.util.iterator.CloneIterator;
+import org.eclipse.persistence.jpa.jpql.util.iterator.IterableIterator;
+
+/**
+ * The concrete implementation of {@link IType} that is wrapping a Java type.
+ *
+ * Provisional API: This interface is part of an interim API that is still under development and
+ * expected to change significantly before reaching stability. It is available at this early stage
+ * to solicit feedback from pioneering adopters on the understanding that any code that uses this
+ * API will almost certainly be broken (repeatedly) as the API evolves.
+ *
+ * @version 3.1
+ * @since 3.0
+ * @author Pascal Filion
+ */
+public class JavaType implements IJpaType {
+
+ /**
+ * The cached {@link IConstructor IConstructors}.
+ */
+ private CollectionJavaType
.
+ *
+ * @param typeRepository The external form of a type repository
+ * @param type The actual Java type wrapped by this class
+ */
+ public JavaType(ITypeRepository typeRepository, Class> type) {
+ super();
+ this.type = type;
+ this.typeName = type.getName();
+ this.typeRepository = typeRepository;
+ }
+
+ protected IConstructor buildConstructor(Constructor> constructor) {
+ return new JavaConstructor(this, constructor);
+ }
+
+ protected Collectionnull
is returned; then the class could not be resolved
+ */
+ protected Class> getType() {
+ return type;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public ITypeDeclaration getTypeDeclaration() {
+ if (typeDeclaration == null) {
+ typeDeclaration = new JavaTypeDeclaration(typeRepository, this, null, (type != null) ? type.isArray() : false);
+ }
+ return typeDeclaration;
+ }
+
+ /**
+ * Returns the type repository for the application.
+ *
+ * @return The repository of {@link IType ITypes}
+ */
+ protected ITypeRepository getTypeRepository() {
+ return typeRepository;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public boolean hasAnnotation(Class extends Annotation> annotationType) {
+ return type.isAnnotationPresent(annotationType);
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public int hashCode() {
+ return typeName.hashCode();
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public boolean isAssignableTo(IType type) {
+
+ if (this == type) {
+ return true;
+ }
+
+ // TODO
+ if (type instanceof JavaType) {
+ Class> otherType = ((JavaType) type).type;
+ return otherType.isAssignableFrom(this.type);
+ }
+ else if (type instanceof JpaType) {
+ // TODO
+ return false;
+ }
+
+ return false;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public boolean isEnum() {
+ return (type != null) && type.isEnum();
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public boolean isResolvable() {
+ return true;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public void setTypeDeclaration(JpaTypeDeclaration typeDeclaration) {
+ this.typeDeclaration = typeDeclaration;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public String toString() {
+ return typeName;
+ }
+}
\ No newline at end of file
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/jpql/spi/JavaTypeDeclaration.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/jpql/spi/JavaTypeDeclaration.java
new file mode 100644
index 0000000000..419a657094
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/jpql/spi/JavaTypeDeclaration.java
@@ -0,0 +1,276 @@
+/*******************************************************************************
+ * Copyright (c) 2011 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 and Eclipse Distribution License v. 1.0
+ * which accompanies this distribution.
+ * The Eclipse Public License is available at http://www.eclipse.org/legal/epl-v10.html
+ * and the Eclipse Distribution License is available at
+ * http://www.eclipse.org/org/documents/edl-v10.php.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ *
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.jpql.spi;
+
+import java.lang.reflect.GenericArrayType;
+import java.lang.reflect.ParameterizedType;
+import java.lang.reflect.Type;
+import java.lang.reflect.TypeVariable;
+import java.lang.reflect.WildcardType;
+import java.util.ArrayList;
+import java.util.List;
+import org.eclipse.persistence.jpa.jpql.spi.IType;
+import org.eclipse.persistence.jpa.jpql.spi.ITypeDeclaration;
+import org.eclipse.persistence.jpa.jpql.spi.ITypeRepository;
+
+/**
+ * The concrete implementation of {@link ITypeDeclaration} that is wrapping the representation
+ * of the declaration description of a type.
+ *
+ * Provisional API: This interface is part of an interim API that is still under development and
+ * expected to change significantly before reaching stability. It is available at this early stage
+ * to solicit feedback from pioneering adopters on the understanding that any code that uses this
+ * API will almost certainly be broken (repeatedly) as the API evolves.
+ *
+ * @see IMapping
+ * @see IType
+ *
+ * @version 3.1
+ * @since 3.0
+ * @author Pascal Filion
+ */
+@SuppressWarnings("nls")
+public class JavaTypeDeclaration implements ITypeDeclaration {
+
+ /**
+ * Determines whether the type declaration represents an array.
+ */
+ private boolean array;
+
+ /**
+ * The actual type that contains the generics, if any is present.
+ */
+ private Object genericType;
+
+ /**
+ * The cached {@link ITypeDeclaration ITypeDeclarations} representing the generics of the {@link
+ * Type}.
+ */
+ private ITypeDeclaration[] genericTypes;
+
+ /**
+ * The external form of the Java type.
+ */
+ private final IType type;
+
+ /**
+ * The repository of {@link IType ITypes}.
+ */
+ private ITypeRepository typeRepository;
+
+ /**
+ * Creates a new JavaTypeDeclaration
.
+ *
+ * @param typeRepository The repository of {@link IType ITypes}
+ * @param type The external form of the Java type
+ * @param genericType The actual type that contains the generics, if any is present
+ * @param array Determines whether the type declaration represents an array
+ */
+ public JavaTypeDeclaration(ITypeRepository typeRepository,
+ IType type,
+ Object genericType,
+ boolean array) {
+
+ super();
+ this.type = type;
+ this.array = array;
+ this.genericType = genericType;
+ this.typeRepository = typeRepository;
+ }
+
+ protected String buildArrayTypeName(String arrayTypeName) {
+
+ StringBuilder sb = new StringBuilder();
+ int index = arrayTypeName.indexOf('[');
+ int dimensionality = (arrayTypeName.length() - index) / 2;
+ String typeName = arrayTypeName.substring(0, index);
+
+ while (--dimensionality >= 0) {
+ sb.append("[");
+ }
+
+ String elementType = elementType(typeName);
+
+ sb.append(elementType);
+ sb.append(typeName);
+
+ if (elementType.equals("L")) {
+ sb.append(";");
+ }
+
+ return sb.toString();
+ }
+
+ protected ITypeDeclaration[] buildParameterTypes() {
+
+ ListJpaConstructor
.
+ *
+ * @param type The type owning the constructor
+ * @param constructor The design-time representation of a Java constructor
+ */
+ public JpaConstructor(JpaType type, IMethodBinding constructor) {
+ super();
+ this.type = type;
+ this.constructor = constructor;
+ }
+
+ protected ITypeDeclaration buildTypeDeclaration(ITypeBinding parameterType) {
+
+ boolean array = parameterType.isArray();
+ String typeParameterName;
+
+ if (array) {
+ ITypeBinding componentType = parameterType.getComponentType();
+
+ // JpaEmbeddable
.
+ *
+ * @param provider The provider of JPA managed types
+ * @param embeddable The design-time model object wrapped by this class
+ * @param mappingBuilder The builder that is responsible to create the {@link IMapping} wrapping
+ * a persistent attribute or property
+ */
+ public JpaEmbeddable(JpaManagedTypeProvider provider,
+ Embeddable embeddable,
+ IMappingBuilderJpaEntity
.
+ *
+ * @param provider The provider of JPA managed types
+ * @param entity The design-time model object wrapped by this class
+ * @param mappingBuilder The builder that is responsible to create the {@link IMapping} wrapping
+ * a persistent attribute or property
+ */
+ public JpaEntity(JpaManagedTypeProvider provider,
+ Entity entity,
+ IMappingBuilderJDeveloperManagedType
.
+ *
+ * @param managedType The provider of JPA managed types
+ * @param mappedClass The design-time model object wrapped by this class
+ * @param mappingBuilder The builder that is responsible to create the {@link IMapping} wrapping
+ * a persistent attribute or property
+ */
+ protected JpaManagedType(JpaManagedTypeProvider provider,
+ TypeMapping managedType,
+ IMappingBuilderJpaManagedTypeProvider
.
+ *
+ * @param jpaProject The project that gives access to the application's metadata
+ * @param persistentTypeContainer The design-time provider of managed types
+ * @param mappingBuilder The builder that is responsible to create the {@link IMapping} wrapping
+ * a persistent attribute or property
+ */
+ public JpaManagedTypeProvider(JpaProject jpaProject,
+ PersistentTypeContainer persistentTypeContainer,
+ IMappingBuilderJpaMappedSuperclass
.
+ *
+ * @param provider The provider of JPA managed types
+ * @param mappedSuperclass The design-time model object wrapped by this class
+ * @param mappingBuilder The builder that is responsible to create the {@link IMapping} wrapping
+ * a persistent attribute or property
+ */
+ public JpaMappedSuperclass(JpaManagedTypeProvider provider,
+ MappedSuperclass mappedSuperclass,
+ IMappingBuilderJpaMapping
.
+ *
+ * @param parent The parent of this mapping
+ * @param mapping The design-time {@link AttributeMapping} wrapped by this class
+ */
+ protected JpaMapping(IManagedType parent, AttributeMapping mapping) {
+ super();
+ this.parent = parent;
+ this.mapping = mapping;
+ this.mappingType = -1;
+ }
+
+ protected ITypeDeclaration[] buildGenericTypeDeclarations() {
+ JavaPersistentAttribute javaPersistentAttribute = mapping.getPersistentAttribute().getJavaPersistentAttribute();
+ JavaResourceAttribute resource = javaPersistentAttribute.getResourceAttribute();
+ ListJpaNullManagedType
.
+ *
+ * @param managedType The provider of JPA managed types
+ * @param typeMapping The design-time model object wrapped by this class
+ */
+ public JpaNullManagedType(JpaManagedTypeProvider provider, TypeMapping typeMapping) {
+ super();
+ this.provider = provider;
+ this.typeMapping = typeMapping;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public void accept(IManagedTypeVisitor visitor) {
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public int compareTo(IManagedType managedType) {
+ return getType().getName().compareTo(managedType.getType().getName());
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public IMapping getMappingNamed(String name) {
+ return null;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public IManagedTypeProvider getProvider() {
+ return provider;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public IType getType() {
+ if (type == null) {
+ type = provider.getTypeRepository().getType(typeMapping.getPersistentType().getName());
+ }
+ return type;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public IterableIteratorJpaQuery
.
+ *
+ * @param provider The provider of managed types
+ * @param query The model object of the JPQL query
+ */
+ public JpaQuery(IManagedTypeProvider provider, NamedQuery query) {
+ this(provider, query, query.getQuery());
+ }
+
+ /**
+ * Creates a new JpaQuery
.
+ *
+ * @param provider The provider of managed types
+ * @param query The model object of the JPQL query
+ * @param actualQuery The actual JPQL query, which can differ from the one owned by the model
+ * object, which happens when the model is out of sync because it has not been updated yet
+ */
+ public JpaQuery(IManagedTypeProvider provider, NamedQuery query, String actualQuery) {
+ super();
+ initialize(provider, query, actualQuery);
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public String getExpression() {
+ return actualQuery;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public IManagedTypeProvider getProvider() {
+ return provider;
+ }
+
+ /**
+ * Returns the encapsulated {@link NamedQuery}, which is the actual object.
+ *
+ * @return The design-time representation of a JPQL query
+ */
+ protected NamedQuery getQuery() {
+ return query;
+ }
+
+ protected void initialize(IManagedTypeProvider provider, NamedQuery query, String actualQuery) {
+
+ this.query = query;
+ this.provider = provider;
+ this.actualQuery = actualQuery;
+
+ if (this.actualQuery == null) {
+ this.actualQuery = StringTools.EMPTY_STRING;
+ }
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public String toString() {
+ StringBuilder sb = new StringBuilder();
+ sb.append(super.toString());
+ sb.append(", query=");
+ sb.append(getExpression());
+ return sb.toString();
+ }
+}
\ No newline at end of file
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/jpql/spi/JpaType.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/jpql/spi/JpaType.java
new file mode 100644
index 0000000000..461bc7b0bf
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/jpql/spi/JpaType.java
@@ -0,0 +1,437 @@
+/*******************************************************************************
+ * Copyright (c) 2011 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 and Eclipse Distribution License v. 1.0
+ * which accompanies this distribution.
+ * The Eclipse Public License is available at http://www.eclipse.org/legal/epl-v10.html
+ * and the Eclipse Distribution License is available at
+ * http://www.eclipse.org/org/documents/edl-v10.php.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ *
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.jpql.spi;
+
+import java.lang.annotation.Annotation;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Collections;
+import java.util.List;
+import org.eclipse.core.runtime.NullProgressMonitor;
+import org.eclipse.jdt.core.Flags;
+import org.eclipse.jdt.core.IField;
+import org.eclipse.jdt.core.IJavaElement;
+import org.eclipse.jdt.core.IMember;
+import org.eclipse.jdt.core.IMethod;
+import org.eclipse.jdt.core.IType;
+import org.eclipse.jdt.core.ITypeHierarchy;
+import org.eclipse.jdt.core.dom.AST;
+import org.eclipse.jdt.core.dom.ASTNode;
+import org.eclipse.jdt.core.dom.ASTParser;
+import org.eclipse.jdt.core.dom.AbstractTypeDeclaration;
+import org.eclipse.jdt.core.dom.AnonymousClassDeclaration;
+import org.eclipse.jdt.core.dom.ClassInstanceCreation;
+import org.eclipse.jdt.core.dom.CompilationUnit;
+import org.eclipse.jdt.core.dom.EnumConstantDeclaration;
+import org.eclipse.jdt.core.dom.IMethodBinding;
+import org.eclipse.jdt.core.dom.ITypeBinding;
+import org.eclipse.jdt.core.dom.NodeFinder;
+import org.eclipse.jpt.common.core.internal.utility.jdt.ASTTools;
+import org.eclipse.jpt.common.utility.internal.StringTools;
+import org.eclipse.jpt.jpa.core.JptJpaCorePlugin;
+import org.eclipse.persistence.jpa.jpql.ExpressionTools;
+import org.eclipse.persistence.jpa.jpql.spi.IConstructor;
+import org.eclipse.persistence.jpa.jpql.spi.ITypeDeclaration;
+import org.eclipse.persistence.jpa.jpql.util.iterator.CloneIterator;
+import org.eclipse.persistence.jpa.jpql.util.iterator.IterableIterator;
+
+/**
+ * The concrete implementation of {@link org.eclipse.persistence.jpa.query.spi.IType IType} that is
+ * wrapping the design-time representation of a Java type.
+ *
+ * Provisional API: This interface is part of an interim API that is still under development and
+ * expected to change significantly before reaching stability. It is available at this early stage
+ * to solicit feedback from pioneering adopters on the understanding that any code that uses this
+ * API will almost certainly be broken (repeatedly) as the API evolves.
+ *
+ * @version 3.1
+ * @since 3.0
+ * @author Pascal Filion
+ */
+public class JpaType implements IJpaType {
+
+ /**
+ * The cached collection of {@link IConstructor constructors}.
+ */
+ private CollectionJpaType
.
+ *
+ * @param typeRepository The external form of a type repository
+ * @param type The design-time representation of a Java type
+ */
+ public JpaType(JpaTypeRepository typeRepository, IType type) {
+ super();
+ this.type = type;
+ this.typeName = type.getFullyQualifiedName();
+ this.typeRepository = typeRepository;
+ }
+
+ protected CompilationUnit buildCompilationUnit() {
+
+ ASTParser parser = ASTParser.newParser(AST.JLS3);
+ parser.setSource(type.getTypeRoot());
+ parser.setIgnoreMethodBodies(true);
+ parser.setResolveBindings(true);
+ parser.setBindingsRecovery(true);
+
+ return (CompilationUnit) parser.createAST(new NullProgressMonitor());
+ }
+
+ protected CollectionJpaTypeDeclaration
.
+ *
+ * @param type The external form of the Java type
+ * @param genericTypes The generics of the given type or an empty list if the type is not
+ * parameterized
+ */
+ public JpaTypeDeclaration(IType type, ITypeDeclaration[] genericTypes) {
+ this(type, genericTypes, 0);
+ }
+
+ /**
+ * Creates a new JpaTypeDeclaration
.
+ *
+ * @param type The external form of the Java type
+ * @param genericTypes The generics of the given type or an empty list if the type is not
+ * parameterized
+ * @param dimensionality The dimensionality of the array or 0 if it's not an array
+ */
+ public JpaTypeDeclaration(IType type, ITypeDeclaration[] genericTypes, int dimensionality) {
+ super();
+ this.type = type;
+ this.genericTypes = genericTypes;
+ this.dimensionality = dimensionality;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public int getDimensionality() {
+ return dimensionality;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public IType getType() {
+ return type;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public ITypeDeclaration[] getTypeParameters() {
+ return genericTypes;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public boolean isArray() {
+ return dimensionality > 0;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public String toString() {
+ return type.getName();
+ }
+}
\ No newline at end of file
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/jpql/spi/JpaTypeRepository.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/jpql/spi/JpaTypeRepository.java
new file mode 100644
index 0000000000..67dfa83b5b
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/jpql/spi/JpaTypeRepository.java
@@ -0,0 +1,409 @@
+/*******************************************************************************
+ * Copyright (c) 2011 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 and Eclipse Distribution License v. 1.0
+ * which accompanies this distribution.
+ * The Eclipse Public License is available at http://www.eclipse.org/legal/epl-v10.html
+ * and the Eclipse Distribution License is available at
+ * http://www.eclipse.org/org/documents/edl-v10.php.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ *
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.jpql.spi;
+
+import java.util.HashMap;
+import java.util.Map;
+import org.eclipse.core.resources.IResource;
+import org.eclipse.core.runtime.IPath;
+import org.eclipse.jdt.core.IJavaProject;
+import org.eclipse.jdt.core.IType;
+import org.eclipse.jdt.core.JavaModelException;
+import org.eclipse.persistence.jpa.jpql.TypeHelper;
+import org.eclipse.persistence.jpa.jpql.spi.ITypeDeclaration;
+import org.eclipse.persistence.jpa.jpql.spi.ITypeRepository;
+
+/**
+ * The concrete implementation of {@link ITypeRepository} that is wrapping the design-time
+ * representation of a type repository.
+ *
+ * Provisional API: This interface is part of an interim API that is still under development and
+ * expected to change significantly before reaching stability. It is available at this early stage
+ * to solicit feedback from pioneering adopters on the understanding that any code that uses this
+ * API will almost certainly be broken (repeatedly) as the API evolves.
+ *
+ * @version 3.1
+ * @since 3.0
+ * @author Pascal Filion
+ */
+@SuppressWarnings("nls")
+public class JpaTypeRepository implements ITypeRepository {
+
+ /**
+ * The Java project that gives access the design-time objects representing the Java types.
+ */
+ private final IJavaProject javaProject;
+
+ /**
+ * Keeps a map of the primitives for fast access.
+ */
+ private MapJpaTypeRepository
.
+ *
+ * @param javaProject The Java project that gives access the design-time objects representing
+ * the Java types
+ */
+ public JpaTypeRepository(IJavaProject javaProject) {
+ super();
+ this.javaProject = javaProject;
+ this.types = new HashMapnull
otherwise
+ */
+ protected IType findType(String typeName) {
+ try {
+ return javaProject.findType(typeName);
+ }
+ catch (JavaModelException e) {
+ return null;
+ }
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public IJpaType getEnumType(String enumTypeName) {
+
+ // Get the position of the last dot so the enum constant can be removed
+ int lastDotIndex = enumTypeName.lastIndexOf(".");
+
+ if (lastDotIndex == -1) {
+ return null;
+ }
+
+ // Retrieve the fully qualified enum type name
+ String typeName = enumTypeName.substring(0, lastDotIndex);
+
+ // Attempt to load the enum type
+ IType type = findType(typeName);
+ IJpaType jpaType;
+
+ if (type != null) {
+ jpaType = buildType(type);
+ }
+ else {
+ jpaType = loadInnerType(typeName);
+ }
+
+ return (jpaType != null) && jpaType.isEnum() ? jpaType : null;
+ }
+
+ /**
+ * Returns the Java project, which gives access to the class path.
+ *
+ * @return The Java project, which gives access to the class path
+ */
+ protected IJavaProject getJavaProject() {
+ return javaProject;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public IJpaType getType(Class> javaClass) {
+ IJpaType type = types.get(javaClass.getName());
+ if (type == null) {
+ type = buildType(javaClass);
+ }
+ return type;
+ }
+
+ /**
+ * Retrieves the {@link IType} for the given {@link IResource}.
+ *
+ * @param resource The workspace location of the {@link IType} to retrieve
+ * @return The design-time representation of a Java type
+ */
+ protected IType getType(IResource resource) {
+ try {
+ return (IType) javaProject.findElement((IPath) resource);
+ }
+ catch (Exception e) {
+ return null;
+ }
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public IJpaType getType(String typeName) {
+
+ if (IJpaType.UNRESOLVABLE_TYPE == typeName) {
+ return unresolvableType();
+ }
+
+ if (typeName.endsWith("[]")) {
+ return loadArrayType(typeName);
+ }
+
+ if (typeName.charAt(0) == '[') {
+ return loadJavaArrayType(typeName);
+ }
+
+ return loadTypeImp(typeName);
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public TypeHelper getTypeHelper() {
+ if (typeHelper == null) {
+ typeHelper = new TypeHelper(this);
+ }
+ return typeHelper;
+ }
+
+ protected IJpaType loadArrayType(String typeName) {
+
+ IJpaType type = types.get(typeName);
+
+ if (type == null) {
+ try {
+ // Try to see if the type is a JDK class, otherwise, just use the type name
+ // since IJpaType doesn't support array types
+ String javaTypeName = convertToJavaArrayType(typeName);
+ type = buildType(Class.forName(javaTypeName));
+ }
+ catch (Exception e) {
+
+ int index = typeName.indexOf("[]");
+ int dimensionality = (typeName.length() - index) / 2;
+
+ type = getType(typeName.substring(0, index));
+
+ type.setTypeDeclaration(
+ new JpaTypeDeclaration(type, new ITypeDeclaration[0], dimensionality)
+ );
+ }
+
+ types.put(typeName, type);
+ }
+
+ return type;
+ }
+
+ protected IJpaType loadInnerType(String typeName) {
+
+ while (true) {
+
+ int index = typeName.lastIndexOf(".");
+
+ if (index == -1) {
+ return null;
+ }
+
+ typeName = buildInnerTypeName(typeName, index);
+ IJpaType cachedType = types.get(typeName);
+
+ if (cachedType != null) {
+ return cachedType;
+ }
+
+ // Attempt to load the Java type
+ IType type = findType(typeName);
+
+ // A Java type exists, return it
+ if (type != null) {
+ return buildType(type);
+ }
+ }
+ }
+
+ protected IJpaType loadJavaArrayType(String typeName) {
+
+ IJpaType type = types.get(typeName);
+
+ if (type == null) {
+ try {
+ // Try to see if the type is a JDK class, otherwise, just use the type name
+ // since IJpaType doesn't support array types
+ type = buildType(Class.forName(typeName));
+ }
+ catch (Exception e) {
+
+ int index = typeName.lastIndexOf("[");
+ int dimensionality = index / 2;
+
+ type = getType(typeName.substring(index, typeName.endsWith(";") ? typeName.length() - 1 : typeName.length()));
+
+ type.setTypeDeclaration(
+ new JpaTypeDeclaration(type, new ITypeDeclaration[0], dimensionality)
+ );
+ }
+
+ types.put(typeName, type);
+ }
+
+ return type;
+ }
+
+ protected IJpaType loadTypeImp(String typeName) {
+
+ IJpaType type = types.get(typeName);
+
+ // The type was already cached, simply return it
+ if (type != null) {
+ return type;
+ }
+
+ // First check for primitive, they don't have a corresponding IJpaType
+ Class> primitive = findPrimitive(typeName);
+
+ if (primitive != null) {
+ return buildType(primitive);
+ }
+
+ // Attempt to load the Java type
+ IType iType = findType(typeName);
+
+ // A Java type exists, return it
+ if (iType != null) {
+ return buildType(iType);
+ }
+
+ // Now try with a possible inner enum type
+ type = loadInnerType(typeName);
+
+ // No Java type exists, create a "null" IJpaType
+ if (type == null) {
+ type = buildType(typeName);
+ }
+
+ return type;
+ }
+
+ protected IJpaType unresolvableType() {
+ if (unresolvableType == null) {
+ unresolvableType = new SimpleType(this, IJpaType.UNRESOLVABLE_TYPE);
+ }
+ return unresolvableType;
+ }
+}
\ No newline at end of file
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/jpql/spi/SimpleType.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/jpql/spi/SimpleType.java
new file mode 100644
index 0000000000..0719161dae
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/jpql/spi/SimpleType.java
@@ -0,0 +1,144 @@
+/*******************************************************************************
+ * Copyright (c) 2011 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 and Eclipse Distribution License v. 1.0
+ * which accompanies this distribution.
+ * The Eclipse Public License is available at http://www.eclipse.org/legal/epl-v10.html
+ * and the Eclipse Distribution License is available at
+ * http://www.eclipse.org/org/documents/edl-v10.php.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ *
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.jpql.spi;
+
+import java.lang.annotation.Annotation;
+import org.eclipse.jpt.common.utility.internal.StringTools;
+import org.eclipse.persistence.jpa.jpql.spi.IConstructor;
+import org.eclipse.persistence.jpa.jpql.spi.IType;
+import org.eclipse.persistence.jpa.jpql.spi.ITypeDeclaration;
+import org.eclipse.persistence.jpa.jpql.util.iterator.IterableIterator;
+import org.eclipse.persistence.jpa.jpql.util.iterator.NullIterator;
+
+/**
+ * The concrete implementation of {@link IType} that is wrapping the type name only.
+ *
+ * Provisional API: This interface is part of an interim API that is still under development and
+ * expected to change significantly before reaching stability. It is available at this early stage
+ * to solicit feedback from pioneering adopters on the understanding that any code that uses this
+ * API will almost certainly be broken (repeatedly) as the API evolves.
+ *
+ * @version 3.1
+ * @since 3.0
+ * @author Pascal Filion
+ */
+public class SimpleType implements IJpaType {
+
+ /**
+ * Caches the type hierarchy of the {@link IType} in order to prevent rebuilding it each time.
+ */
+ private ITypeDeclaration typeDeclaration;
+
+ /**
+ * The fully qualified name of the Java type.
+ */
+ private final String typeName;
+
+ /**
+ * The external form of a type repository.
+ */
+ private final JpaTypeRepository typeRepository;
+
+ /**
+ * Creates a new SimpleType
.
+ *
+ * @param typeName The fully qualified name of the Java type
+ */
+ public SimpleType(JpaTypeRepository typeRepository, String typeName) {
+ super();
+ this.typeRepository = typeRepository;
+ this.typeName = typeName;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public IterableIteratorAbstractEclipseLinkJpaJpqlQueryHelper
.
+ *
+ * @param jpqlGrammar The grammar that defines how to parse a JPQL query
+ */
+ protected AbstractEclipseLinkJpaJpqlQueryHelper(JPQLGrammar jpqlGrammar) {
+ super(jpqlGrammar);
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ protected AbstractContentAssistVisitor buildContentAssistVisitor(JPQLQueryContext queryContext) {
+ return new EclipseLinkContentAssistVisitor(queryContext);
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ protected AbstractGrammarValidator buildGrammarValidator(JPQLQueryContext queryContext) {
+ return new EclipseLinkGrammarValidator(queryContext);
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ protected JPQLQueryContext buildJPQLQueryContext(JPQLGrammar jpqlGrammar) {
+ return new EclipseLinkJPQLQueryContext(jpqlGrammar);
+ }
+
+ protected IMappingBuilderEclipseLink1_1JpaJpqlQueryHelper
.
+ */
+ private EclipseLink1_1JpaJpqlQueryHelper() {
+ super(EclipseLinkJPQLGrammar1.instance());
+ }
+
+ /**
+ * Returns the singleton instance of this helper.
+ *
+ * @return The singleton instance of this helper
+ */
+ public static JpaJpqlQueryHelper instance() {
+ return INSTANCE;
+ }
+}
\ No newline at end of file
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/EclipseLink1_1JpaPlatformFactory.java b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/EclipseLink1_1JpaPlatformFactory.java
index 452c6b9bfc..84c3d31263 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/EclipseLink1_1JpaPlatformFactory.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/EclipseLink1_1JpaPlatformFactory.java
@@ -3,7 +3,7 @@
* 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
******************************************************************************/
@@ -33,24 +33,25 @@ public class EclipseLink1_1JpaPlatformFactory
public EclipseLink1_1JpaPlatformFactory() {
super();
}
-
-
+
+
public JpaPlatform buildJpaPlatform(String id) {
return new GenericJpaPlatform(
id,
buildJpaVersion(),
- new EclipseLinkJpaFactory(),
+ new EclipseLinkJpaFactory(),
buildAnnotationProvider(),
- EclipseLink1_1JpaPlatformProvider.instance(),
- buildJpaPlatformVariation());
+ EclipseLink1_1JpaPlatformProvider.instance(),
+ buildJpaPlatformVariation(),
+ EclipseLink1_1JpaJpqlQueryHelper.instance());
}
-
+
protected AnnotationProvider buildAnnotationProvider() {
return new JpaAnnotationProvider(
GenericJpaAnnotationDefinitionProvider.instance(),
EclipseLinkJpaAnnotationDefinitionProvider.instance());
}
-
+
protected JpaPlatformVariation buildJpaPlatformVariation() {
return new JpaPlatformVariation() {
public Supported getTablePerConcreteClassInheritanceIsSupported() {
@@ -61,7 +62,7 @@ public class EclipseLink1_1JpaPlatformFactory
}
};
}
-
+
private JpaPlatform.Version buildJpaVersion() {
return new EclipseLinkVersion(
JptJpaEclipseLinkCorePlugin.ECLIPSELINK_PLATFORM_VERSION_1_1,
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/EclipseLink1_2JpaJpqlQueryHelper.java b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/EclipseLink1_2JpaJpqlQueryHelper.java
new file mode 100644
index 0000000000..6aa2b5add5
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/EclipseLink1_2JpaJpqlQueryHelper.java
@@ -0,0 +1,49 @@
+/*******************************************************************************
+ * Copyright (c) 2011 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 and Eclipse Distribution License v. 1.0
+ * which accompanies this distribution.
+ * The Eclipse Public License is available at http://www.eclipse.org/legal/epl-v10.html
+ * and the Eclipse Distribution License is available at
+ * http://www.eclipse.org/org/documents/edl-v10.php.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ *
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.eclipselink.core.internal;
+
+import org.eclipse.jpt.jpa.core.jpql.JpaJpqlQueryHelper;
+
+import org.eclipse.persistence.jpa.jpql.parser.EclipseLinkJPQLGrammar1;
+
+/**
+ * The EclipseLink 1.2 implementation of {@link JpaJpqlQueryHelper}.
+ *
+ * @version 3.1
+ * @since 3.1
+ * @author Pascal Filion
+ */
+public class EclipseLink1_2JpaJpqlQueryHelper extends AbstractEclipseLinkJpaJpqlQueryHelper {
+
+ /**
+ * The singleton instance of this helper.
+ */
+ private static final JpaJpqlQueryHelper INSTANCE = new EclipseLink1_2JpaJpqlQueryHelper();
+
+ /**
+ * Creates a new EclipseLink1_2JpaJpqlQueryHelper
.
+ */
+ private EclipseLink1_2JpaJpqlQueryHelper() {
+ super(EclipseLinkJPQLGrammar1.instance());
+ }
+
+ /**
+ * Returns the singleton instance of this helper.
+ *
+ * @return The singleton instance of this helper
+ */
+ public static JpaJpqlQueryHelper instance() {
+ return INSTANCE;
+ }
+}
\ No newline at end of file
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/EclipseLink1_2JpaPlatformFactory.java b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/EclipseLink1_2JpaPlatformFactory.java
index ceaf168d89..42bb704f41 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/EclipseLink1_2JpaPlatformFactory.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/EclipseLink1_2JpaPlatformFactory.java
@@ -3,7 +3,7 @@
* 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
******************************************************************************/
@@ -33,25 +33,26 @@ public class EclipseLink1_2JpaPlatformFactory
public EclipseLink1_2JpaPlatformFactory() {
super();
}
-
-
+
+
public JpaPlatform buildJpaPlatform(String id) {
return new GenericJpaPlatform(
id,
buildJpaVersion(),
- new EclipseLinkJpaFactory(),
+ new EclipseLinkJpaFactory(),
buildAnnotationProvider(),
- EclipseLink1_2JpaPlatformProvider.instance(),
- buildJpaPlatformVariation());
+ EclipseLink1_2JpaPlatformProvider.instance(),
+ buildJpaPlatformVariation(),
+ EclipseLink1_2JpaJpqlQueryHelper.instance());
}
-
+
protected AnnotationProvider buildAnnotationProvider() {
return new JpaAnnotationProvider(
GenericJpaAnnotationDefinitionProvider.instance(),
EclipseLinkJpaAnnotationDefinitionProvider.instance(),
EclipseLink1_2JpaAnnotationDefinitionProvider.instance());
}
-
+
protected JpaPlatformVariation buildJpaPlatformVariation() {
return new JpaPlatformVariation() {
public Supported getTablePerConcreteClassInheritanceIsSupported() {
@@ -62,7 +63,7 @@ public class EclipseLink1_2JpaPlatformFactory
}
};
}
-
+
private JpaPlatform.Version buildJpaVersion() {
return new EclipseLinkVersion(
JptJpaEclipseLinkCorePlugin.ECLIPSELINK_PLATFORM_VERSION_1_2,
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/EclipseLink2_0JpaJpqlQueryHelper.java b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/EclipseLink2_0JpaJpqlQueryHelper.java
new file mode 100644
index 0000000000..e8f4128e1d
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/EclipseLink2_0JpaJpqlQueryHelper.java
@@ -0,0 +1,49 @@
+/*******************************************************************************
+ * Copyright (c) 2011 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 and Eclipse Distribution License v. 1.0
+ * which accompanies this distribution.
+ * The Eclipse Public License is available at http://www.eclipse.org/legal/epl-v10.html
+ * and the Eclipse Distribution License is available at
+ * http://www.eclipse.org/org/documents/edl-v10.php.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ *
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.eclipselink.core.internal;
+
+import org.eclipse.jpt.jpa.core.jpql.JpaJpqlQueryHelper;
+
+import org.eclipse.persistence.jpa.jpql.parser.EclipseLinkJPQLGrammar2_0;
+
+/**
+ * The EclipseLink 2.0 implementation of {@link JpaJpqlQueryHelper}.
+ *
+ * @version 3.1
+ * @since 3.1
+ * @author Pascal Filion
+ */
+public class EclipseLink2_0JpaJpqlQueryHelper extends AbstractEclipseLinkJpaJpqlQueryHelper {
+
+ /**
+ * The singleton instance of this helper.
+ */
+ private static final JpaJpqlQueryHelper INSTANCE = new EclipseLink2_0JpaJpqlQueryHelper();
+
+ /**
+ * Creates a new EclipseLink2_0JpaJpqlQueryHelper
.
+ */
+ private EclipseLink2_0JpaJpqlQueryHelper() {
+ super(EclipseLinkJPQLGrammar2_0.instance());
+ }
+
+ /**
+ * Returns the singleton instance of this helper.
+ *
+ * @return The singleton instance of this helper
+ */
+ public static JpaJpqlQueryHelper instance() {
+ return INSTANCE;
+ }
+}
\ No newline at end of file
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/EclipseLink2_0JpaPlatformFactory.java b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/EclipseLink2_0JpaPlatformFactory.java
index 412486fc13..898397b9a4 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/EclipseLink2_0JpaPlatformFactory.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/EclipseLink2_0JpaPlatformFactory.java
@@ -3,7 +3,7 @@
* 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
*******************************************************************************/
@@ -38,18 +38,19 @@ public class EclipseLink2_0JpaPlatformFactory
return new GenericJpaPlatform(
id,
buildJpaVersion(),
- new EclipseLink2_0JpaFactory(),
+ new EclipseLink2_0JpaFactory(),
this.buildAnnotationProvider(),
- EclipseLink2_0JpaPlatformProvider.instance(),
- this.buildJpaVariation());
+ EclipseLink2_0JpaPlatformProvider.instance(),
+ this.buildJpaVariation(),
+ EclipseLink2_0JpaJpqlQueryHelper.instance());
}
-
+
protected JpaPlatform.Version buildJpaVersion() {
return new EclipseLinkVersion(
JptJpaEclipseLinkCorePlugin.ECLIPSELINK_PLATFORM_VERSION_2_0,
JpaFacet.VERSION_2_0.getVersionString());
}
-
+
protected AnnotationProvider buildAnnotationProvider() {
return new JpaAnnotationProvider(
Generic2_0JpaAnnotationDefinitionProvider.instance(),
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/EclipseLink2_1JpaJpqlQueryHelper.java b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/EclipseLink2_1JpaJpqlQueryHelper.java
new file mode 100644
index 0000000000..443560da55
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/EclipseLink2_1JpaJpqlQueryHelper.java
@@ -0,0 +1,49 @@
+/*******************************************************************************
+ * Copyright (c) 2011 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 and Eclipse Distribution License v. 1.0
+ * which accompanies this distribution.
+ * The Eclipse Public License is available at http://www.eclipse.org/legal/epl-v10.html
+ * and the Eclipse Distribution License is available at
+ * http://www.eclipse.org/org/documents/edl-v10.php.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ *
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.eclipselink.core.internal;
+
+import org.eclipse.jpt.jpa.core.jpql.JpaJpqlQueryHelper;
+
+import org.eclipse.persistence.jpa.jpql.parser.EclipseLinkJPQLGrammar2_1;
+
+/**
+ * The EclipseLink 2.1 implementation of {@link JpaJpqlQueryHelper}.
+ *
+ * @version 3.1
+ * @since 3.1
+ * @author Pascal Filion
+ */
+public class EclipseLink2_1JpaJpqlQueryHelper extends AbstractEclipseLinkJpaJpqlQueryHelper {
+
+ /**
+ * The singleton instance of this helper.
+ */
+ private static final JpaJpqlQueryHelper INSTANCE = new EclipseLink2_1JpaJpqlQueryHelper();
+
+ /**
+ * Creates a new EclipseLink2_1JpaJpqlQueryHelper
.
+ */
+ private EclipseLink2_1JpaJpqlQueryHelper() {
+ super(EclipseLinkJPQLGrammar2_1.instance());
+ }
+
+ /**
+ * Returns the singleton instance of this helper.
+ *
+ * @return The singleton instance of this helper
+ */
+ public static JpaJpqlQueryHelper instance() {
+ return INSTANCE;
+ }
+}
\ No newline at end of file
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/EclipseLink2_1JpaPlatformFactory.java b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/EclipseLink2_1JpaPlatformFactory.java
index fcd0abf99f..e8bf3a029c 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/EclipseLink2_1JpaPlatformFactory.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/EclipseLink2_1JpaPlatformFactory.java
@@ -1,11 +1,11 @@
/*******************************************************************************
- * 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
+ * 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:
+ *
+ * Contributors:
* Oracle - initial API and implementation
*******************************************************************************/
package org.eclipse.jpt.jpa.eclipselink.core.internal;
@@ -28,40 +28,41 @@ public class EclipseLink2_1JpaPlatformFactory
public EclipseLink2_1JpaPlatformFactory() {
super();
}
-
-
+
+
@Override
public JpaPlatform buildJpaPlatform(String id) {
return new GenericJpaPlatform(
id,
buildJpaVersion(),
- new EclipseLink2_0JpaFactory(),
+ new EclipseLink2_0JpaFactory(),
this.buildAnnotationProvider(),
- EclipseLink2_1JpaPlatformProvider.instance(),
- this.buildJpaVariation());
+ EclipseLink2_1JpaPlatformProvider.instance(),
+ this.buildJpaVariation(),
+ EclipseLink2_1JpaJpqlQueryHelper.instance());
}
-
+
@Override
protected JpaPlatform.Version buildJpaVersion() {
return new EclipseLinkVersion(
JptJpaEclipseLinkCorePlugin.ECLIPSELINK_PLATFORM_VERSION_2_1,
JpaFacet.VERSION_2_0.getVersionString());
}
-
+
@Override
protected AnnotationProvider buildAnnotationProvider() {
return new JpaAnnotationProvider(
Generic2_0JpaAnnotationDefinitionProvider.instance(),
EclipseLink2_1JpaAnnotationDefinitionProvider.instance());
}
-
+
// @Override
// protected JpaPlatformVariation buildJpaVariation() {
// return new JpaPlatformVariation() {
// public Supported getTablePerConcreteClassInheritanceIsSupported() {
// return Supported.YES;
// }
-//
+//
// public boolean isJoinTableOverridable() {
// return true;
// }
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/EclipseLink2_2JpaJpqlQueryHelper.java b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/EclipseLink2_2JpaJpqlQueryHelper.java
new file mode 100644
index 0000000000..762e694583
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/EclipseLink2_2JpaJpqlQueryHelper.java
@@ -0,0 +1,49 @@
+/*******************************************************************************
+ * Copyright (c) 2011 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 and Eclipse Distribution License v. 1.0
+ * which accompanies this distribution.
+ * The Eclipse Public License is available at http://www.eclipse.org/legal/epl-v10.html
+ * and the Eclipse Distribution License is available at
+ * http://www.eclipse.org/org/documents/edl-v10.php.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ *
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.eclipselink.core.internal;
+
+import org.eclipse.jpt.jpa.core.jpql.JpaJpqlQueryHelper;
+
+import org.eclipse.persistence.jpa.jpql.parser.EclipseLinkJPQLGrammar2_2;
+
+/**
+ * The EclipseLink 2.2 implementation of {@link JpaJpqlQueryHelper}.
+ *
+ * @version 3.1
+ * @since 3.1
+ * @author Pascal Filion
+ */
+public class EclipseLink2_2JpaJpqlQueryHelper extends AbstractEclipseLinkJpaJpqlQueryHelper {
+
+ /**
+ * The singleton instance of this helper.
+ */
+ private static final JpaJpqlQueryHelper INSTANCE = new EclipseLink2_2JpaJpqlQueryHelper();
+
+ /**
+ * Creates a new EclipseLink2_2JpaJpqlQueryHelper
.
+ */
+ private EclipseLink2_2JpaJpqlQueryHelper() {
+ super(EclipseLinkJPQLGrammar2_2.instance());
+ }
+
+ /**
+ * Returns the singleton instance of this helper.
+ *
+ * @return The singleton instance of this helper
+ */
+ public static JpaJpqlQueryHelper instance() {
+ return INSTANCE;
+ }
+}
\ No newline at end of file
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/EclipseLink2_2JpaPlatformFactory.java b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/EclipseLink2_2JpaPlatformFactory.java
index e0760dcc53..0f239825ba 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/EclipseLink2_2JpaPlatformFactory.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/EclipseLink2_2JpaPlatformFactory.java
@@ -1,11 +1,11 @@
/*******************************************************************************
- * 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
+ * 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:
+ *
+ * Contributors:
* Oracle - initial API and implementation
*******************************************************************************/
package org.eclipse.jpt.jpa.eclipselink.core.internal;
@@ -28,40 +28,41 @@ public class EclipseLink2_2JpaPlatformFactory
public EclipseLink2_2JpaPlatformFactory() {
super();
}
-
-
+
+
@Override
public JpaPlatform buildJpaPlatform(String id) {
return new GenericJpaPlatform(
id,
buildJpaVersion(),
- new EclipseLink2_0JpaFactory(),
+ new EclipseLink2_0JpaFactory(),
this.buildAnnotationProvider(),
- EclipseLink2_2JpaPlatformProvider.instance(),
- this.buildJpaVariation());
+ EclipseLink2_2JpaPlatformProvider.instance(),
+ this.buildJpaVariation(),
+ EclipseLink2_2JpaJpqlQueryHelper.instance());
}
-
+
@Override
protected JpaPlatform.Version buildJpaVersion() {
return new EclipseLinkVersion(
JptJpaEclipseLinkCorePlugin.ECLIPSELINK_PLATFORM_VERSION_2_2,
JpaFacet.VERSION_2_0.getVersionString());
}
-
+
@Override
protected AnnotationProvider buildAnnotationProvider() {
return new JpaAnnotationProvider(
Generic2_0JpaAnnotationDefinitionProvider.instance(),
EclipseLink2_2JpaAnnotationDefinitionProvider.instance());
}
-
+
// @Override
// protected JpaPlatformVariation buildJpaVariation() {
// return new JpaPlatformVariation() {
// public Supported getTablePerConcreteClassInheritanceIsSupported() {
// return Supported.YES;
// }
-//
+//
// public boolean isJoinTableOverridable() {
// return true;
// }
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/EclipseLink2_3JpaJpqlQueryHelper.java b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/EclipseLink2_3JpaJpqlQueryHelper.java
new file mode 100644
index 0000000000..206936e1b0
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/EclipseLink2_3JpaJpqlQueryHelper.java
@@ -0,0 +1,49 @@
+/*******************************************************************************
+ * Copyright (c) 2011 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 and Eclipse Distribution License v. 1.0
+ * which accompanies this distribution.
+ * The Eclipse Public License is available at http://www.eclipse.org/legal/epl-v10.html
+ * and the Eclipse Distribution License is available at
+ * http://www.eclipse.org/org/documents/edl-v10.php.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ *
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.eclipselink.core.internal;
+
+import org.eclipse.jpt.jpa.core.jpql.JpaJpqlQueryHelper;
+
+import org.eclipse.persistence.jpa.jpql.parser.EclipseLinkJPQLGrammar2_3;
+
+/**
+ * The EclipseLink 2.3 implementation of {@link JpaJpqlQueryHelper}.
+ *
+ * @version 3.1
+ * @since 3.1
+ * @author Pascal Filion
+ */
+public class EclipseLink2_3JpaJpqlQueryHelper extends AbstractEclipseLinkJpaJpqlQueryHelper {
+
+ /**
+ * The singleton instance of this helper.
+ */
+ private static final JpaJpqlQueryHelper INSTANCE = new EclipseLink2_3JpaJpqlQueryHelper();
+
+ /**
+ * Creates a new EclipseLink2_3JpaJpqlQueryHelper
.
+ */
+ private EclipseLink2_3JpaJpqlQueryHelper() {
+ super(EclipseLinkJPQLGrammar2_3.instance());
+ }
+
+ /**
+ * Returns the singleton instance of this helper.
+ *
+ * @return The singleton instance of this helper
+ */
+ public static JpaJpqlQueryHelper instance() {
+ return INSTANCE;
+ }
+}
\ No newline at end of file
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/EclipseLink2_3JpaPlatformFactory.java b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/EclipseLink2_3JpaPlatformFactory.java
index 3ef604182f..eab5437766 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/EclipseLink2_3JpaPlatformFactory.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/EclipseLink2_3JpaPlatformFactory.java
@@ -3,8 +3,8 @@
* 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:
+ *
+ * Contributors:
* Oracle - initial API and implementation
*******************************************************************************/
package org.eclipse.jpt.jpa.eclipselink.core.internal;
@@ -21,33 +21,34 @@ import org.eclipse.jpt.jpa.eclipselink.core.internal.EclipseLinkJpaPlatformFacto
public class EclipseLink2_3JpaPlatformFactory
extends EclipseLink2_0JpaPlatformFactory {
-
+
/**
* zero-argument constructor
*/
public EclipseLink2_3JpaPlatformFactory() {
super();
}
-
-
+
+
@Override
public JpaPlatform buildJpaPlatform(String id) {
return new GenericJpaPlatform(
id,
buildJpaVersion(),
- new EclipseLink2_0JpaFactory(),
+ new EclipseLink2_0JpaFactory(),
buildAnnotationProvider(),
- EclipseLink2_3JpaPlatformProvider.instance(),
- buildJpaVariation());
+ EclipseLink2_3JpaPlatformProvider.instance(),
+ buildJpaVariation(),
+ EclipseLink2_3JpaJpqlQueryHelper.instance());
}
-
+
@Override
protected JpaPlatform.Version buildJpaVersion() {
return new EclipseLinkVersion(
JptJpaEclipseLinkCorePlugin.ECLIPSELINK_PLATFORM_VERSION_2_3,
JpaFacet.VERSION_2_0.getVersionString());
}
-
+
@Override
protected AnnotationProvider buildAnnotationProvider() {
return new JpaAnnotationProvider(
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/EclipseLink2_4JpaJpqlQueryHelper.java b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/EclipseLink2_4JpaJpqlQueryHelper.java
new file mode 100644
index 0000000000..980a41636f
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/EclipseLink2_4JpaJpqlQueryHelper.java
@@ -0,0 +1,49 @@
+/*******************************************************************************
+ * Copyright (c) 2011 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 and Eclipse Distribution License v. 1.0
+ * which accompanies this distribution.
+ * The Eclipse Public License is available at http://www.eclipse.org/legal/epl-v10.html
+ * and the Eclipse Distribution License is available at
+ * http://www.eclipse.org/org/documents/edl-v10.php.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ *
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.eclipselink.core.internal;
+
+import org.eclipse.jpt.jpa.core.jpql.JpaJpqlQueryHelper;
+
+import org.eclipse.persistence.jpa.jpql.parser.EclipseLinkJPQLGrammar2_4;
+
+/**
+ * The EclipseLink 2.4 implementation of {@link JpaJpqlQueryHelper}.
+ *
+ * @version 3.1
+ * @since 3.1
+ * @author Pascal Filion
+ */
+public class EclipseLink2_4JpaJpqlQueryHelper extends AbstractEclipseLinkJpaJpqlQueryHelper {
+
+ /**
+ * The singleton instance of this helper.
+ */
+ private static final JpaJpqlQueryHelper INSTANCE = new EclipseLink2_4JpaJpqlQueryHelper();
+
+ /**
+ * Creates a new EclipseLink2_4JpaJpqlQueryHelper
.
+ */
+ private EclipseLink2_4JpaJpqlQueryHelper() {
+ super(EclipseLinkJPQLGrammar2_4.instance());
+ }
+
+ /**
+ * Returns the singleton instance of this helper.
+ *
+ * @return The singleton instance of this helper
+ */
+ public static JpaJpqlQueryHelper instance() {
+ return INSTANCE;
+ }
+}
\ No newline at end of file
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/EclipseLink2_4JpaPlatformFactory.java b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/EclipseLink2_4JpaPlatformFactory.java
index 76f8db01cc..c2dc4abfb7 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/EclipseLink2_4JpaPlatformFactory.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/EclipseLink2_4JpaPlatformFactory.java
@@ -3,8 +3,8 @@
* 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:
+ *
+ * Contributors:
* Oracle - initial API and implementation
*******************************************************************************/
package org.eclipse.jpt.jpa.eclipselink.core.internal;
@@ -35,10 +35,11 @@ public class EclipseLink2_4JpaPlatformFactory
return new GenericJpaPlatform(
id,
buildJpaVersion(),
- new EclipseLink2_0JpaFactory(),
+ new EclipseLink2_0JpaFactory(),
buildAnnotationProvider(),
- EclipseLink2_4JpaPlatformProvider.instance(),
- buildJpaVariation());
+ EclipseLink2_4JpaPlatformProvider.instance(),
+ buildJpaVariation(),
+ EclipseLink2_4JpaJpqlQueryHelper.instance());
}
@Override
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/EclipseLinkJpaJpqlQueryHelper.java b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/EclipseLinkJpaJpqlQueryHelper.java
new file mode 100644
index 0000000000..0bc8f32318
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/EclipseLinkJpaJpqlQueryHelper.java
@@ -0,0 +1,49 @@
+/*******************************************************************************
+ * Copyright (c) 2011 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 and Eclipse Distribution License v. 1.0
+ * which accompanies this distribution.
+ * The Eclipse Public License is available at http://www.eclipse.org/legal/epl-v10.html
+ * and the Eclipse Distribution License is available at
+ * http://www.eclipse.org/org/documents/edl-v10.php.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ *
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.eclipselink.core.internal;
+
+import org.eclipse.jpt.jpa.core.jpql.JpaJpqlQueryHelper;
+
+import org.eclipse.persistence.jpa.jpql.parser.EclipseLinkJPQLGrammar1;
+
+/**
+ * The EclipseLink 1.0 implementation of {@link JpaJpqlQueryHelper}.
+ *
+ * @version 2.4
+ * @since 2.4
+ * @author Pascal Filion
+ */
+public class EclipseLinkJpaJpqlQueryHelper extends AbstractEclipseLinkJpaJpqlQueryHelper {
+
+ /**
+ * The singleton instance of this helper.
+ */
+ private static final JpaJpqlQueryHelper INSTANCE = new EclipseLinkJpaJpqlQueryHelper();
+
+ /**
+ * Creates a new EclipseLinkJpaJpqlQueryHelper
.
+ */
+ private EclipseLinkJpaJpqlQueryHelper() {
+ super(EclipseLinkJPQLGrammar1.instance());
+ }
+
+ /**
+ * Returns the singleton instance of this helper.
+ *
+ * @return The singleton instance of this helper
+ */
+ public static JpaJpqlQueryHelper instance() {
+ return INSTANCE;
+ }
+}
\ No newline at end of file
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/EclipseLinkJpaPlatformFactory.java b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/EclipseLinkJpaPlatformFactory.java
index 5b510eebc0..011b6dc46c 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/EclipseLinkJpaPlatformFactory.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/EclipseLinkJpaPlatformFactory.java
@@ -3,7 +3,7 @@
* 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
******************************************************************************/
@@ -16,9 +16,9 @@ import org.eclipse.jpt.jpa.core.JpaPlatform;
import org.eclipse.jpt.jpa.core.JpaPlatformFactory;
import org.eclipse.jpt.jpa.core.JpaPlatformVariation;
import org.eclipse.jpt.jpa.core.internal.GenericJpaAnnotationDefinitionProvider;
-import org.eclipse.jpt.jpa.core.internal.JpaAnnotationProvider;
import org.eclipse.jpt.jpa.core.internal.GenericJpaPlatform;
import org.eclipse.jpt.jpa.core.internal.GenericJpaPlatformFactory.SimpleVersion;
+import org.eclipse.jpt.jpa.core.internal.JpaAnnotationProvider;
import org.eclipse.jpt.jpa.eclipselink.core.JptJpaEclipseLinkCorePlugin;
import org.eclipse.wst.common.project.facet.core.DefaultVersionComparator;
@@ -36,29 +36,30 @@ public class EclipseLinkJpaPlatformFactory
public EclipseLinkJpaPlatformFactory() {
super();
}
-
+
public JpaPlatform buildJpaPlatform(String id) {
return new GenericJpaPlatform(
id,
buildJpaVersion(),
- new EclipseLinkJpaFactory(),
- buildAnnotationProvider(),
- EclipseLinkJpaPlatformProvider.instance(),
- buildJpaPlatformVariation());
+ new EclipseLinkJpaFactory(),
+ buildAnnotationProvider(),
+ EclipseLinkJpaPlatformProvider.instance(),
+ buildJpaPlatformVariation(),
+ EclipseLinkJpaJpqlQueryHelper.instance());
}
-
+
private JpaPlatform.Version buildJpaVersion() {
return new EclipseLinkVersion(
JptJpaEclipseLinkCorePlugin.ECLIPSELINK_PLATFORM_VERSION_1_0,
JpaFacet.VERSION_1_0.getVersionString());
}
-
+
protected AnnotationProvider buildAnnotationProvider() {
return new JpaAnnotationProvider(
GenericJpaAnnotationDefinitionProvider.instance(),
EclipseLinkJpaAnnotationDefinitionProvider.instance());
}
-
+
protected JpaPlatformVariation buildJpaPlatformVariation() {
return new JpaPlatformVariation() {
public Supported getTablePerConcreteClassInheritanceIsSupported() {
@@ -85,7 +86,7 @@ public class EclipseLinkJpaPlatformFactory
public String getVersion() {
return this.eclipseLinkVersion;
}
-
+
/**
* Return whether the platform is compatible with the specified EclipseLink version.
* @see JptJpaEclipseLinkCorePlugin#ECLIPSELINK_PLATFORM_VERSION_1_0
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/jpql/spi/EclipseLinkMapping.java b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/jpql/spi/EclipseLinkMapping.java
new file mode 100644
index 0000000000..d39bc2b6ee
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/jpql/spi/EclipseLinkMapping.java
@@ -0,0 +1,113 @@
+/*******************************************************************************
+ * Copyright (c) 2011 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 and Eclipse Distribution License v. 1.0
+ * which accompanies this distribution.
+ * The Eclipse Public License is available at http://www.eclipse.org/legal/epl-v10.html
+ * and the Eclipse Distribution License is available at
+ * http://www.eclipse.org/org/documents/edl-v10.php.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ *
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.eclipselink.core.jpql.spi;
+
+import org.eclipse.jpt.jpa.core.jpql.spi.JpaMapping;
+
+import org.eclipse.jpt.jpa.core.context.AttributeMapping;
+import org.eclipse.jpt.jpa.eclipselink.core.EclipseLinkMappingKeys;
+import org.eclipse.persistence.jpa.jpql.spi.IManagedType;
+
+import static org.eclipse.persistence.jpa.jpql.spi.IEclipseLinkMappingType.*;
+import static org.eclipse.persistence.jpa.jpql.spi.IMappingType.*;
+
+/**
+ * The EclipseLink implementation of Hermes' {@link IMapping}, which adds EclipseLink specific
+ * mapping support.
+ *
+ * Provisional API: This interface is part of an interim API that is still under development and
+ * expected to change significantly before reaching stability. It is available at this early stage
+ * to solicit feedback from pioneering adopters on the understanding that any code that uses this
+ * API will almost certainly be broken (repeatedly) as the API evolves.
+ *
+ * @version 3.1
+ * @since 3.1
+ * @author Pascal Filion
+ */
+@SuppressWarnings("unused" /* For the extra import statement, see bug 330740 */)
+public class EclipseLinkMapping extends JpaMapping {
+
+ /**
+ * Creates a new EclipseLinkMapping
.
+ *
+ * @param parent The parent of this mapping
+ * @param mapping The design-time {@link AttributeMapping} wrapped by this class
+ */
+ public EclipseLinkMapping(IManagedType parent, AttributeMapping mapping) {
+ super(parent, mapping);
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ protected int calculateMappingType() {
+
+ String type = getMapping().getKey();
+
+ // Basic Collection
+ if (type == EclipseLinkMappingKeys.BASIC_COLLECTION_ATTRIBUTE_MAPPING_KEY) {
+ return BASIC_COLLECTION;
+ }
+
+ // Basic Map
+ if (type == EclipseLinkMappingKeys.BASIC_MAP_ATTRIBUTE_MAPPING_KEY) {
+ return BASIC_MAP;
+ }
+
+ // Transformation
+ if (type == EclipseLinkMappingKeys.TRANSFORMATION_ATTRIBUTE_MAPPING_KEY) {
+ return TRANSFORMATION;
+ }
+
+ // Variable 1:1
+ if (type == EclipseLinkMappingKeys.VARIABLE_ONE_TO_ONE_ATTRIBUTE_MAPPING_KEY) {
+ return VARIABLE_ONE_TO_ONE;
+ }
+
+ return super.calculateMappingType();
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public boolean isCollection() {
+ switch (getMappingType()) {
+ case BASIC_COLLECTION:
+ case BASIC_MAP:
+ case ELEMENT_COLLECTION:
+ case MANY_TO_MANY:
+ case ONE_TO_MANY: return true;
+ default: return false;
+ }
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public boolean isRelationship() {
+ switch (getMappingType()) {
+ case ELEMENT_COLLECTION:
+ case EMBEDDED_ID:
+ case MANY_TO_MANY:
+ case MANY_TO_ONE:
+ case ONE_TO_MANY:
+ case ONE_TO_ONE:
+ case VARIABLE_ONE_TO_ONE: return true;
+ default: return false;
+ }
+ }
+}
\ No newline at end of file
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/jpql/spi/EclipseLinkMappingBuilder.java b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/jpql/spi/EclipseLinkMappingBuilder.java
new file mode 100644
index 0000000000..9e21d20087
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/jpql/spi/EclipseLinkMappingBuilder.java
@@ -0,0 +1,49 @@
+/*******************************************************************************
+ * Copyright (c) 2011 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 and Eclipse Distribution License v. 1.0
+ * which accompanies this distribution.
+ * The Eclipse Public License is available at http://www.eclipse.org/legal/epl-v10.html
+ * and the Eclipse Distribution License is available at
+ * http://www.eclipse.org/org/documents/edl-v10.php.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ *
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.eclipselink.core.jpql.spi;
+
+import org.eclipse.jpt.jpa.core.context.AttributeMapping;
+import org.eclipse.persistence.jpa.jpql.spi.IManagedType;
+import org.eclipse.persistence.jpa.jpql.spi.IMapping;
+import org.eclipse.persistence.jpa.jpql.spi.IMappingBuilder;
+
+/**
+ * An implementation of {@link IMappingBuilder} that creates the EclipseLink version of Hermes's
+ * {@link IMapping}.
+ *
+ * Provisional API: This interface is part of an interim API that is still under development and
+ * expected to change significantly before reaching stability. It is available at this early stage
+ * to solicit feedback from pioneering adopters on the understanding that any code that uses this
+ * API will almost certainly be broken (repeatedly) as the API evolves.
+ *
+ * @version 2.4
+ * @since 2.4
+ * @author Pascal Filion
+ */
+public class EclipseLinkMappingBuilder implements IMappingBuilderEclipseLinkMappingBuilder
.
+ */
+ public EclipseLinkMappingBuilder() {
+ super();
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public IMapping buildMapping(IManagedType parent, AttributeMapping value) {
+ return new EclipseLinkMapping(parent, value);
+ }
+}
\ No newline at end of file
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.ui/META-INF/MANIFEST.MF b/jpa/plugins/org.eclipse.jpt.jpa.ui/META-INF/MANIFEST.MF
index 678761d693..18c3ab1397 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.ui/META-INF/MANIFEST.MF
+++ b/jpa/plugins/org.eclipse.jpt.jpa.ui/META-INF/MANIFEST.MF
@@ -32,7 +32,7 @@ Require-Bundle: org.eclipse.core.expressions;bundle-version="[3.4.0,4.0.0)",
org.eclipse.jst.common.project.facet.ui;bundle-version="[1.3.100,2.0.0)",
org.eclipse.jst.j2ee;bundle-version="[1.1.200,2.0.0)",
org.eclipse.jst.j2ee.ui;bundle-version="[1.1.200,2.0.0)",
- org.eclipse.persistence.jpa.jpql;bundle-version="[1.0.0,2.0.0)",
+ org.eclipse.persistence.jpa.jpql;bundle-version="[2.0.0,3.0.0)",
org.eclipse.ui.ide;bundle-version="[3.4.0,4.0.0)",
org.eclipse.ui.views.properties.tabbed;bundle-version="[3.4.0,4.0.0)",
org.eclipse.ui.navigator;bundle-version="[3.3.100,4.0.0)",
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/jpql/JpaJpqlContentProposalProvider.java b/jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/jpql/JpaJpqlContentProposalProvider.java
index 7f6301b8e9..c7c4d5c3fb 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/jpql/JpaJpqlContentProposalProvider.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/jpql/JpaJpqlContentProposalProvider.java
@@ -417,8 +417,10 @@ public final class JpaJpqlContentProposalProvider extends JpqlCompletionProposal
}
private void disposeQueryHelper() {
- queryHelper.dispose();
- queryHelper.disposeProvider();
+ if (queryHelper != null) {
+ queryHelper.dispose();
+ queryHelper.disposeProvider();
+ }
}
private KeyStroke findContentAssistTrigger() {
@@ -550,11 +552,14 @@ public final class JpaJpqlContentProposalProvider extends JpqlCompletionProposal
private void subjectChanged(PropertyChangeEvent e) {
- // Disposes of the internal data since the subject changed
disposeQueryHelper();
// Prevent undoing the actual query that was set
if (e.getNewValue() != null) {
+
+ namedQuery = (NamedQuery) e.getNewValue();
+ queryHelper = namedQuery.getJpaProject().getJpaPlatform().getJpqlQueryHelper();
+
sourceViewer.getUndoManager().reset();
validate();
}
@@ -568,29 +573,35 @@ public final class JpaJpqlContentProposalProvider extends JpqlCompletionProposal
*/
private void validate() {
- NamedQuery query = query();
+ // First clear any existing problems
annotationModel.removeAllAnnotations();
- if ((query != null) && !styledText.isDisposed()) {
- try {
- String jpqlQuery = styledText.getText();
- queryHelper.setQuery(query, jpqlQuery);
- String parsedJpqlQuery = queryHelper.getParsedJPQLQuery();
+ // Nothing to validate
+ if ((query() == null) ||
+ styledText.isDisposed() ||
+ StringTools.stringIsEmpty(styledText.getText())) {
- for (JPQLQueryProblem problem : sortProblems(queryHelper.validate())) {
+ return;
+ }
- // Create the range
- int[] positions = queryHelper.buildPositions(problem, parsedJpqlQuery, jpqlQuery);
+ try {
+ String jpqlQuery = styledText.getText();
+ queryHelper.setQuery(query(), jpqlQuery);
+ String parsedJpqlQuery = queryHelper.getParsedJPQLQuery();
- // Add the problem to the tool tip
- Annotation annotation = new Annotation(ERROR_TYPE, true, buildMessage(problem));
- annotationModel.addAnnotation(annotation, new Position(positions[0], positions[1] - positions[0]));
- }
- }
- finally {
- queryHelper.dispose();
+ for (JPQLQueryProblem problem : sortProblems(queryHelper.validate())) {
+
+ // Create the range
+ int[] positions = queryHelper.buildPositions(problem, parsedJpqlQuery, jpqlQuery);
+
+ // Add the problem to the tool tip
+ Annotation annotation = new Annotation(ERROR_TYPE, true, buildMessage(problem));
+ annotationModel.addAnnotation(annotation, new Position(positions[0], positions[1] - positions[0]));
}
}
+ finally {
+ queryHelper.dispose();
+ }
}
/**
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/jpql/JpqlCompletionProposalComputer.java b/jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/jpql/JpqlCompletionProposalComputer.java
index a6afab7c0c..bea30857c3 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/jpql/JpqlCompletionProposalComputer.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/jpql/JpqlCompletionProposalComputer.java
@@ -13,6 +13,8 @@
******************************************************************************/
package org.eclipse.jpt.jpa.ui.internal.jpql;
+import org.eclipse.jpt.jpa.core.jpql.JpaJpqlQueryHelper;
+
import java.util.ArrayList;
import java.util.Comparator;
import java.util.List;
@@ -21,29 +23,27 @@ import org.eclipse.jface.resource.ImageDescriptor;
import org.eclipse.jface.resource.ImageRegistry;
import org.eclipse.jpt.common.utility.internal.CollectionTools;
import org.eclipse.jpt.jpa.core.context.NamedQuery;
-import org.eclipse.jpt.jpa.core.internal.jpql.JpaJpqlQueryHelper;
import org.eclipse.jpt.jpa.ui.JptJpaUiPlugin;
import org.eclipse.jpt.jpa.ui.internal.JptUiIcons;
-import org.eclipse.persistence.jpa.internal.jpql.WordParser;
-import org.eclipse.persistence.jpa.internal.jpql.parser.Expression;
-import org.eclipse.persistence.jpa.internal.jpql.parser.IdentifierRole;
-import org.eclipse.persistence.jpa.internal.jpql.parser.JPQLExpression;
import org.eclipse.persistence.jpa.jpql.ContentAssistProposals;
+import org.eclipse.persistence.jpa.jpql.WordParser;
+import org.eclipse.persistence.jpa.jpql.parser.Expression;
+import org.eclipse.persistence.jpa.jpql.parser.IdentifierRole;
import org.eclipse.persistence.jpa.jpql.spi.IEntity;
import org.eclipse.persistence.jpa.jpql.spi.IMapping;
import org.eclipse.swt.graphics.Image;
import org.eclipse.swt.widgets.Display;
-import static org.eclipse.jpt.common.utility.internal.CollectionTools.*;
+import static org.eclipse.persistence.jpa.jpql.spi.IMappingType.*;
/**
* The abstract definition of JPQL content assist support.
*
- * @version 3.0
+ * @version 3.1
* @since 3.0
* @author Pascal Filion
*/
-@SuppressWarnings({"nls", "restriction"})
+@SuppressWarnings("nls")
abstract class JpqlCompletionProposalComputerJpqlCompletionProposalComputer
.
*/
public JpqlCompletionProposalComputer() {
super();
- queryHelper = new JpaJpqlQueryHelper();
}
/**
@@ -188,7 +187,7 @@ abstract class JpqlCompletionProposalComputerTestJpaJpqlQueryHelper
.
+ */
+ public TestJpaJpqlQueryHelper() {
+ super(JPQLGrammar2_0.instance());
+ }
+
+ public static JpaJpqlQueryHelper instance() {
+ return INSTANCE;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ protected AbstractContentAssistVisitor buildContentAssistVisitor(JPQLQueryContext queryContext) {
+ return null;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ protected AbstractGrammarValidator buildGrammarValidator(JPQLQueryContext queryContext) {
+ return null;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ protected JPQLQueryContext buildJPQLQueryContext(JPQLGrammar jpqlGrammar) {
+ return null;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public JpaManagedTypeProvider buildProvider(NamedQuery query) {
+ return null;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ protected AbstractSemanticValidator buildSemanticValidator(JPQLQueryContext queryContext) {
+ return null;
+ }
+}
\ No newline at end of file
diff --git a/jpa/tests/org.eclipse.jpt.jpa.core.tests.extension.resource/src/org/eclipse/jpt/jpa/core/tests/extension/resource/TestJpaPlatformFactory.java b/jpa/tests/org.eclipse.jpt.jpa.core.tests.extension.resource/src/org/eclipse/jpt/jpa/core/tests/extension/resource/TestJpaPlatformFactory.java
index 754eeeb007..5dc1eb4e3b 100644
--- a/jpa/tests/org.eclipse.jpt.jpa.core.tests.extension.resource/src/org/eclipse/jpt/jpa/core/tests/extension/resource/TestJpaPlatformFactory.java
+++ b/jpa/tests/org.eclipse.jpt.jpa.core.tests.extension.resource/src/org/eclipse/jpt/jpa/core/tests/extension/resource/TestJpaPlatformFactory.java
@@ -3,7 +3,7 @@
* 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
******************************************************************************/
@@ -14,9 +14,9 @@ import org.eclipse.jpt.jpa.core.JpaPlatform;
import org.eclipse.jpt.jpa.core.JpaPlatformFactory;
import org.eclipse.jpt.jpa.core.JpaPlatformVariation;
import org.eclipse.jpt.jpa.core.internal.GenericJpaAnnotationDefinitionProvider;
-import org.eclipse.jpt.jpa.core.internal.JpaAnnotationProvider;
import org.eclipse.jpt.jpa.core.internal.GenericJpaPlatform;
import org.eclipse.jpt.jpa.core.internal.GenericJpaPlatformFactory.SimpleVersion;
+import org.eclipse.jpt.jpa.core.internal.JpaAnnotationProvider;
/**
* All the state in the JPA platform should be "static" (i.e. unchanging once
@@ -32,18 +32,19 @@ public class TestJpaPlatformFactory
public TestJpaPlatformFactory() {
super();
}
-
-
+
+
public JpaPlatform buildJpaPlatform(String id) {
return new GenericJpaPlatform(
id,
buildJpaVersion(),
- new TestJpaFactory(),
- new JpaAnnotationProvider(GenericJpaAnnotationDefinitionProvider.instance()),
+ new TestJpaFactory(),
+ new JpaAnnotationProvider(GenericJpaAnnotationDefinitionProvider.instance()),
TestJpaPlatformProvider.instance(),
- buildJpaPlatformVariation());
+ buildJpaPlatformVariation(),
+ TestJpaJpqlQueryHelper.instance());
}
-
+
private JpaPlatform.Version buildJpaVersion() {
return new SimpleVersion(JpaFacet.VERSION_1_0.getVersionString()) {
@Override
@@ -52,7 +53,7 @@ public class TestJpaPlatformFactory
}
};
}
-
+
protected JpaPlatformVariation buildJpaPlatformVariation() {
return new JpaPlatformVariation() {
public Supported getTablePerConcreteClassInheritanceIsSupported() {
--
cgit v1.2.3