diff options
Diffstat (limited to 'jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal')
329 files changed, 0 insertions, 42042 deletions
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/AbstractEclipseLink2_0JpaPlatformProvider.java b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/AbstractEclipseLink2_0JpaPlatformProvider.java deleted file mode 100644 index 56f1cc4eee..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/AbstractEclipseLink2_0JpaPlatformProvider.java +++ /dev/null @@ -1,180 +0,0 @@ -/******************************************************************************* -* Copyright (c) 2009, 2011 Oracle. All rights reserved. -* This program and the accompanying materials are made available under the -* terms of the Eclipse Public License v1.0, which accompanies this distribution -* and is available at http://www.eclipse.org/legal/epl-v10.html. -* -* Contributors: -* Oracle - initial API and implementation -*******************************************************************************/ -package org.eclipse.jpt.jpa.eclipselink.core.internal; - -import java.util.ArrayList; -import org.eclipse.core.runtime.content.IContentType; -import org.eclipse.jpt.common.core.JptCommonCorePlugin; -import org.eclipse.jpt.common.core.JptResourceType; -import org.eclipse.jpt.common.utility.internal.CollectionTools; -import org.eclipse.jpt.jpa.core.JpaResourceModelProvider; -import org.eclipse.jpt.jpa.core.JptJpaCorePlugin; -import org.eclipse.jpt.jpa.core.ResourceDefinition; -import org.eclipse.jpt.jpa.core.context.java.DefaultJavaAttributeMappingDefinition; -import org.eclipse.jpt.jpa.core.context.java.JavaAttributeMappingDefinition; -import org.eclipse.jpt.jpa.core.context.java.JavaTypeMappingDefinition; -import org.eclipse.jpt.jpa.core.internal.AbstractJpaPlatformProvider; -import org.eclipse.jpt.jpa.core.internal.JarResourceModelProvider; -import org.eclipse.jpt.jpa.core.internal.JavaResourceModelProvider; -import org.eclipse.jpt.jpa.core.internal.OrmResourceModelProvider; -import org.eclipse.jpt.jpa.core.internal.PersistenceResourceModelProvider; -import org.eclipse.jpt.jpa.core.internal.context.java.JavaTransientMappingDefinition; -import org.eclipse.jpt.jpa.core.internal.jpa1.context.orm.GenericOrmXmlDefinition; -import org.eclipse.jpt.jpa.core.internal.jpa2.context.orm.GenericOrmXml2_0Definition; -import org.eclipse.jpt.jpa.eclipselink.core.JptJpaEclipseLinkCorePlugin; -import org.eclipse.jpt.jpa.eclipselink.core.internal.context.java.EclipseLinkJavaBasicCollectionMappingDefinition2_0; -import org.eclipse.jpt.jpa.eclipselink.core.internal.context.java.EclipseLinkJavaBasicMapMappingDefinition2_0; -import org.eclipse.jpt.jpa.eclipselink.core.internal.context.java.EclipseLinkJavaBasicMappingDefinition2_0; -import org.eclipse.jpt.jpa.eclipselink.core.internal.context.java.EclipseLinkJavaElementCollectionMappingDefinition2_0; -import org.eclipse.jpt.jpa.eclipselink.core.internal.context.java.EclipseLinkJavaEmbeddableDefinition2_0; -import org.eclipse.jpt.jpa.eclipselink.core.internal.context.java.EclipseLinkJavaEmbeddedIdMappingDefinition2_0; -import org.eclipse.jpt.jpa.eclipselink.core.internal.context.java.EclipseLinkJavaEmbeddedMappingDefinition2_0; -import org.eclipse.jpt.jpa.eclipselink.core.internal.context.java.EclipseLinkJavaEntityDefinition2_0; -import org.eclipse.jpt.jpa.eclipselink.core.internal.context.java.EclipseLinkJavaIdMappingDefinition2_0; -import org.eclipse.jpt.jpa.eclipselink.core.internal.context.java.EclipseLinkJavaManyToManyMappingDefinition2_0; -import org.eclipse.jpt.jpa.eclipselink.core.internal.context.java.EclipseLinkJavaManyToOneMappingDefinition2_0; -import org.eclipse.jpt.jpa.eclipselink.core.internal.context.java.EclipseLinkJavaMappedSuperclassDefinition2_0; -import org.eclipse.jpt.jpa.eclipselink.core.internal.context.java.EclipseLinkJavaOneToManyMappingDefinition2_0; -import org.eclipse.jpt.jpa.eclipselink.core.internal.context.java.EclipseLinkJavaOneToOneMappingDefinition2_0; -import org.eclipse.jpt.jpa.eclipselink.core.internal.context.java.EclipseLinkJavaTransformationMappingDefinition2_0; -import org.eclipse.jpt.jpa.eclipselink.core.internal.context.java.EclipseLinkJavaVariableOneToOneMappingDefinition2_0; -import org.eclipse.jpt.jpa.eclipselink.core.internal.context.java.EclipseLinkJavaVersionMappingDefinition2_0; -import org.eclipse.jpt.jpa.eclipselink.core.internal.context.orm.EclipseLinkOrmXml1_1Definition; -import org.eclipse.jpt.jpa.eclipselink.core.internal.context.orm.EclipseLinkOrmXml1_2Definition; -import org.eclipse.jpt.jpa.eclipselink.core.internal.context.orm.EclipseLinkOrmXml2_0Definition; -import org.eclipse.jpt.jpa.eclipselink.core.internal.context.orm.EclipseLinkOrmXmlDefinition; -import org.eclipse.jpt.jpa.eclipselink.core.internal.context.persistence.EclipseLink2_0PersistenceXmlDefinition; -import org.eclipse.jpt.jpa.eclipselink.core.internal.context.persistence.EclipseLinkPersistenceXmlDefinition; - -/** - * EclipseLink 2.0 platform config - */ -public abstract class AbstractEclipseLink2_0JpaPlatformProvider - extends AbstractJpaPlatformProvider -{ - protected AbstractEclipseLink2_0JpaPlatformProvider() { - super(); - } - - - // ********** resource models ********** - - public JptResourceType getMostRecentSupportedResourceType(IContentType contentType) { - if (contentType.equals(JptCommonCorePlugin.JAVA_SOURCE_CONTENT_TYPE)) { - return JptCommonCorePlugin.JAVA_SOURCE_RESOURCE_TYPE; - } - else if (contentType.equals(JptCommonCorePlugin.JAR_CONTENT_TYPE)) { - return JptCommonCorePlugin.JAR_RESOURCE_TYPE; - } - else if (contentType.equals(JptJpaCorePlugin.PERSISTENCE_XML_CONTENT_TYPE)) { - return JptJpaCorePlugin.PERSISTENCE_XML_2_0_RESOURCE_TYPE; - } - else if (contentType.equals(JptJpaCorePlugin.ORM_XML_CONTENT_TYPE)) { - return JptJpaCorePlugin.ORM_XML_2_0_RESOURCE_TYPE; - } - else if (contentType.equals(JptJpaEclipseLinkCorePlugin.ECLIPSELINK_ORM_XML_CONTENT_TYPE)) { - return JptJpaEclipseLinkCorePlugin.ECLIPSELINK_ORM_XML_2_0_RESOURCE_TYPE; - } - else { - throw new IllegalArgumentException(contentType.toString()); - } - } - - @Override - protected void addResourceModelProvidersTo(ArrayList<JpaResourceModelProvider> providers) { - CollectionTools.addAll(providers, RESOURCE_MODEL_PROVIDERS); - } - - // order should not be important here - protected static final JpaResourceModelProvider[] RESOURCE_MODEL_PROVIDERS = new JpaResourceModelProvider[] { - JavaResourceModelProvider.instance(), - JarResourceModelProvider.instance(), - PersistenceResourceModelProvider.instance(), - OrmResourceModelProvider.instance(), - EclipseLinkOrmResourceModelProvider.instance() - }; - - - // ********* Java type mappings ********* - - @Override - protected void addJavaTypeMappingDefinitionsTo(ArrayList<JavaTypeMappingDefinition> definitions) { - CollectionTools.addAll(definitions, JAVA_TYPE_MAPPING_DEFINITIONS); - } - - // order matches that used by EclipseLink - // NB: no EclipseLink-specific mappings - protected static final JavaTypeMappingDefinition[] JAVA_TYPE_MAPPING_DEFINITIONS = new JavaTypeMappingDefinition[] { - EclipseLinkJavaEntityDefinition2_0.instance(), - EclipseLinkJavaEmbeddableDefinition2_0.instance(), - EclipseLinkJavaMappedSuperclassDefinition2_0.instance() - }; - - - // ********* Java attribute mappings ********* - - @Override - protected void addDefaultJavaAttributeMappingDefinitionsTo(ArrayList<DefaultJavaAttributeMappingDefinition> definitions) { - CollectionTools.addAll(definitions, DEFAULT_JAVA_ATTRIBUTE_MAPPING_DEFINITIONS); - } - - // order matches that used by EclipseLink - // NB: no change from EclipseLink 1.2 to 2.0 - protected static final DefaultJavaAttributeMappingDefinition[] DEFAULT_JAVA_ATTRIBUTE_MAPPING_DEFINITIONS = new DefaultJavaAttributeMappingDefinition[] { - EclipseLinkJavaEmbeddedMappingDefinition2_0.instance(), - EclipseLinkJavaOneToManyMappingDefinition2_0.instance(), - EclipseLinkJavaOneToOneMappingDefinition2_0.instance(), - EclipseLinkJavaVariableOneToOneMappingDefinition2_0.instance(), - EclipseLinkJavaBasicMappingDefinition2_0.instance() - }; - - @Override - protected void addSpecifiedJavaAttributeMappingDefinitionsTo(ArrayList<JavaAttributeMappingDefinition> definitions) { - CollectionTools.addAll(definitions, SPECIFIED_JAVA_ATTRIBUTE_MAPPING_DEFINITIONS); - } - - // order matches that used by EclipseLink - protected static final JavaAttributeMappingDefinition[] SPECIFIED_JAVA_ATTRIBUTE_MAPPING_DEFINITIONS = new JavaAttributeMappingDefinition[] { - JavaTransientMappingDefinition.instance(), - EclipseLinkJavaBasicCollectionMappingDefinition2_0.instance(), - EclipseLinkJavaBasicMapMappingDefinition2_0.instance(), - EclipseLinkJavaElementCollectionMappingDefinition2_0.instance(), - EclipseLinkJavaIdMappingDefinition2_0.instance(), - EclipseLinkJavaVersionMappingDefinition2_0.instance(), - EclipseLinkJavaBasicMappingDefinition2_0.instance(), - EclipseLinkJavaEmbeddedMappingDefinition2_0.instance(), - EclipseLinkJavaEmbeddedIdMappingDefinition2_0.instance(), - EclipseLinkJavaTransformationMappingDefinition2_0.instance(), - EclipseLinkJavaManyToManyMappingDefinition2_0.instance(), - EclipseLinkJavaManyToOneMappingDefinition2_0.instance(), - EclipseLinkJavaOneToManyMappingDefinition2_0.instance(), - EclipseLinkJavaOneToOneMappingDefinition2_0.instance(), - EclipseLinkJavaVariableOneToOneMappingDefinition2_0.instance() - }; - - - // ********** resource definitions ********** - - @Override - protected void addResourceDefinitionsTo(ArrayList<ResourceDefinition> definitions) { - CollectionTools.addAll(definitions, RESOURCE_DEFINITIONS); - } - - protected static final ResourceDefinition[] RESOURCE_DEFINITIONS = new ResourceDefinition[] { - EclipseLinkPersistenceXmlDefinition.instance(), - EclipseLink2_0PersistenceXmlDefinition.instance(), - GenericOrmXmlDefinition.instance(), - GenericOrmXml2_0Definition.instance(), - EclipseLinkOrmXmlDefinition.instance(), - EclipseLinkOrmXml1_1Definition.instance(), - EclipseLinkOrmXml1_2Definition.instance(), - EclipseLinkOrmXml2_0Definition.instance() - }; -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/DefaultEclipseLinkJpaValidationMessages.java b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/DefaultEclipseLinkJpaValidationMessages.java deleted file mode 100644 index 532f70ab4b..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/DefaultEclipseLinkJpaValidationMessages.java +++ /dev/null @@ -1,114 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2005, 2012 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.eclipselink.core.internal; - -import java.util.Locale; -import java.util.MissingResourceException; -import java.util.ResourceBundle; -import org.eclipse.core.resources.IResource; -import org.eclipse.jpt.common.core.utility.TextRange; -import org.eclipse.jpt.common.utility.internal.StringTools; -import org.eclipse.jpt.jpa.core.JpaNode; -import org.eclipse.jpt.jpa.core.JptJpaCorePlugin; -import org.eclipse.jpt.jpa.core.internal.validation.DefaultJpaValidationMessages; -import org.eclipse.wst.validation.internal.core.Message; -import org.eclipse.wst.validation.internal.provisional.core.IMessage; - -public class DefaultEclipseLinkJpaValidationMessages { - - private static String[] DEFAULT_PARMS = new String[0]; - private static TextRange DEFAULT_TEXT_RANGE = TextRange.Empty.instance(); - - public static IMessage buildMessage(int defaultSeverity, String messageId, JpaNode targetObject) { - return buildMessage(defaultSeverity, messageId, targetObject.getResource()); - } - - public static IMessage buildMessage(int defaultSeverity, String messageId, IResource targetObject) { - return buildMessage(defaultSeverity, messageId, DEFAULT_PARMS, targetObject); - } - - public static IMessage buildMessage(int defaultSeverity, String messageId, String[] parms, JpaNode targetObject) { - return buildMessage(defaultSeverity, messageId, parms, targetObject.getResource()); - } - - public static IMessage buildMessage(int defaultSeverity, String messageId, String[] parms, IResource targetObject) { - return buildMessage(defaultSeverity, messageId, parms, targetObject, DEFAULT_TEXT_RANGE); - } - - public static IMessage buildMessage(int defaultSeverity, String messageId, JpaNode targetObject, TextRange textRange) { - return buildMessage(defaultSeverity, messageId, targetObject.getResource(), textRange); - } - - public static IMessage buildMessage(int defaultSeverity, String messageId, IResource targetObject, TextRange textRange) { - return buildMessage(defaultSeverity, messageId, DEFAULT_PARMS, targetObject, textRange); - } - - public static IMessage buildMessage(int defaultSeverity, String messageId, String[] parms, JpaNode targetObject, TextRange textRange) { - return buildMessage(defaultSeverity, messageId, parms, targetObject.getResource(), textRange); - } - - public static IMessage buildMessage(int defaultSeverity, String messageId, String[] parms, IResource targetObject, TextRange textRange) { - return DefaultJpaValidationMessages.buildMessage(defaultSeverity, messageId, parms, targetObject, textRange, MESSAGE_FACTORY); - } - - - private DefaultEclipseLinkJpaValidationMessages() { - super(); - throw new UnsupportedOperationException(); - } - - - private static final DefaultJpaValidationMessages.MessageFactory MESSAGE_FACTORY = new EclipseLinkMessageFactory(); - - /* CU private */ static class EclipseLinkMessageFactory - implements DefaultJpaValidationMessages.MessageFactory - { - public IMessage buildMessage(int severity, String messageId, String[] parms, IResource targetObject) { - // TODO check for preference override -// int prefSeverity = JpaValidationPreferences.getProblemSeverityPreference(targetObject, messageId); -// if (prefSeverity != JpaValidationPreferences.NO_SEVERITY_PREFERENCE){ -// severity = prefSeverity; -// } - IMessage message = new EclipseLinkMessage(EclipseLinkJpaValidationMessages.BUNDLE_NAME, severity, messageId, parms, targetObject); - // TODO "EclipseLink JPA" validation marker? - message.setMarkerId(JptJpaCorePlugin.VALIDATION_MARKER_ID); - return message; - } - @Override - public String toString() { - return StringTools.buildToStringFor(this); - } - } - - /** - * We have to build this message so {@link Message} uses the right class - * loader to retrieve the message bundles. - * <p> - * Another way we could potentially solve this is to have a separate - * EclispeLink JPA validator and set up the extension points so that - * it only runs against JPA projects with the EclispeLink platform.... - */ - /* CU private */ static class EclipseLinkMessage - extends Message - { - EclipseLinkMessage(String bundleName, int severity, String id, String[] params, Object target) { - super(bundleName, severity, id, params, target); - } - - @Override - public ResourceBundle getBundle(Locale locale, ClassLoader classLoader) { - try { - return super.getBundle(locale, this.getClass().getClassLoader()); - } catch (MissingResourceException ex) { - return super.getBundle(locale, classLoader); - } - } - } -} 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 deleted file mode 100644 index d134425f5f..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/EclipseLink1_1JpaPlatformFactory.java +++ /dev/null @@ -1,76 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2007, 2012 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.eclipselink.core.internal; - -import org.eclipse.jpt.common.core.AnnotationProvider; -import org.eclipse.jpt.common.core.JptResourceType; -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.context.AccessType; -import org.eclipse.jpt.jpa.core.internal.GenericJpaAnnotationDefinitionProvider; -import org.eclipse.jpt.jpa.core.internal.GenericJpaPlatform; -import org.eclipse.jpt.jpa.core.internal.JpaAnnotationProvider; -import org.eclipse.jpt.jpa.eclipselink.core.JptJpaEclipseLinkCorePlugin; -import org.eclipse.jpt.jpa.eclipselink.core.internal.EclipseLinkJpaPlatformFactory.EclipseLinkVersion; -import org.eclipse.persistence.jpa.jpql.parser.EclipseLinkJPQLGrammar1; - -/** - * All the state in the JPA platform should be "static" (i.e. unchanging once - * it is initialized). - */ -public class EclipseLink1_1JpaPlatformFactory - implements JpaPlatformFactory -{ - /** - * zero-argument constructor - */ - public EclipseLink1_1JpaPlatformFactory() { - super(); - } - - public JpaPlatform buildJpaPlatform(String id) { - return new GenericJpaPlatform( - id, - buildJpaVersion(), - new EclipseLinkJpaFactory(), - buildAnnotationProvider(), - EclipseLink1_1JpaPlatformProvider.instance(), - buildJpaPlatformVariation(), - EclipseLinkJPQLGrammar1.instance()); - } - - protected AnnotationProvider buildAnnotationProvider() { - return new JpaAnnotationProvider( - GenericJpaAnnotationDefinitionProvider.instance(), - EclipseLinkJpaAnnotationDefinitionProvider.instance()); - } - - protected JpaPlatformVariation buildJpaPlatformVariation() { - return new JpaPlatformVariation() { - public Supported getTablePerConcreteClassInheritanceIsSupported() { - return Supported.YES; - } - public boolean isJoinTableOverridable() { - return false; - } - public AccessType[] getSupportedAccessTypes(JptResourceType resourceType) { - return GENERIC_SUPPORTED_ACCESS_TYPES; - } - }; - } - - private JpaPlatform.Version buildJpaVersion() { - return new EclipseLinkVersion( - JptJpaEclipseLinkCorePlugin.ECLIPSELINK_PLATFORM_VERSION_1_1, - JpaFacet.VERSION_1_0.getVersionString()); - } -}
\ 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_1JpaPlatformProvider.java b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/EclipseLink1_1JpaPlatformProvider.java deleted file mode 100644 index fb4d28faed..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/EclipseLink1_1JpaPlatformProvider.java +++ /dev/null @@ -1,187 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2009, 2011 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - *******************************************************************************/ -package org.eclipse.jpt.jpa.eclipselink.core.internal; - -import java.util.ArrayList; -import org.eclipse.core.runtime.content.IContentType; -import org.eclipse.jpt.common.core.JptCommonCorePlugin; -import org.eclipse.jpt.common.core.JptResourceType; -import org.eclipse.jpt.common.utility.internal.CollectionTools; -import org.eclipse.jpt.jpa.core.JpaPlatformProvider; -import org.eclipse.jpt.jpa.core.JpaResourceModelProvider; -import org.eclipse.jpt.jpa.core.JptJpaCorePlugin; -import org.eclipse.jpt.jpa.core.ResourceDefinition; -import org.eclipse.jpt.jpa.core.context.java.DefaultJavaAttributeMappingDefinition; -import org.eclipse.jpt.jpa.core.context.java.JavaAttributeMappingDefinition; -import org.eclipse.jpt.jpa.core.context.java.JavaTypeMappingDefinition; -import org.eclipse.jpt.jpa.core.internal.AbstractJpaPlatformProvider; -import org.eclipse.jpt.jpa.core.internal.JarResourceModelProvider; -import org.eclipse.jpt.jpa.core.internal.JavaResourceModelProvider; -import org.eclipse.jpt.jpa.core.internal.OrmResourceModelProvider; -import org.eclipse.jpt.jpa.core.internal.PersistenceResourceModelProvider; -import org.eclipse.jpt.jpa.core.internal.context.java.JavaEmbeddedIdMappingDefinition; -import org.eclipse.jpt.jpa.core.internal.context.java.JavaEmbeddedMappingDefinition; -import org.eclipse.jpt.jpa.core.internal.context.java.JavaTransientMappingDefinition; -import org.eclipse.jpt.jpa.core.internal.jpa1.context.orm.GenericOrmXmlDefinition; -import org.eclipse.jpt.jpa.eclipselink.core.JptJpaEclipseLinkCorePlugin; -import org.eclipse.jpt.jpa.eclipselink.core.internal.context.java.EclipseLinkJavaBasicCollectionMappingDefinition; -import org.eclipse.jpt.jpa.eclipselink.core.internal.context.java.EclipseLinkJavaBasicMapMappingDefinition; -import org.eclipse.jpt.jpa.eclipselink.core.internal.context.java.EclipseLinkJavaBasicMappingDefinition; -import org.eclipse.jpt.jpa.eclipselink.core.internal.context.java.EclipseLinkJavaEmbeddableDefinition; -import org.eclipse.jpt.jpa.eclipselink.core.internal.context.java.EclipseLinkJavaEntityDefinition; -import org.eclipse.jpt.jpa.eclipselink.core.internal.context.java.EclipseLinkJavaIdMappingDefinition; -import org.eclipse.jpt.jpa.eclipselink.core.internal.context.java.EclipseLinkJavaManyToManyMappingDefinition; -import org.eclipse.jpt.jpa.eclipselink.core.internal.context.java.EclipseLinkJavaManyToOneMappingDefinition; -import org.eclipse.jpt.jpa.eclipselink.core.internal.context.java.EclipseLinkJavaMappedSuperclassDefinition; -import org.eclipse.jpt.jpa.eclipselink.core.internal.context.java.EclipseLinkJavaOneToManyMappingDefinition; -import org.eclipse.jpt.jpa.eclipselink.core.internal.context.java.EclipseLinkJavaOneToOneMappingDefinition; -import org.eclipse.jpt.jpa.eclipselink.core.internal.context.java.EclipseLinkJavaTransformationMappingDefinition; -import org.eclipse.jpt.jpa.eclipselink.core.internal.context.java.EclipseLinkJavaVariableOneToOneMappingDefinition; -import org.eclipse.jpt.jpa.eclipselink.core.internal.context.java.EclipseLinkJavaVersionMappingDefinition; -import org.eclipse.jpt.jpa.eclipselink.core.internal.context.orm.EclipseLinkOrmXml1_1Definition; -import org.eclipse.jpt.jpa.eclipselink.core.internal.context.orm.EclipseLinkOrmXmlDefinition; -import org.eclipse.jpt.jpa.eclipselink.core.internal.context.persistence.EclipseLinkPersistenceXmlDefinition; - -/** - * EclipseLink platform - */ -public class EclipseLink1_1JpaPlatformProvider - extends AbstractJpaPlatformProvider { - - // singleton - private static final JpaPlatformProvider INSTANCE = new EclipseLink1_1JpaPlatformProvider(); - - - /** - * Return the singleton. - */ - public static JpaPlatformProvider instance() { - return INSTANCE; - } - - - /** - * Enforce singleton usage - */ - private EclipseLink1_1JpaPlatformProvider() { - super(); - } - - - // ********** resource models ********** - - public JptResourceType getMostRecentSupportedResourceType(IContentType contentType) { - if (contentType.equals(JptCommonCorePlugin.JAVA_SOURCE_CONTENT_TYPE)) { - return JptCommonCorePlugin.JAVA_SOURCE_RESOURCE_TYPE; - } - else if (contentType.equals(JptCommonCorePlugin.JAR_CONTENT_TYPE)) { - return JptCommonCorePlugin.JAR_RESOURCE_TYPE; - } - else if (contentType.equals(JptJpaCorePlugin.PERSISTENCE_XML_CONTENT_TYPE)) { - return JptJpaCorePlugin.PERSISTENCE_XML_1_0_RESOURCE_TYPE; - } - else if (contentType.equals(JptJpaCorePlugin.ORM_XML_CONTENT_TYPE)) { - return JptJpaCorePlugin.ORM_XML_1_0_RESOURCE_TYPE; - } - else if (contentType.equals(JptJpaEclipseLinkCorePlugin.ECLIPSELINK_ORM_XML_CONTENT_TYPE)) { - return JptJpaEclipseLinkCorePlugin.ECLIPSELINK_ORM_XML_1_1_RESOURCE_TYPE; - } - else { - throw new IllegalArgumentException(contentType.toString()); - } - } - - @Override - protected void addResourceModelProvidersTo(ArrayList<JpaResourceModelProvider> providers) { - CollectionTools.addAll(providers, RESOURCE_MODEL_PROVIDERS); - } - - // order should not be important here - protected static final JpaResourceModelProvider[] RESOURCE_MODEL_PROVIDERS = new JpaResourceModelProvider[] { - JavaResourceModelProvider.instance(), - JarResourceModelProvider.instance(), - PersistenceResourceModelProvider.instance(), - OrmResourceModelProvider.instance(), - EclipseLinkOrmResourceModelProvider.instance() - }; - - - // ********* Java type mappings ********* - - @Override - protected void addJavaTypeMappingDefinitionsTo(ArrayList<JavaTypeMappingDefinition> definitions) { - CollectionTools.addAll(definitions, JAVA_TYPE_MAPPING_DEFINITIONS); - } - - // order matches that used by EclipseLink - // NB: no EclipseLink-specific mappings - protected static final JavaTypeMappingDefinition[] JAVA_TYPE_MAPPING_DEFINITIONS = new JavaTypeMappingDefinition[] { - EclipseLinkJavaEntityDefinition.instance(), - EclipseLinkJavaEmbeddableDefinition.instance(), - EclipseLinkJavaMappedSuperclassDefinition.instance() - }; - - - // ********* Java attribute mappings ********* - - @Override - protected void addDefaultJavaAttributeMappingDefinitionsTo(ArrayList<DefaultJavaAttributeMappingDefinition> definitions) { - CollectionTools.addAll(definitions, DEFAULT_JAVA_ATTRIBUTE_MAPPING_DEFINITIONS); - } - - // order matches that used by EclipseLink - // NB: no change from EclipseLink 1.0 to 1.1 - protected static final DefaultJavaAttributeMappingDefinition[] DEFAULT_JAVA_ATTRIBUTE_MAPPING_DEFINITIONS = new DefaultJavaAttributeMappingDefinition[] { - JavaEmbeddedMappingDefinition.instance(), - EclipseLinkJavaOneToManyMappingDefinition.instance(), - EclipseLinkJavaOneToOneMappingDefinition.instance(), - EclipseLinkJavaVariableOneToOneMappingDefinition.instance(), - EclipseLinkJavaBasicMappingDefinition.instance() - }; - - @Override - protected void addSpecifiedJavaAttributeMappingDefinitionsTo(ArrayList<JavaAttributeMappingDefinition> definitions) { - CollectionTools.addAll(definitions, SPECIFIED_JAVA_ATTRIBUTE_MAPPING_DEFINITIONS); - } - - // order matches that used by EclipseLink - // NB: no change from EclipseLink 1.0 to 1.1 - protected static final JavaAttributeMappingDefinition[] SPECIFIED_JAVA_ATTRIBUTE_MAPPING_DEFINITIONS = new JavaAttributeMappingDefinition[] { - JavaTransientMappingDefinition.instance(), - EclipseLinkJavaBasicCollectionMappingDefinition.instance(), - EclipseLinkJavaBasicMapMappingDefinition.instance(), - EclipseLinkJavaIdMappingDefinition.instance(), - EclipseLinkJavaVersionMappingDefinition.instance(), - EclipseLinkJavaBasicMappingDefinition.instance(), - JavaEmbeddedMappingDefinition.instance(), - JavaEmbeddedIdMappingDefinition.instance(), - EclipseLinkJavaTransformationMappingDefinition.instance(), - EclipseLinkJavaManyToManyMappingDefinition.instance(), - EclipseLinkJavaManyToOneMappingDefinition.instance(), - EclipseLinkJavaOneToManyMappingDefinition.instance(), - EclipseLinkJavaOneToOneMappingDefinition.instance(), - EclipseLinkJavaVariableOneToOneMappingDefinition.instance() - }; - - - // ********** resource definitions ********** - - @Override - protected void addResourceDefinitionsTo(ArrayList<ResourceDefinition> definitions) { - CollectionTools.addAll(definitions, RESOURCE_DEFINITIONS); - } - - protected static final ResourceDefinition[] RESOURCE_DEFINITIONS = new ResourceDefinition[] { - EclipseLinkPersistenceXmlDefinition.instance(), - GenericOrmXmlDefinition.instance(), - EclipseLinkOrmXmlDefinition.instance(), - EclipseLinkOrmXml1_1Definition.instance() - }; -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/EclipseLink1_2JpaAnnotationDefinitionProvider.java b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/EclipseLink1_2JpaAnnotationDefinitionProvider.java deleted file mode 100644 index f0776d8918..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/EclipseLink1_2JpaAnnotationDefinitionProvider.java +++ /dev/null @@ -1,52 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010, 2011 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.eclipselink.core.internal; - -import java.util.ArrayList; -import org.eclipse.jpt.common.core.resource.java.AnnotationDefinition; -import org.eclipse.jpt.common.core.resource.java.NestableAnnotationDefinition; -import org.eclipse.jpt.jpa.core.JpaAnnotationDefinitionProvider; -import org.eclipse.jpt.jpa.core.internal.AbstractJpaAnnotationDefinitionProvider; -import org.eclipse.jpt.jpa.core.internal.jpa2.resource.java.Access2_0AnnotationDefinition; - -/** - * Provides annotations for 1.2 EclipseLink platform - */ -public class EclipseLink1_2JpaAnnotationDefinitionProvider - extends AbstractJpaAnnotationDefinitionProvider -{ - // singleton - private static final JpaAnnotationDefinitionProvider INSTANCE = new EclipseLink1_2JpaAnnotationDefinitionProvider(); - - /** - * Return the singleton - */ - public static JpaAnnotationDefinitionProvider instance() { - return INSTANCE; - } - - - /** - * Enforce singleton usage - */ - private EclipseLink1_2JpaAnnotationDefinitionProvider() { - super(); - } - - @Override - protected void addAnnotationDefinitionsTo(ArrayList<AnnotationDefinition> definitions) { - definitions.add(Access2_0AnnotationDefinition.instance()); - } - - @Override - protected void addNestableAnnotationDefinitionsTo(ArrayList<NestableAnnotationDefinition> definitions) { - // nothing new for EclipseLink 1.2 - } -} 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 deleted file mode 100644 index cf82ed8b66..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/EclipseLink1_2JpaPlatformFactory.java +++ /dev/null @@ -1,77 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2007, 2012 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.eclipselink.core.internal; - -import org.eclipse.jpt.common.core.AnnotationProvider; -import org.eclipse.jpt.common.core.JptResourceType; -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.context.AccessType; -import org.eclipse.jpt.jpa.core.internal.GenericJpaAnnotationDefinitionProvider; -import org.eclipse.jpt.jpa.core.internal.GenericJpaPlatform; -import org.eclipse.jpt.jpa.core.internal.JpaAnnotationProvider; -import org.eclipse.jpt.jpa.eclipselink.core.JptJpaEclipseLinkCorePlugin; -import org.eclipse.jpt.jpa.eclipselink.core.internal.EclipseLinkJpaPlatformFactory.EclipseLinkVersion; -import org.eclipse.persistence.jpa.jpql.parser.EclipseLinkJPQLGrammar1; - -/** - * All the state in the JPA platform should be "static" (i.e. unchanging once - * it is initialized). - */ -public class EclipseLink1_2JpaPlatformFactory - implements JpaPlatformFactory -{ - /** - * zero-argument constructor - */ - public EclipseLink1_2JpaPlatformFactory() { - super(); - } - - public JpaPlatform buildJpaPlatform(String id) { - return new GenericJpaPlatform( - id, - buildJpaVersion(), - new EclipseLinkJpaFactory(), - buildAnnotationProvider(), - EclipseLink1_2JpaPlatformProvider.instance(), - buildJpaPlatformVariation(), - EclipseLinkJPQLGrammar1.instance()); - } - - protected AnnotationProvider buildAnnotationProvider() { - return new JpaAnnotationProvider( - GenericJpaAnnotationDefinitionProvider.instance(), - EclipseLinkJpaAnnotationDefinitionProvider.instance(), - EclipseLink1_2JpaAnnotationDefinitionProvider.instance()); - } - - protected JpaPlatformVariation buildJpaPlatformVariation() { - return new JpaPlatformVariation() { - public Supported getTablePerConcreteClassInheritanceIsSupported() { - return Supported.YES; - } - public boolean isJoinTableOverridable() { - return false; - } - public AccessType[] getSupportedAccessTypes(JptResourceType resourceType) { - return GENERIC_SUPPORTED_ACCESS_TYPES; - } - }; - } - - private JpaPlatform.Version buildJpaVersion() { - return new EclipseLinkVersion( - JptJpaEclipseLinkCorePlugin.ECLIPSELINK_PLATFORM_VERSION_1_2, - JpaFacet.VERSION_1_0.getVersionString()); - } -}
\ 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_2JpaPlatformProvider.java b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/EclipseLink1_2JpaPlatformProvider.java deleted file mode 100644 index 1b31d88dbe..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/EclipseLink1_2JpaPlatformProvider.java +++ /dev/null @@ -1,190 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2009, 2011 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - *******************************************************************************/ -package org.eclipse.jpt.jpa.eclipselink.core.internal; - -import java.util.ArrayList; -import org.eclipse.core.runtime.content.IContentType; -import org.eclipse.jpt.common.core.JptCommonCorePlugin; -import org.eclipse.jpt.common.core.JptResourceType; -import org.eclipse.jpt.common.utility.internal.CollectionTools; -import org.eclipse.jpt.jpa.core.JpaPlatformProvider; -import org.eclipse.jpt.jpa.core.JpaResourceModelProvider; -import org.eclipse.jpt.jpa.core.JptJpaCorePlugin; -import org.eclipse.jpt.jpa.core.ResourceDefinition; -import org.eclipse.jpt.jpa.core.context.java.DefaultJavaAttributeMappingDefinition; -import org.eclipse.jpt.jpa.core.context.java.JavaAttributeMappingDefinition; -import org.eclipse.jpt.jpa.core.context.java.JavaTypeMappingDefinition; -import org.eclipse.jpt.jpa.core.internal.AbstractJpaPlatformProvider; -import org.eclipse.jpt.jpa.core.internal.JarResourceModelProvider; -import org.eclipse.jpt.jpa.core.internal.JavaResourceModelProvider; -import org.eclipse.jpt.jpa.core.internal.OrmResourceModelProvider; -import org.eclipse.jpt.jpa.core.internal.PersistenceResourceModelProvider; -import org.eclipse.jpt.jpa.core.internal.context.java.JavaBasicMappingDefinition; -import org.eclipse.jpt.jpa.core.internal.context.java.JavaEmbeddedIdMappingDefinition; -import org.eclipse.jpt.jpa.core.internal.context.java.JavaEmbeddedMappingDefinition; -import org.eclipse.jpt.jpa.core.internal.context.java.JavaTransientMappingDefinition; -import org.eclipse.jpt.jpa.core.internal.jpa1.context.orm.GenericOrmXmlDefinition; -import org.eclipse.jpt.jpa.eclipselink.core.JptJpaEclipseLinkCorePlugin; -import org.eclipse.jpt.jpa.eclipselink.core.internal.context.java.EclipseLinkJavaBasicCollectionMappingDefinition; -import org.eclipse.jpt.jpa.eclipselink.core.internal.context.java.EclipseLinkJavaBasicMapMappingDefinition; -import org.eclipse.jpt.jpa.eclipselink.core.internal.context.java.EclipseLinkJavaBasicMappingDefinition; -import org.eclipse.jpt.jpa.eclipselink.core.internal.context.java.EclipseLinkJavaEmbeddableDefinition; -import org.eclipse.jpt.jpa.eclipselink.core.internal.context.java.EclipseLinkJavaEntityDefinition; -import org.eclipse.jpt.jpa.eclipselink.core.internal.context.java.EclipseLinkJavaIdMappingDefinition; -import org.eclipse.jpt.jpa.eclipselink.core.internal.context.java.EclipseLinkJavaManyToManyMappingDefinition; -import org.eclipse.jpt.jpa.eclipselink.core.internal.context.java.EclipseLinkJavaManyToOneMappingDefinition; -import org.eclipse.jpt.jpa.eclipselink.core.internal.context.java.EclipseLinkJavaMappedSuperclassDefinition; -import org.eclipse.jpt.jpa.eclipselink.core.internal.context.java.EclipseLinkJavaOneToManyMappingDefinition; -import org.eclipse.jpt.jpa.eclipselink.core.internal.context.java.EclipseLinkJavaOneToOneMappingDefinition; -import org.eclipse.jpt.jpa.eclipselink.core.internal.context.java.EclipseLinkJavaTransformationMappingDefinition; -import org.eclipse.jpt.jpa.eclipselink.core.internal.context.java.EclipseLinkJavaVariableOneToOneMappingDefinition; -import org.eclipse.jpt.jpa.eclipselink.core.internal.context.java.EclipseLinkJavaVersionMappingDefinition; -import org.eclipse.jpt.jpa.eclipselink.core.internal.context.orm.EclipseLinkOrmXml1_1Definition; -import org.eclipse.jpt.jpa.eclipselink.core.internal.context.orm.EclipseLinkOrmXml1_2Definition; -import org.eclipse.jpt.jpa.eclipselink.core.internal.context.orm.EclipseLinkOrmXmlDefinition; -import org.eclipse.jpt.jpa.eclipselink.core.internal.context.persistence.EclipseLinkPersistenceXmlDefinition; - -/** - * EclipseLink platform - */ -public class EclipseLink1_2JpaPlatformProvider - extends AbstractJpaPlatformProvider { - - // singleton - private static final JpaPlatformProvider INSTANCE = new EclipseLink1_2JpaPlatformProvider(); - - - /** - * Return the singleton. - */ - public static JpaPlatformProvider instance() { - return INSTANCE; - } - - - /** - * Enforce singleton usage - */ - private EclipseLink1_2JpaPlatformProvider() { - super(); - } - - - // ********** resource models ********** - - public JptResourceType getMostRecentSupportedResourceType(IContentType contentType) { - if (contentType.equals(JptCommonCorePlugin.JAVA_SOURCE_CONTENT_TYPE)) { - return JptCommonCorePlugin.JAVA_SOURCE_RESOURCE_TYPE; - } - else if (contentType.equals(JptCommonCorePlugin.JAR_CONTENT_TYPE)) { - return JptCommonCorePlugin.JAR_RESOURCE_TYPE; - } - else if (contentType.equals(JptJpaCorePlugin.PERSISTENCE_XML_CONTENT_TYPE)) { - return JptJpaCorePlugin.PERSISTENCE_XML_1_0_RESOURCE_TYPE; - } - else if (contentType.equals(JptJpaCorePlugin.ORM_XML_CONTENT_TYPE)) { - return JptJpaCorePlugin.ORM_XML_1_0_RESOURCE_TYPE; - } - else if (contentType.equals(JptJpaEclipseLinkCorePlugin.ECLIPSELINK_ORM_XML_CONTENT_TYPE)) { - return JptJpaEclipseLinkCorePlugin.ECLIPSELINK_ORM_XML_1_2_RESOURCE_TYPE; - } - else { - throw new IllegalArgumentException(contentType.toString()); - } - } - - @Override - protected void addResourceModelProvidersTo(ArrayList<JpaResourceModelProvider> providers) { - CollectionTools.addAll(providers, RESOURCE_MODEL_PROVIDERS); - } - - // order should not be important here - protected static final JpaResourceModelProvider[] RESOURCE_MODEL_PROVIDERS = new JpaResourceModelProvider[] { - JavaResourceModelProvider.instance(), - JarResourceModelProvider.instance(), - PersistenceResourceModelProvider.instance(), - OrmResourceModelProvider.instance(), - EclipseLinkOrmResourceModelProvider.instance() - }; - - - // ********* Java type mappings ********* - - @Override - protected void addJavaTypeMappingDefinitionsTo(ArrayList<JavaTypeMappingDefinition> definitions) { - CollectionTools.addAll(definitions, JAVA_TYPE_MAPPING_DEFINITIONS); - } - - // order matches that used by EclipseLink - // NB: no EclipseLink-specific mappings - protected static final JavaTypeMappingDefinition[] JAVA_TYPE_MAPPING_DEFINITIONS = new JavaTypeMappingDefinition[] { - EclipseLinkJavaEntityDefinition.instance(), - EclipseLinkJavaEmbeddableDefinition.instance(), - EclipseLinkJavaMappedSuperclassDefinition.instance() - }; - - - // ********* Java attribute mappings ********* - - @Override - protected void addDefaultJavaAttributeMappingDefinitionsTo(ArrayList<DefaultJavaAttributeMappingDefinition> definitions) { - CollectionTools.addAll(definitions, DEFAULT_JAVA_ATTRIBUTE_MAPPING_DEFINITIONS); - } - - // order matches that used by EclipseLink - // NB: no change from EclipseLink 1.1 to 1.2 - protected static final DefaultJavaAttributeMappingDefinition[] DEFAULT_JAVA_ATTRIBUTE_MAPPING_DEFINITIONS = new DefaultJavaAttributeMappingDefinition[] { - JavaEmbeddedMappingDefinition.instance(), - EclipseLinkJavaOneToManyMappingDefinition.instance(), - EclipseLinkJavaOneToOneMappingDefinition.instance(), - EclipseLinkJavaVariableOneToOneMappingDefinition.instance(), - EclipseLinkJavaBasicMappingDefinition.instance() - }; - - @Override - protected void addSpecifiedJavaAttributeMappingDefinitionsTo(ArrayList<JavaAttributeMappingDefinition> definitions) { - CollectionTools.addAll(definitions, SPECIFIED_JAVA_ATTRIBUTE_MAPPING_DEFINITIONS); - } - - // order matches that used by EclipseLink - // NB: no change from EclipseLink 1.1 to 1.2 - protected static final JavaAttributeMappingDefinition[] SPECIFIED_JAVA_ATTRIBUTE_MAPPING_DEFINITIONS = new JavaAttributeMappingDefinition[] { - JavaTransientMappingDefinition.instance(), - EclipseLinkJavaBasicCollectionMappingDefinition.instance(), - EclipseLinkJavaBasicMapMappingDefinition.instance(), - EclipseLinkJavaIdMappingDefinition.instance(), - EclipseLinkJavaVersionMappingDefinition.instance(), - JavaBasicMappingDefinition.instance(), - JavaEmbeddedMappingDefinition.instance(), - JavaEmbeddedIdMappingDefinition.instance(), - EclipseLinkJavaTransformationMappingDefinition.instance(), - EclipseLinkJavaManyToManyMappingDefinition.instance(), - EclipseLinkJavaManyToOneMappingDefinition.instance(), - EclipseLinkJavaOneToManyMappingDefinition.instance(), - EclipseLinkJavaOneToOneMappingDefinition.instance(), - EclipseLinkJavaVariableOneToOneMappingDefinition.instance() - }; - - - // ********** resource definitions ********** - - @Override - protected void addResourceDefinitionsTo(ArrayList<ResourceDefinition> definitions) { - CollectionTools.addAll(definitions, RESOURCE_DEFINITIONS); - } - - protected static final ResourceDefinition[] RESOURCE_DEFINITIONS = new ResourceDefinition[] { - EclipseLinkPersistenceXmlDefinition.instance(), - GenericOrmXmlDefinition.instance(), - EclipseLinkOrmXmlDefinition.instance(), - EclipseLinkOrmXml1_1Definition.instance(), - EclipseLinkOrmXml1_2Definition.instance() - }; -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/EclipseLink2_0JpaAnnotationDefinitionProvider.java b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/EclipseLink2_0JpaAnnotationDefinitionProvider.java deleted file mode 100644 index 229346a442..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/EclipseLink2_0JpaAnnotationDefinitionProvider.java +++ /dev/null @@ -1,100 +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, 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.eclipselink.core.internal; - -import java.util.ArrayList; -import org.eclipse.jpt.common.core.resource.java.AnnotationDefinition; -import org.eclipse.jpt.common.core.resource.java.NestableAnnotationDefinition; -import org.eclipse.jpt.common.utility.internal.CollectionTools; -import org.eclipse.jpt.jpa.core.JpaAnnotationDefinitionProvider; -import org.eclipse.jpt.jpa.core.internal.AbstractJpaAnnotationDefinitionProvider; -import org.eclipse.jpt.jpa.eclipselink.core.internal.resource.java.EclipseLinkBasicCollectionAnnotationDefinition; -import org.eclipse.jpt.jpa.eclipselink.core.internal.resource.java.EclipseLinkBasicMapAnnotationDefinition; -import org.eclipse.jpt.jpa.eclipselink.core.internal.resource.java.EclipseLinkCacheAnnotationDefinition; -import org.eclipse.jpt.jpa.eclipselink.core.internal.resource.java.EclipseLinkChangeTrackingAnnotationDefinition; -import org.eclipse.jpt.jpa.eclipselink.core.internal.resource.java.EclipseLinkConvertAnnotationDefinition; -import org.eclipse.jpt.jpa.eclipselink.core.internal.resource.java.EclipseLinkConverterAnnotationDefinition; -import org.eclipse.jpt.jpa.eclipselink.core.internal.resource.java.EclipseLinkCustomizerAnnotationDefinition; -import org.eclipse.jpt.jpa.eclipselink.core.internal.resource.java.EclipseLinkExistenceCheckingAnnotationDefinition; -import org.eclipse.jpt.jpa.eclipselink.core.internal.resource.java.EclipseLinkJoinFetchAnnotationDefinition; -import org.eclipse.jpt.jpa.eclipselink.core.internal.resource.java.EclipseLinkMapKeyConvert2_0AnnotationDefinition; -import org.eclipse.jpt.jpa.eclipselink.core.internal.resource.java.EclipseLinkMutableAnnotationDefinition; -import org.eclipse.jpt.jpa.eclipselink.core.internal.resource.java.EclipseLinkObjectTypeConverterAnnotationDefinition; -import org.eclipse.jpt.jpa.eclipselink.core.internal.resource.java.EclipseLinkPrimaryKeyAnnotationDefinition; -import org.eclipse.jpt.jpa.eclipselink.core.internal.resource.java.EclipseLinkPrivateOwnedAnnotationDefinition; -import org.eclipse.jpt.jpa.eclipselink.core.internal.resource.java.EclipseLinkReadOnlyAnnotationDefinition; -import org.eclipse.jpt.jpa.eclipselink.core.internal.resource.java.EclipseLinkReadTransformerAnnotationDefinition; -import org.eclipse.jpt.jpa.eclipselink.core.internal.resource.java.EclipseLinkStructConverterAnnotationDefinition; -import org.eclipse.jpt.jpa.eclipselink.core.internal.resource.java.EclipseLinkTransformationAnnotationDefinition; -import org.eclipse.jpt.jpa.eclipselink.core.internal.resource.java.EclipseLinkTypeConverterAnnotationDefinition; -import org.eclipse.jpt.jpa.eclipselink.core.internal.resource.java.EclipseLinkVariableOneToOneAnnotationDefinition; -import org.eclipse.jpt.jpa.eclipselink.core.internal.resource.java.EclipseLinkWriteTransformerAnnotationDefinition; - -/** - * Provides annotations for 2.0 EclipseLink platform - */ -public class EclipseLink2_0JpaAnnotationDefinitionProvider - extends AbstractJpaAnnotationDefinitionProvider -{ - // singleton - private static final JpaAnnotationDefinitionProvider INSTANCE = new EclipseLink2_0JpaAnnotationDefinitionProvider(); - - /** - * Return the singleton - */ - public static JpaAnnotationDefinitionProvider instance() { - return INSTANCE; - } - - /** - * Enforce singleton usage - */ - private EclipseLink2_0JpaAnnotationDefinitionProvider() { - super(); - } - - @Override - protected void addAnnotationDefinitionsTo(ArrayList<AnnotationDefinition> definitions) { - CollectionTools.addAll(definitions, ANNOTATION_DEFINITIONS); - } - - protected static final AnnotationDefinition[] ANNOTATION_DEFINITIONS = new AnnotationDefinition[] { - EclipseLinkBasicCollectionAnnotationDefinition.instance(), - EclipseLinkBasicMapAnnotationDefinition.instance(), - EclipseLinkCacheAnnotationDefinition.instance(), - EclipseLinkChangeTrackingAnnotationDefinition.instance(), - EclipseLinkConvertAnnotationDefinition.instance(), - EclipseLinkCustomizerAnnotationDefinition.instance(), - EclipseLinkExistenceCheckingAnnotationDefinition.instance(), - EclipseLinkJoinFetchAnnotationDefinition.instance(), - EclipseLinkMapKeyConvert2_0AnnotationDefinition.instance(), - EclipseLinkMutableAnnotationDefinition.instance(), - EclipseLinkPrimaryKeyAnnotationDefinition.instance(), - EclipseLinkPrivateOwnedAnnotationDefinition.instance(), - EclipseLinkReadOnlyAnnotationDefinition.instance(), - EclipseLinkReadTransformerAnnotationDefinition.instance(), - EclipseLinkTransformationAnnotationDefinition.instance(), - EclipseLinkVariableOneToOneAnnotationDefinition.instance(), - EclipseLinkWriteTransformerAnnotationDefinition.instance() - }; - - @Override - protected void addNestableAnnotationDefinitionsTo(ArrayList<NestableAnnotationDefinition> definitions) { - CollectionTools.addAll(definitions, NESTABLE_ANNOTATION_DEFINITIONS); - } - - protected static final NestableAnnotationDefinition[] NESTABLE_ANNOTATION_DEFINITIONS = new NestableAnnotationDefinition[] { - EclipseLinkConverterAnnotationDefinition.instance(), - EclipseLinkObjectTypeConverterAnnotationDefinition.instance(), - EclipseLinkStructConverterAnnotationDefinition.instance(), - EclipseLinkTypeConverterAnnotationDefinition.instance(), - }; - -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/EclipseLink2_0JpaFactory.java b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/EclipseLink2_0JpaFactory.java deleted file mode 100644 index 1826ba1595..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/EclipseLink2_0JpaFactory.java +++ /dev/null @@ -1,154 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2009, 2011 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.eclipselink.core.internal; - -import org.eclipse.jpt.common.core.resource.java.JavaResourceType; -import org.eclipse.jpt.jpa.core.JpaDataSource; -import org.eclipse.jpt.jpa.core.JpaProject.Config; -import org.eclipse.jpt.jpa.core.context.PersistentType; -import org.eclipse.jpt.jpa.core.context.Table; -import org.eclipse.jpt.jpa.core.context.java.JavaAssociationOverrideContainer; -import org.eclipse.jpt.jpa.core.context.java.JavaAttributeMapping; -import org.eclipse.jpt.jpa.core.context.java.JavaColumn; -import org.eclipse.jpt.jpa.core.context.java.JavaGeneratorContainer; -import org.eclipse.jpt.jpa.core.context.java.JavaJpaContextNode; -import org.eclipse.jpt.jpa.core.context.java.JavaNamedQuery; -import org.eclipse.jpt.jpa.core.context.java.JavaOrderable; -import org.eclipse.jpt.jpa.core.context.java.JavaPersistentAttribute; -import org.eclipse.jpt.jpa.core.context.java.JavaPersistentType; -import org.eclipse.jpt.jpa.core.context.java.JavaQueryContainer; -import org.eclipse.jpt.jpa.core.context.java.JavaReadOnlyNamedColumn; -import org.eclipse.jpt.jpa.core.context.java.JavaSequenceGenerator; -import org.eclipse.jpt.jpa.core.internal.jpa1.context.java.GenericJavaAssociationOverrideContainer; -import org.eclipse.jpt.jpa.core.internal.jpa1.context.java.GenericJavaColumn; -import org.eclipse.jpt.jpa.core.internal.jpa1.context.java.GenericJavaOrderable; -import org.eclipse.jpt.jpa.core.internal.jpa2.GenericJpaDatabaseIdentifierAdapter; -import org.eclipse.jpt.jpa.core.internal.jpa2.GenericMetamodelSynchronizer; -import org.eclipse.jpt.jpa.core.internal.jpa2.context.java.GenericJavaCacheable2_0; -import org.eclipse.jpt.jpa.core.internal.jpa2.context.java.GenericJavaCollectionTable2_0; -import org.eclipse.jpt.jpa.core.internal.jpa2.context.java.GenericJavaDerivedIdentity2_0; -import org.eclipse.jpt.jpa.core.internal.jpa2.context.java.GenericJavaNamedQuery2_0; -import org.eclipse.jpt.jpa.core.internal.jpa2.context.java.GenericJavaOrderColumn2_0; -import org.eclipse.jpt.jpa.core.internal.jpa2.context.java.GenericJavaOrphanRemoval2_0; -import org.eclipse.jpt.jpa.core.internal.jpa2.context.java.GenericJavaPersistentType2_0; -import org.eclipse.jpt.jpa.core.internal.jpa2.context.java.GenericJavaSequenceGenerator2_0; -import org.eclipse.jpt.jpa.core.jpa2.JpaFactory2_0; -import org.eclipse.jpt.jpa.core.jpa2.JpaProject2_0; -import org.eclipse.jpt.jpa.core.jpa2.context.MetamodelSourceType; -import org.eclipse.jpt.jpa.core.jpa2.context.Orderable2_0.Owner; -import org.eclipse.jpt.jpa.core.jpa2.context.java.JavaCacheable2_0; -import org.eclipse.jpt.jpa.core.jpa2.context.java.JavaCacheableHolder2_0; -import org.eclipse.jpt.jpa.core.jpa2.context.java.JavaCollectionTable2_0; -import org.eclipse.jpt.jpa.core.jpa2.context.java.JavaDerivedIdentity2_0; -import org.eclipse.jpt.jpa.core.jpa2.context.java.JavaElementCollectionMapping2_0; -import org.eclipse.jpt.jpa.core.jpa2.context.java.JavaEmbeddedMapping2_0; -import org.eclipse.jpt.jpa.core.jpa2.context.java.JavaOrderColumn2_0; -import org.eclipse.jpt.jpa.core.jpa2.context.java.JavaOrderable2_0; -import org.eclipse.jpt.jpa.core.jpa2.context.java.JavaOrphanRemovable2_0; -import org.eclipse.jpt.jpa.core.jpa2.context.java.JavaOrphanRemovalHolder2_0; -import org.eclipse.jpt.jpa.core.jpa2.context.java.JavaSingleRelationshipMapping2_0; -import org.eclipse.jpt.jpa.core.jpa2.resource.java.NamedQuery2_0Annotation; -import org.eclipse.jpt.jpa.core.jpa2.resource.java.SequenceGenerator2_0Annotation; -import org.eclipse.jpt.jpa.core.resource.java.NamedQueryAnnotation; -import org.eclipse.jpt.jpa.core.resource.java.SequenceGeneratorAnnotation; -import org.eclipse.jpt.jpa.db.DatabaseIdentifierAdapter; -import org.eclipse.jpt.jpa.eclipselink.core.EclipseLinkJpaProject; -import org.eclipse.jpt.jpa.eclipselink.core.internal.context.java.JavaEclipseLinkElementCollectionMapping2_0; - -/** - * EclipseLink 2.0 factory - */ -public class EclipseLink2_0JpaFactory - extends EclipseLinkJpaFactory - implements JpaFactory2_0 -{ - public EclipseLink2_0JpaFactory() { - super(); - } - - - // ********** Core Model ********** - - @Override - public EclipseLinkJpaProject buildJpaProject(Config config) { - if ( ! (config instanceof JpaProject2_0.Config)) { - throw new IllegalArgumentException("config must be 2.0-compatible: " + config); //$NON-NLS-1$ - } - return super.buildJpaProject(config); - } - - public MetamodelSourceType.Synchronizer buildMetamodelSynchronizer(MetamodelSourceType sourceType) { - return new GenericMetamodelSynchronizer(sourceType); - } - - public DatabaseIdentifierAdapter buildDatabaseIdentifierAdapter(JpaDataSource dataSource) { - return new GenericJpaDatabaseIdentifierAdapter(dataSource); - } - - - // ********** Java Context Model ********** - - @Override - public JavaPersistentType buildJavaPersistentType(PersistentType.Owner owner, JavaResourceType jrt) { - return new GenericJavaPersistentType2_0(owner, jrt); - } - - @Override - public JavaSequenceGenerator buildJavaSequenceGenerator(JavaGeneratorContainer parent, SequenceGeneratorAnnotation annotation) { - return new GenericJavaSequenceGenerator2_0(parent, (SequenceGenerator2_0Annotation) annotation); - } - - //The 2.0 JPA spec supports association overrides on an embedded mapping while the 1.0 spec did not - public JavaAssociationOverrideContainer buildJavaAssociationOverrideContainer(JavaEmbeddedMapping2_0 parent, JavaAssociationOverrideContainer.Owner owner) { - return new GenericJavaAssociationOverrideContainer(parent, owner); - } - - public JavaDerivedIdentity2_0 buildJavaDerivedIdentity(JavaSingleRelationshipMapping2_0 parent) { - return new GenericJavaDerivedIdentity2_0(parent); - } - - public JavaElementCollectionMapping2_0 buildJavaElementCollectionMapping2_0(JavaPersistentAttribute parent) { - return new JavaEclipseLinkElementCollectionMapping2_0(parent); - } - - public JavaCacheable2_0 buildJavaCacheable(JavaCacheableHolder2_0 parent) { - return new GenericJavaCacheable2_0(parent); - } - - public JavaOrphanRemovable2_0 buildJavaOrphanRemoval(JavaOrphanRemovalHolder2_0 parent) { - return new GenericJavaOrphanRemoval2_0(parent); - } - - @Override - public JavaNamedQuery buildJavaNamedQuery(JavaQueryContainer parent, NamedQueryAnnotation annotation) { - return new GenericJavaNamedQuery2_0(parent, (NamedQuery2_0Annotation) annotation); - } - - public JavaCollectionTable2_0 buildJavaCollectionTable(JavaElementCollectionMapping2_0 parent, Table.Owner owner) { - return new GenericJavaCollectionTable2_0(parent, owner); - } - - public JavaOrderColumn2_0 buildJavaOrderColumn(JavaOrderable2_0 parent, JavaReadOnlyNamedColumn.Owner owner) { - return new GenericJavaOrderColumn2_0(parent, owner); - } - - public JavaColumn buildJavaMapKeyColumn(JavaJpaContextNode parent, JavaColumn.Owner owner) { - return new GenericJavaColumn(parent, owner); - } - - public JavaOrderable2_0 buildJavaOrderable(JavaAttributeMapping parent, Owner owner) { - return new GenericJavaOrderable(parent, owner); - } - - @Override - public JavaOrderable buildJavaOrderable(JavaAttributeMapping parent) { - throw new UnsupportedOperationException(); - } -} 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 deleted file mode 100644 index a758509542..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/EclipseLink2_0JpaPlatformFactory.java +++ /dev/null @@ -1,76 +0,0 @@ -/******************************************************************************* -* Copyright (c) 2009, 2012 Oracle. All rights reserved. -* This program and the accompanying materials are made available under the -* terms of the Eclipse Public License v1.0, which accompanies this distribution -* and is available at http://www.eclipse.org/legal/epl-v10.html. -* -* Contributors: -* Oracle - initial API and implementation -*******************************************************************************/ -package org.eclipse.jpt.jpa.eclipselink.core.internal; - -import org.eclipse.jpt.common.core.AnnotationProvider; -import org.eclipse.jpt.common.core.JptResourceType; -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.context.AccessType; -import org.eclipse.jpt.jpa.core.internal.GenericJpaPlatform; -import org.eclipse.jpt.jpa.core.internal.JpaAnnotationProvider; -import org.eclipse.jpt.jpa.core.internal.jpa2.Generic2_0JpaAnnotationDefinitionProvider; -import org.eclipse.jpt.jpa.eclipselink.core.JptJpaEclipseLinkCorePlugin; -import org.eclipse.jpt.jpa.eclipselink.core.internal.EclipseLinkJpaPlatformFactory.EclipseLinkVersion; -import org.eclipse.persistence.jpa.jpql.parser.EclipseLinkJPQLGrammar2_0; - -/** - * All the state in the JPA platform should be "static" (i.e. unchanging once - * it is initialized). - */ -public class EclipseLink2_0JpaPlatformFactory - implements JpaPlatformFactory -{ - /** - * zero-argument constructor - */ - public EclipseLink2_0JpaPlatformFactory() { - super(); - } - - public JpaPlatform buildJpaPlatform(String id) { - return new GenericJpaPlatform( - id, - buildJpaVersion(), - new EclipseLink2_0JpaFactory(), - this.buildAnnotationProvider(), - EclipseLink2_0JpaPlatformProvider.instance(), - this.buildJpaVariation(), - EclipseLinkJPQLGrammar2_0.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(), - EclipseLink2_0JpaAnnotationDefinitionProvider.instance()); - } - - protected JpaPlatformVariation buildJpaVariation() { - return new JpaPlatformVariation() { - public Supported getTablePerConcreteClassInheritanceIsSupported() { - return Supported.YES; - } - public boolean isJoinTableOverridable() { - return true; - } - public AccessType[] getSupportedAccessTypes(JptResourceType resourceType) { - return GENERIC_SUPPORTED_ACCESS_TYPES; - } - }; - } -}
\ 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_0JpaPlatformProvider.java b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/EclipseLink2_0JpaPlatformProvider.java deleted file mode 100644 index 0cfa335424..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/EclipseLink2_0JpaPlatformProvider.java +++ /dev/null @@ -1,38 +0,0 @@ -/******************************************************************************* -* Copyright (c) 2009, 2011 Oracle. All rights reserved. -* This program and the accompanying materials are made available under the -* terms of the Eclipse Public License v1.0, which accompanies this distribution -* and is available at http://www.eclipse.org/legal/epl-v10.html. -* -* Contributors: -* Oracle - initial API and implementation -*******************************************************************************/ -package org.eclipse.jpt.jpa.eclipselink.core.internal; - -import org.eclipse.jpt.jpa.core.JpaPlatformProvider; - -/** - * EclipseLink 2.0 platform config - */ -public class EclipseLink2_0JpaPlatformProvider - extends AbstractEclipseLink2_0JpaPlatformProvider -{ - // singleton - private static final JpaPlatformProvider INSTANCE = new EclipseLink2_0JpaPlatformProvider(); - - - /** - * Return the singleton - */ - public static JpaPlatformProvider instance() { - return INSTANCE; - } - - - /** - * Enforce singleton usage - */ - protected EclipseLink2_0JpaPlatformProvider() { - super(); - } -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/EclipseLink2_1JpaAnnotationDefinitionProvider.java b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/EclipseLink2_1JpaAnnotationDefinitionProvider.java deleted file mode 100644 index e4a0e922b2..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/EclipseLink2_1JpaAnnotationDefinitionProvider.java +++ /dev/null @@ -1,101 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010, 2011 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.eclipselink.core.internal; - -import java.util.ArrayList; -import org.eclipse.jpt.common.core.resource.java.AnnotationDefinition; -import org.eclipse.jpt.common.core.resource.java.NestableAnnotationDefinition; -import org.eclipse.jpt.common.utility.internal.CollectionTools; -import org.eclipse.jpt.jpa.core.JpaAnnotationDefinitionProvider; -import org.eclipse.jpt.jpa.core.internal.AbstractJpaAnnotationDefinitionProvider; -import org.eclipse.jpt.jpa.eclipselink.core.internal.resource.java.EclipseLinkBasicCollectionAnnotationDefinition; -import org.eclipse.jpt.jpa.eclipselink.core.internal.resource.java.EclipseLinkBasicMapAnnotationDefinition; -import org.eclipse.jpt.jpa.eclipselink.core.internal.resource.java.EclipseLinkCacheAnnotationDefinition; -import org.eclipse.jpt.jpa.eclipselink.core.internal.resource.java.EclipseLinkChangeTrackingAnnotationDefinition; -import org.eclipse.jpt.jpa.eclipselink.core.internal.resource.java.EclipseLinkClassExtractor2_1AnnotationDefinition; -import org.eclipse.jpt.jpa.eclipselink.core.internal.resource.java.EclipseLinkConvertAnnotationDefinition; -import org.eclipse.jpt.jpa.eclipselink.core.internal.resource.java.EclipseLinkConverterAnnotationDefinition; -import org.eclipse.jpt.jpa.eclipselink.core.internal.resource.java.EclipseLinkCustomizerAnnotationDefinition; -import org.eclipse.jpt.jpa.eclipselink.core.internal.resource.java.EclipseLinkExistenceCheckingAnnotationDefinition; -import org.eclipse.jpt.jpa.eclipselink.core.internal.resource.java.EclipseLinkJoinFetchAnnotationDefinition; -import org.eclipse.jpt.jpa.eclipselink.core.internal.resource.java.EclipseLinkMutableAnnotationDefinition; -import org.eclipse.jpt.jpa.eclipselink.core.internal.resource.java.EclipseLinkObjectTypeConverterAnnotationDefinition; -import org.eclipse.jpt.jpa.eclipselink.core.internal.resource.java.EclipseLinkPrimaryKeyAnnotationDefinition; -import org.eclipse.jpt.jpa.eclipselink.core.internal.resource.java.EclipseLinkPrivateOwnedAnnotationDefinition; -import org.eclipse.jpt.jpa.eclipselink.core.internal.resource.java.EclipseLinkReadOnlyAnnotationDefinition; -import org.eclipse.jpt.jpa.eclipselink.core.internal.resource.java.EclipseLinkReadTransformerAnnotationDefinition; -import org.eclipse.jpt.jpa.eclipselink.core.internal.resource.java.EclipseLinkStructConverterAnnotationDefinition; -import org.eclipse.jpt.jpa.eclipselink.core.internal.resource.java.EclipseLinkTransformationAnnotationDefinition; -import org.eclipse.jpt.jpa.eclipselink.core.internal.resource.java.EclipseLinkTypeConverterAnnotationDefinition; -import org.eclipse.jpt.jpa.eclipselink.core.internal.resource.java.EclipseLinkVariableOneToOneAnnotationDefinition; -import org.eclipse.jpt.jpa.eclipselink.core.internal.resource.java.EclipseLinkWriteTransformerAnnotationDefinition; - -/** - * Provides annotations for 2.1 EclipseLink platform - */ -public class EclipseLink2_1JpaAnnotationDefinitionProvider - extends AbstractJpaAnnotationDefinitionProvider -{ - // singleton - private static final JpaAnnotationDefinitionProvider INSTANCE = new EclipseLink2_1JpaAnnotationDefinitionProvider(); - - /** - * Return the singleton - */ - public static JpaAnnotationDefinitionProvider instance() { - return INSTANCE; - } - - /** - * Enforce singleton usage - */ - private EclipseLink2_1JpaAnnotationDefinitionProvider() { - super(); - } - - @Override - protected void addAnnotationDefinitionsTo(ArrayList<AnnotationDefinition> definitions) { - CollectionTools.addAll(definitions, ANNOTATION_DEFINITIONS); - } - - protected static final AnnotationDefinition[] ANNOTATION_DEFINITIONS = new AnnotationDefinition[] { - EclipseLinkBasicCollectionAnnotationDefinition.instance(), - EclipseLinkBasicMapAnnotationDefinition.instance(), - EclipseLinkCacheAnnotationDefinition.instance(), - EclipseLinkChangeTrackingAnnotationDefinition.instance(), - EclipseLinkClassExtractor2_1AnnotationDefinition.instance(), - EclipseLinkConvertAnnotationDefinition.instance(), - EclipseLinkCustomizerAnnotationDefinition.instance(), - EclipseLinkExistenceCheckingAnnotationDefinition.instance(), - EclipseLinkJoinFetchAnnotationDefinition.instance(), - EclipseLinkMutableAnnotationDefinition.instance(), - EclipseLinkPrimaryKeyAnnotationDefinition.instance(), - EclipseLinkPrivateOwnedAnnotationDefinition.instance(), - EclipseLinkReadOnlyAnnotationDefinition.instance(), - EclipseLinkReadTransformerAnnotationDefinition.instance(), - EclipseLinkTransformationAnnotationDefinition.instance(), - EclipseLinkVariableOneToOneAnnotationDefinition.instance(), - EclipseLinkWriteTransformerAnnotationDefinition.instance() - }; - - - @Override - protected void addNestableAnnotationDefinitionsTo(ArrayList<NestableAnnotationDefinition> definitions) { - CollectionTools.addAll(definitions, NESTABLE_ANNOTATION_DEFINITIONS); - } - - protected static final NestableAnnotationDefinition[] NESTABLE_ANNOTATION_DEFINITIONS = new NestableAnnotationDefinition[] { - EclipseLinkConverterAnnotationDefinition.instance(), - EclipseLinkObjectTypeConverterAnnotationDefinition.instance(), - EclipseLinkStructConverterAnnotationDefinition.instance(), - EclipseLinkTypeConverterAnnotationDefinition.instance(), - }; - -} 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 deleted file mode 100644 index 648d92fca3..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/EclipseLink2_1JpaPlatformFactory.java +++ /dev/null @@ -1,88 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010, 2012 Oracle. - * All rights reserved. This program and the accompanying materials are - * made available under the terms of the Eclipse Public License v1.0 which - * accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Oracle - initial API and implementation - *******************************************************************************/ -package org.eclipse.jpt.jpa.eclipselink.core.internal; - -import org.eclipse.jpt.common.core.AnnotationProvider; -import org.eclipse.jpt.common.core.JptResourceType; -import org.eclipse.jpt.jpa.core.JpaFacet; -import org.eclipse.jpt.jpa.core.JpaPlatform; -import org.eclipse.jpt.jpa.core.JpaPlatformVariation; -import org.eclipse.jpt.jpa.core.JptJpaCorePlugin; -import org.eclipse.jpt.jpa.core.context.AccessType; -import org.eclipse.jpt.jpa.core.internal.GenericJpaPlatform; -import org.eclipse.jpt.jpa.core.internal.JpaAnnotationProvider; -import org.eclipse.jpt.jpa.core.internal.jpa2.Generic2_0JpaAnnotationDefinitionProvider; -import org.eclipse.jpt.jpa.eclipselink.core.JptJpaEclipseLinkCorePlugin; -import org.eclipse.jpt.jpa.eclipselink.core.context.EclipseLinkAccessType; -import org.eclipse.jpt.jpa.eclipselink.core.internal.EclipseLinkJpaPlatformFactory.EclipseLinkVersion; -import org.eclipse.persistence.jpa.jpql.parser.EclipseLinkJPQLGrammar2_1; - -public class EclipseLink2_1JpaPlatformFactory - extends EclipseLink2_0JpaPlatformFactory -{ - /** - * zero-argument constructor - */ - public EclipseLink2_1JpaPlatformFactory() { - super(); - } - - @Override - public JpaPlatform buildJpaPlatform(String id) { - return new GenericJpaPlatform( - id, - buildJpaVersion(), - new EclipseLink2_0JpaFactory(), - this.buildAnnotationProvider(), - EclipseLink2_1JpaPlatformProvider.instance(), - this.buildJpaVariation(), - EclipseLinkJPQLGrammar2_1.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; - } - public AccessType[] getSupportedAccessTypes(JptResourceType resourceType) { - if (resourceType.getContentType() == JptJpaEclipseLinkCorePlugin.ECLIPSELINK_ORM_XML_CONTENT_TYPE) { - if (this.versionIsEclipseLink2_1Compatibile(resourceType)) { - return ECLIPSELINK_SUPPORTED_ACCESS_TYPES; - } - } - return GENERIC_SUPPORTED_ACCESS_TYPES; - } - protected boolean versionIsEclipseLink2_1Compatibile(JptResourceType resourceType) { - return JptJpaCorePlugin.resourceTypeIsCompatible(resourceType, JptJpaEclipseLinkCorePlugin.ECLIPSELINK_ORM_XML_2_1_RESOURCE_TYPE.getVersion()); - } - }; - } - - public static final AccessType[] ECLIPSELINK_SUPPORTED_ACCESS_TYPES = new AccessType[] {AccessType.FIELD, AccessType.PROPERTY, EclipseLinkAccessType.VIRTUAL}; -}
\ 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_1JpaPlatformProvider.java b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/EclipseLink2_1JpaPlatformProvider.java deleted file mode 100644 index 9a5ed3063c..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/EclipseLink2_1JpaPlatformProvider.java +++ /dev/null @@ -1,63 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2009, 2011 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.eclipselink.core.internal; - -import java.util.ArrayList; -import org.eclipse.core.runtime.content.IContentType; -import org.eclipse.jpt.common.core.JptResourceType; -import org.eclipse.jpt.jpa.core.JpaPlatformProvider; -import org.eclipse.jpt.jpa.core.ResourceDefinition; -import org.eclipse.jpt.jpa.eclipselink.core.JptJpaEclipseLinkCorePlugin; -import org.eclipse.jpt.jpa.eclipselink.core.internal.context.orm.EclipseLinkOrmXml2_1Definition; - -/** - * EclipseLink 2.1 platform config - */ -public class EclipseLink2_1JpaPlatformProvider - extends AbstractEclipseLink2_0JpaPlatformProvider -{ - // singleton - private static final JpaPlatformProvider INSTANCE = new EclipseLink2_1JpaPlatformProvider(); - - - /** - * Return the singleton - */ - public static JpaPlatformProvider instance() { - return INSTANCE; - } - - - /** - * Enforce singleton usage - */ - private EclipseLink2_1JpaPlatformProvider() { - super(); - } - - - // ********** resource models ********** - - @Override - public JptResourceType getMostRecentSupportedResourceType(IContentType contentType) { - if (contentType.equals(JptJpaEclipseLinkCorePlugin.ECLIPSELINK_ORM_XML_CONTENT_TYPE)) { - return JptJpaEclipseLinkCorePlugin.ECLIPSELINK_ORM_XML_2_1_RESOURCE_TYPE; - } - return super.getMostRecentSupportedResourceType(contentType); - } - - // ********** resource definitions ********** - - @Override - protected void addResourceDefinitionsTo(ArrayList<ResourceDefinition> definitions) { - super.addResourceDefinitionsTo(definitions); - definitions.add(EclipseLinkOrmXml2_1Definition.instance()); - } -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/EclipseLink2_2JpaAnnotationDefinitionProvider.java b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/EclipseLink2_2JpaAnnotationDefinitionProvider.java deleted file mode 100644 index ba286dea99..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/EclipseLink2_2JpaAnnotationDefinitionProvider.java +++ /dev/null @@ -1,108 +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, 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.eclipselink.core.internal; - -import java.util.ArrayList; -import org.eclipse.jpt.common.core.resource.java.AnnotationDefinition; -import org.eclipse.jpt.common.core.resource.java.NestableAnnotationDefinition; -import org.eclipse.jpt.common.utility.internal.CollectionTools; -import org.eclipse.jpt.jpa.core.JpaAnnotationDefinitionProvider; -import org.eclipse.jpt.jpa.core.internal.AbstractJpaAnnotationDefinitionProvider; -import org.eclipse.jpt.jpa.eclipselink.core.internal.resource.java.EclipseLinkBasicCollectionAnnotationDefinition; -import org.eclipse.jpt.jpa.eclipselink.core.internal.resource.java.EclipseLinkBasicMapAnnotationDefinition; -import org.eclipse.jpt.jpa.eclipselink.core.internal.resource.java.EclipseLinkCacheAnnotationDefinition; -import org.eclipse.jpt.jpa.eclipselink.core.internal.resource.java.EclipseLinkChangeTrackingAnnotationDefinition; -import org.eclipse.jpt.jpa.eclipselink.core.internal.resource.java.EclipseLinkClassExtractor2_1AnnotationDefinition; -import org.eclipse.jpt.jpa.eclipselink.core.internal.resource.java.EclipseLinkConvertAnnotationDefinition; -import org.eclipse.jpt.jpa.eclipselink.core.internal.resource.java.EclipseLinkConverterAnnotationDefinition; -import org.eclipse.jpt.jpa.eclipselink.core.internal.resource.java.EclipseLinkConverters2_2AnnotationDefinition; -import org.eclipse.jpt.jpa.eclipselink.core.internal.resource.java.EclipseLinkCustomizerAnnotationDefinition; -import org.eclipse.jpt.jpa.eclipselink.core.internal.resource.java.EclipseLinkExistenceCheckingAnnotationDefinition; -import org.eclipse.jpt.jpa.eclipselink.core.internal.resource.java.EclipseLinkJoinFetchAnnotationDefinition; -import org.eclipse.jpt.jpa.eclipselink.core.internal.resource.java.EclipseLinkMutableAnnotationDefinition; -import org.eclipse.jpt.jpa.eclipselink.core.internal.resource.java.EclipseLinkObjectTypeConverterAnnotationDefinition; -import org.eclipse.jpt.jpa.eclipselink.core.internal.resource.java.EclipseLinkObjectTypeConverters2_2AnnotationDefinition; -import org.eclipse.jpt.jpa.eclipselink.core.internal.resource.java.EclipseLinkPrimaryKeyAnnotationDefinition; -import org.eclipse.jpt.jpa.eclipselink.core.internal.resource.java.EclipseLinkPrivateOwnedAnnotationDefinition; -import org.eclipse.jpt.jpa.eclipselink.core.internal.resource.java.EclipseLinkReadOnlyAnnotationDefinition; -import org.eclipse.jpt.jpa.eclipselink.core.internal.resource.java.EclipseLinkReadTransformerAnnotationDefinition; -import org.eclipse.jpt.jpa.eclipselink.core.internal.resource.java.EclipseLinkStructConverterAnnotationDefinition; -import org.eclipse.jpt.jpa.eclipselink.core.internal.resource.java.EclipseLinkStructConverters2_2AnnotationDefinition; -import org.eclipse.jpt.jpa.eclipselink.core.internal.resource.java.EclipseLinkTransformationAnnotationDefinition; -import org.eclipse.jpt.jpa.eclipselink.core.internal.resource.java.EclipseLinkTypeConverterAnnotationDefinition; -import org.eclipse.jpt.jpa.eclipselink.core.internal.resource.java.EclipseLinkTypeConverters2_2AnnotationDefinition; -import org.eclipse.jpt.jpa.eclipselink.core.internal.resource.java.EclipseLinkVariableOneToOneAnnotationDefinition; -import org.eclipse.jpt.jpa.eclipselink.core.internal.resource.java.EclipseLinkWriteTransformerAnnotationDefinition; - -/** - * Provides annotations for 2.3 EclipseLink platform - */ -public class EclipseLink2_2JpaAnnotationDefinitionProvider - extends AbstractJpaAnnotationDefinitionProvider -{ - // singleton - private static final JpaAnnotationDefinitionProvider INSTANCE = new EclipseLink2_2JpaAnnotationDefinitionProvider(); - - /** - * Return the singleton - */ - public static JpaAnnotationDefinitionProvider instance() { - return INSTANCE; - } - - /** - * Enforce singleton usage - */ - private EclipseLink2_2JpaAnnotationDefinitionProvider() { - super(); - } - - @Override - protected void addAnnotationDefinitionsTo(ArrayList<AnnotationDefinition> definitions) { - CollectionTools.addAll(definitions, ANNOTATION_DEFINITIONS); - } - - protected static final AnnotationDefinition[] ANNOTATION_DEFINITIONS = new AnnotationDefinition[] { - EclipseLinkBasicCollectionAnnotationDefinition.instance(), - EclipseLinkBasicMapAnnotationDefinition.instance(), - EclipseLinkCacheAnnotationDefinition.instance(), - EclipseLinkChangeTrackingAnnotationDefinition.instance(), - EclipseLinkClassExtractor2_1AnnotationDefinition.instance(), - EclipseLinkConvertAnnotationDefinition.instance(), - EclipseLinkConverters2_2AnnotationDefinition.instance(), - EclipseLinkCustomizerAnnotationDefinition.instance(), - EclipseLinkExistenceCheckingAnnotationDefinition.instance(), - EclipseLinkJoinFetchAnnotationDefinition.instance(), - EclipseLinkMutableAnnotationDefinition.instance(), - EclipseLinkObjectTypeConverters2_2AnnotationDefinition.instance(), - EclipseLinkPrimaryKeyAnnotationDefinition.instance(), - EclipseLinkPrivateOwnedAnnotationDefinition.instance(), - EclipseLinkReadOnlyAnnotationDefinition.instance(), - EclipseLinkReadTransformerAnnotationDefinition.instance(), - EclipseLinkStructConverters2_2AnnotationDefinition.instance(), - EclipseLinkTransformationAnnotationDefinition.instance(), - EclipseLinkTypeConverters2_2AnnotationDefinition.instance(), - EclipseLinkVariableOneToOneAnnotationDefinition.instance(), - EclipseLinkWriteTransformerAnnotationDefinition.instance() - }; - - @Override - protected void addNestableAnnotationDefinitionsTo(ArrayList<NestableAnnotationDefinition> definitions) { - CollectionTools.addAll(definitions, NESTABLE_ANNOTATION_DEFINITIONS); - } - - protected static final NestableAnnotationDefinition[] NESTABLE_ANNOTATION_DEFINITIONS = new NestableAnnotationDefinition[] { - EclipseLinkConverterAnnotationDefinition.instance(), - EclipseLinkObjectTypeConverterAnnotationDefinition.instance(), - EclipseLinkStructConverterAnnotationDefinition.instance(), - EclipseLinkTypeConverterAnnotationDefinition.instance(), - }; - -} 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 deleted file mode 100644 index 317a2d7082..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/EclipseLink2_2JpaPlatformFactory.java +++ /dev/null @@ -1,85 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010, 2012 Oracle. - * All rights reserved. This program and the accompanying materials are - * made available under the terms of the Eclipse Public License v1.0 which - * accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Oracle - initial API and implementation - *******************************************************************************/ -package org.eclipse.jpt.jpa.eclipselink.core.internal; - -import org.eclipse.jpt.common.core.AnnotationProvider; -import org.eclipse.jpt.common.core.JptResourceType; -import org.eclipse.jpt.jpa.core.JpaFacet; -import org.eclipse.jpt.jpa.core.JpaPlatform; -import org.eclipse.jpt.jpa.core.JpaPlatformVariation; -import org.eclipse.jpt.jpa.core.JptJpaCorePlugin; -import org.eclipse.jpt.jpa.core.context.AccessType; -import org.eclipse.jpt.jpa.core.internal.GenericJpaPlatform; -import org.eclipse.jpt.jpa.core.internal.JpaAnnotationProvider; -import org.eclipse.jpt.jpa.core.internal.jpa2.Generic2_0JpaAnnotationDefinitionProvider; -import org.eclipse.jpt.jpa.eclipselink.core.JptJpaEclipseLinkCorePlugin; -import org.eclipse.jpt.jpa.eclipselink.core.internal.EclipseLinkJpaPlatformFactory.EclipseLinkVersion; -import org.eclipse.persistence.jpa.jpql.parser.EclipseLinkJPQLGrammar2_2; - -public class EclipseLink2_2JpaPlatformFactory - extends EclipseLink2_0JpaPlatformFactory -{ - /** - * zero-argument constructor - */ - public EclipseLink2_2JpaPlatformFactory() { - super(); - } - - @Override - public JpaPlatform buildJpaPlatform(String id) { - return new GenericJpaPlatform( - id, - buildJpaVersion(), - new EclipseLink2_0JpaFactory(), - this.buildAnnotationProvider(), - EclipseLink2_2JpaPlatformProvider.instance(), - this.buildJpaVariation(), - EclipseLinkJPQLGrammar2_2.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; - } - public AccessType[] getSupportedAccessTypes(JptResourceType resourceType) { - if (resourceType.getContentType() == JptJpaEclipseLinkCorePlugin.ECLIPSELINK_ORM_XML_CONTENT_TYPE) { - if (this.versionIsEclipseLink2_1Compatibile(resourceType)) { - return EclipseLink2_1JpaPlatformFactory.ECLIPSELINK_SUPPORTED_ACCESS_TYPES; - } - } - return GENERIC_SUPPORTED_ACCESS_TYPES; - } - protected boolean versionIsEclipseLink2_1Compatibile(JptResourceType resourceType) { - return JptJpaCorePlugin.resourceTypeIsCompatible(resourceType, JptJpaEclipseLinkCorePlugin.ECLIPSELINK_ORM_XML_2_1_RESOURCE_TYPE.getVersion()); - } - }; - } -}
\ 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_2JpaPlatformProvider.java b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/EclipseLink2_2JpaPlatformProvider.java deleted file mode 100644 index bd1cafa900..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/EclipseLink2_2JpaPlatformProvider.java +++ /dev/null @@ -1,147 +0,0 @@ -/******************************************************************************* -* Copyright (c) 2010, 2011 Oracle. All rights reserved. -* This program and the accompanying materials are made available under the -* terms of the Eclipse Public License v1.0, which accompanies this distribution -* and is available at http://www.eclipse.org/legal/epl-v10.html. -* -* Contributors: -* Oracle - initial API and implementation -*******************************************************************************/ -package org.eclipse.jpt.jpa.eclipselink.core.internal; - -import java.util.ArrayList; -import org.eclipse.core.runtime.content.IContentType; -import org.eclipse.jpt.common.core.JptResourceType; -import org.eclipse.jpt.common.utility.internal.CollectionTools; -import org.eclipse.jpt.jpa.core.JpaPlatformProvider; -import org.eclipse.jpt.jpa.core.ResourceDefinition; -import org.eclipse.jpt.jpa.core.context.java.DefaultJavaAttributeMappingDefinition; -import org.eclipse.jpt.jpa.core.context.java.JavaAttributeMappingDefinition; -import org.eclipse.jpt.jpa.core.context.java.JavaTypeMappingDefinition; -import org.eclipse.jpt.jpa.core.internal.context.java.JavaTransientMappingDefinition; -import org.eclipse.jpt.jpa.eclipselink.core.JptJpaEclipseLinkCorePlugin; -import org.eclipse.jpt.jpa.eclipselink.core.internal.context.java.EclipseLinkJavaBasicCollectionMappingDefinition2_0; -import org.eclipse.jpt.jpa.eclipselink.core.internal.context.java.EclipseLinkJavaBasicMapMappingDefinition2_0; -import org.eclipse.jpt.jpa.eclipselink.core.internal.context.java.EclipseLinkJavaBasicMappingDefinition2_2; -import org.eclipse.jpt.jpa.eclipselink.core.internal.context.java.EclipseLinkJavaElementCollectionMappingDefinition2_2; -import org.eclipse.jpt.jpa.eclipselink.core.internal.context.java.EclipseLinkJavaEmbeddableDefinition2_2; -import org.eclipse.jpt.jpa.eclipselink.core.internal.context.java.EclipseLinkJavaEmbeddedIdMappingDefinition2_2; -import org.eclipse.jpt.jpa.eclipselink.core.internal.context.java.EclipseLinkJavaEmbeddedMappingDefinition2_2; -import org.eclipse.jpt.jpa.eclipselink.core.internal.context.java.EclipseLinkJavaEntityDefinition2_2; -import org.eclipse.jpt.jpa.eclipselink.core.internal.context.java.EclipseLinkJavaIdMappingDefinition2_2; -import org.eclipse.jpt.jpa.eclipselink.core.internal.context.java.EclipseLinkJavaManyToManyMappingDefinition2_2; -import org.eclipse.jpt.jpa.eclipselink.core.internal.context.java.EclipseLinkJavaManyToOneMappingDefinition2_2; -import org.eclipse.jpt.jpa.eclipselink.core.internal.context.java.EclipseLinkJavaMappedSuperclassDefinition2_2; -import org.eclipse.jpt.jpa.eclipselink.core.internal.context.java.EclipseLinkJavaOneToManyMappingDefinition2_2; -import org.eclipse.jpt.jpa.eclipselink.core.internal.context.java.EclipseLinkJavaOneToOneMappingDefinition2_2; -import org.eclipse.jpt.jpa.eclipselink.core.internal.context.java.EclipseLinkJavaTransformationMappingDefinition2_0; -import org.eclipse.jpt.jpa.eclipselink.core.internal.context.java.EclipseLinkJavaVariableOneToOneMappingDefinition2_0; -import org.eclipse.jpt.jpa.eclipselink.core.internal.context.java.EclipseLinkJavaVersionMappingDefinition2_2; -import org.eclipse.jpt.jpa.eclipselink.core.internal.context.orm.EclipseLinkOrmXml2_1Definition; -import org.eclipse.jpt.jpa.eclipselink.core.internal.context.orm.EclipseLinkOrmXml2_2Definition; - -public class EclipseLink2_2JpaPlatformProvider - extends AbstractEclipseLink2_0JpaPlatformProvider -{ - // singleton - private static final JpaPlatformProvider INSTANCE = new EclipseLink2_2JpaPlatformProvider(); - - - /** - * Return the singleton - */ - public static JpaPlatformProvider instance() { - return INSTANCE; - } - - - /** - * Enforce singleton usage - */ - private EclipseLink2_2JpaPlatformProvider() { - super(); - } - - - // ********** resource models ********** - - @Override - public JptResourceType getMostRecentSupportedResourceType(IContentType contentType) { - if (contentType.equals(JptJpaEclipseLinkCorePlugin.ECLIPSELINK_ORM_XML_CONTENT_TYPE)) { - return JptJpaEclipseLinkCorePlugin.ECLIPSELINK_ORM_XML_2_2_RESOURCE_TYPE; - } - return super.getMostRecentSupportedResourceType(contentType); - } - - - // ********** resource definitions ********** - - @Override - protected void addResourceDefinitionsTo(ArrayList<ResourceDefinition> definitions) { - super.addResourceDefinitionsTo(definitions); - CollectionTools.addAll(definitions, RESOURCE_DEFINITIONS); - } - - protected static final ResourceDefinition[] RESOURCE_DEFINITIONS = new ResourceDefinition[] { - EclipseLinkOrmXml2_1Definition.instance(), - EclipseLinkOrmXml2_2Definition.instance(), - }; - - - // ********* Java type mappings ********* - - @Override - protected void addJavaTypeMappingDefinitionsTo(ArrayList<JavaTypeMappingDefinition> definitions) { - CollectionTools.addAll(definitions, JAVA_TYPE_MAPPING_DEFINITIONS); - } - - // order matches that used by EclipseLink - // NB: no EclipseLink-specific mappings - protected static final JavaTypeMappingDefinition[] JAVA_TYPE_MAPPING_DEFINITIONS = new JavaTypeMappingDefinition[] { - EclipseLinkJavaEntityDefinition2_2.instance(), - EclipseLinkJavaEmbeddableDefinition2_2.instance(), - EclipseLinkJavaMappedSuperclassDefinition2_2.instance() - }; - - // ********* Java attribute mappings ********* - - @Override - protected void addDefaultJavaAttributeMappingDefinitionsTo(ArrayList<DefaultJavaAttributeMappingDefinition> definitions) { - CollectionTools.addAll(definitions, DEFAULT_JAVA_ATTRIBUTE_MAPPING_DEFINITIONS); - } - - // order matches that used by EclipseLink - // NB: no change from EclipseLink 1.2 to 2.0 - protected static final DefaultJavaAttributeMappingDefinition[] DEFAULT_JAVA_ATTRIBUTE_MAPPING_DEFINITIONS = new DefaultJavaAttributeMappingDefinition[] { - EclipseLinkJavaEmbeddedMappingDefinition2_2.instance(), - EclipseLinkJavaOneToManyMappingDefinition2_2.instance(), - EclipseLinkJavaOneToOneMappingDefinition2_2.instance(), - EclipseLinkJavaVariableOneToOneMappingDefinition2_0.instance(), - EclipseLinkJavaBasicMappingDefinition2_2.instance() - }; - - @Override - protected void addSpecifiedJavaAttributeMappingDefinitionsTo(ArrayList<JavaAttributeMappingDefinition> definitions) { - CollectionTools.addAll(definitions, SPECIFIED_JAVA_ATTRIBUTE_MAPPING_DEFINITIONS); - } - - // order matches that used by EclipseLink - protected static final JavaAttributeMappingDefinition[] SPECIFIED_JAVA_ATTRIBUTE_MAPPING_DEFINITIONS = new JavaAttributeMappingDefinition[] { - JavaTransientMappingDefinition.instance(), - EclipseLinkJavaBasicCollectionMappingDefinition2_0.instance(), - EclipseLinkJavaBasicMapMappingDefinition2_0.instance(), - EclipseLinkJavaElementCollectionMappingDefinition2_2.instance(), - EclipseLinkJavaIdMappingDefinition2_2.instance(), - EclipseLinkJavaVersionMappingDefinition2_2.instance(), - EclipseLinkJavaBasicMappingDefinition2_2.instance(), - EclipseLinkJavaEmbeddedMappingDefinition2_2.instance(), - EclipseLinkJavaEmbeddedIdMappingDefinition2_2.instance(), - EclipseLinkJavaTransformationMappingDefinition2_0.instance(), - EclipseLinkJavaManyToManyMappingDefinition2_2.instance(), - EclipseLinkJavaManyToOneMappingDefinition2_2.instance(), - EclipseLinkJavaOneToManyMappingDefinition2_2.instance(), - EclipseLinkJavaOneToOneMappingDefinition2_2.instance(), - EclipseLinkJavaVariableOneToOneMappingDefinition2_0.instance() - }; - -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/EclipseLink2_3JpaAnnotationDefinitionProvider.java b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/EclipseLink2_3JpaAnnotationDefinitionProvider.java deleted file mode 100644 index d98f4f534c..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/EclipseLink2_3JpaAnnotationDefinitionProvider.java +++ /dev/null @@ -1,119 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010, 2011 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.eclipselink.core.internal; - -import java.util.ArrayList; -import org.eclipse.jpt.common.core.resource.java.AnnotationDefinition; -import org.eclipse.jpt.common.core.resource.java.NestableAnnotationDefinition; -import org.eclipse.jpt.common.utility.internal.CollectionTools; -import org.eclipse.jpt.jpa.core.JpaAnnotationDefinitionProvider; -import org.eclipse.jpt.jpa.core.internal.AbstractJpaAnnotationDefinitionProvider; -import org.eclipse.jpt.jpa.eclipselink.core.internal.resource.java.EclipseLinkArray2_3AnnotationDefinition; -import org.eclipse.jpt.jpa.eclipselink.core.internal.resource.java.EclipseLinkBasicCollectionAnnotationDefinition; -import org.eclipse.jpt.jpa.eclipselink.core.internal.resource.java.EclipseLinkBasicMapAnnotationDefinition; -import org.eclipse.jpt.jpa.eclipselink.core.internal.resource.java.EclipseLinkCacheAnnotationDefinition; -import org.eclipse.jpt.jpa.eclipselink.core.internal.resource.java.EclipseLinkChangeTrackingAnnotationDefinition; -import org.eclipse.jpt.jpa.eclipselink.core.internal.resource.java.EclipseLinkClassExtractor2_1AnnotationDefinition; -import org.eclipse.jpt.jpa.eclipselink.core.internal.resource.java.EclipseLinkConvertAnnotationDefinition; -import org.eclipse.jpt.jpa.eclipselink.core.internal.resource.java.EclipseLinkConverterAnnotationDefinition; -import org.eclipse.jpt.jpa.eclipselink.core.internal.resource.java.EclipseLinkConverters2_2AnnotationDefinition; -import org.eclipse.jpt.jpa.eclipselink.core.internal.resource.java.EclipseLinkCustomizerAnnotationDefinition; -import org.eclipse.jpt.jpa.eclipselink.core.internal.resource.java.EclipseLinkExistenceCheckingAnnotationDefinition; -import org.eclipse.jpt.jpa.eclipselink.core.internal.resource.java.EclipseLinkJoinFetchAnnotationDefinition; -import org.eclipse.jpt.jpa.eclipselink.core.internal.resource.java.EclipseLinkMultitenant2_3AnnotationDefinition; -import org.eclipse.jpt.jpa.eclipselink.core.internal.resource.java.EclipseLinkMutableAnnotationDefinition; -import org.eclipse.jpt.jpa.eclipselink.core.internal.resource.java.EclipseLinkObjectTypeConverterAnnotationDefinition; -import org.eclipse.jpt.jpa.eclipselink.core.internal.resource.java.EclipseLinkObjectTypeConverters2_2AnnotationDefinition; -import org.eclipse.jpt.jpa.eclipselink.core.internal.resource.java.EclipseLinkPrimaryKeyAnnotationDefinition; -import org.eclipse.jpt.jpa.eclipselink.core.internal.resource.java.EclipseLinkPrivateOwnedAnnotationDefinition; -import org.eclipse.jpt.jpa.eclipselink.core.internal.resource.java.EclipseLinkReadOnlyAnnotationDefinition; -import org.eclipse.jpt.jpa.eclipselink.core.internal.resource.java.EclipseLinkReadTransformerAnnotationDefinition; -import org.eclipse.jpt.jpa.eclipselink.core.internal.resource.java.EclipseLinkStructConverterAnnotationDefinition; -import org.eclipse.jpt.jpa.eclipselink.core.internal.resource.java.EclipseLinkStructConverters2_2AnnotationDefinition; -import org.eclipse.jpt.jpa.eclipselink.core.internal.resource.java.EclipseLinkStructure2_3AnnotationDefinition; -import org.eclipse.jpt.jpa.eclipselink.core.internal.resource.java.EclipseLinkTenantDiscriminatorColumn2_3AnnotationDefinition; -import org.eclipse.jpt.jpa.eclipselink.core.internal.resource.java.EclipseLinkTenantDiscriminatorColumns2_3AnnotationDefinition; -import org.eclipse.jpt.jpa.eclipselink.core.internal.resource.java.EclipseLinkTransformationAnnotationDefinition; -import org.eclipse.jpt.jpa.eclipselink.core.internal.resource.java.EclipseLinkTypeConverterAnnotationDefinition; -import org.eclipse.jpt.jpa.eclipselink.core.internal.resource.java.EclipseLinkTypeConverters2_2AnnotationDefinition; -import org.eclipse.jpt.jpa.eclipselink.core.internal.resource.java.EclipseLinkVariableOneToOneAnnotationDefinition; -import org.eclipse.jpt.jpa.eclipselink.core.internal.resource.java.EclipseLinkWriteTransformerAnnotationDefinition; - -/** - * Provides annotations for 2.3 EclipseLink platform - */ -public class EclipseLink2_3JpaAnnotationDefinitionProvider - extends AbstractJpaAnnotationDefinitionProvider -{ - // singleton - private static final JpaAnnotationDefinitionProvider INSTANCE = new EclipseLink2_3JpaAnnotationDefinitionProvider(); - - /** - * Return the singleton - */ - public static JpaAnnotationDefinitionProvider instance() { - return INSTANCE; - } - - /** - * Enforce singleton usage - */ - private EclipseLink2_3JpaAnnotationDefinitionProvider() { - super(); - } - - @Override - protected void addAnnotationDefinitionsTo(ArrayList<AnnotationDefinition> definitions) { - CollectionTools.addAll(definitions, ANNOTATION_DEFINITIONS); - } - - protected static final AnnotationDefinition[] ANNOTATION_DEFINITIONS = new AnnotationDefinition[] { - EclipseLinkArray2_3AnnotationDefinition.instance(), - EclipseLinkBasicCollectionAnnotationDefinition.instance(), - EclipseLinkBasicMapAnnotationDefinition.instance(), - EclipseLinkCacheAnnotationDefinition.instance(), - EclipseLinkChangeTrackingAnnotationDefinition.instance(), - EclipseLinkClassExtractor2_1AnnotationDefinition.instance(), - EclipseLinkConvertAnnotationDefinition.instance(), - EclipseLinkConverters2_2AnnotationDefinition.instance(), - EclipseLinkCustomizerAnnotationDefinition.instance(), - EclipseLinkExistenceCheckingAnnotationDefinition.instance(), - EclipseLinkJoinFetchAnnotationDefinition.instance(), - EclipseLinkMultitenant2_3AnnotationDefinition.instance(), - EclipseLinkMutableAnnotationDefinition.instance(), - EclipseLinkObjectTypeConverters2_2AnnotationDefinition.instance(), - EclipseLinkPrimaryKeyAnnotationDefinition.instance(), - EclipseLinkPrivateOwnedAnnotationDefinition.instance(), - EclipseLinkReadOnlyAnnotationDefinition.instance(), - EclipseLinkReadTransformerAnnotationDefinition.instance(), - EclipseLinkStructConverters2_2AnnotationDefinition.instance(), - EclipseLinkStructure2_3AnnotationDefinition.instance(), - EclipseLinkTenantDiscriminatorColumns2_3AnnotationDefinition.instance(), - EclipseLinkTransformationAnnotationDefinition.instance(), - EclipseLinkTypeConverters2_2AnnotationDefinition.instance(), - EclipseLinkVariableOneToOneAnnotationDefinition.instance(), - EclipseLinkWriteTransformerAnnotationDefinition.instance() - }; - - @Override - protected void addNestableAnnotationDefinitionsTo(ArrayList<NestableAnnotationDefinition> definitions) { - CollectionTools.addAll(definitions, NESTABLE_ANNOTATION_DEFINITIONS); - } - - protected static final NestableAnnotationDefinition[] NESTABLE_ANNOTATION_DEFINITIONS = new NestableAnnotationDefinition[] { - EclipseLinkConverterAnnotationDefinition.instance(), - EclipseLinkObjectTypeConverterAnnotationDefinition.instance(), - EclipseLinkStructConverterAnnotationDefinition.instance(), - EclipseLinkTenantDiscriminatorColumn2_3AnnotationDefinition.instance(), - EclipseLinkTypeConverterAnnotationDefinition.instance(), - }; - - -} 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 deleted file mode 100644 index 9157ad05c0..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/EclipseLink2_3JpaPlatformFactory.java +++ /dev/null @@ -1,84 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2011, 2012 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Oracle - initial API and implementation - *******************************************************************************/ -package org.eclipse.jpt.jpa.eclipselink.core.internal; - -import org.eclipse.jpt.common.core.AnnotationProvider; -import org.eclipse.jpt.common.core.JptResourceType; -import org.eclipse.jpt.jpa.core.JpaFacet; -import org.eclipse.jpt.jpa.core.JpaPlatform; -import org.eclipse.jpt.jpa.core.JpaPlatformVariation; -import org.eclipse.jpt.jpa.core.JptJpaCorePlugin; -import org.eclipse.jpt.jpa.core.context.AccessType; -import org.eclipse.jpt.jpa.core.internal.GenericJpaPlatform; -import org.eclipse.jpt.jpa.core.internal.JpaAnnotationProvider; -import org.eclipse.jpt.jpa.core.internal.jpa2.Generic2_0JpaAnnotationDefinitionProvider; -import org.eclipse.jpt.jpa.eclipselink.core.JptJpaEclipseLinkCorePlugin; -import org.eclipse.jpt.jpa.eclipselink.core.internal.EclipseLinkJpaPlatformFactory.EclipseLinkVersion; -import org.eclipse.persistence.jpa.jpql.parser.EclipseLinkJPQLGrammar2_3; - -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(), - buildAnnotationProvider(), - EclipseLink2_3JpaPlatformProvider.instance(), - buildJpaVariation(), - EclipseLinkJPQLGrammar2_3.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( - Generic2_0JpaAnnotationDefinitionProvider.instance(), - EclipseLink2_3JpaAnnotationDefinitionProvider.instance()); - } - - @Override - protected JpaPlatformVariation buildJpaVariation() { - return new JpaPlatformVariation() { - public Supported getTablePerConcreteClassInheritanceIsSupported() { - return Supported.YES; - } - public boolean isJoinTableOverridable() { - return true; - } - public AccessType[] getSupportedAccessTypes(JptResourceType resourceType) { - if (resourceType.getContentType() == JptJpaEclipseLinkCorePlugin.ECLIPSELINK_ORM_XML_CONTENT_TYPE) { - if (this.versionIsEclipseLink2_1Compatibile(resourceType)) { - return EclipseLink2_1JpaPlatformFactory.ECLIPSELINK_SUPPORTED_ACCESS_TYPES; - } - } - return GENERIC_SUPPORTED_ACCESS_TYPES; - } - protected boolean versionIsEclipseLink2_1Compatibile(JptResourceType resourceType) { - return JptJpaCorePlugin.resourceTypeIsCompatible(resourceType, JptJpaEclipseLinkCorePlugin.ECLIPSELINK_ORM_XML_2_1_RESOURCE_TYPE.getVersion()); - } - }; - } -}
\ 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_3JpaPlatformProvider.java b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/EclipseLink2_3JpaPlatformProvider.java deleted file mode 100644 index 474055a6b7..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/EclipseLink2_3JpaPlatformProvider.java +++ /dev/null @@ -1,153 +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, 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.eclipselink.core.internal; - -import java.util.ArrayList; -import org.eclipse.core.runtime.content.IContentType; -import org.eclipse.jpt.common.core.JptResourceType; -import org.eclipse.jpt.common.utility.internal.CollectionTools; -import org.eclipse.jpt.jpa.core.JpaPlatformProvider; -import org.eclipse.jpt.jpa.core.ResourceDefinition; -import org.eclipse.jpt.jpa.core.context.java.DefaultJavaAttributeMappingDefinition; -import org.eclipse.jpt.jpa.core.context.java.JavaAttributeMappingDefinition; -import org.eclipse.jpt.jpa.core.context.java.JavaTypeMappingDefinition; -import org.eclipse.jpt.jpa.core.internal.context.java.JavaTransientMappingDefinition; -import org.eclipse.jpt.jpa.eclipselink.core.JptJpaEclipseLinkCorePlugin; -import org.eclipse.jpt.jpa.eclipselink.core.internal.context.java.EclipseLinkJavaArrayMappingDefinition2_3; -import org.eclipse.jpt.jpa.eclipselink.core.internal.context.java.EclipseLinkJavaBasicCollectionMappingDefinition2_0; -import org.eclipse.jpt.jpa.eclipselink.core.internal.context.java.EclipseLinkJavaBasicMapMappingDefinition2_0; -import org.eclipse.jpt.jpa.eclipselink.core.internal.context.java.EclipseLinkJavaBasicMappingDefinition2_2; -import org.eclipse.jpt.jpa.eclipselink.core.internal.context.java.EclipseLinkJavaElementCollectionMappingDefinition2_2; -import org.eclipse.jpt.jpa.eclipselink.core.internal.context.java.EclipseLinkJavaEmbeddableDefinition2_2; -import org.eclipse.jpt.jpa.eclipselink.core.internal.context.java.EclipseLinkJavaEmbeddedIdMappingDefinition2_2; -import org.eclipse.jpt.jpa.eclipselink.core.internal.context.java.EclipseLinkJavaEmbeddedMappingDefinition2_2; -import org.eclipse.jpt.jpa.eclipselink.core.internal.context.java.EclipseLinkJavaEntityDefinition2_3; -import org.eclipse.jpt.jpa.eclipselink.core.internal.context.java.EclipseLinkJavaIdMappingDefinition2_2; -import org.eclipse.jpt.jpa.eclipselink.core.internal.context.java.EclipseLinkJavaManyToManyMappingDefinition2_2; -import org.eclipse.jpt.jpa.eclipselink.core.internal.context.java.EclipseLinkJavaManyToOneMappingDefinition2_2; -import org.eclipse.jpt.jpa.eclipselink.core.internal.context.java.EclipseLinkJavaMappedSuperclassDefinition2_3; -import org.eclipse.jpt.jpa.eclipselink.core.internal.context.java.EclipseLinkJavaOneToManyMappingDefinition2_2; -import org.eclipse.jpt.jpa.eclipselink.core.internal.context.java.EclipseLinkJavaOneToOneMappingDefinition2_2; -import org.eclipse.jpt.jpa.eclipselink.core.internal.context.java.EclipseLinkJavaStructureMappingDefinition2_3; -import org.eclipse.jpt.jpa.eclipselink.core.internal.context.java.EclipseLinkJavaTransformationMappingDefinition2_0; -import org.eclipse.jpt.jpa.eclipselink.core.internal.context.java.EclipseLinkJavaVariableOneToOneMappingDefinition2_0; -import org.eclipse.jpt.jpa.eclipselink.core.internal.context.java.EclipseLinkJavaVersionMappingDefinition2_2; -import org.eclipse.jpt.jpa.eclipselink.core.internal.context.orm.EclipseLinkOrmXml2_1Definition; -import org.eclipse.jpt.jpa.eclipselink.core.internal.context.orm.EclipseLinkOrmXml2_2Definition; -import org.eclipse.jpt.jpa.eclipselink.core.internal.context.orm.EclipseLinkOrmXml2_3Definition; - - -public class EclipseLink2_3JpaPlatformProvider - extends AbstractEclipseLink2_0JpaPlatformProvider { - - // singleton - private static final JpaPlatformProvider INSTANCE = new EclipseLink2_3JpaPlatformProvider(); - - - /** - * Return the singleton - */ - public static JpaPlatformProvider instance() { - return INSTANCE; - } - - - /** - * Enforce singleton usage - */ - private EclipseLink2_3JpaPlatformProvider() { - super(); - } - - - // ********** resource models ********** - - @Override - public JptResourceType getMostRecentSupportedResourceType(IContentType contentType) { - if (contentType.equals(JptJpaEclipseLinkCorePlugin.ECLIPSELINK_ORM_XML_CONTENT_TYPE)) { - return JptJpaEclipseLinkCorePlugin.ECLIPSELINK_ORM_XML_2_3_RESOURCE_TYPE; - } - return super.getMostRecentSupportedResourceType(contentType); - } - - - // ********** resource definitions ********** - - @Override - protected void addResourceDefinitionsTo(ArrayList<ResourceDefinition> definitions) { - super.addResourceDefinitionsTo(definitions); - CollectionTools.addAll(definitions, RESOURCE_DEFINITIONS); - } - - protected static final ResourceDefinition[] RESOURCE_DEFINITIONS = new ResourceDefinition[] { - EclipseLinkOrmXml2_1Definition.instance(), - EclipseLinkOrmXml2_2Definition.instance(), - EclipseLinkOrmXml2_3Definition.instance() - }; - - // ********* Java type mappings ********* - - @Override - protected void addJavaTypeMappingDefinitionsTo(ArrayList<JavaTypeMappingDefinition> definitions) { - CollectionTools.addAll(definitions, JAVA_TYPE_MAPPING_DEFINITIONS); - } - - // order matches that used by EclipseLink - // NB: no EclipseLink-specific mappings - protected static final JavaTypeMappingDefinition[] JAVA_TYPE_MAPPING_DEFINITIONS = new JavaTypeMappingDefinition[] { - EclipseLinkJavaEntityDefinition2_3.instance(), - EclipseLinkJavaEmbeddableDefinition2_2.instance(), - EclipseLinkJavaMappedSuperclassDefinition2_3.instance() - }; - - - // ********* Java attribute mappings ********* - - @Override - protected void addDefaultJavaAttributeMappingDefinitionsTo(ArrayList<DefaultJavaAttributeMappingDefinition> definitions) { - CollectionTools.addAll(definitions, DEFAULT_JAVA_ATTRIBUTE_MAPPING_DEFINITIONS); - } - - // order matches that used by EclipseLink - // NB: no change from EclipseLink 1.2 to 2.0 - protected static final DefaultJavaAttributeMappingDefinition[] DEFAULT_JAVA_ATTRIBUTE_MAPPING_DEFINITIONS = new DefaultJavaAttributeMappingDefinition[] { - EclipseLinkJavaEmbeddedMappingDefinition2_2.instance(), - EclipseLinkJavaOneToManyMappingDefinition2_2.instance(), - EclipseLinkJavaOneToOneMappingDefinition2_2.instance(), - EclipseLinkJavaVariableOneToOneMappingDefinition2_0.instance(), - EclipseLinkJavaBasicMappingDefinition2_2.instance() - }; - - @Override - protected void addSpecifiedJavaAttributeMappingDefinitionsTo(ArrayList<JavaAttributeMappingDefinition> definitions) { - CollectionTools.addAll(definitions, SPECIFIED_JAVA_ATTRIBUTE_MAPPING_DEFINITIONS); - } - - // order matches that used by EclipseLink - protected static final JavaAttributeMappingDefinition[] SPECIFIED_JAVA_ATTRIBUTE_MAPPING_DEFINITIONS = new JavaAttributeMappingDefinition[] { - JavaTransientMappingDefinition.instance(), - EclipseLinkJavaBasicCollectionMappingDefinition2_0.instance(), - EclipseLinkJavaBasicMapMappingDefinition2_0.instance(), - EclipseLinkJavaArrayMappingDefinition2_3.instance(), - EclipseLinkJavaElementCollectionMappingDefinition2_2.instance(), - EclipseLinkJavaIdMappingDefinition2_2.instance(), - EclipseLinkJavaVersionMappingDefinition2_2.instance(), - EclipseLinkJavaBasicMappingDefinition2_2.instance(), - EclipseLinkJavaStructureMappingDefinition2_3.instance(), - EclipseLinkJavaEmbeddedMappingDefinition2_2.instance(), - EclipseLinkJavaEmbeddedIdMappingDefinition2_2.instance(), - EclipseLinkJavaTransformationMappingDefinition2_0.instance(), - EclipseLinkJavaManyToManyMappingDefinition2_2.instance(), - EclipseLinkJavaManyToOneMappingDefinition2_2.instance(), - EclipseLinkJavaOneToManyMappingDefinition2_2.instance(), - EclipseLinkJavaOneToOneMappingDefinition2_2.instance(), - EclipseLinkJavaVariableOneToOneMappingDefinition2_0.instance() - }; -} 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 deleted file mode 100644 index c263a00881..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/EclipseLink2_4JpaPlatformFactory.java +++ /dev/null @@ -1,84 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2011, 2012 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Oracle - initial API and implementation - *******************************************************************************/ -package org.eclipse.jpt.jpa.eclipselink.core.internal; - -import org.eclipse.jpt.common.core.AnnotationProvider; -import org.eclipse.jpt.common.core.JptResourceType; -import org.eclipse.jpt.jpa.core.JpaFacet; -import org.eclipse.jpt.jpa.core.JpaPlatform; -import org.eclipse.jpt.jpa.core.JpaPlatformVariation; -import org.eclipse.jpt.jpa.core.JptJpaCorePlugin; -import org.eclipse.jpt.jpa.core.context.AccessType; -import org.eclipse.jpt.jpa.core.internal.GenericJpaPlatform; -import org.eclipse.jpt.jpa.core.internal.JpaAnnotationProvider; -import org.eclipse.jpt.jpa.core.internal.jpa2.Generic2_0JpaAnnotationDefinitionProvider; -import org.eclipse.jpt.jpa.eclipselink.core.JptJpaEclipseLinkCorePlugin; -import org.eclipse.jpt.jpa.eclipselink.core.internal.EclipseLinkJpaPlatformFactory.EclipseLinkVersion; -import org.eclipse.persistence.jpa.jpql.parser.EclipseLinkJPQLGrammar2_4; - -public class EclipseLink2_4JpaPlatformFactory - extends EclipseLink2_0JpaPlatformFactory { - - /** - * zero-argument constructor - */ - public EclipseLink2_4JpaPlatformFactory() { - super(); - } - - @Override - public JpaPlatform buildJpaPlatform(String id) { - return new GenericJpaPlatform( - id, - buildJpaVersion(), - new EclipseLink2_0JpaFactory(), - buildAnnotationProvider(), - EclipseLink2_4JpaPlatformProvider.instance(), - buildJpaVariation(), - EclipseLinkJPQLGrammar2_4.instance()); - } - - @Override - protected JpaPlatform.Version buildJpaVersion() { - return new EclipseLinkVersion( - JptJpaEclipseLinkCorePlugin.ECLIPSELINK_PLATFORM_VERSION_2_4, - JpaFacet.VERSION_2_0.getVersionString()); - } - - @Override - protected AnnotationProvider buildAnnotationProvider() { - return new JpaAnnotationProvider( - Generic2_0JpaAnnotationDefinitionProvider.instance(), - EclipseLink2_3JpaAnnotationDefinitionProvider.instance()); - } - - @Override - protected JpaPlatformVariation buildJpaVariation() { - return new JpaPlatformVariation() { - public Supported getTablePerConcreteClassInheritanceIsSupported() { - return Supported.YES; - } - public boolean isJoinTableOverridable() { - return true; - } - public AccessType[] getSupportedAccessTypes(JptResourceType resourceType) { - if (resourceType.getContentType() == JptJpaEclipseLinkCorePlugin.ECLIPSELINK_ORM_XML_CONTENT_TYPE) { - if (this.versionIsEclipseLink2_1Compatibile(resourceType)) { - return EclipseLink2_1JpaPlatformFactory.ECLIPSELINK_SUPPORTED_ACCESS_TYPES; - } - } - return GENERIC_SUPPORTED_ACCESS_TYPES; - } - protected boolean versionIsEclipseLink2_1Compatibile(JptResourceType resourceType) { - return JptJpaCorePlugin.resourceTypeIsCompatible(resourceType, JptJpaEclipseLinkCorePlugin.ECLIPSELINK_ORM_XML_2_1_RESOURCE_TYPE.getVersion()); - } - }; - } -}
\ 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_4JpaPlatformProvider.java b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/EclipseLink2_4JpaPlatformProvider.java deleted file mode 100644 index d84df233d8..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/EclipseLink2_4JpaPlatformProvider.java +++ /dev/null @@ -1,155 +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, 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.eclipselink.core.internal; - -import java.util.ArrayList; -import org.eclipse.core.runtime.content.IContentType; -import org.eclipse.jpt.common.core.JptResourceType; -import org.eclipse.jpt.common.utility.internal.CollectionTools; -import org.eclipse.jpt.jpa.core.JpaPlatformProvider; -import org.eclipse.jpt.jpa.core.ResourceDefinition; -import org.eclipse.jpt.jpa.core.context.java.DefaultJavaAttributeMappingDefinition; -import org.eclipse.jpt.jpa.core.context.java.JavaAttributeMappingDefinition; -import org.eclipse.jpt.jpa.core.context.java.JavaTypeMappingDefinition; -import org.eclipse.jpt.jpa.core.internal.context.java.JavaTransientMappingDefinition; -import org.eclipse.jpt.jpa.eclipselink.core.JptJpaEclipseLinkCorePlugin; -import org.eclipse.jpt.jpa.eclipselink.core.internal.context.java.EclipseLinkJavaArrayMappingDefinition2_3; -import org.eclipse.jpt.jpa.eclipselink.core.internal.context.java.EclipseLinkJavaBasicCollectionMappingDefinition2_0; -import org.eclipse.jpt.jpa.eclipselink.core.internal.context.java.EclipseLinkJavaBasicMapMappingDefinition2_0; -import org.eclipse.jpt.jpa.eclipselink.core.internal.context.java.EclipseLinkJavaBasicMappingDefinition2_2; -import org.eclipse.jpt.jpa.eclipselink.core.internal.context.java.EclipseLinkJavaElementCollectionMappingDefinition2_2; -import org.eclipse.jpt.jpa.eclipselink.core.internal.context.java.EclipseLinkJavaEmbeddableDefinition2_2; -import org.eclipse.jpt.jpa.eclipselink.core.internal.context.java.EclipseLinkJavaEmbeddedIdMappingDefinition2_2; -import org.eclipse.jpt.jpa.eclipselink.core.internal.context.java.EclipseLinkJavaEmbeddedMappingDefinition2_2; -import org.eclipse.jpt.jpa.eclipselink.core.internal.context.java.EclipseLinkJavaEntityDefinition2_3; -import org.eclipse.jpt.jpa.eclipselink.core.internal.context.java.EclipseLinkJavaIdMappingDefinition2_2; -import org.eclipse.jpt.jpa.eclipselink.core.internal.context.java.EclipseLinkJavaManyToManyMappingDefinition2_2; -import org.eclipse.jpt.jpa.eclipselink.core.internal.context.java.EclipseLinkJavaManyToOneMappingDefinition2_2; -import org.eclipse.jpt.jpa.eclipselink.core.internal.context.java.EclipseLinkJavaMappedSuperclassDefinition2_3; -import org.eclipse.jpt.jpa.eclipselink.core.internal.context.java.EclipseLinkJavaOneToManyMappingDefinition2_2; -import org.eclipse.jpt.jpa.eclipselink.core.internal.context.java.EclipseLinkJavaOneToOneMappingDefinition2_2; -import org.eclipse.jpt.jpa.eclipselink.core.internal.context.java.EclipseLinkJavaStructureMappingDefinition2_3; -import org.eclipse.jpt.jpa.eclipselink.core.internal.context.java.EclipseLinkJavaTransformationMappingDefinition2_0; -import org.eclipse.jpt.jpa.eclipselink.core.internal.context.java.EclipseLinkJavaVariableOneToOneMappingDefinition2_0; -import org.eclipse.jpt.jpa.eclipselink.core.internal.context.java.EclipseLinkJavaVersionMappingDefinition2_2; -import org.eclipse.jpt.jpa.eclipselink.core.internal.context.orm.EclipseLinkOrmXml2_1Definition; -import org.eclipse.jpt.jpa.eclipselink.core.internal.context.orm.EclipseLinkOrmXml2_2Definition; -import org.eclipse.jpt.jpa.eclipselink.core.internal.context.orm.EclipseLinkOrmXml2_3Definition; -import org.eclipse.jpt.jpa.eclipselink.core.internal.context.orm.EclipseLinkOrmXml2_4Definition; - - -public class EclipseLink2_4JpaPlatformProvider - extends AbstractEclipseLink2_0JpaPlatformProvider { - - // singleton - private static final JpaPlatformProvider INSTANCE = new EclipseLink2_4JpaPlatformProvider(); - - - /** - * Return the singleton - */ - public static JpaPlatformProvider instance() { - return INSTANCE; - } - - - /** - * Enforce singleton usage - */ - private EclipseLink2_4JpaPlatformProvider() { - super(); - } - - - // ********** resource models ********** - - @Override - public JptResourceType getMostRecentSupportedResourceType(IContentType contentType) { - if (contentType.equals(JptJpaEclipseLinkCorePlugin.ECLIPSELINK_ORM_XML_CONTENT_TYPE)) { - return JptJpaEclipseLinkCorePlugin.ECLIPSELINK_ORM_XML_2_4_RESOURCE_TYPE; - } - return super.getMostRecentSupportedResourceType(contentType); - } - - - // ********** resource definitions ********** - - @Override - protected void addResourceDefinitionsTo(ArrayList<ResourceDefinition> definitions) { - super.addResourceDefinitionsTo(definitions); - CollectionTools.addAll(definitions, RESOURCE_DEFINITIONS); - } - - protected static final ResourceDefinition[] RESOURCE_DEFINITIONS = new ResourceDefinition[] { - EclipseLinkOrmXml2_1Definition.instance(), - EclipseLinkOrmXml2_2Definition.instance(), - EclipseLinkOrmXml2_3Definition.instance(), - EclipseLinkOrmXml2_4Definition.instance() - }; - - // ********* Java type mappings ********* - - @Override - protected void addJavaTypeMappingDefinitionsTo(ArrayList<JavaTypeMappingDefinition> definitions) { - CollectionTools.addAll(definitions, JAVA_TYPE_MAPPING_DEFINITIONS); - } - - // order matches that used by EclipseLink - // NB: no EclipseLink-specific mappings - protected static final JavaTypeMappingDefinition[] JAVA_TYPE_MAPPING_DEFINITIONS = new JavaTypeMappingDefinition[] { - EclipseLinkJavaEntityDefinition2_3.instance(), - EclipseLinkJavaEmbeddableDefinition2_2.instance(), - EclipseLinkJavaMappedSuperclassDefinition2_3.instance() - }; - - - // ********* Java attribute mappings ********* - - @Override - protected void addDefaultJavaAttributeMappingDefinitionsTo(ArrayList<DefaultJavaAttributeMappingDefinition> definitions) { - CollectionTools.addAll(definitions, DEFAULT_JAVA_ATTRIBUTE_MAPPING_DEFINITIONS); - } - - // order matches that used by EclipseLink - // NB: no change from EclipseLink 1.2 to 2.0 - protected static final DefaultJavaAttributeMappingDefinition[] DEFAULT_JAVA_ATTRIBUTE_MAPPING_DEFINITIONS = new DefaultJavaAttributeMappingDefinition[] { - EclipseLinkJavaEmbeddedMappingDefinition2_2.instance(), - EclipseLinkJavaOneToManyMappingDefinition2_2.instance(), - EclipseLinkJavaOneToOneMappingDefinition2_2.instance(), - EclipseLinkJavaVariableOneToOneMappingDefinition2_0.instance(), - EclipseLinkJavaBasicMappingDefinition2_2.instance() - }; - - @Override - protected void addSpecifiedJavaAttributeMappingDefinitionsTo(ArrayList<JavaAttributeMappingDefinition> definitions) { - CollectionTools.addAll(definitions, SPECIFIED_JAVA_ATTRIBUTE_MAPPING_DEFINITIONS); - } - - // order matches that used by EclipseLink - protected static final JavaAttributeMappingDefinition[] SPECIFIED_JAVA_ATTRIBUTE_MAPPING_DEFINITIONS = new JavaAttributeMappingDefinition[] { - JavaTransientMappingDefinition.instance(), - EclipseLinkJavaBasicCollectionMappingDefinition2_0.instance(), - EclipseLinkJavaBasicMapMappingDefinition2_0.instance(), - EclipseLinkJavaArrayMappingDefinition2_3.instance(), - EclipseLinkJavaElementCollectionMappingDefinition2_2.instance(), - EclipseLinkJavaIdMappingDefinition2_2.instance(), - EclipseLinkJavaVersionMappingDefinition2_2.instance(), - EclipseLinkJavaBasicMappingDefinition2_2.instance(), - EclipseLinkJavaStructureMappingDefinition2_3.instance(), - EclipseLinkJavaEmbeddedMappingDefinition2_2.instance(), - EclipseLinkJavaEmbeddedIdMappingDefinition2_2.instance(), - EclipseLinkJavaTransformationMappingDefinition2_0.instance(), - EclipseLinkJavaManyToManyMappingDefinition2_2.instance(), - EclipseLinkJavaManyToOneMappingDefinition2_2.instance(), - EclipseLinkJavaOneToManyMappingDefinition2_2.instance(), - EclipseLinkJavaOneToOneMappingDefinition2_2.instance(), - EclipseLinkJavaVariableOneToOneMappingDefinition2_0.instance() - }; -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/EclipseLinkJpaAnnotationDefinitionProvider.java b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/EclipseLinkJpaAnnotationDefinitionProvider.java deleted file mode 100644 index bcca4f019e..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/EclipseLinkJpaAnnotationDefinitionProvider.java +++ /dev/null @@ -1,100 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2008, 2011 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.eclipselink.core.internal; - -import java.util.ArrayList; -import org.eclipse.jpt.common.core.resource.java.AnnotationDefinition; -import org.eclipse.jpt.common.core.resource.java.NestableAnnotationDefinition; -import org.eclipse.jpt.common.utility.internal.CollectionTools; -import org.eclipse.jpt.jpa.core.JpaAnnotationDefinitionProvider; -import org.eclipse.jpt.jpa.core.internal.AbstractJpaAnnotationDefinitionProvider; -import org.eclipse.jpt.jpa.eclipselink.core.internal.resource.java.EclipseLinkBasicCollectionAnnotationDefinition; -import org.eclipse.jpt.jpa.eclipselink.core.internal.resource.java.EclipseLinkBasicMapAnnotationDefinition; -import org.eclipse.jpt.jpa.eclipselink.core.internal.resource.java.EclipseLinkCacheAnnotationDefinition; -import org.eclipse.jpt.jpa.eclipselink.core.internal.resource.java.EclipseLinkChangeTrackingAnnotationDefinition; -import org.eclipse.jpt.jpa.eclipselink.core.internal.resource.java.EclipseLinkConvertAnnotationDefinition; -import org.eclipse.jpt.jpa.eclipselink.core.internal.resource.java.EclipseLinkConverterAnnotationDefinition; -import org.eclipse.jpt.jpa.eclipselink.core.internal.resource.java.EclipseLinkCustomizerAnnotationDefinition; -import org.eclipse.jpt.jpa.eclipselink.core.internal.resource.java.EclipseLinkExistenceCheckingAnnotationDefinition; -import org.eclipse.jpt.jpa.eclipselink.core.internal.resource.java.EclipseLinkJoinFetchAnnotationDefinition; -import org.eclipse.jpt.jpa.eclipselink.core.internal.resource.java.EclipseLinkMutableAnnotationDefinition; -import org.eclipse.jpt.jpa.eclipselink.core.internal.resource.java.EclipseLinkObjectTypeConverterAnnotationDefinition; -import org.eclipse.jpt.jpa.eclipselink.core.internal.resource.java.EclipseLinkPrimaryKeyAnnotationDefinition; -import org.eclipse.jpt.jpa.eclipselink.core.internal.resource.java.EclipseLinkPrivateOwnedAnnotationDefinition; -import org.eclipse.jpt.jpa.eclipselink.core.internal.resource.java.EclipseLinkReadOnlyAnnotationDefinition; -import org.eclipse.jpt.jpa.eclipselink.core.internal.resource.java.EclipseLinkReadTransformerAnnotationDefinition; -import org.eclipse.jpt.jpa.eclipselink.core.internal.resource.java.EclipseLinkStructConverterAnnotationDefinition; -import org.eclipse.jpt.jpa.eclipselink.core.internal.resource.java.EclipseLinkTransformationAnnotationDefinition; -import org.eclipse.jpt.jpa.eclipselink.core.internal.resource.java.EclipseLinkTypeConverterAnnotationDefinition; -import org.eclipse.jpt.jpa.eclipselink.core.internal.resource.java.EclipseLinkVariableOneToOneAnnotationDefinition; -import org.eclipse.jpt.jpa.eclipselink.core.internal.resource.java.EclipseLinkWriteTransformerAnnotationDefinition; - -/** - * Provides annotations for 1.0 EclipseLink platform - */ -public class EclipseLinkJpaAnnotationDefinitionProvider - extends AbstractJpaAnnotationDefinitionProvider -{ - // singleton - private static final JpaAnnotationDefinitionProvider INSTANCE = new EclipseLinkJpaAnnotationDefinitionProvider(); - - /** - * Return the singleton - */ - public static JpaAnnotationDefinitionProvider instance() { - return INSTANCE; - } - - - /** - * Enforce singleton usage - */ - private EclipseLinkJpaAnnotationDefinitionProvider() { - super(); - } - - @Override - protected void addAnnotationDefinitionsTo(ArrayList<AnnotationDefinition> definitions) { - CollectionTools.addAll(definitions, ANNOTATION_DEFINITIONS); - } - - protected static final AnnotationDefinition[] ANNOTATION_DEFINITIONS = new AnnotationDefinition[] { - EclipseLinkBasicCollectionAnnotationDefinition.instance(), - EclipseLinkBasicMapAnnotationDefinition.instance(), - EclipseLinkCacheAnnotationDefinition.instance(), - EclipseLinkChangeTrackingAnnotationDefinition.instance(), - EclipseLinkConvertAnnotationDefinition.instance(), - EclipseLinkCustomizerAnnotationDefinition.instance(), - EclipseLinkExistenceCheckingAnnotationDefinition.instance(), - EclipseLinkJoinFetchAnnotationDefinition.instance(), - EclipseLinkMutableAnnotationDefinition.instance(), - EclipseLinkPrimaryKeyAnnotationDefinition.instance(), - EclipseLinkPrivateOwnedAnnotationDefinition.instance(), - EclipseLinkReadOnlyAnnotationDefinition.instance(), - EclipseLinkReadTransformerAnnotationDefinition.instance(), - EclipseLinkTransformationAnnotationDefinition.instance(), - EclipseLinkVariableOneToOneAnnotationDefinition.instance(), - EclipseLinkWriteTransformerAnnotationDefinition.instance() - }; - - - @Override - protected void addNestableAnnotationDefinitionsTo(ArrayList<NestableAnnotationDefinition> definitions) { - CollectionTools.addAll(definitions, NESTABLE_ANNOTATION_DEFINITIONS); - } - - protected static final NestableAnnotationDefinition[] NESTABLE_ANNOTATION_DEFINITIONS = new NestableAnnotationDefinition[] { - EclipseLinkConverterAnnotationDefinition.instance(), - EclipseLinkObjectTypeConverterAnnotationDefinition.instance(), - EclipseLinkStructConverterAnnotationDefinition.instance(), - EclipseLinkTypeConverterAnnotationDefinition.instance(), - }; - -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/EclipseLinkJpaFactory.java b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/EclipseLinkJpaFactory.java deleted file mode 100644 index 3f89c55f55..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/EclipseLinkJpaFactory.java +++ /dev/null @@ -1,151 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2008, 2012 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - *******************************************************************************/ -package org.eclipse.jpt.jpa.eclipselink.core.internal; - -import org.eclipse.jpt.common.core.resource.java.JavaResourceField; -import org.eclipse.jpt.common.core.resource.java.JavaResourceMethod; -import org.eclipse.jpt.jpa.core.JpaProject; -import org.eclipse.jpt.jpa.core.context.PersistentType; -import org.eclipse.jpt.jpa.core.context.java.Accessor; -import org.eclipse.jpt.jpa.core.context.java.JavaBasicMapping; -import org.eclipse.jpt.jpa.core.context.java.JavaEmbeddable; -import org.eclipse.jpt.jpa.core.context.java.JavaIdMapping; -import org.eclipse.jpt.jpa.core.context.java.JavaManyToManyMapping; -import org.eclipse.jpt.jpa.core.context.java.JavaManyToOneMapping; -import org.eclipse.jpt.jpa.core.context.java.JavaOneToManyMapping; -import org.eclipse.jpt.jpa.core.context.java.JavaOneToOneMapping; -import org.eclipse.jpt.jpa.core.context.java.JavaPersistentAttribute; -import org.eclipse.jpt.jpa.core.context.java.JavaPersistentType; -import org.eclipse.jpt.jpa.core.context.java.JavaVersionMapping; -import org.eclipse.jpt.jpa.core.internal.AbstractJpaFactory; -import org.eclipse.jpt.jpa.core.resource.java.EmbeddableAnnotation; -import org.eclipse.jpt.jpa.core.resource.java.EntityAnnotation; -import org.eclipse.jpt.jpa.core.resource.java.MappedSuperclassAnnotation; -import org.eclipse.jpt.jpa.eclipselink.core.EclipseLinkJpaProject; -import org.eclipse.jpt.jpa.eclipselink.core.context.java.JavaEclipseLinkEntity; -import org.eclipse.jpt.jpa.eclipselink.core.context.java.JavaEclipseLinkMappedSuperclass; -import org.eclipse.jpt.jpa.eclipselink.core.internal.context.java.JavaEclipseLinkBasicCollectionMapping; -import org.eclipse.jpt.jpa.eclipselink.core.internal.context.java.JavaEclipseLinkBasicMapMapping; -import org.eclipse.jpt.jpa.eclipselink.core.internal.context.java.JavaEclipseLinkBasicMapping; -import org.eclipse.jpt.jpa.eclipselink.core.internal.context.java.JavaEclipseLinkEmbeddableImpl; -import org.eclipse.jpt.jpa.eclipselink.core.internal.context.java.JavaEclipseLinkEntityImpl; -import org.eclipse.jpt.jpa.eclipselink.core.internal.context.java.JavaEclipseLinkIdMapping; -import org.eclipse.jpt.jpa.eclipselink.core.internal.context.java.JavaEclipseLinkManyToManyMapping; -import org.eclipse.jpt.jpa.eclipselink.core.internal.context.java.JavaEclipseLinkManyToOneMapping; -import org.eclipse.jpt.jpa.eclipselink.core.internal.context.java.JavaEclipseLinkMappedSuperclassImpl; -import org.eclipse.jpt.jpa.eclipselink.core.internal.context.java.JavaEclipseLinkOneToManyMapping; -import org.eclipse.jpt.jpa.eclipselink.core.internal.context.java.JavaEclipseLinkOneToOneMapping; -import org.eclipse.jpt.jpa.eclipselink.core.internal.context.java.SpecifiedJavaEclipseLinkPersistentAttribute; -import org.eclipse.jpt.jpa.eclipselink.core.internal.context.java.JavaEclipseLinkTransformationMapping; -import org.eclipse.jpt.jpa.eclipselink.core.internal.context.java.JavaEclipseLinkVariableOneToOneMapping; -import org.eclipse.jpt.jpa.eclipselink.core.internal.context.java.JavaEclipseLinkVersionMapping; - -public class EclipseLinkJpaFactory - extends AbstractJpaFactory -{ - public EclipseLinkJpaFactory() { - super(); - } - - - // ********** Core Model ********** - - @Override - public EclipseLinkJpaProject buildJpaProject(JpaProject.Config config) { - return new EclipseLinkJpaProjectImpl(config); - } - - - // ********** Java Context Model overrides ********** - - @Override - public JavaPersistentAttribute buildJavaPersistentAttribute(PersistentType parent, Accessor accessor) { - return new SpecifiedJavaEclipseLinkPersistentAttribute(parent, accessor); - } - - @Override - public JavaPersistentAttribute buildJavaPersistentField(PersistentType parent, JavaResourceField resourceField) { - return new SpecifiedJavaEclipseLinkPersistentAttribute(parent, resourceField); - } - - @Override - public JavaPersistentAttribute buildJavaPersistentProperty(PersistentType parent, JavaResourceMethod resourceGetter, JavaResourceMethod resourceSetter) { - return new SpecifiedJavaEclipseLinkPersistentAttribute(parent, resourceGetter, resourceSetter); - } - - @Override - public JavaBasicMapping buildJavaBasicMapping(JavaPersistentAttribute parent) { - return new JavaEclipseLinkBasicMapping(parent); - } - - @Override - public JavaEmbeddable buildJavaEmbeddable(JavaPersistentType parent, EmbeddableAnnotation embeddableAnnotation) { - return new JavaEclipseLinkEmbeddableImpl(parent, embeddableAnnotation); - } - - @Override - public JavaEclipseLinkEntity buildJavaEntity(JavaPersistentType parent, EntityAnnotation entityAnnotation) { - return new JavaEclipseLinkEntityImpl(parent, entityAnnotation); - } - - @Override - public JavaIdMapping buildJavaIdMapping(JavaPersistentAttribute parent) { - return new JavaEclipseLinkIdMapping(parent); - } - - @Override - public JavaEclipseLinkMappedSuperclass buildJavaMappedSuperclass(JavaPersistentType parent, MappedSuperclassAnnotation mappedSuperclassAnnotation) { - return new JavaEclipseLinkMappedSuperclassImpl(parent, mappedSuperclassAnnotation); - } - - @Override - public JavaVersionMapping buildJavaVersionMapping(JavaPersistentAttribute parent) { - return new JavaEclipseLinkVersionMapping(parent); - } - - @Override - public JavaOneToManyMapping buildJavaOneToManyMapping(JavaPersistentAttribute parent) { - return new JavaEclipseLinkOneToManyMapping(parent); - } - - @Override - public JavaOneToOneMapping buildJavaOneToOneMapping(JavaPersistentAttribute parent) { - return new JavaEclipseLinkOneToOneMapping(parent); - } - - @Override - public JavaManyToManyMapping buildJavaManyToManyMapping(JavaPersistentAttribute parent) { - return new JavaEclipseLinkManyToManyMapping(parent); - } - - @Override - public JavaManyToOneMapping buildJavaManyToOneMapping(JavaPersistentAttribute parent) { - return new JavaEclipseLinkManyToOneMapping(parent); - } - - - // ********** EclipseLink-specific Java Context Model ********** - - public JavaEclipseLinkBasicCollectionMapping buildJavaEclipseLinkBasicCollectionMapping(JavaPersistentAttribute parent) { - return new JavaEclipseLinkBasicCollectionMapping(parent); - } - - public JavaEclipseLinkBasicMapMapping buildJavaEclipseLinkBasicMapMapping(JavaPersistentAttribute parent) { - return new JavaEclipseLinkBasicMapMapping(parent); - } - - public JavaEclipseLinkTransformationMapping buildJavaEclipseLinkTransformationMapping(JavaPersistentAttribute parent) { - return new JavaEclipseLinkTransformationMapping(parent); - } - - public JavaEclipseLinkVariableOneToOneMapping buildJavaEclipseLinkVariableOneToOneMapping(JavaPersistentAttribute parent) { - return new JavaEclipseLinkVariableOneToOneMapping(parent); - } -} 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 deleted file mode 100644 index 82ebbb2e39..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/EclipseLinkJpaJpqlQueryHelper.java +++ /dev/null @@ -1,97 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2011, 2012 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.context.AttributeMapping; -import org.eclipse.jpt.jpa.core.jpql.JpaJpqlQueryHelper; -import org.eclipse.jpt.jpa.core.jpql.spi.IManagedTypeBuilder; -import org.eclipse.jpt.jpa.eclipselink.core.jpql.spi.EclipseLinkManagedTypeBuilder; -import org.eclipse.jpt.jpa.eclipselink.core.jpql.spi.EclipseLinkMappingBuilder; -import org.eclipse.persistence.jpa.jpql.AbstractContentAssistVisitor; -import org.eclipse.persistence.jpa.jpql.AbstractGrammarValidator; -import org.eclipse.persistence.jpa.jpql.AbstractSemanticValidator; -import org.eclipse.persistence.jpa.jpql.EclipseLinkContentAssistVisitor; -import org.eclipse.persistence.jpa.jpql.EclipseLinkGrammarValidator; -import org.eclipse.persistence.jpa.jpql.EclipseLinkJPQLQueryContext; -import org.eclipse.persistence.jpa.jpql.EclipseLinkSemanticValidator; -import org.eclipse.persistence.jpa.jpql.JPQLQueryContext; -import org.eclipse.persistence.jpa.jpql.parser.JPQLGrammar; -import org.eclipse.persistence.jpa.jpql.spi.IMappingBuilder; - -/** - * The abstract implementation of {@link JpaJpqlQueryHelper} that supports EclipseLink. - * - * @version 3.2 - * @since 3.1 - * @author Pascal Filion - */ -public class EclipseLinkJpaJpqlQueryHelper extends JpaJpqlQueryHelper { - - /** - * Creates a new <code>EclipseLinkJpaJpqlQueryHelper</code>. - * - * @param jpqlGrammar The grammar that defines how to parse a JPQL query - */ - public EclipseLinkJpaJpqlQueryHelper(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); - } - - /** - * {@inheritDoc} - */ - @Override - protected IManagedTypeBuilder buildManagedTypeBuilder() { - return new EclipseLinkManagedTypeBuilder(); - } - - /** - * {@inheritDoc} - */ - @Override - protected IMappingBuilder<AttributeMapping> buildMappingBuilder() { - return new EclipseLinkMappingBuilder(); - } - - /** - * {@inheritDoc} - */ - @Override - protected AbstractSemanticValidator buildSemanticValidator(JPQLQueryContext queryContext) { - return new EclipseLinkSemanticValidator(queryContext); - } -}
\ 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 deleted file mode 100644 index ec067a3fd5..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/EclipseLinkJpaPlatformFactory.java +++ /dev/null @@ -1,112 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2007, 2012 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.eclipselink.core.internal; - -import org.eclipse.jpt.common.core.AnnotationProvider; -import org.eclipse.jpt.common.core.JptResourceType; -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.context.AccessType; -import org.eclipse.jpt.jpa.core.internal.GenericJpaAnnotationDefinitionProvider; -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.persistence.jpa.jpql.parser.EclipseLinkJPQLGrammar1; - -/** - * All the state in the JPA platform should be "static" (i.e. unchanging once - * it is initialized). - */ -public class EclipseLinkJpaPlatformFactory - implements JpaPlatformFactory -{ - - /** - * zero-argument constructor - */ - public EclipseLinkJpaPlatformFactory() { - super(); - } - - public JpaPlatform buildJpaPlatform(String id) { - return new GenericJpaPlatform( - id, - buildJpaVersion(), - new EclipseLinkJpaFactory(), - buildAnnotationProvider(), - EclipseLinkJpaPlatformProvider.instance(), - buildJpaPlatformVariation(), - EclipseLinkJPQLGrammar1.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() { - return Supported.NO; - } - public boolean isJoinTableOverridable() { - return false; - } - public AccessType[] getSupportedAccessTypes(JptResourceType resourceType) { - return GENERIC_SUPPORTED_ACCESS_TYPES; - } - }; - } - - - public static class EclipseLinkVersion extends SimpleVersion { - - protected final String eclipseLinkVersion; - - public EclipseLinkVersion(String eclipseLinkVersion, String jpaVersion) { - super(jpaVersion); - this.eclipseLinkVersion = eclipseLinkVersion; - } - - @Override - public String getVersion() { - return this.eclipseLinkVersion; - } - - /** - * Return whether the platform is compatible with the specified EclipseLink version. - * @see JptJpaEclipseLinkCorePlugin#ECLIPSELINK_PLATFORM_VERSION_1_0 - * @see JptJpaEclipseLinkCorePlugin#ECLIPSELINK_PLATFORM_VERSION_1_1 - * @see JptJpaEclipseLinkCorePlugin#ECLIPSELINK_PLATFORM_VERSION_1_2 - * @see JptJpaEclipseLinkCorePlugin#ECLIPSELINK_PLATFORM_VERSION_2_0 - * @see JptJpaEclipseLinkCorePlugin#ECLIPSELINK_PLATFORM_VERSION_2_1 - * @see JptJpaEclipseLinkCorePlugin#ECLIPSELINK_PLATFORM_VERSION_2_2 - * @see JptJpaEclipseLinkCorePlugin#ECLIPSELINK_PLATFORM_VERSION_2_3 - */ - public boolean isCompatibleWithVersion(String version) { - return VERSION_COMPARATOR.compare(this.eclipseLinkVersion, version) >= 0; - } - - @Override - public String toString() { - return super.toString() + " EclipseLink version: " + this.getVersion(); //$NON-NLS-1$ - } - } -}
\ 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/EclipseLinkJpaPlatformProvider.java b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/EclipseLinkJpaPlatformProvider.java deleted file mode 100644 index 641e5b14a1..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/EclipseLinkJpaPlatformProvider.java +++ /dev/null @@ -1,183 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2008, 2011 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - *******************************************************************************/ -package org.eclipse.jpt.jpa.eclipselink.core.internal; - -import java.util.ArrayList; -import org.eclipse.core.runtime.content.IContentType; -import org.eclipse.jpt.common.core.JptCommonCorePlugin; -import org.eclipse.jpt.common.core.JptResourceType; -import org.eclipse.jpt.common.utility.internal.CollectionTools; -import org.eclipse.jpt.jpa.core.JpaPlatformProvider; -import org.eclipse.jpt.jpa.core.JpaResourceModelProvider; -import org.eclipse.jpt.jpa.core.JptJpaCorePlugin; -import org.eclipse.jpt.jpa.core.ResourceDefinition; -import org.eclipse.jpt.jpa.core.context.java.DefaultJavaAttributeMappingDefinition; -import org.eclipse.jpt.jpa.core.context.java.JavaAttributeMappingDefinition; -import org.eclipse.jpt.jpa.core.context.java.JavaTypeMappingDefinition; -import org.eclipse.jpt.jpa.core.internal.AbstractJpaPlatformProvider; -import org.eclipse.jpt.jpa.core.internal.JarResourceModelProvider; -import org.eclipse.jpt.jpa.core.internal.JavaResourceModelProvider; -import org.eclipse.jpt.jpa.core.internal.OrmResourceModelProvider; -import org.eclipse.jpt.jpa.core.internal.PersistenceResourceModelProvider; -import org.eclipse.jpt.jpa.core.internal.context.java.JavaEmbeddedIdMappingDefinition; -import org.eclipse.jpt.jpa.core.internal.context.java.JavaEmbeddedMappingDefinition; -import org.eclipse.jpt.jpa.core.internal.context.java.JavaTransientMappingDefinition; -import org.eclipse.jpt.jpa.core.internal.jpa1.context.orm.GenericOrmXmlDefinition; -import org.eclipse.jpt.jpa.eclipselink.core.JptJpaEclipseLinkCorePlugin; -import org.eclipse.jpt.jpa.eclipselink.core.internal.context.java.EclipseLinkJavaBasicCollectionMappingDefinition; -import org.eclipse.jpt.jpa.eclipselink.core.internal.context.java.EclipseLinkJavaBasicMapMappingDefinition; -import org.eclipse.jpt.jpa.eclipselink.core.internal.context.java.EclipseLinkJavaBasicMappingDefinition; -import org.eclipse.jpt.jpa.eclipselink.core.internal.context.java.EclipseLinkJavaEmbeddableDefinition; -import org.eclipse.jpt.jpa.eclipselink.core.internal.context.java.EclipseLinkJavaEntityDefinition; -import org.eclipse.jpt.jpa.eclipselink.core.internal.context.java.EclipseLinkJavaIdMappingDefinition; -import org.eclipse.jpt.jpa.eclipselink.core.internal.context.java.EclipseLinkJavaManyToManyMappingDefinition; -import org.eclipse.jpt.jpa.eclipselink.core.internal.context.java.EclipseLinkJavaManyToOneMappingDefinition; -import org.eclipse.jpt.jpa.eclipselink.core.internal.context.java.EclipseLinkJavaMappedSuperclassDefinition; -import org.eclipse.jpt.jpa.eclipselink.core.internal.context.java.EclipseLinkJavaOneToManyMappingDefinition; -import org.eclipse.jpt.jpa.eclipselink.core.internal.context.java.EclipseLinkJavaOneToOneMappingDefinition; -import org.eclipse.jpt.jpa.eclipselink.core.internal.context.java.EclipseLinkJavaTransformationMappingDefinition; -import org.eclipse.jpt.jpa.eclipselink.core.internal.context.java.EclipseLinkJavaVariableOneToOneMappingDefinition; -import org.eclipse.jpt.jpa.eclipselink.core.internal.context.java.EclipseLinkJavaVersionMappingDefinition; -import org.eclipse.jpt.jpa.eclipselink.core.internal.context.orm.EclipseLinkOrmXmlDefinition; -import org.eclipse.jpt.jpa.eclipselink.core.internal.context.persistence.EclipseLinkPersistenceXmlDefinition; - -/** - * EclipseLink platform - */ -public class EclipseLinkJpaPlatformProvider - extends AbstractJpaPlatformProvider { - - // singleton - private static final JpaPlatformProvider INSTANCE = new EclipseLinkJpaPlatformProvider(); - - - /** - * Return the singleton. - */ - public static JpaPlatformProvider instance() { - return INSTANCE; - } - - - /** - * Enforce singleton usage - */ - private EclipseLinkJpaPlatformProvider() { - super(); - } - - - // ********* resource models ********* - - public JptResourceType getMostRecentSupportedResourceType(IContentType contentType) { - if (contentType.equals(JptCommonCorePlugin.JAVA_SOURCE_CONTENT_TYPE)) { - return JptCommonCorePlugin.JAVA_SOURCE_RESOURCE_TYPE; - } - else if (contentType.equals(JptCommonCorePlugin.JAR_CONTENT_TYPE)) { - return JptCommonCorePlugin.JAR_RESOURCE_TYPE; - } - else if (contentType.equals(JptJpaCorePlugin.PERSISTENCE_XML_CONTENT_TYPE)) { - return JptJpaCorePlugin.PERSISTENCE_XML_1_0_RESOURCE_TYPE; - } - else if (contentType.equals(JptJpaCorePlugin.ORM_XML_CONTENT_TYPE)) { - return JptJpaCorePlugin.ORM_XML_1_0_RESOURCE_TYPE; - } - else if (contentType.equals(JptJpaEclipseLinkCorePlugin.ECLIPSELINK_ORM_XML_CONTENT_TYPE)) { - return JptJpaEclipseLinkCorePlugin.ECLIPSELINK_ORM_XML_1_0_RESOURCE_TYPE; - } - else { - throw new IllegalArgumentException(contentType.toString()); - } - } - - @Override - protected void addResourceModelProvidersTo(ArrayList<JpaResourceModelProvider> providers) { - CollectionTools.addAll(providers, RESOURCE_MODEL_PROVIDERS); - } - - // order should not be important here - protected static final JpaResourceModelProvider[] RESOURCE_MODEL_PROVIDERS = new JpaResourceModelProvider[] { - JavaResourceModelProvider.instance(), - JarResourceModelProvider.instance(), - PersistenceResourceModelProvider.instance(), - OrmResourceModelProvider.instance(), - EclipseLinkOrmResourceModelProvider.instance() - }; - - - // ********* Java type mappings ********* - - @Override - protected void addJavaTypeMappingDefinitionsTo(ArrayList<JavaTypeMappingDefinition> definitions) { - CollectionTools.addAll(definitions, JAVA_TYPE_MAPPING_DEFINITIONS); - } - - // order matches that used by EclipseLink - // NB: no EclipseLink-specific mappings - protected static final JavaTypeMappingDefinition[] JAVA_TYPE_MAPPING_DEFINITIONS = new JavaTypeMappingDefinition[] { - EclipseLinkJavaEntityDefinition.instance(), - EclipseLinkJavaEmbeddableDefinition.instance(), - EclipseLinkJavaMappedSuperclassDefinition.instance() - }; - - - // ********* Java attribute mappings ********* - - @Override - protected void addDefaultJavaAttributeMappingDefinitionsTo(ArrayList<DefaultJavaAttributeMappingDefinition> definitions) { - CollectionTools.addAll(definitions, DEFAULT_JAVA_ATTRIBUTE_MAPPING_DEFINITIONS); - } - - // order matches that used by EclipseLink - protected static final DefaultJavaAttributeMappingDefinition[] DEFAULT_JAVA_ATTRIBUTE_MAPPING_DEFINITIONS = new DefaultJavaAttributeMappingDefinition[] { - JavaEmbeddedMappingDefinition.instance(), - EclipseLinkJavaOneToManyMappingDefinition.instance(), - EclipseLinkJavaOneToOneMappingDefinition.instance(), - EclipseLinkJavaVariableOneToOneMappingDefinition.instance(), - EclipseLinkJavaBasicMappingDefinition.instance() - }; - - @Override - protected void addSpecifiedJavaAttributeMappingDefinitionsTo(ArrayList<JavaAttributeMappingDefinition> definitions) { - CollectionTools.addAll(definitions, SPECIFIED_JAVA_ATTRIBUTE_MAPPING_DEFINITIONS); - } - - // order matches that used by EclipseLink - protected static final JavaAttributeMappingDefinition[] SPECIFIED_JAVA_ATTRIBUTE_MAPPING_DEFINITIONS = new JavaAttributeMappingDefinition[] { - JavaTransientMappingDefinition.instance(), - EclipseLinkJavaBasicCollectionMappingDefinition.instance(), - EclipseLinkJavaBasicMapMappingDefinition.instance(), - EclipseLinkJavaIdMappingDefinition.instance(), - EclipseLinkJavaVersionMappingDefinition.instance(), - EclipseLinkJavaBasicMappingDefinition.instance(), - JavaEmbeddedMappingDefinition.instance(), - JavaEmbeddedIdMappingDefinition.instance(), - EclipseLinkJavaTransformationMappingDefinition.instance(), - EclipseLinkJavaManyToManyMappingDefinition.instance(), - EclipseLinkJavaManyToOneMappingDefinition.instance(), - EclipseLinkJavaOneToManyMappingDefinition.instance(), - EclipseLinkJavaOneToOneMappingDefinition.instance(), - EclipseLinkJavaVariableOneToOneMappingDefinition.instance() - }; - - - // ********** resource definitions ********** - - @Override - protected void addResourceDefinitionsTo(ArrayList<ResourceDefinition> definitions) { - CollectionTools.addAll(definitions, RESOURCE_DEFINITIONS); - } - - protected static final ResourceDefinition[] RESOURCE_DEFINITIONS = new ResourceDefinition[] { - EclipseLinkPersistenceXmlDefinition.instance(), - EclipseLinkOrmXmlDefinition.instance(), - GenericOrmXmlDefinition.instance() - }; -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/EclipseLinkJpaProjectImpl.java b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/EclipseLinkJpaProjectImpl.java deleted file mode 100644 index d354457ad5..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/EclipseLinkJpaProjectImpl.java +++ /dev/null @@ -1,34 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2009, 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.eclipselink.core.internal; - -import org.eclipse.jpt.jpa.core.JpaProject; -import org.eclipse.jpt.jpa.core.internal.AbstractJpaProject; -import org.eclipse.jpt.jpa.core.resource.xml.JpaXmlResource; -import org.eclipse.jpt.jpa.eclipselink.core.EclipseLinkJpaProject; -import org.eclipse.jpt.jpa.eclipselink.core.JptJpaEclipseLinkCorePlugin; - -/** - * EclipseLink-specific JPA project. - */ -public class EclipseLinkJpaProjectImpl - extends AbstractJpaProject - implements EclipseLinkJpaProject { - - public EclipseLinkJpaProjectImpl(JpaProject.Config config) { - super(config); - } - - public JpaXmlResource getDefaultEclipseLinkOrmXmlResource() { - return (JpaXmlResource) this.getResourceModel( - JptJpaEclipseLinkCorePlugin.DEFAULT_ECLIPSELINK_ORM_XML_RUNTIME_PATH, - JptJpaEclipseLinkCorePlugin.ECLIPSELINK_ORM_XML_CONTENT_TYPE); - } -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/EclipseLinkJpaValidationMessages.java b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/EclipseLinkJpaValidationMessages.java deleted file mode 100644 index 2eb9fc274e..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/EclipseLinkJpaValidationMessages.java +++ /dev/null @@ -1,113 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2008, 2012 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.eclipselink.core.internal; - -@SuppressWarnings("nls") -public interface EclipseLinkJpaValidationMessages { - - public static final String BUNDLE_NAME = "eclipselink_jpa_validation"; - - public static final String CACHE_EXPIRY_AND_EXPIRY_TIME_OF_DAY_BOTH_SPECIFIED = "CACHE_EXPIRY_AND_EXPIRY_TIME_OF_DAY_BOTH_SPECIFIED"; - - public static final String CONVERTER_CLASS_IMPLEMENTS_CONVERTER = "CONVERTER_CLASS_IMPLEMENTS_CONVERTER"; - - public static final String STRUCT_CONVERTER_CLASS_IMPLEMENTS_STRUCT_CONVERTER = "STRUCT_CONVERTER_CLASS_IMPLEMENTS_STRUCT_CONVERTER"; - - public static final String CONVERTER_DUPLICATE_NAME = "CONVERTER_DUPLICATE_NAME"; - - public static final String CONVERTER_NAME_UNDEFINED = "CONVERTER_NAME_UNDEFINED"; - - public static final String RESERVED_CONVERTER_NAME = "RESERVED_CONVERTER_NAME"; - - public static final String CONVERTER_CLASS_EXISTS = "CONVERTER_CLASS_EXISTS"; - - public static final String CONVERTER_CLASS_DEFINED = "CONVERTER_CLASS_DEFINED"; - - public static final String DESCRIPTOR_CUSTOMIZER_CLASS_NOT_SPECIFIED = "DESCRIPTOR_CUSTOMIZER_CLASS_NOT_SPECIFIED"; - - public static final String DESCRIPTOR_CUSTOMIZER_CLASS_NOT_EXIST = "DESCRIPTOR_CUSTOMIZER_CLASS_NOT_EXIST"; - - public static final String DESCRIPTOR_CUSTOMIZER_CLASS_NOT_VALID = "DESCRIPTOR_CUSTOMIZER_CLASS_NOT_VALID"; - - public static final String DESCRIPTOR_CUSTOMIZER_CLASS_IMPLEMENTS_DESCRIPTOR_CUSTOMIZER = "DESCRIPTOR_CUSTOMIZER_CLASS_IMPLEMENTS_DESCRIPTOR_CUSTOMIZER"; - - public static final String EXCEPTION_HANDLER_CLASS_NOT_SPECIFIED = "EXCEPTION_HANDLER_CLASS_NOT_SPECIFIED"; - - public static final String EXCEPTION_HANDLER_CLASS_NOT_EXIST = "EXCEPTION_HANDLER_CLASS_NOT_EXIST"; - - public static final String EXCEPTION_HANDLER_CLASS_NOT_VALID = "EXCEPTION_HANDLER_CLASS_NOT_VALID"; - - public static final String EXCEPTION_HANDLER_CLASS_IMPLEMENTS_EXCEPTION_HANDLER = "EXCEPTION_HANDLER_CLASS_IMPLEMENTS_EXCEPTION_HANDLER"; - - public static final String GENERATOR_DUPLICATE_NAME = "GENERATOR_DUPLICATE_NAME"; - - public static final String GENERATOR_EQUIVALENT = "GENERATOR_EQUIVALENT"; - - public static final String ID_MAPPING_UNRESOLVED_CONVERTER_NAME = "ID_MAPPING_UNRESOLVED_CONVERTER_NAME"; - - public static final String MULTIPLE_OBJECT_VALUES_FOR_DATA_VALUE = "MULTIPLE_OBJECT_VALUES_FOR_DATA_VALUE"; - - public static final String PERSISTENT_ATTRIBUTE_INVALID_VERSION_MAPPING_TYPE = "PERSISTENT_ATTRIBUTE_INVALID_VERSION_MAPPING_TYPE"; - - public static final String PERSISTENCE_UNIT_LEGACY_DESCRIPTOR_CUSTOMIZER = "PERSISTENCE_UNIT_LEGACY_DESCRIPTOR_CUSTOMIZER"; - - public static final String PERSISTENCE_UNIT_LEGACY_ENTITY_CACHING = "PERSISTENCE_UNIT_LEGACY_ENTITY_CACHING"; - - public static final String PERSISTENCE_UNIT_CACHING_PROPERTY_IGNORED = "PERSISTENCE_UNIT_CACHING_PROPERTY_IGNORED"; - - public static final String QUERY_DUPLICATE_NAME = "QUERY_DUPLICATE_NAME"; - - public static final String QUERY_EQUIVALENT = "QUERY_EQUIVALENT"; - - public static final String SESSION_CUSTOMIZER_CLASS_NOT_SPECIFIED = "SESSION_CUSTOMIZER_CLASS_NOT_SPECIFIED"; - - public static final String SESSION_CUSTOMIZER_CLASS_NOT_EXIST = "SESSION_CUSTOMIZER_CLASS_NOT_EXIST"; - - public static final String SESSION_CUSTOMIZER_CLASS_NOT_VALID = "SESSION_CUSTOMIZER_CLASS_NOT_VALID"; - - public static final String SESSION_CUSTOMIZER_CLASS_IMPLEMENTS_SESSION_CUSTOMIZER = "SESSION_CUSTOMIZER_CLASS_IMPLEMENTS_SESSION_CUSTOMIZER"; - - public static final String SESSION_LOGGER_CLASS_NOT_SPECIFIED = "SESSION_LOGGER_CLASS_NOT_SPECIFIED"; - - public static final String SESSION_LOGGER_CLASS_NOT_EXIST = "SESSION_LOGGER_CLASS_NOT_EXIST"; - - public static final String SESSION_LOGGER_CLASS_IMPLEMENTS_SESSION_LOG = "SESSION_LOGGER_CLASS_IMPLEMENTS_SESSION_LOG"; - - public static final String SESSION_PROFILER_CLASS_NOT_SPECIFIED = "SESSION_PROFILER_CLASS_NOT_SPECIFIED"; - - public static final String SESSION_PROFILER_CLASS_NOT_EXIST = "SESSION_PROFILER_CLASS_NOT_EXIST"; - - public static final String SESSION_PROFILER_CLASS_NOT_VALID = "SESSION_PROFILER_CLASS_NOT_VALID"; - - public static final String SESSION_PROFILER_CLASS_IMPLEMENTS_SESSIONP_ROFILER = "SESSION_PROFILER_CLASS_IMPLEMENTS_SESSION_PROFILER"; - - public static final String BASIC_COLLECTION_MAPPING_DEPRECATED = "BASIC_COLLECTION_MAPPING_DEPRECATED"; - - public static final String BASIC_MAP_MAPPING_DEPRECATED = "BASIC_MAP_MAPPING_DEPRECATED"; - - public static final String TYPE_MAPPING_MEMBER_CLASS_NOT_STATIC = "TYPE_MAPPING_MEMBER_CLASS_NOT_STATIC"; - - public static final String TENANT_DISCRIMINATOR_COLUMN_UNRESOLVED_NAME = "TENANT_DISCRIMINATOR_COLUMN_UNRESOLVED_NAME"; - public static final String VIRTUAL_TENANT_DISCRIMINATOR_COLUMN_UNRESOLVED_NAME = "VIRTUAL_TENANT_DISCRIMINATOR_COLUMN_UNRESOLVED_NAME"; - public static final String VIRTUAL_ATTRIBUTE_TENANT_DISCRIMINATOR_COLUMN_UNRESOLVED_NAME = "VIRTUAL_ATTRIBUTE_TENANT_DISCRIMINATOR_COLUMN_UNRESOLVED_NAME"; - public static final String TENANT_DISCRIMINATOR_COLUMN_TABLE_NOT_VALID = "TENANT_DISCRIMINATOR_COLUMN_TABLE_NOT_VALID"; - public static final String VIRTUAL_TENANT_DISCRIMINATOR_COLUMN_TABLE_NOT_VALID = "VIRTUAL_TENANT_DISCRIMINATOR_COLUMN_TABLE_NOT_VALID"; - public static final String VIRTUAL_ATTRIBUTE_TENANT_DISCRIMINATOR_COLUMN_TABLE_NOT_VALID="VIRTUAL_ATTRIBUTE_TENANT_DISCRIMINATOR_COLUMN_TABLE_NOT_VALID"; - public static final String MULTITENANT_NOT_SPECIFIED_WITH_TENANT_DISCRIMINATOR_COLUMNS = "MULTITENANT_NOT_SPECIFIED_WITH_TENANT_DISCRIMINATOR_COLUMNS"; - public static final String MULTITENANT_METADATA_CANNOT_BE_SPECIFIED_ON_NON_ROOT_ENTITY = "MULTITENANT_METADATA_CANNOT_BE_SPECIFIED_ON_NON_ROOT_ENTITY"; - public static final String MULTITENANT_TABLE_PER_TENANT_NOT_SUPPORTED = "MULTITENANT_TABLE_PER_TENANT_NOT_SUPPORTED"; - public static final String MULTITENANT_VPD_MIGHT_NOT_BE_NOT_SUPPORTED = "MULTITENANT_VPD_MIGHT_NOT_BE_NOT_SUPPORTED"; - public static final String MULTITENANT_VPD_NOT_SUPPORTED_ON_NON_ORACLE_DATABASE_PLATFORM = "MULTITENANT_VPD_NOT_SUPPORTED_ON_NON_ORACLE_DATABASE_PLATFORM"; - public static final String MULTITENANT_VPD_INCLUDE_CRITERIA_WILL_BE_IGNORED = "MULTITENANT_VPD_INCLUDE_CRITERIA_WILL_BE_IGNORED"; - - public static final String VIRTUAL_ATTRIBUTE_NO_ATTRIBUTE_TYPE_SPECIFIED = "VIRTUAL_ATTRIBUTE_NO_ATTRIBUTE_TYPE_SPECIFIED"; - public static final String VIRTUAL_ATTRIBUTE_ATTRIBUTE_TYPE_DOES_NOT_EXIST = "VIRTUAL_ATTRIBUTE_ATTRIBUTE_TYPE_DOES_NOT_EXIST"; - public static final String VIRTUAL_TYPE_PARENT_CLASS_DOES_NOT_EXIST = "VIRTUAL_TYPE_PARENT_CLASS_DOES_NOT_EXIST"; -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/EclipseLinkOrmResourceModelProvider.java b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/EclipseLinkOrmResourceModelProvider.java deleted file mode 100644 index d6d8ed6086..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/EclipseLinkOrmResourceModelProvider.java +++ /dev/null @@ -1,53 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2008, 2009 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.eclipselink.core.internal; - -import org.eclipse.core.resources.IFile; -import org.eclipse.core.runtime.content.IContentType; -import org.eclipse.jpt.jpa.core.JpaProject; -import org.eclipse.jpt.jpa.core.JpaResourceModelProvider; -import org.eclipse.jpt.jpa.core.resource.xml.JpaXmlResource; -import org.eclipse.jpt.jpa.eclipselink.core.JptJpaEclipseLinkCorePlugin; -import org.eclipse.jpt.jpa.eclipselink.core.internal.resource.orm.EclipseLinkOrmXmlResourceProvider; - -/** - * EclipseLink orm.xml - */ -public class EclipseLinkOrmResourceModelProvider - implements JpaResourceModelProvider -{ - // singleton - private static final JpaResourceModelProvider INSTANCE = new EclipseLinkOrmResourceModelProvider(); - - - /** - * Return the singleton - */ - public static JpaResourceModelProvider instance() { - return INSTANCE; - } - - - /** - * Enforce singleton usage - */ - private EclipseLinkOrmResourceModelProvider() { - super(); - } - - - public IContentType getContentType() { - return JptJpaEclipseLinkCorePlugin.ECLIPSELINK_ORM_XML_CONTENT_TYPE; - } - - public JpaXmlResource buildResourceModel(JpaProject jpaProject, IFile file) { - return EclipseLinkOrmXmlResourceProvider.getXmlResourceProvider(file).getXmlResource(); - } -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/JptJpaEclipseLinkCoreMessages.java b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/JptJpaEclipseLinkCoreMessages.java deleted file mode 100644 index fe25959081..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/JptJpaEclipseLinkCoreMessages.java +++ /dev/null @@ -1,28 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2012 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.eclipselink.core.internal; - -import org.eclipse.osgi.util.NLS; - -public class JptJpaEclipseLinkCoreMessages { - - public static String JPA_METADATA_CONVERSION_CONVERT_CONVERTER; - - - private static final String BUNDLE_NAME = "jpt_jpa_eclipselink_core"; //$NON-NLS-1$ - private static final Class<?> BUNDLE_CLASS = JptJpaEclipseLinkCoreMessages.class; - static { - NLS.initializeMessages(BUNDLE_NAME, BUNDLE_CLASS); - } - - private JptJpaEclipseLinkCoreMessages() { - throw new UnsupportedOperationException(); - } -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/AbstractEclipseLinkTypeMappingValidator.java b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/AbstractEclipseLinkTypeMappingValidator.java deleted file mode 100644 index 0ada0fb11b..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/AbstractEclipseLinkTypeMappingValidator.java +++ /dev/null @@ -1,49 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010, 2011 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.eclipselink.core.internal.context; - -import java.util.List; -import org.eclipse.jpt.common.core.resource.java.JavaResourceType; -import org.eclipse.jpt.jpa.core.context.TypeMapping; -import org.eclipse.jpt.jpa.core.internal.context.TypeMappingTextRangeResolver; -import org.eclipse.jpt.jpa.core.internal.jpa1.context.AbstractTypeMappingValidator; -import org.eclipse.jpt.jpa.core.internal.validation.JpaValidationMessages; -import org.eclipse.jpt.jpa.eclipselink.core.internal.DefaultEclipseLinkJpaValidationMessages; -import org.eclipse.jpt.jpa.eclipselink.core.internal.EclipseLinkJpaValidationMessages; -import org.eclipse.wst.validation.internal.provisional.core.IMessage; - -public abstract class AbstractEclipseLinkTypeMappingValidator<T extends TypeMapping> - extends AbstractTypeMappingValidator<T> -{ - protected AbstractEclipseLinkTypeMappingValidator(T typeMapping, JavaResourceType jrt, TypeMappingTextRangeResolver textRangeResolver) { - super(typeMapping, jrt, textRangeResolver); - } - - - @Override - protected void validateType(List<IMessage> messages) { - if (this.isMemberType() && !this.isStaticType()) { - messages.add(this.buildEclipseLinkTypeMessage(EclipseLinkJpaValidationMessages.TYPE_MAPPING_MEMBER_CLASS_NOT_STATIC)); - } - if (!this.hasNoArgConstructor()) { - messages.add(this.buildTypeMessage(JpaValidationMessages.TYPE_MAPPING_CLASS_MISSING_NO_ARG_CONSTRUCTOR)); - } - } - - protected IMessage buildEclipseLinkTypeMessage(String msgID) { - return DefaultEclipseLinkJpaValidationMessages.buildMessage( - IMessage.HIGH_SEVERITY, - msgID, - new String[] {this.typeMapping.getName()}, - this.typeMapping, - this.textRangeResolver.getTypeMappingTextRange() - ); - } -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/EclipseLinkConvertValidator.java b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/EclipseLinkConvertValidator.java deleted file mode 100644 index 8a9057b880..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/EclipseLinkConvertValidator.java +++ /dev/null @@ -1,87 +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, 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.eclipselink.core.internal.context; - -import java.util.List; -import org.eclipse.jpt.common.utility.internal.ArrayTools; -import org.eclipse.jpt.common.utility.internal.CollectionTools; -import org.eclipse.jpt.jpa.core.context.AttributeMapping; -import org.eclipse.jpt.jpa.core.internal.context.JptValidator; -import org.eclipse.jpt.jpa.core.internal.jpa1.context.ConverterTextRangeResolver; -import org.eclipse.jpt.jpa.eclipselink.core.context.EclipseLinkConvert; -import org.eclipse.jpt.jpa.eclipselink.core.context.persistence.EclipseLinkPersistenceUnit; -import org.eclipse.jpt.jpa.eclipselink.core.internal.DefaultEclipseLinkJpaValidationMessages; -import org.eclipse.jpt.jpa.eclipselink.core.internal.EclipseLinkJpaValidationMessages; -import org.eclipse.wst.validation.internal.provisional.core.IMessage; -import org.eclipse.wst.validation.internal.provisional.core.IReporter; - -public class EclipseLinkConvertValidator - implements JptValidator -{ - protected final EclipseLinkConvert convert; - - protected final ConverterTextRangeResolver textRangeResolver; - - - public EclipseLinkConvertValidator(EclipseLinkConvert convert, ConverterTextRangeResolver textRangeResolver) { - super(); - this.convert = convert; - this.textRangeResolver = textRangeResolver; - } - - protected AttributeMapping getAttributeMapping() { - return this.convert.getParent(); - } - - protected EclipseLinkPersistenceUnit getPersistenceUnit() { - return this.convert.getPersistenceUnit(); - } - - /** - * The converters are validated in the persistence unit. - * @see org.eclipse.jpt.jpa.eclipselink.core.context.persistence.EclipseLinkPersistenceUnit#validateConverters(List, IReporter) - */ - public boolean validate(List<IMessage> messages, IReporter reporter) { - // converters are validated in the persistence unit - return this.validateConverterName(messages); - } - - - private boolean validateConverterName(List<IMessage> messages) { - String converterName = this.convert.getConverterName(); - if (converterName == null) { - return true; - } - - if (CollectionTools.contains(this.getPersistenceUnit().getUniqueConverterNames(), converterName)) { - return true; - } - - if (ArrayTools.contains(EclipseLinkConvert.RESERVED_CONVERTER_NAMES, converterName)) { - return true; - } - - messages.add( - DefaultEclipseLinkJpaValidationMessages.buildMessage( - IMessage.HIGH_SEVERITY, - EclipseLinkJpaValidationMessages.ID_MAPPING_UNRESOLVED_CONVERTER_NAME, - new String[] { - converterName, - this.getAttributeMapping().getName() - }, - this.getAttributeMapping(), - this.textRangeResolver.getConverterTextRange() - ) - ); - return false; - } - - -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/EclipseLinkDynamicTypeMappingValidator.java b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/EclipseLinkDynamicTypeMappingValidator.java deleted file mode 100644 index 947aecf2d9..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/EclipseLinkDynamicTypeMappingValidator.java +++ /dev/null @@ -1,28 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2012 Oracle. - * All rights reserved. This program and the accompanying materials are - * made available under the terms of the Eclipse Public License v1.0 which - * accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Oracle - initial API and implementation - *******************************************************************************/ -package org.eclipse.jpt.jpa.eclipselink.core.internal.context; - -import java.util.List; -import org.eclipse.jpt.jpa.core.context.TypeMapping; -import org.eclipse.wst.validation.internal.provisional.core.IMessage; - -public class EclipseLinkDynamicTypeMappingValidator - extends AbstractEclipseLinkTypeMappingValidator<TypeMapping> -{ - public EclipseLinkDynamicTypeMappingValidator(TypeMapping typeMapping) { - super(typeMapping, null, null); - } - - @Override - protected void validateType(List<IMessage> messages) { - //no validation for a dynamic type - } -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/EclipseLinkEntityPrimaryKeyValidator.java b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/EclipseLinkEntityPrimaryKeyValidator.java deleted file mode 100644 index 29a3a3fce5..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/EclipseLinkEntityPrimaryKeyValidator.java +++ /dev/null @@ -1,75 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010, 2012 Oracle. - * All rights reserved. This program and the accompanying materials are - * made available under the terms of the Eclipse Public License v1.0 which - * accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Oracle - initial API and implementation - *******************************************************************************/ -package org.eclipse.jpt.jpa.eclipselink.core.internal.context; - -import java.util.List; -import org.eclipse.jpt.jpa.core.context.TypeMapping; -import org.eclipse.jpt.jpa.core.context.java.JavaPersistentType; -import org.eclipse.jpt.jpa.core.internal.context.PrimaryKeyTextRangeResolver; -import org.eclipse.jpt.jpa.core.internal.jpa1.context.AbstractEntityPrimaryKeyValidator; -import org.eclipse.jpt.jpa.core.internal.validation.DefaultJpaValidationMessages; -import org.eclipse.jpt.jpa.core.internal.validation.JpaValidationMessages; -import org.eclipse.jpt.jpa.eclipselink.core.context.EclipseLinkEntity; -import org.eclipse.jpt.jpa.eclipselink.core.context.EclipseLinkTypeMapping; -import org.eclipse.wst.validation.internal.provisional.core.IMessage; -import org.eclipse.wst.validation.internal.provisional.core.IReporter; - -public class EclipseLinkEntityPrimaryKeyValidator - extends AbstractEntityPrimaryKeyValidator -{ - public EclipseLinkEntityPrimaryKeyValidator( - EclipseLinkEntity entity, PrimaryKeyTextRangeResolver textRangeResolver) { - - super(entity, textRangeResolver); - } - - - @Override - protected EclipseLinkEntity entity() { - return (EclipseLinkEntity) typeMapping(); - } - - // in EclipseLink, a hierarchy may define its primary key on multiple classes, so long as the - // root entity has a coherent defined primary key. - // However, the id class may only be defined on one class in the hierarchy. - @Override - protected void validatePrimaryKeyIsNotRedefined(List<IMessage> messages, IReporter reporter) { - if (idClassReference().isSpecified() && definesIdClassOnAncestor(typeMapping())) { - messages.add( - DefaultJpaValidationMessages.buildMessage( - IMessage.HIGH_SEVERITY, - JpaValidationMessages.TYPE_MAPPING_ID_CLASS_REDEFINED, - new String[0], - typeMapping(), - textRangeResolver().getIdClassTextRange())); - } - } - - @Override - protected boolean definesPrimaryKey(TypeMapping typeMapping) { - return super.definesPrimaryKey(typeMapping) - || ((EclipseLinkTypeMapping) typeMapping).usesPrimaryKeyColumns() - || ((EclipseLinkTypeMapping) typeMapping).usesPrimaryKeyTenantDiscriminatorColumns(); - } - - @Override - protected boolean specifiesIdClass() { - return super.specifiesIdClass() || definesIdClass(typeMapping()); - } - - - @Override - protected void validateIdClassAttributesWithPropertyAccess( - JavaPersistentType idClass, List<IMessage> messages, - IReporter reporter) { - //do nothing - Eclipselink does not care about the existence status of property methods - } -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/EclipseLinkMappedSuperclassPrimaryKeyValidator.java b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/EclipseLinkMappedSuperclassPrimaryKeyValidator.java deleted file mode 100644 index b3b97d2791..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/EclipseLinkMappedSuperclassPrimaryKeyValidator.java +++ /dev/null @@ -1,82 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010, 2012 Oracle. - * All rights reserved. This program and the accompanying materials are - * made available under the terms of the Eclipse Public License v1.0 which - * accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Oracle - initial API and implementation - *******************************************************************************/ -package org.eclipse.jpt.jpa.eclipselink.core.internal.context; - -import java.util.List; -import org.eclipse.jpt.jpa.core.context.TypeMapping; -import org.eclipse.jpt.jpa.core.context.java.JavaPersistentType; -import org.eclipse.jpt.jpa.core.internal.context.PrimaryKeyTextRangeResolver; -import org.eclipse.jpt.jpa.core.internal.jpa1.context.AbstractMappedSuperclassPrimaryKeyValidator; -import org.eclipse.jpt.jpa.core.internal.validation.DefaultJpaValidationMessages; -import org.eclipse.jpt.jpa.core.internal.validation.JpaValidationMessages; -import org.eclipse.jpt.jpa.eclipselink.core.context.EclipseLinkMappedSuperclass; -import org.eclipse.jpt.jpa.eclipselink.core.context.EclipseLinkTypeMapping; -import org.eclipse.wst.validation.internal.provisional.core.IMessage; -import org.eclipse.wst.validation.internal.provisional.core.IReporter; - -public class EclipseLinkMappedSuperclassPrimaryKeyValidator - extends AbstractMappedSuperclassPrimaryKeyValidator -{ - public EclipseLinkMappedSuperclassPrimaryKeyValidator( - EclipseLinkMappedSuperclass mappedSuperclass, PrimaryKeyTextRangeResolver textRangeResolver) { - - super(mappedSuperclass, textRangeResolver); - } - - - @Override - protected EclipseLinkMappedSuperclass mappedSuperclass() { - return (EclipseLinkMappedSuperclass) typeMapping(); - } - - // in EclipseLink, a hierarchy may define its primary key on multiple classes, so long as the - // root entity has a coherent defined primary key. - // However, the id class may only be defined on one class in the hierarchy. - @Override - protected void validatePrimaryKeyIsNotRedefined(List<IMessage> messages, IReporter reporter) { - if (idClassReference().isSpecified() && definesIdClassOnAncestor(typeMapping())) { - messages.add( - DefaultJpaValidationMessages.buildMessage( - IMessage.HIGH_SEVERITY, - JpaValidationMessages.TYPE_MAPPING_ID_CLASS_REDEFINED, - new String[0], - typeMapping(), - textRangeResolver().getIdClassTextRange())); - } - } - - // in EclipseLink, it's only the root entity where this matters - @Override - protected void validateIdClassIsUsedIfNecessary(List<IMessage> messages, IReporter reporter) { - // no op - } - - // in EclipseLink, it's only the root entity where this matters - @Override - protected void validateIdClass(JavaPersistentType idClass, List<IMessage> messages, IReporter reporter) { - // no op - } - - @Override - protected boolean definesPrimaryKey(TypeMapping typeMapping) { - return super.definesPrimaryKey(typeMapping) - || ((EclipseLinkTypeMapping) typeMapping).usesPrimaryKeyColumns(); - } - - - @Override - protected void validateIdClassAttributesWithPropertyAccess( - JavaPersistentType idClass, List<IMessage> messages, - IReporter reporter) { - //do nothing - Eclipselink does not care about the existence status of property methods - } - -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/EclipseLinkMappedSuperclassValidator.java b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/EclipseLinkMappedSuperclassValidator.java deleted file mode 100644 index aab2123010..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/EclipseLinkMappedSuperclassValidator.java +++ /dev/null @@ -1,35 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010, 2011 Oracle. - * All rights reserved. This program and the accompanying materials are - * made available under the terms of the Eclipse Public License v1.0 which - * accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Oracle - initial API and implementation - *******************************************************************************/ -package org.eclipse.jpt.jpa.eclipselink.core.internal.context; - -import java.util.List; -import org.eclipse.jpt.common.core.resource.java.JavaResourceType; -import org.eclipse.jpt.jpa.core.context.MappedSuperclass; -import org.eclipse.jpt.jpa.core.internal.context.TypeMappingTextRangeResolver; -import org.eclipse.jpt.jpa.core.internal.validation.JpaValidationMessages; -import org.eclipse.wst.validation.internal.provisional.core.IMessage; - -public class EclipseLinkMappedSuperclassValidator - extends AbstractEclipseLinkTypeMappingValidator<MappedSuperclass> -{ - public EclipseLinkMappedSuperclassValidator(MappedSuperclass mappedSuperclass, JavaResourceType jrt, TypeMappingTextRangeResolver textRangeResolver) { - super(mappedSuperclass, jrt, textRangeResolver); - } - - - @Override - protected void validateType(List<IMessage> messages) { - if (this.isFinalType()) { - messages.add(this.buildTypeMessage(JpaValidationMessages.TYPE_MAPPING_FINAL_CLASS)); - } - super.validateType(messages); - } -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/EclipseLinkPersistentAttributeValidator.java b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/EclipseLinkPersistentAttributeValidator.java deleted file mode 100644 index 1a0f14d1b7..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/EclipseLinkPersistentAttributeValidator.java +++ /dev/null @@ -1,36 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010, 2011 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.eclipselink.core.internal.context; - -import java.util.List; -import org.eclipse.jpt.jpa.core.context.ReadOnlyPersistentAttribute; -import org.eclipse.jpt.jpa.core.internal.context.PersistentAttributeTextRangeResolver; -import org.eclipse.jpt.jpa.core.internal.jpa1.context.AbstractPersistentAttributeValidator; -import org.eclipse.wst.validation.internal.provisional.core.IMessage; - -public class EclipseLinkPersistentAttributeValidator - extends AbstractPersistentAttributeValidator -{ - public EclipseLinkPersistentAttributeValidator( - ReadOnlyPersistentAttribute persistentAttribute, PersistentAttributeTextRangeResolver textRangeResolver) - { - super(persistentAttribute, textRangeResolver); - } - - /** - * EclipseLink does not have the same restrictions on the - * attribute as the JPA spec does (e.g. the spec prohibits a field from - * being public). - */ - @Override - protected void validateMappedAttribute(List<IMessage> messages) { - return; - } -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/EclipseLinkTypeMappingValidator.java b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/EclipseLinkTypeMappingValidator.java deleted file mode 100644 index a2f720f05f..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/EclipseLinkTypeMappingValidator.java +++ /dev/null @@ -1,23 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010, 2011 Oracle. - * All rights reserved. This program and the accompanying materials are - * made available under the terms of the Eclipse Public License v1.0 which - * accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Oracle - initial API and implementation - *******************************************************************************/ -package org.eclipse.jpt.jpa.eclipselink.core.internal.context; - -import org.eclipse.jpt.common.core.resource.java.JavaResourceType; -import org.eclipse.jpt.jpa.core.context.TypeMapping; -import org.eclipse.jpt.jpa.core.internal.context.TypeMappingTextRangeResolver; - -public class EclipseLinkTypeMappingValidator - extends AbstractEclipseLinkTypeMappingValidator<TypeMapping> -{ - public EclipseLinkTypeMappingValidator(TypeMapping typeMapping, JavaResourceType jrt, TypeMappingTextRangeResolver textRangeResolver) { - super(typeMapping, jrt, textRangeResolver); - } -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/TenantDiscriminatorColumnValidator2_3.java b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/TenantDiscriminatorColumnValidator2_3.java deleted file mode 100644 index 0ca15e5edc..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/TenantDiscriminatorColumnValidator2_3.java +++ /dev/null @@ -1,120 +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, 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.eclipselink.core.internal.context; - -import org.eclipse.jpt.jpa.core.internal.context.JptValidator; -import org.eclipse.jpt.jpa.core.internal.context.NamedColumnTextRangeResolver; -import org.eclipse.jpt.jpa.core.internal.jpa1.context.AbstractNamedColumnValidator; -import org.eclipse.jpt.jpa.core.internal.jpa1.context.EntityTableDescriptionProvider; -import org.eclipse.jpt.jpa.eclipselink.core.context.ReadOnlyTenantDiscriminatorColumn2_3; -import org.eclipse.jpt.jpa.eclipselink.core.internal.DefaultEclipseLinkJpaValidationMessages; -import org.eclipse.jpt.jpa.eclipselink.core.internal.EclipseLinkJpaValidationMessages; -import org.eclipse.wst.validation.internal.provisional.core.IMessage; - -public class TenantDiscriminatorColumnValidator2_3 - extends AbstractNamedColumnValidator<ReadOnlyTenantDiscriminatorColumn2_3, NamedColumnTextRangeResolver> -{ - public TenantDiscriminatorColumnValidator2_3( - ReadOnlyTenantDiscriminatorColumn2_3 namedColumn, - NamedColumnTextRangeResolver textRangeResolver) { - super(namedColumn, textRangeResolver, new EntityTableDescriptionProvider()); - } - - @Override - protected JptValidator buildTableValidator() { - return new TableValidator(); - } - - @Override - protected IMessage buildUnresolvedNameMessage(String message) { - return DefaultEclipseLinkJpaValidationMessages.buildMessage( - IMessage.HIGH_SEVERITY, - message, - new String[] { - this.column.getName(), - this.column.getDbTable().getName() - }, - this.column, - this.textRangeResolver.getNameTextRange() - ); - } - - @Override - protected IMessage buildUnresolvedNameMessage() { - return this.column.isVirtual() ? - this.buildUnresolvedNameMessage(this.getVirtualTenantDiscriminatorColumnUnresolvedNameMessage()) : - super.buildUnresolvedNameMessage(); - } - - protected String getVirtualTenantDiscriminatorColumnUnresolvedNameMessage() { - return EclipseLinkJpaValidationMessages.VIRTUAL_TENANT_DISCRIMINATOR_COLUMN_UNRESOLVED_NAME; - } - - @Override - protected String getUnresolvedNameMessage() { - return EclipseLinkJpaValidationMessages.TENANT_DISCRIMINATOR_COLUMN_UNRESOLVED_NAME; - } - - @Override - protected String getVirtualAttributeUnresolvedNameMessage() { - return EclipseLinkJpaValidationMessages.VIRTUAL_ATTRIBUTE_TENANT_DISCRIMINATOR_COLUMN_UNRESOLVED_NAME; - } - - - // ********** table validator ********** - - protected class TableValidator - extends BaseColumnTableValidator - { - protected TableValidator() { - super(); - } - - @Override - protected ReadOnlyTenantDiscriminatorColumn2_3 getColumn() { - return (ReadOnlyTenantDiscriminatorColumn2_3) super.getColumn(); - } - - @Override - protected IMessage buildTableNotValidMessage_() { - return DefaultEclipseLinkJpaValidationMessages.buildMessage( - IMessage.HIGH_SEVERITY, - this.getColumnTableNotValidMessage(), - new String[] { - this.getColumn().getTable(), - this.getColumn().getName(), - this.getColumnTableDescriptionMessage() - }, - this.getColumn(), - this.getTextRangeResolver().getTableTextRange() - ); - } - - @Override - protected String getColumnTableNotValidMessage() { - return this.getColumn().isVirtual() ? - this.getVirtualTenantDiscriminatorColumnTableNotValidMessage() : - this.getColumnTableNotValidMessage_(); - } - - protected String getVirtualTenantDiscriminatorColumnTableNotValidMessage() { - return EclipseLinkJpaValidationMessages.VIRTUAL_TENANT_DISCRIMINATOR_COLUMN_TABLE_NOT_VALID; - } - - protected String getColumnTableNotValidMessage_() { - return EclipseLinkJpaValidationMessages.TENANT_DISCRIMINATOR_COLUMN_TABLE_NOT_VALID; - } - - @Override - protected String getVirtualAttributeColumnTableNotValidMessage() { - return EclipseLinkJpaValidationMessages.VIRTUAL_ATTRIBUTE_TENANT_DISCRIMINATOR_COLUMN_TABLE_NOT_VALID; - } - } -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/java/EclipseLinkJavaArrayMappingDefinition2_3.java b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/java/EclipseLinkJavaArrayMappingDefinition2_3.java deleted file mode 100644 index 437c432f1a..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/java/EclipseLinkJavaArrayMappingDefinition2_3.java +++ /dev/null @@ -1,87 +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, 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.eclipselink.core.internal.context.java; - -import org.eclipse.jpt.common.utility.internal.iterables.ArrayIterable; -import org.eclipse.jpt.common.utility.internal.iterables.CompositeIterable; -import org.eclipse.jpt.jpa.core.JpaFactory; -import org.eclipse.jpt.jpa.core.context.java.JavaAttributeMapping; -import org.eclipse.jpt.jpa.core.context.java.JavaAttributeMappingDefinition; -import org.eclipse.jpt.jpa.core.context.java.JavaPersistentAttribute; -import org.eclipse.jpt.jpa.core.internal.context.java.JavaBasicMappingDefinition; -import org.eclipse.jpt.jpa.eclipselink.core.EclipseLinkMappingKeys; -import org.eclipse.jpt.jpa.eclipselink.core.resource.java.EclipseLinkArrayAnnotation2_3; -import org.eclipse.jpt.jpa.eclipselink.core.resource.java.EclipseLinkConvertAnnotation; -import org.eclipse.jpt.jpa.eclipselink.core.resource.java.EclipseLinkConverterAnnotation; -import org.eclipse.jpt.jpa.eclipselink.core.resource.java.EclipseLinkObjectTypeConverterAnnotation; -import org.eclipse.jpt.jpa.eclipselink.core.resource.java.EclipseLinkStructConverterAnnotation; -import org.eclipse.jpt.jpa.eclipselink.core.resource.java.EclipseLinkTypeConverterAnnotation; - -public class EclipseLinkJavaArrayMappingDefinition2_3 - implements JavaAttributeMappingDefinition -{ - // singleton - private static final JavaAttributeMappingDefinition INSTANCE = new EclipseLinkJavaArrayMappingDefinition2_3(); - - /** - * Return the singleton. - */ - public static JavaAttributeMappingDefinition instance() { - return INSTANCE; - } - - - /** - * Enforce singleton usage - */ - private EclipseLinkJavaArrayMappingDefinition2_3() { - super(); - } - - public String getKey() { - return EclipseLinkMappingKeys.ARRAY_ATTRIBUTE_MAPPING_KEY; - } - - public String getAnnotationName() { - return EclipseLinkArrayAnnotation2_3.ANNOTATION_NAME; - } - - public boolean isSpecified(JavaPersistentAttribute persistentAttribute) { - return persistentAttribute.getResourceAttribute().getAnnotation(this.getAnnotationName()) != null; - } - - public Iterable<String> getSupportingAnnotationNames() { - return COMBINED_SUPPORTING_ANNOTATION_NAMES; - } - - private static final String[] ECLIPSE_LINK_SUPPORTING_ANNOTATION_NAMES_ARRAY = new String[] { - EclipseLinkConvertAnnotation.ANNOTATION_NAME, - EclipseLinkConverterAnnotation.ANNOTATION_NAME, - EclipseLinkObjectTypeConverterAnnotation.ANNOTATION_NAME, - EclipseLinkStructConverterAnnotation.ANNOTATION_NAME, - EclipseLinkTypeConverterAnnotation.ANNOTATION_NAME - }; - private static final Iterable<String> ECLIPSE_LINK_SUPPORTING_ANNOTATION_NAMES = new ArrayIterable<String>(ECLIPSE_LINK_SUPPORTING_ANNOTATION_NAMES_ARRAY); - - public JavaAttributeMapping buildMapping(JavaPersistentAttribute persistentAttribute, JpaFactory factory) { - return new JavaEclipseLinkArrayMapping2_3(persistentAttribute); - } - - @SuppressWarnings("unchecked") - private static final Iterable<String> COMBINED_SUPPORTING_ANNOTATION_NAMES = new CompositeIterable<String>( - JavaBasicMappingDefinition.instance().getSupportingAnnotationNames(), - ECLIPSE_LINK_SUPPORTING_ANNOTATION_NAMES - ); - - @Override - public String toString() { - return this.getClass().getSimpleName(); - } -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/java/EclipseLinkJavaBasicCollectionMappingDefinition.java b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/java/EclipseLinkJavaBasicCollectionMappingDefinition.java deleted file mode 100644 index 9697611f6b..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/java/EclipseLinkJavaBasicCollectionMappingDefinition.java +++ /dev/null @@ -1,66 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2008, 2011 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.eclipselink.core.internal.context.java; - -import org.eclipse.jpt.common.utility.internal.iterables.EmptyIterable; -import org.eclipse.jpt.jpa.core.JpaFactory; -import org.eclipse.jpt.jpa.core.context.java.JavaAttributeMapping; -import org.eclipse.jpt.jpa.core.context.java.JavaAttributeMappingDefinition; -import org.eclipse.jpt.jpa.core.context.java.JavaPersistentAttribute; -import org.eclipse.jpt.jpa.eclipselink.core.EclipseLinkMappingKeys; -import org.eclipse.jpt.jpa.eclipselink.core.internal.EclipseLinkJpaFactory; -import org.eclipse.jpt.jpa.eclipselink.core.resource.java.EclipseLinkBasicCollectionAnnotation; - -public class EclipseLinkJavaBasicCollectionMappingDefinition - implements JavaAttributeMappingDefinition -{ - // singleton - private static final JavaAttributeMappingDefinition INSTANCE = new EclipseLinkJavaBasicCollectionMappingDefinition(); - - /** - * Return the singleton. - */ - public static JavaAttributeMappingDefinition instance() { - return INSTANCE; - } - - - /** - * Enforce singleton usage - */ - private EclipseLinkJavaBasicCollectionMappingDefinition() { - super(); - } - - public String getKey() { - return EclipseLinkMappingKeys.BASIC_COLLECTION_ATTRIBUTE_MAPPING_KEY; - } - - public String getAnnotationName() { - return EclipseLinkBasicCollectionAnnotation.ANNOTATION_NAME; - } - - public boolean isSpecified(JavaPersistentAttribute persistentAttribute) { - return persistentAttribute.getResourceAttribute().getAnnotation(this.getAnnotationName()) != null; - } - - public Iterable<String> getSupportingAnnotationNames() { - return EmptyIterable.instance(); - } - - public JavaAttributeMapping buildMapping(JavaPersistentAttribute persistentAttribute, JpaFactory factory) { - return ((EclipseLinkJpaFactory) factory).buildJavaEclipseLinkBasicCollectionMapping(persistentAttribute); - } - - @Override - public String toString() { - return this.getClass().getSimpleName(); - } -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/java/EclipseLinkJavaBasicCollectionMappingDefinition2_0.java b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/java/EclipseLinkJavaBasicCollectionMappingDefinition2_0.java deleted file mode 100644 index 4e73f3e103..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/java/EclipseLinkJavaBasicCollectionMappingDefinition2_0.java +++ /dev/null @@ -1,62 +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, 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.eclipselink.core.internal.context.java; - -import org.eclipse.jpt.common.utility.internal.iterables.ArrayIterable; -import org.eclipse.jpt.common.utility.internal.iterables.CompositeIterable; -import org.eclipse.jpt.jpa.core.context.java.JavaAttributeMappingDefinition; -import org.eclipse.jpt.jpa.core.internal.context.java.JavaAttributeMappingDefinitionWrapper; -import org.eclipse.jpt.jpa.core.jpa2.resource.java.Access2_0Annotation; - -public class EclipseLinkJavaBasicCollectionMappingDefinition2_0 - extends JavaAttributeMappingDefinitionWrapper -{ - private static final JavaAttributeMappingDefinition DELEGATE = EclipseLinkJavaBasicCollectionMappingDefinition.instance(); - - // singleton - private static final JavaAttributeMappingDefinition INSTANCE = new EclipseLinkJavaBasicCollectionMappingDefinition2_0(); - - /** - * Return the singleton. - */ - public static JavaAttributeMappingDefinition instance() { - return INSTANCE; - } - - - /** - * Enforce singleton usage - */ - private EclipseLinkJavaBasicCollectionMappingDefinition2_0() { - super(); - } - - @Override - protected JavaAttributeMappingDefinition getDelegate() { - return DELEGATE; - } - - @Override - public Iterable<String> getSupportingAnnotationNames() { - return COMBINED_SUPPORTING_ANNOTATION_NAMES; - } - - public static final String[] SUPPORTING_ANNOTATION_NAMES_ARRAY_2_0 = new String[] { - Access2_0Annotation.ANNOTATION_NAME, - }; - private static final Iterable<String> SUPPORTING_ANNOTATION_NAMES_2_0 = new ArrayIterable<String>(SUPPORTING_ANNOTATION_NAMES_ARRAY_2_0); - - @SuppressWarnings("unchecked") - private static final Iterable<String> COMBINED_SUPPORTING_ANNOTATION_NAMES = new CompositeIterable<String>( - DELEGATE.getSupportingAnnotationNames(), - SUPPORTING_ANNOTATION_NAMES_2_0 - ); - -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/java/EclipseLinkJavaBasicMapMappingDefinition.java b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/java/EclipseLinkJavaBasicMapMappingDefinition.java deleted file mode 100644 index 498cbfbb94..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/java/EclipseLinkJavaBasicMapMappingDefinition.java +++ /dev/null @@ -1,66 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2008, 2011 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.eclipselink.core.internal.context.java; - -import org.eclipse.jpt.common.utility.internal.iterables.EmptyIterable; -import org.eclipse.jpt.jpa.core.JpaFactory; -import org.eclipse.jpt.jpa.core.context.java.JavaAttributeMapping; -import org.eclipse.jpt.jpa.core.context.java.JavaAttributeMappingDefinition; -import org.eclipse.jpt.jpa.core.context.java.JavaPersistentAttribute; -import org.eclipse.jpt.jpa.eclipselink.core.EclipseLinkMappingKeys; -import org.eclipse.jpt.jpa.eclipselink.core.internal.EclipseLinkJpaFactory; -import org.eclipse.jpt.jpa.eclipselink.core.resource.java.EclipseLinkBasicMapAnnotation; - -public class EclipseLinkJavaBasicMapMappingDefinition - implements JavaAttributeMappingDefinition -{ - // singleton - private static final JavaAttributeMappingDefinition INSTANCE = new EclipseLinkJavaBasicMapMappingDefinition(); - - /** - * Return the singleton. - */ - public static JavaAttributeMappingDefinition instance() { - return INSTANCE; - } - - - /** - * Enforce singleton usage - */ - private EclipseLinkJavaBasicMapMappingDefinition() { - super(); - } - - public String getKey() { - return EclipseLinkMappingKeys.BASIC_MAP_ATTRIBUTE_MAPPING_KEY; - } - - public String getAnnotationName() { - return EclipseLinkBasicMapAnnotation.ANNOTATION_NAME; - } - - public boolean isSpecified(JavaPersistentAttribute persistentAttribute) { - return persistentAttribute.getResourceAttribute().getAnnotation(this.getAnnotationName()) != null; - } - - public Iterable<String> getSupportingAnnotationNames() { - return EmptyIterable.instance(); - } - - public JavaAttributeMapping buildMapping(JavaPersistentAttribute persistentAttribute, JpaFactory factory) { - return ((EclipseLinkJpaFactory) factory).buildJavaEclipseLinkBasicMapMapping(persistentAttribute); - } - - @Override - public String toString() { - return this.getClass().getSimpleName(); - } -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/java/EclipseLinkJavaBasicMapMappingDefinition2_0.java b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/java/EclipseLinkJavaBasicMapMappingDefinition2_0.java deleted file mode 100644 index 3aa06e0148..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/java/EclipseLinkJavaBasicMapMappingDefinition2_0.java +++ /dev/null @@ -1,62 +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, 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.eclipselink.core.internal.context.java; - -import org.eclipse.jpt.common.utility.internal.iterables.ArrayIterable; -import org.eclipse.jpt.common.utility.internal.iterables.CompositeIterable; -import org.eclipse.jpt.jpa.core.context.java.JavaAttributeMappingDefinition; -import org.eclipse.jpt.jpa.core.internal.context.java.JavaAttributeMappingDefinitionWrapper; -import org.eclipse.jpt.jpa.core.jpa2.resource.java.Access2_0Annotation; - -public class EclipseLinkJavaBasicMapMappingDefinition2_0 - extends JavaAttributeMappingDefinitionWrapper -{ - private static final JavaAttributeMappingDefinition DELEGATE = EclipseLinkJavaBasicMapMappingDefinition.instance(); - - // singleton - private static final JavaAttributeMappingDefinition INSTANCE = new EclipseLinkJavaBasicMapMappingDefinition2_0(); - - /** - * Return the singleton. - */ - public static JavaAttributeMappingDefinition instance() { - return INSTANCE; - } - - - /** - * Enforce singleton usage - */ - private EclipseLinkJavaBasicMapMappingDefinition2_0() { - super(); - } - - @Override - protected JavaAttributeMappingDefinition getDelegate() { - return DELEGATE; - } - - @Override - public Iterable<String> getSupportingAnnotationNames() { - return COMBINED_SUPPORTING_ANNOTATION_NAMES; - } - - public static final String[] SUPPORTING_ANNOTATION_NAMES_ARRAY_2_0 = new String[] { - Access2_0Annotation.ANNOTATION_NAME, - }; - private static final Iterable<String> SUPPORTING_ANNOTATION_NAMES_2_0 = new ArrayIterable<String>(SUPPORTING_ANNOTATION_NAMES_ARRAY_2_0); - - @SuppressWarnings("unchecked") - private static final Iterable<String> COMBINED_SUPPORTING_ANNOTATION_NAMES = new CompositeIterable<String>( - DELEGATE.getSupportingAnnotationNames(), - SUPPORTING_ANNOTATION_NAMES_2_0 - ); - -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/java/EclipseLinkJavaBasicMappingDefinition.java b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/java/EclipseLinkJavaBasicMappingDefinition.java deleted file mode 100644 index 8a516cc7ba..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/java/EclipseLinkJavaBasicMappingDefinition.java +++ /dev/null @@ -1,73 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010, 2011 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.eclipselink.core.internal.context.java; - -import org.eclipse.jpt.common.utility.internal.iterables.ArrayIterable; -import org.eclipse.jpt.common.utility.internal.iterables.CompositeIterable; -import org.eclipse.jpt.jpa.core.context.java.DefaultJavaAttributeMappingDefinition; -import org.eclipse.jpt.jpa.core.internal.context.java.DefaultJavaAttributeMappingDefinitionWrapper; -import org.eclipse.jpt.jpa.core.internal.context.java.JavaBasicMappingDefinition; -import org.eclipse.jpt.jpa.eclipselink.core.resource.java.EclipseLinkConvertAnnotation; -import org.eclipse.jpt.jpa.eclipselink.core.resource.java.EclipseLinkConverterAnnotation; -import org.eclipse.jpt.jpa.eclipselink.core.resource.java.EclipseLinkMutableAnnotation; -import org.eclipse.jpt.jpa.eclipselink.core.resource.java.EclipseLinkObjectTypeConverterAnnotation; -import org.eclipse.jpt.jpa.eclipselink.core.resource.java.EclipseLinkStructConverterAnnotation; -import org.eclipse.jpt.jpa.eclipselink.core.resource.java.EclipseLinkTypeConverterAnnotation; - -public class EclipseLinkJavaBasicMappingDefinition - extends DefaultJavaAttributeMappingDefinitionWrapper -{ - private static final DefaultJavaAttributeMappingDefinition DELEGATE = JavaBasicMappingDefinition.instance(); - - // singleton - private static final DefaultJavaAttributeMappingDefinition INSTANCE = new EclipseLinkJavaBasicMappingDefinition(); - - /** - * Return the singleton. - */ - public static DefaultJavaAttributeMappingDefinition instance() { - return INSTANCE; - } - - - /** - * Enforce singleton usage - */ - private EclipseLinkJavaBasicMappingDefinition() { - super(); - } - - @Override - protected DefaultJavaAttributeMappingDefinition getDelegate() { - return DELEGATE; - } - - @Override - public Iterable<String> getSupportingAnnotationNames() { - return COMBINED_SUPPORTING_ANNOTATION_NAMES; - } - - private static final String[] ECLIPSE_LINK_SUPPORTING_ANNOTATION_NAMES_ARRAY = new String[] { - EclipseLinkConvertAnnotation.ANNOTATION_NAME, - EclipseLinkConverterAnnotation.ANNOTATION_NAME, - EclipseLinkMutableAnnotation.ANNOTATION_NAME, - EclipseLinkObjectTypeConverterAnnotation.ANNOTATION_NAME, - EclipseLinkStructConverterAnnotation.ANNOTATION_NAME, - EclipseLinkTypeConverterAnnotation.ANNOTATION_NAME, - }; - // 'public' because the EclipseLink Id and Version mappings also support these annotations - public static final Iterable<String> ECLIPSE_LINK_SUPPORTING_ANNOTATION_NAMES = new ArrayIterable<String>(ECLIPSE_LINK_SUPPORTING_ANNOTATION_NAMES_ARRAY); - - @SuppressWarnings("unchecked") - private static final Iterable<String> COMBINED_SUPPORTING_ANNOTATION_NAMES = new CompositeIterable<String>( - DELEGATE.getSupportingAnnotationNames(), - ECLIPSE_LINK_SUPPORTING_ANNOTATION_NAMES - ); -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/java/EclipseLinkJavaBasicMappingDefinition2_0.java b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/java/EclipseLinkJavaBasicMappingDefinition2_0.java deleted file mode 100644 index 961bf8bd5c..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/java/EclipseLinkJavaBasicMappingDefinition2_0.java +++ /dev/null @@ -1,62 +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, 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.eclipselink.core.internal.context.java; - -import org.eclipse.jpt.common.utility.internal.iterables.CompositeIterable; -import org.eclipse.jpt.jpa.core.context.java.DefaultJavaAttributeMappingDefinition; -import org.eclipse.jpt.jpa.core.context.java.JavaAttributeMappingDefinition; -import org.eclipse.jpt.jpa.core.context.java.JavaPersistentAttribute; -import org.eclipse.jpt.jpa.core.internal.context.java.JavaAttributeMappingDefinitionWrapper; -import org.eclipse.jpt.jpa.core.internal.jpa2.context.java.JavaBasicMappingDefinition2_0; - -public class EclipseLinkJavaBasicMappingDefinition2_0 - extends JavaAttributeMappingDefinitionWrapper - implements DefaultJavaAttributeMappingDefinition -{ - private static final JavaAttributeMappingDefinition DELEGATE = JavaBasicMappingDefinition2_0.instance(); - - // singleton - private static final DefaultJavaAttributeMappingDefinition INSTANCE = new EclipseLinkJavaBasicMappingDefinition2_0(); - - /** - * Return the singleton. - */ - public static DefaultJavaAttributeMappingDefinition instance() { - return INSTANCE; - } - - - /** - * Enforce singleton usage - */ - private EclipseLinkJavaBasicMappingDefinition2_0() { - super(); - } - - @Override - protected JavaAttributeMappingDefinition getDelegate() { - return DELEGATE; - } - - @Override - public Iterable<String> getSupportingAnnotationNames() { - return COMBINED_SUPPORTING_ANNOTATION_NAMES; - } - - @SuppressWarnings("unchecked") - private static final Iterable<String> COMBINED_SUPPORTING_ANNOTATION_NAMES = new CompositeIterable<String>( - DELEGATE.getSupportingAnnotationNames(), - EclipseLinkJavaBasicMappingDefinition.ECLIPSE_LINK_SUPPORTING_ANNOTATION_NAMES - ); - - public boolean isDefault(JavaPersistentAttribute persistentAttribute) { - return EclipseLinkJavaBasicMappingDefinition.instance().isDefault(persistentAttribute); - } -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/java/EclipseLinkJavaBasicMappingDefinition2_2.java b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/java/EclipseLinkJavaBasicMappingDefinition2_2.java deleted file mode 100644 index 4873517592..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/java/EclipseLinkJavaBasicMappingDefinition2_2.java +++ /dev/null @@ -1,72 +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, 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.eclipselink.core.internal.context.java; - -import org.eclipse.jpt.common.utility.internal.iterables.ArrayIterable; -import org.eclipse.jpt.common.utility.internal.iterables.CompositeIterable; -import org.eclipse.jpt.jpa.core.context.java.DefaultJavaAttributeMappingDefinition; -import org.eclipse.jpt.jpa.core.context.java.JavaAttributeMappingDefinition; -import org.eclipse.jpt.jpa.core.context.java.JavaPersistentAttribute; -import org.eclipse.jpt.jpa.core.internal.context.java.JavaAttributeMappingDefinitionWrapper; -import org.eclipse.jpt.jpa.eclipselink.core.resource.java.EclipseLink; - -public class EclipseLinkJavaBasicMappingDefinition2_2 - extends JavaAttributeMappingDefinitionWrapper - implements DefaultJavaAttributeMappingDefinition -{ - private static final DefaultJavaAttributeMappingDefinition DELEGATE = EclipseLinkJavaBasicMappingDefinition2_0.instance(); - - // singleton - private static final DefaultJavaAttributeMappingDefinition INSTANCE = new EclipseLinkJavaBasicMappingDefinition2_2(); - - /** - * Return the singleton. - */ - public static DefaultJavaAttributeMappingDefinition instance() { - return INSTANCE; - } - - - /** - * Enforce singleton usage - */ - private EclipseLinkJavaBasicMappingDefinition2_2() { - super(); - } - - @Override - protected JavaAttributeMappingDefinition getDelegate() { - return DELEGATE; - } - - @Override - public Iterable<String> getSupportingAnnotationNames() { - return COMBINED_SUPPORTING_ANNOTATION_NAMES; - } - - private static final String[] ECLIPSE_LINK2_2_SUPPORTING_ANNOTATION_NAMES_ARRAY = new String[] { - EclipseLink.CONVERTERS, - EclipseLink.OBJECT_TYPE_CONVERTERS, - EclipseLink.STRUCT_CONVERTERS, - EclipseLink.TYPE_CONVERTERS, - }; - public static final Iterable<String> ECLIPSE_LINK2_2_SUPPORTING_ANNOTATION_NAMES = new ArrayIterable<String>(ECLIPSE_LINK2_2_SUPPORTING_ANNOTATION_NAMES_ARRAY); - - @SuppressWarnings("unchecked") - private static final Iterable<String> COMBINED_SUPPORTING_ANNOTATION_NAMES = new CompositeIterable<String>( - DELEGATE.getSupportingAnnotationNames(), - ECLIPSE_LINK2_2_SUPPORTING_ANNOTATION_NAMES - ); - - - public boolean isDefault(JavaPersistentAttribute persistentAttribute) { - return DELEGATE.isDefault(persistentAttribute); - } -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/java/EclipseLinkJavaElementCollectionMappingDefinition2_0.java b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/java/EclipseLinkJavaElementCollectionMappingDefinition2_0.java deleted file mode 100644 index 6a39972bb3..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/java/EclipseLinkJavaElementCollectionMappingDefinition2_0.java +++ /dev/null @@ -1,70 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010, 2011 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.eclipselink.core.internal.context.java; - -import org.eclipse.jpt.common.utility.internal.iterables.ArrayIterable; -import org.eclipse.jpt.common.utility.internal.iterables.CompositeIterable; -import org.eclipse.jpt.jpa.core.context.java.JavaAttributeMappingDefinition; -import org.eclipse.jpt.jpa.core.internal.context.java.JavaAttributeMappingDefinitionWrapper; -import org.eclipse.jpt.jpa.core.internal.jpa2.context.java.JavaElementCollectionMappingDefinition2_0; -import org.eclipse.jpt.jpa.eclipselink.core.resource.java.EclipseLinkConverterAnnotation; -import org.eclipse.jpt.jpa.eclipselink.core.resource.java.EclipseLinkJoinFetchAnnotation; -import org.eclipse.jpt.jpa.eclipselink.core.resource.java.EclipseLinkObjectTypeConverterAnnotation; -import org.eclipse.jpt.jpa.eclipselink.core.resource.java.EclipseLinkStructConverterAnnotation; -import org.eclipse.jpt.jpa.eclipselink.core.resource.java.EclipseLinkTypeConverterAnnotation; - -public class EclipseLinkJavaElementCollectionMappingDefinition2_0 - extends JavaAttributeMappingDefinitionWrapper -{ - private static final JavaAttributeMappingDefinition DELEGATE = JavaElementCollectionMappingDefinition2_0.instance(); - - // singleton - private static final JavaAttributeMappingDefinition INSTANCE = new EclipseLinkJavaElementCollectionMappingDefinition2_0(); - - /** - * Return the singleton. - */ - public static JavaAttributeMappingDefinition instance() { - return INSTANCE; - } - - - /** - * Enforce singleton usage - */ - private EclipseLinkJavaElementCollectionMappingDefinition2_0() { - super(); - } - - @Override - protected JavaAttributeMappingDefinition getDelegate() { - return DELEGATE; - } - - @Override - public Iterable<String> getSupportingAnnotationNames() { - return COMBINED_SUPPORTING_ANNOTATION_NAMES; - } - - private static final String[] ECLIPSE_LINK_SUPPORTING_ANNOTATION_NAMES_ARRAY = new String[] { - EclipseLinkConverterAnnotation.ANNOTATION_NAME, - EclipseLinkJoinFetchAnnotation.ANNOTATION_NAME, - EclipseLinkObjectTypeConverterAnnotation.ANNOTATION_NAME, - EclipseLinkStructConverterAnnotation.ANNOTATION_NAME, - EclipseLinkTypeConverterAnnotation.ANNOTATION_NAME - }; - private static final Iterable<String> ECLIPSE_LINK_SUPPORTING_ANNOTATION_NAMES = new ArrayIterable<String>(ECLIPSE_LINK_SUPPORTING_ANNOTATION_NAMES_ARRAY); - - @SuppressWarnings("unchecked") - private static final Iterable<String> COMBINED_SUPPORTING_ANNOTATION_NAMES = new CompositeIterable<String>( - DELEGATE.getSupportingAnnotationNames(), - ECLIPSE_LINK_SUPPORTING_ANNOTATION_NAMES - ); -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/java/EclipseLinkJavaElementCollectionMappingDefinition2_2.java b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/java/EclipseLinkJavaElementCollectionMappingDefinition2_2.java deleted file mode 100644 index a14b2c171e..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/java/EclipseLinkJavaElementCollectionMappingDefinition2_2.java +++ /dev/null @@ -1,54 +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, 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.eclipselink.core.internal.context.java; - -import org.eclipse.jpt.common.utility.internal.iterables.CompositeIterable; -import org.eclipse.jpt.jpa.core.context.java.JavaAttributeMappingDefinition; -import org.eclipse.jpt.jpa.core.internal.context.java.JavaAttributeMappingDefinitionWrapper; - -public class EclipseLinkJavaElementCollectionMappingDefinition2_2 - extends JavaAttributeMappingDefinitionWrapper -{ - private static final JavaAttributeMappingDefinition DELEGATE = EclipseLinkJavaElementCollectionMappingDefinition2_0.instance(); - - // singleton - private static final JavaAttributeMappingDefinition INSTANCE = new EclipseLinkJavaElementCollectionMappingDefinition2_2(); - - /** - * Return the singleton. - */ - public static JavaAttributeMappingDefinition instance() { - return INSTANCE; - } - - - /** - * Enforce singleton usage - */ - private EclipseLinkJavaElementCollectionMappingDefinition2_2() { - super(); - } - - @Override - protected JavaAttributeMappingDefinition getDelegate() { - return DELEGATE; - } - - @Override - public Iterable<String> getSupportingAnnotationNames() { - return COMBINED_SUPPORTING_ANNOTATION_NAMES; - } - - @SuppressWarnings("unchecked") - private static final Iterable<String> COMBINED_SUPPORTING_ANNOTATION_NAMES = new CompositeIterable<String>( - DELEGATE.getSupportingAnnotationNames(), - EclipseLinkJavaBasicMappingDefinition2_2.ECLIPSE_LINK2_2_SUPPORTING_ANNOTATION_NAMES - ); -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/java/EclipseLinkJavaEmbeddableDefinition.java b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/java/EclipseLinkJavaEmbeddableDefinition.java deleted file mode 100644 index f84d80d3e0..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/java/EclipseLinkJavaEmbeddableDefinition.java +++ /dev/null @@ -1,72 +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, 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.eclipselink.core.internal.context.java; - -import org.eclipse.jpt.common.utility.internal.iterables.ArrayIterable; -import org.eclipse.jpt.common.utility.internal.iterables.CompositeIterable; -import org.eclipse.jpt.jpa.core.context.java.JavaTypeMappingDefinition; -import org.eclipse.jpt.jpa.core.internal.context.java.JavaEmbeddableDefinition; -import org.eclipse.jpt.jpa.core.internal.context.java.JavaTypeMappingDefinitionWrapper; -import org.eclipse.jpt.jpa.eclipselink.core.resource.java.EclipseLinkChangeTrackingAnnotation; -import org.eclipse.jpt.jpa.eclipselink.core.resource.java.EclipseLinkConverterAnnotation; -import org.eclipse.jpt.jpa.eclipselink.core.resource.java.EclipseLinkCustomizerAnnotation; -import org.eclipse.jpt.jpa.eclipselink.core.resource.java.EclipseLinkObjectTypeConverterAnnotation; -import org.eclipse.jpt.jpa.eclipselink.core.resource.java.EclipseLinkStructConverterAnnotation; -import org.eclipse.jpt.jpa.eclipselink.core.resource.java.EclipseLinkTypeConverterAnnotation; - -public class EclipseLinkJavaEmbeddableDefinition - extends JavaTypeMappingDefinitionWrapper -{ - private static final JavaTypeMappingDefinition DELEGATE = JavaEmbeddableDefinition.instance(); - - // singleton - private static final JavaTypeMappingDefinition INSTANCE = new EclipseLinkJavaEmbeddableDefinition(); - - /** - * Return the singleton. - */ - public static JavaTypeMappingDefinition instance() { - return INSTANCE; - } - - - /** - * Enforce singleton usage - */ - private EclipseLinkJavaEmbeddableDefinition() { - super(); - } - - @Override - protected JavaTypeMappingDefinition getDelegate() { - return DELEGATE; - } - - @Override - public Iterable<String> getSupportingAnnotationNames() { - return COMBINED_SUPPORTING_ANNOTATION_NAMES; - } - - private static final String[] ECLIPSE_LINK_SUPPORTING_ANNOTATION_NAMES_ARRAY = new String[] { - EclipseLinkChangeTrackingAnnotation.ANNOTATION_NAME, - EclipseLinkConverterAnnotation.ANNOTATION_NAME, - EclipseLinkCustomizerAnnotation.ANNOTATION_NAME, - EclipseLinkObjectTypeConverterAnnotation.ANNOTATION_NAME, - EclipseLinkStructConverterAnnotation.ANNOTATION_NAME, - EclipseLinkTypeConverterAnnotation.ANNOTATION_NAME, - }; - public static final Iterable<String> ECLIPSE_LINK_SUPPORTING_ANNOTATION_NAMES = new ArrayIterable<String>(ECLIPSE_LINK_SUPPORTING_ANNOTATION_NAMES_ARRAY); - - @SuppressWarnings("unchecked") - private static final Iterable<String> COMBINED_SUPPORTING_ANNOTATION_NAMES = new CompositeIterable<String>( - DELEGATE.getSupportingAnnotationNames(), - ECLIPSE_LINK_SUPPORTING_ANNOTATION_NAMES - ); -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/java/EclipseLinkJavaEmbeddableDefinition2_0.java b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/java/EclipseLinkJavaEmbeddableDefinition2_0.java deleted file mode 100644 index 8803312721..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/java/EclipseLinkJavaEmbeddableDefinition2_0.java +++ /dev/null @@ -1,55 +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, 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.eclipselink.core.internal.context.java; - -import org.eclipse.jpt.common.utility.internal.iterables.CompositeIterable; -import org.eclipse.jpt.jpa.core.context.java.JavaTypeMappingDefinition; -import org.eclipse.jpt.jpa.core.internal.context.java.JavaTypeMappingDefinitionWrapper; -import org.eclipse.jpt.jpa.core.internal.jpa2.context.java.JavaEmbeddableDefinition2_0; - -public class EclipseLinkJavaEmbeddableDefinition2_0 - extends JavaTypeMappingDefinitionWrapper -{ - private static final JavaTypeMappingDefinition DELEGATE = JavaEmbeddableDefinition2_0.instance(); - - // singleton - private static final JavaTypeMappingDefinition INSTANCE = new EclipseLinkJavaEmbeddableDefinition2_0(); - - /** - * Return the singleton. - */ - public static JavaTypeMappingDefinition instance() { - return INSTANCE; - } - - - /** - * Enforce singleton usage - */ - private EclipseLinkJavaEmbeddableDefinition2_0() { - super(); - } - - @Override - protected JavaTypeMappingDefinition getDelegate() { - return DELEGATE; - } - - @Override - public Iterable<String> getSupportingAnnotationNames() { - return COMBINED_SUPPORTING_ANNOTATION_NAMES; - } - - @SuppressWarnings("unchecked") - private static final Iterable<String> COMBINED_SUPPORTING_ANNOTATION_NAMES = new CompositeIterable<String>( - DELEGATE.getSupportingAnnotationNames(), - EclipseLinkJavaEmbeddableDefinition.ECLIPSE_LINK_SUPPORTING_ANNOTATION_NAMES - ); -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/java/EclipseLinkJavaEmbeddableDefinition2_2.java b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/java/EclipseLinkJavaEmbeddableDefinition2_2.java deleted file mode 100644 index 8607463658..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/java/EclipseLinkJavaEmbeddableDefinition2_2.java +++ /dev/null @@ -1,64 +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, 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.eclipselink.core.internal.context.java; - -import org.eclipse.jpt.common.utility.internal.iterables.ArrayIterable; -import org.eclipse.jpt.common.utility.internal.iterables.CompositeIterable; -import org.eclipse.jpt.jpa.core.context.java.JavaTypeMappingDefinition; -import org.eclipse.jpt.jpa.core.internal.context.java.JavaTypeMappingDefinitionWrapper; -import org.eclipse.jpt.jpa.eclipselink.core.resource.java.EclipseLink; - -public class EclipseLinkJavaEmbeddableDefinition2_2 - extends JavaTypeMappingDefinitionWrapper -{ - private static final JavaTypeMappingDefinition DELEGATE = EclipseLinkJavaEmbeddableDefinition2_0.instance(); - - // singleton - private static final JavaTypeMappingDefinition INSTANCE = new EclipseLinkJavaEmbeddableDefinition2_2(); - - /** - * Return the singleton. - */ - public static JavaTypeMappingDefinition instance() { - return INSTANCE; - } - - - /** - * Enforce singleton usage - */ - private EclipseLinkJavaEmbeddableDefinition2_2() { - super(); - } - - @Override - protected JavaTypeMappingDefinition getDelegate() { - return DELEGATE; - } - - @Override - public Iterable<String> getSupportingAnnotationNames() { - return COMBINED_SUPPORTING_ANNOTATION_NAMES; - } - - public static final String[] ECLIPSE_LINK2_2_SUPPORTING_ANNOTATION_NAMES_ARRAY = new String[] { - EclipseLink.CONVERTERS, - EclipseLink.OBJECT_TYPE_CONVERTERS, - EclipseLink.STRUCT_CONVERTERS, - EclipseLink.TYPE_CONVERTERS, - }; - public static final Iterable<String> ECLIPSE_LINK2_2_SUPPORTING_ANNOTATION_NAMES = new ArrayIterable<String>(ECLIPSE_LINK2_2_SUPPORTING_ANNOTATION_NAMES_ARRAY); - - @SuppressWarnings("unchecked") - private static final Iterable<String> COMBINED_SUPPORTING_ANNOTATION_NAMES = new CompositeIterable<String>( - DELEGATE.getSupportingAnnotationNames(), - ECLIPSE_LINK2_2_SUPPORTING_ANNOTATION_NAMES - ); -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/java/EclipseLinkJavaEmbeddedIdMappingDefinition.java b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/java/EclipseLinkJavaEmbeddedIdMappingDefinition.java deleted file mode 100644 index 418af12c8d..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/java/EclipseLinkJavaEmbeddedIdMappingDefinition.java +++ /dev/null @@ -1,68 +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, 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.eclipselink.core.internal.context.java; - -import org.eclipse.jpt.common.utility.internal.iterables.ArrayIterable; -import org.eclipse.jpt.common.utility.internal.iterables.CompositeIterable; -import org.eclipse.jpt.jpa.core.context.java.JavaAttributeMappingDefinition; -import org.eclipse.jpt.jpa.core.internal.context.java.JavaAttributeMappingDefinitionWrapper; -import org.eclipse.jpt.jpa.core.internal.context.java.JavaEmbeddedIdMappingDefinition; -import org.eclipse.jpt.jpa.eclipselink.core.resource.java.EclipseLinkConverterAnnotation; -import org.eclipse.jpt.jpa.eclipselink.core.resource.java.EclipseLinkObjectTypeConverterAnnotation; -import org.eclipse.jpt.jpa.eclipselink.core.resource.java.EclipseLinkStructConverterAnnotation; -import org.eclipse.jpt.jpa.eclipselink.core.resource.java.EclipseLinkTypeConverterAnnotation; - -public class EclipseLinkJavaEmbeddedIdMappingDefinition - extends JavaAttributeMappingDefinitionWrapper -{ - private static final JavaAttributeMappingDefinition DELEGATE = JavaEmbeddedIdMappingDefinition.instance(); - - // singleton - private static final JavaAttributeMappingDefinition INSTANCE = new EclipseLinkJavaEmbeddedIdMappingDefinition(); - - /** - * Return the singleton. - */ - public static JavaAttributeMappingDefinition instance() { - return INSTANCE; - } - - - /** - * Enforce singleton usage - */ - private EclipseLinkJavaEmbeddedIdMappingDefinition() { - super(); - } - - @Override - protected JavaAttributeMappingDefinition getDelegate() { - return DELEGATE; - } - - @Override - public Iterable<String> getSupportingAnnotationNames() { - return COMBINED_SUPPORTING_ANNOTATION_NAMES; - } - - private static final String[] ECLIPSE_LINK_SUPPORTING_ANNOTATION_NAMES_ARRAY = new String[] { - EclipseLinkConverterAnnotation.ANNOTATION_NAME, - EclipseLinkObjectTypeConverterAnnotation.ANNOTATION_NAME, - EclipseLinkStructConverterAnnotation.ANNOTATION_NAME, - EclipseLinkTypeConverterAnnotation.ANNOTATION_NAME, - }; - public static final Iterable<String> ECLIPSE_LINK_SUPPORTING_ANNOTATION_NAMES = new ArrayIterable<String>(ECLIPSE_LINK_SUPPORTING_ANNOTATION_NAMES_ARRAY); - - @SuppressWarnings("unchecked") - private static final Iterable<String> COMBINED_SUPPORTING_ANNOTATION_NAMES = new CompositeIterable<String>( - DELEGATE.getSupportingAnnotationNames(), - ECLIPSE_LINK_SUPPORTING_ANNOTATION_NAMES - ); -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/java/EclipseLinkJavaEmbeddedIdMappingDefinition2_0.java b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/java/EclipseLinkJavaEmbeddedIdMappingDefinition2_0.java deleted file mode 100644 index 9abe4fcb34..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/java/EclipseLinkJavaEmbeddedIdMappingDefinition2_0.java +++ /dev/null @@ -1,55 +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, 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.eclipselink.core.internal.context.java; - -import org.eclipse.jpt.common.utility.internal.iterables.CompositeIterable; -import org.eclipse.jpt.jpa.core.context.java.JavaAttributeMappingDefinition; -import org.eclipse.jpt.jpa.core.internal.context.java.JavaAttributeMappingDefinitionWrapper; -import org.eclipse.jpt.jpa.core.internal.jpa2.context.java.JavaEmbeddedIdMappingDefinition2_0; - -public class EclipseLinkJavaEmbeddedIdMappingDefinition2_0 - extends JavaAttributeMappingDefinitionWrapper -{ - private static final JavaAttributeMappingDefinition DELEGATE = JavaEmbeddedIdMappingDefinition2_0.instance(); - - // singleton - private static final JavaAttributeMappingDefinition INSTANCE = new EclipseLinkJavaEmbeddedIdMappingDefinition2_0(); - - /** - * Return the singleton. - */ - public static JavaAttributeMappingDefinition instance() { - return INSTANCE; - } - - - /** - * Enforce singleton usage - */ - private EclipseLinkJavaEmbeddedIdMappingDefinition2_0() { - super(); - } - - @Override - protected JavaAttributeMappingDefinition getDelegate() { - return DELEGATE; - } - - @Override - public Iterable<String> getSupportingAnnotationNames() { - return COMBINED_SUPPORTING_ANNOTATION_NAMES; - } - - @SuppressWarnings("unchecked") - private static final Iterable<String> COMBINED_SUPPORTING_ANNOTATION_NAMES = new CompositeIterable<String>( - DELEGATE.getSupportingAnnotationNames(), - EclipseLinkJavaEmbeddedIdMappingDefinition.ECLIPSE_LINK_SUPPORTING_ANNOTATION_NAMES - ); -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/java/EclipseLinkJavaEmbeddedIdMappingDefinition2_2.java b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/java/EclipseLinkJavaEmbeddedIdMappingDefinition2_2.java deleted file mode 100644 index 00b2ee65a5..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/java/EclipseLinkJavaEmbeddedIdMappingDefinition2_2.java +++ /dev/null @@ -1,54 +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, 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.eclipselink.core.internal.context.java; - -import org.eclipse.jpt.common.utility.internal.iterables.CompositeIterable; -import org.eclipse.jpt.jpa.core.context.java.JavaAttributeMappingDefinition; -import org.eclipse.jpt.jpa.core.internal.context.java.JavaAttributeMappingDefinitionWrapper; - -public class EclipseLinkJavaEmbeddedIdMappingDefinition2_2 - extends JavaAttributeMappingDefinitionWrapper -{ - private static final JavaAttributeMappingDefinition DELEGATE = EclipseLinkJavaEmbeddedIdMappingDefinition2_0.instance(); - - // singleton - private static final JavaAttributeMappingDefinition INSTANCE = new EclipseLinkJavaEmbeddedIdMappingDefinition2_2(); - - /** - * Return the singleton. - */ - public static JavaAttributeMappingDefinition instance() { - return INSTANCE; - } - - - /** - * Enforce singleton usage - */ - private EclipseLinkJavaEmbeddedIdMappingDefinition2_2() { - super(); - } - - @Override - protected JavaAttributeMappingDefinition getDelegate() { - return DELEGATE; - } - - @Override - public Iterable<String> getSupportingAnnotationNames() { - return COMBINED_SUPPORTING_ANNOTATION_NAMES; - } - - @SuppressWarnings("unchecked") - private static final Iterable<String> COMBINED_SUPPORTING_ANNOTATION_NAMES = new CompositeIterable<String>( - DELEGATE.getSupportingAnnotationNames(), - EclipseLinkJavaBasicMappingDefinition2_2.ECLIPSE_LINK2_2_SUPPORTING_ANNOTATION_NAMES - ); -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/java/EclipseLinkJavaEmbeddedMappingDefinition.java b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/java/EclipseLinkJavaEmbeddedMappingDefinition.java deleted file mode 100644 index 9241b5354f..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/java/EclipseLinkJavaEmbeddedMappingDefinition.java +++ /dev/null @@ -1,68 +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, 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.eclipselink.core.internal.context.java; - -import org.eclipse.jpt.common.utility.internal.iterables.ArrayIterable; -import org.eclipse.jpt.common.utility.internal.iterables.CompositeIterable; -import org.eclipse.jpt.jpa.core.context.java.DefaultJavaAttributeMappingDefinition; -import org.eclipse.jpt.jpa.core.internal.context.java.DefaultJavaAttributeMappingDefinitionWrapper; -import org.eclipse.jpt.jpa.core.internal.context.java.JavaEmbeddedMappingDefinition; -import org.eclipse.jpt.jpa.eclipselink.core.resource.java.EclipseLinkConverterAnnotation; -import org.eclipse.jpt.jpa.eclipselink.core.resource.java.EclipseLinkObjectTypeConverterAnnotation; -import org.eclipse.jpt.jpa.eclipselink.core.resource.java.EclipseLinkStructConverterAnnotation; -import org.eclipse.jpt.jpa.eclipselink.core.resource.java.EclipseLinkTypeConverterAnnotation; - -public class EclipseLinkJavaEmbeddedMappingDefinition - extends DefaultJavaAttributeMappingDefinitionWrapper -{ - private static final DefaultJavaAttributeMappingDefinition DELEGATE = JavaEmbeddedMappingDefinition.instance(); - - // singleton - private static final DefaultJavaAttributeMappingDefinition INSTANCE = new EclipseLinkJavaEmbeddedMappingDefinition(); - - /** - * Return the singleton. - */ - public static DefaultJavaAttributeMappingDefinition instance() { - return INSTANCE; - } - - - /** - * Enforce singleton usage - */ - private EclipseLinkJavaEmbeddedMappingDefinition() { - super(); - } - - @Override - protected DefaultJavaAttributeMappingDefinition getDelegate() { - return DELEGATE; - } - - @Override - public Iterable<String> getSupportingAnnotationNames() { - return COMBINED_SUPPORTING_ANNOTATION_NAMES; - } - - private static final String[] ECLIPSE_LINK_SUPPORTING_ANNOTATION_NAMES_ARRAY = new String[] { - EclipseLinkConverterAnnotation.ANNOTATION_NAME, - EclipseLinkObjectTypeConverterAnnotation.ANNOTATION_NAME, - EclipseLinkStructConverterAnnotation.ANNOTATION_NAME, - EclipseLinkTypeConverterAnnotation.ANNOTATION_NAME, - }; - public static final Iterable<String> ECLIPSE_LINK_SUPPORTING_ANNOTATION_NAMES = new ArrayIterable<String>(ECLIPSE_LINK_SUPPORTING_ANNOTATION_NAMES_ARRAY); - - @SuppressWarnings("unchecked") - private static final Iterable<String> COMBINED_SUPPORTING_ANNOTATION_NAMES = new CompositeIterable<String>( - DELEGATE.getSupportingAnnotationNames(), - ECLIPSE_LINK_SUPPORTING_ANNOTATION_NAMES - ); -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/java/EclipseLinkJavaEmbeddedMappingDefinition2_0.java b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/java/EclipseLinkJavaEmbeddedMappingDefinition2_0.java deleted file mode 100644 index 8b73d718f1..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/java/EclipseLinkJavaEmbeddedMappingDefinition2_0.java +++ /dev/null @@ -1,55 +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, 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.eclipselink.core.internal.context.java; - -import org.eclipse.jpt.common.utility.internal.iterables.CompositeIterable; -import org.eclipse.jpt.jpa.core.context.java.DefaultJavaAttributeMappingDefinition; -import org.eclipse.jpt.jpa.core.internal.context.java.DefaultJavaAttributeMappingDefinitionWrapper; -import org.eclipse.jpt.jpa.core.internal.jpa2.context.java.JavaEmbeddedMappingDefinition2_0; - -public class EclipseLinkJavaEmbeddedMappingDefinition2_0 - extends DefaultJavaAttributeMappingDefinitionWrapper -{ - private static final DefaultJavaAttributeMappingDefinition DELEGATE = JavaEmbeddedMappingDefinition2_0.instance(); - - // singleton - private static final DefaultJavaAttributeMappingDefinition INSTANCE = new EclipseLinkJavaEmbeddedMappingDefinition2_0(); - - /** - * Return the singleton. - */ - public static DefaultJavaAttributeMappingDefinition instance() { - return INSTANCE; - } - - - /** - * Enforce singleton usage - */ - private EclipseLinkJavaEmbeddedMappingDefinition2_0() { - super(); - } - - @Override - protected DefaultJavaAttributeMappingDefinition getDelegate() { - return DELEGATE; - } - - @Override - public Iterable<String> getSupportingAnnotationNames() { - return COMBINED_SUPPORTING_ANNOTATION_NAMES; - } - - @SuppressWarnings("unchecked") - private static final Iterable<String> COMBINED_SUPPORTING_ANNOTATION_NAMES = new CompositeIterable<String>( - DELEGATE.getSupportingAnnotationNames(), - EclipseLinkJavaEmbeddedMappingDefinition.ECLIPSE_LINK_SUPPORTING_ANNOTATION_NAMES - ); -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/java/EclipseLinkJavaEmbeddedMappingDefinition2_2.java b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/java/EclipseLinkJavaEmbeddedMappingDefinition2_2.java deleted file mode 100644 index 64ef0ac813..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/java/EclipseLinkJavaEmbeddedMappingDefinition2_2.java +++ /dev/null @@ -1,54 +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, 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.eclipselink.core.internal.context.java; - -import org.eclipse.jpt.common.utility.internal.iterables.CompositeIterable; -import org.eclipse.jpt.jpa.core.context.java.DefaultJavaAttributeMappingDefinition; -import org.eclipse.jpt.jpa.core.internal.context.java.DefaultJavaAttributeMappingDefinitionWrapper; - -public class EclipseLinkJavaEmbeddedMappingDefinition2_2 - extends DefaultJavaAttributeMappingDefinitionWrapper -{ - private static final DefaultJavaAttributeMappingDefinition DELEGATE = EclipseLinkJavaEmbeddedMappingDefinition2_0.instance(); - - // singleton - private static final DefaultJavaAttributeMappingDefinition INSTANCE = new EclipseLinkJavaEmbeddedMappingDefinition2_2(); - - /** - * Return the singleton. - */ - public static DefaultJavaAttributeMappingDefinition instance() { - return INSTANCE; - } - - - /** - * Enforce singleton usage - */ - private EclipseLinkJavaEmbeddedMappingDefinition2_2() { - super(); - } - - @Override - protected DefaultJavaAttributeMappingDefinition getDelegate() { - return DELEGATE; - } - - @Override - public Iterable<String> getSupportingAnnotationNames() { - return COMBINED_SUPPORTING_ANNOTATION_NAMES; - } - - @SuppressWarnings("unchecked") - private static final Iterable<String> COMBINED_SUPPORTING_ANNOTATION_NAMES = new CompositeIterable<String>( - DELEGATE.getSupportingAnnotationNames(), - EclipseLinkJavaBasicMappingDefinition2_2.ECLIPSE_LINK2_2_SUPPORTING_ANNOTATION_NAMES - ); -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/java/EclipseLinkJavaEntityDefinition.java b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/java/EclipseLinkJavaEntityDefinition.java deleted file mode 100644 index 7477386ae0..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/java/EclipseLinkJavaEntityDefinition.java +++ /dev/null @@ -1,79 +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, 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.eclipselink.core.internal.context.java; - -import org.eclipse.jpt.common.utility.internal.iterables.ArrayIterable; -import org.eclipse.jpt.common.utility.internal.iterables.CompositeIterable; -import org.eclipse.jpt.jpa.core.context.java.JavaTypeMappingDefinition; -import org.eclipse.jpt.jpa.core.internal.context.java.JavaEntityDefinition; -import org.eclipse.jpt.jpa.core.internal.context.java.JavaTypeMappingDefinitionWrapper; -import org.eclipse.jpt.jpa.eclipselink.core.resource.java.EclipseLinkCacheAnnotation; -import org.eclipse.jpt.jpa.eclipselink.core.resource.java.EclipseLinkChangeTrackingAnnotation; -import org.eclipse.jpt.jpa.eclipselink.core.resource.java.EclipseLinkConverterAnnotation; -import org.eclipse.jpt.jpa.eclipselink.core.resource.java.EclipseLinkCustomizerAnnotation; -import org.eclipse.jpt.jpa.eclipselink.core.resource.java.EclipseLinkExistenceCheckingAnnotation; -import org.eclipse.jpt.jpa.eclipselink.core.resource.java.EclipseLinkObjectTypeConverterAnnotation; -import org.eclipse.jpt.jpa.eclipselink.core.resource.java.EclipseLinkReadOnlyAnnotation; -import org.eclipse.jpt.jpa.eclipselink.core.resource.java.EclipseLinkStructConverterAnnotation; -import org.eclipse.jpt.jpa.eclipselink.core.resource.java.EclipseLinkTypeConverterAnnotation; - -public class EclipseLinkJavaEntityDefinition - extends JavaTypeMappingDefinitionWrapper -{ - private static final JavaTypeMappingDefinition DELEGATE = JavaEntityDefinition.instance(); - - // singleton - private static final JavaTypeMappingDefinition INSTANCE = new EclipseLinkJavaEntityDefinition(); - - /** - * Return the singleton. - */ - public static JavaTypeMappingDefinition instance() { - return INSTANCE; - } - - - /** - * Enforce singleton usage - */ - private EclipseLinkJavaEntityDefinition() { - super(); - } - - @Override - protected JavaTypeMappingDefinition getDelegate() { - return DELEGATE; - } - - @Override - public Iterable<String> getSupportingAnnotationNames() { - return COMBINED_SUPPORTING_ANNOTATION_NAMES; - } - - private static final String[] ECLIPSE_LINK_SUPPORTING_ANNOTATION_NAMES_ARRAY = new String[] { - EclipseLinkCacheAnnotation.ANNOTATION_NAME, - EclipseLinkChangeTrackingAnnotation.ANNOTATION_NAME, - EclipseLinkConverterAnnotation.ANNOTATION_NAME, - EclipseLinkCustomizerAnnotation.ANNOTATION_NAME, - EclipseLinkExistenceCheckingAnnotation.ANNOTATION_NAME, - EclipseLinkObjectTypeConverterAnnotation.ANNOTATION_NAME, - EclipseLinkReadOnlyAnnotation.ANNOTATION_NAME, - EclipseLinkStructConverterAnnotation.ANNOTATION_NAME, - EclipseLinkTypeConverterAnnotation.ANNOTATION_NAME, - }; - // 'public' because EclipseLink MappedSuperclass also supports these annotations - public static final Iterable<String> ECLIPSE_LINK_SUPPORTING_ANNOTATION_NAMES = new ArrayIterable<String>(ECLIPSE_LINK_SUPPORTING_ANNOTATION_NAMES_ARRAY); - - @SuppressWarnings("unchecked") - private static final Iterable<String> COMBINED_SUPPORTING_ANNOTATION_NAMES = new CompositeIterable<String>( - DELEGATE.getSupportingAnnotationNames(), - ECLIPSE_LINK_SUPPORTING_ANNOTATION_NAMES - ); -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/java/EclipseLinkJavaEntityDefinition2_0.java b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/java/EclipseLinkJavaEntityDefinition2_0.java deleted file mode 100644 index 9e3021f20b..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/java/EclipseLinkJavaEntityDefinition2_0.java +++ /dev/null @@ -1,55 +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, 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.eclipselink.core.internal.context.java; - -import org.eclipse.jpt.common.utility.internal.iterables.CompositeIterable; -import org.eclipse.jpt.jpa.core.context.java.JavaTypeMappingDefinition; -import org.eclipse.jpt.jpa.core.internal.context.java.JavaTypeMappingDefinitionWrapper; -import org.eclipse.jpt.jpa.core.internal.jpa2.context.java.JavaEntityDefinition2_0; - -public class EclipseLinkJavaEntityDefinition2_0 - extends JavaTypeMappingDefinitionWrapper -{ - private static final JavaTypeMappingDefinition DELEGATE = JavaEntityDefinition2_0.instance(); - - // singleton - private static final JavaTypeMappingDefinition INSTANCE = new EclipseLinkJavaEntityDefinition2_0(); - - /** - * Return the singleton. - */ - public static JavaTypeMappingDefinition instance() { - return INSTANCE; - } - - - /** - * Enforce singleton usage - */ - private EclipseLinkJavaEntityDefinition2_0() { - super(); - } - - @Override - protected JavaTypeMappingDefinition getDelegate() { - return DELEGATE; - } - - @Override - public Iterable<String> getSupportingAnnotationNames() { - return COMBINED_SUPPORTING_ANNOTATION_NAMES; - } - - @SuppressWarnings("unchecked") - private static final Iterable<String> COMBINED_SUPPORTING_ANNOTATION_NAMES = new CompositeIterable<String>( - DELEGATE.getSupportingAnnotationNames(), - EclipseLinkJavaEntityDefinition.ECLIPSE_LINK_SUPPORTING_ANNOTATION_NAMES - ); -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/java/EclipseLinkJavaEntityDefinition2_2.java b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/java/EclipseLinkJavaEntityDefinition2_2.java deleted file mode 100644 index d49fd52aff..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/java/EclipseLinkJavaEntityDefinition2_2.java +++ /dev/null @@ -1,65 +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, 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.eclipselink.core.internal.context.java; - -import org.eclipse.jpt.common.utility.internal.iterables.ArrayIterable; -import org.eclipse.jpt.common.utility.internal.iterables.CompositeIterable; -import org.eclipse.jpt.jpa.core.context.java.JavaTypeMappingDefinition; -import org.eclipse.jpt.jpa.core.internal.context.java.JavaTypeMappingDefinitionWrapper; -import org.eclipse.jpt.jpa.eclipselink.core.resource.java.EclipseLink; - -public class EclipseLinkJavaEntityDefinition2_2 - extends JavaTypeMappingDefinitionWrapper -{ - private static final JavaTypeMappingDefinition DELEGATE = EclipseLinkJavaEntityDefinition2_0.instance(); - - // singleton - private static final JavaTypeMappingDefinition INSTANCE = new EclipseLinkJavaEntityDefinition2_2(); - - /** - * Return the singleton. - */ - public static JavaTypeMappingDefinition instance() { - return INSTANCE; - } - - - /** - * Enforce singleton usage - */ - private EclipseLinkJavaEntityDefinition2_2() { - super(); - } - - @Override - protected JavaTypeMappingDefinition getDelegate() { - return DELEGATE; - } - - @Override - public Iterable<String> getSupportingAnnotationNames() { - return COMBINED_SUPPORTING_ANNOTATION_NAMES; - } - - public static final String[] ECLIPSE_LINK2_2_SUPPORTING_ANNOTATION_NAMES_ARRAY = new String[] { - EclipseLink.CONVERTERS, - EclipseLink.OBJECT_TYPE_CONVERTERS, - EclipseLink.STRUCT_CONVERTERS, - EclipseLink.TYPE_CONVERTERS, - }; - - public static final Iterable<String> ECLIPSE_LINK2_2_SUPPORTING_ANNOTATION_NAMES = new ArrayIterable<String>(ECLIPSE_LINK2_2_SUPPORTING_ANNOTATION_NAMES_ARRAY); - - @SuppressWarnings("unchecked") - private static final Iterable<String> COMBINED_SUPPORTING_ANNOTATION_NAMES = new CompositeIterable<String>( - DELEGATE.getSupportingAnnotationNames(), - ECLIPSE_LINK2_2_SUPPORTING_ANNOTATION_NAMES - ); -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/java/EclipseLinkJavaEntityDefinition2_3.java b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/java/EclipseLinkJavaEntityDefinition2_3.java deleted file mode 100644 index 0be7d15f90..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/java/EclipseLinkJavaEntityDefinition2_3.java +++ /dev/null @@ -1,65 +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, 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.eclipselink.core.internal.context.java; - -import org.eclipse.jpt.common.utility.internal.iterables.ArrayIterable; -import org.eclipse.jpt.common.utility.internal.iterables.CompositeIterable; -import org.eclipse.jpt.jpa.core.context.java.JavaTypeMappingDefinition; -import org.eclipse.jpt.jpa.core.internal.context.java.JavaTypeMappingDefinitionWrapper; -import org.eclipse.jpt.jpa.eclipselink.core.resource.java.EclipseLink; -import org.eclipse.jpt.jpa.eclipselink.core.resource.java.EclipseLinkMultitenantAnnotation2_3; -import org.eclipse.jpt.jpa.eclipselink.core.resource.java.EclipseLinkTenantDiscriminatorColumnAnnotation2_3; - -public class EclipseLinkJavaEntityDefinition2_3 - extends JavaTypeMappingDefinitionWrapper -{ - private static final JavaTypeMappingDefinition DELEGATE = EclipseLinkJavaEntityDefinition2_2.instance(); - - // singleton - private static final JavaTypeMappingDefinition INSTANCE = new EclipseLinkJavaEntityDefinition2_3(); - - /** - * Return the singleton. - */ - public static JavaTypeMappingDefinition instance() { - return INSTANCE; - } - - - /** - * Enforce singleton usage - */ - private EclipseLinkJavaEntityDefinition2_3() { - super(); - } - - @Override - protected JavaTypeMappingDefinition getDelegate() { - return DELEGATE; - } - - @Override - public Iterable<String> getSupportingAnnotationNames() { - return COMBINED_SUPPORTING_ANNOTATION_NAMES; - } - - public static final String[] ECLIPSE_LINK2_3_SUPPORTING_ANNOTATION_NAMES_ARRAY = new String[] { - EclipseLinkMultitenantAnnotation2_3.ANNOTATION_NAME, - EclipseLinkTenantDiscriminatorColumnAnnotation2_3.ANNOTATION_NAME, - EclipseLink.TENANT_DISCRIMINATOR_COLUMNS - }; - public static final Iterable<String> ECLIPSE_LINK2_3_SUPPORTING_ANNOTATION_NAMES = new ArrayIterable<String>(ECLIPSE_LINK2_3_SUPPORTING_ANNOTATION_NAMES_ARRAY); - - @SuppressWarnings("unchecked") - private static final Iterable<String> COMBINED_SUPPORTING_ANNOTATION_NAMES = new CompositeIterable<String>( - DELEGATE.getSupportingAnnotationNames(), - ECLIPSE_LINK2_3_SUPPORTING_ANNOTATION_NAMES - ); -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/java/EclipseLinkJavaIdMappingDefinition.java b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/java/EclipseLinkJavaIdMappingDefinition.java deleted file mode 100644 index 7bbfb2547b..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/java/EclipseLinkJavaIdMappingDefinition.java +++ /dev/null @@ -1,55 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010, 2011 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.eclipselink.core.internal.context.java; - -import org.eclipse.jpt.common.utility.internal.iterables.CompositeIterable; -import org.eclipse.jpt.jpa.core.context.java.JavaAttributeMappingDefinition; -import org.eclipse.jpt.jpa.core.internal.context.java.JavaAttributeMappingDefinitionWrapper; -import org.eclipse.jpt.jpa.core.internal.context.java.JavaIdMappingDefinition; - -public class EclipseLinkJavaIdMappingDefinition - extends JavaAttributeMappingDefinitionWrapper -{ - private static final JavaAttributeMappingDefinition DELEGATE = JavaIdMappingDefinition.instance(); - - // singleton - private static final JavaAttributeMappingDefinition INSTANCE = new EclipseLinkJavaIdMappingDefinition(); - - /** - * Return the singleton. - */ - public static JavaAttributeMappingDefinition instance() { - return INSTANCE; - } - - - /** - * Enforce singleton usage - */ - private EclipseLinkJavaIdMappingDefinition() { - super(); - } - - @Override - protected JavaAttributeMappingDefinition getDelegate() { - return DELEGATE; - } - - @Override - public Iterable<String> getSupportingAnnotationNames() { - return COMBINED_SUPPORTING_ANNOTATION_NAMES; - } - - @SuppressWarnings("unchecked") - private static final Iterable<String> COMBINED_SUPPORTING_ANNOTATION_NAMES = new CompositeIterable<String>( - DELEGATE.getSupportingAnnotationNames(), - EclipseLinkJavaBasicMappingDefinition.ECLIPSE_LINK_SUPPORTING_ANNOTATION_NAMES - ); -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/java/EclipseLinkJavaIdMappingDefinition2_0.java b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/java/EclipseLinkJavaIdMappingDefinition2_0.java deleted file mode 100644 index 2962443e4c..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/java/EclipseLinkJavaIdMappingDefinition2_0.java +++ /dev/null @@ -1,85 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010, 2011 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.eclipselink.core.internal.context.java; - -import org.eclipse.jpt.common.utility.internal.Tools; -import org.eclipse.jpt.common.utility.internal.iterables.CompositeIterable; -import org.eclipse.jpt.jpa.core.context.java.JavaAttributeMappingDefinition; -import org.eclipse.jpt.jpa.core.context.java.JavaPersistentAttribute; -import org.eclipse.jpt.jpa.core.internal.context.java.JavaAttributeMappingDefinitionWrapper; -import org.eclipse.jpt.jpa.core.internal.jpa2.context.java.JavaIdMappingDefinition2_0; - -public class EclipseLinkJavaIdMappingDefinition2_0 - extends JavaAttributeMappingDefinitionWrapper -{ - private static final JavaAttributeMappingDefinition DELEGATE = JavaIdMappingDefinition2_0.instance(); - - // singleton - private static final JavaAttributeMappingDefinition INSTANCE = new EclipseLinkJavaIdMappingDefinition2_0(); - - /** - * Return the singleton. - */ - public static JavaAttributeMappingDefinition instance() { - return INSTANCE; - } - - - /** - * Enforce singleton usage - */ - private EclipseLinkJavaIdMappingDefinition2_0() { - super(); - } - - @Override - protected JavaAttributeMappingDefinition getDelegate() { - return DELEGATE; - } - - /** - * Check whether the <code>Id</code> mapping is "specified" according to - * the spec then check for EclipseLink default mappings that negate the - * <code>Id</code> mapping. - */ - @Override - public boolean isSpecified(JavaPersistentAttribute persistentAttribute) { - boolean specSpecified = super.isSpecified(persistentAttribute); - return specSpecified && ! this.isDefaultDerivedId(persistentAttribute); - } - - /** - * EclipseLink supports default M:1 and 1:1 mappings. - */ - private boolean isDefaultDerivedId(JavaPersistentAttribute persistentAttribute) { - String defaultKey = persistentAttribute.getDefaultMappingKey(); - return Tools.valuesAreEqual(defaultKey, this.getManyToOneKey()) || - Tools.valuesAreEqual(defaultKey, this.getOneToOneKey()); - } - - private String getManyToOneKey() { - return EclipseLinkJavaOneToOneMappingDefinition2_0.instance().getKey(); - } - - private String getOneToOneKey() { - return EclipseLinkJavaOneToOneMappingDefinition2_0.instance().getKey(); - } - - @Override - public Iterable<String> getSupportingAnnotationNames() { - return COMBINED_SUPPORTING_ANNOTATION_NAMES; - } - - @SuppressWarnings("unchecked") - private static final Iterable<String> COMBINED_SUPPORTING_ANNOTATION_NAMES = new CompositeIterable<String>( - DELEGATE.getSupportingAnnotationNames(), - EclipseLinkJavaBasicMappingDefinition.ECLIPSE_LINK_SUPPORTING_ANNOTATION_NAMES - ); -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/java/EclipseLinkJavaIdMappingDefinition2_2.java b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/java/EclipseLinkJavaIdMappingDefinition2_2.java deleted file mode 100644 index bca3fc929f..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/java/EclipseLinkJavaIdMappingDefinition2_2.java +++ /dev/null @@ -1,54 +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, 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.eclipselink.core.internal.context.java; - -import org.eclipse.jpt.common.utility.internal.iterables.CompositeIterable; -import org.eclipse.jpt.jpa.core.context.java.JavaAttributeMappingDefinition; -import org.eclipse.jpt.jpa.core.internal.context.java.JavaAttributeMappingDefinitionWrapper; - -public class EclipseLinkJavaIdMappingDefinition2_2 - extends JavaAttributeMappingDefinitionWrapper -{ - private static final JavaAttributeMappingDefinition DELEGATE = EclipseLinkJavaIdMappingDefinition2_0.instance(); - - // singleton - private static final JavaAttributeMappingDefinition INSTANCE = new EclipseLinkJavaIdMappingDefinition2_2(); - - /** - * Return the singleton. - */ - public static JavaAttributeMappingDefinition instance() { - return INSTANCE; - } - - - /** - * Enforce singleton usage - */ - private EclipseLinkJavaIdMappingDefinition2_2() { - super(); - } - - @Override - protected JavaAttributeMappingDefinition getDelegate() { - return DELEGATE; - } - - @Override - public Iterable<String> getSupportingAnnotationNames() { - return COMBINED_SUPPORTING_ANNOTATION_NAMES; - } - - @SuppressWarnings("unchecked") - private static final Iterable<String> COMBINED_SUPPORTING_ANNOTATION_NAMES = new CompositeIterable<String>( - DELEGATE.getSupportingAnnotationNames(), - EclipseLinkJavaBasicMappingDefinition2_2.ECLIPSE_LINK2_2_SUPPORTING_ANNOTATION_NAMES - ); -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/java/EclipseLinkJavaManyToManyMappingDefinition.java b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/java/EclipseLinkJavaManyToManyMappingDefinition.java deleted file mode 100644 index 12e4d936cd..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/java/EclipseLinkJavaManyToManyMappingDefinition.java +++ /dev/null @@ -1,70 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010, 2011 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.eclipselink.core.internal.context.java; - -import org.eclipse.jpt.common.utility.internal.iterables.ArrayIterable; -import org.eclipse.jpt.common.utility.internal.iterables.CompositeIterable; -import org.eclipse.jpt.jpa.core.context.java.JavaAttributeMappingDefinition; -import org.eclipse.jpt.jpa.core.internal.context.java.JavaAttributeMappingDefinitionWrapper; -import org.eclipse.jpt.jpa.core.internal.context.java.JavaManyToManyMappingDefinition; -import org.eclipse.jpt.jpa.eclipselink.core.resource.java.EclipseLinkConverterAnnotation; -import org.eclipse.jpt.jpa.eclipselink.core.resource.java.EclipseLinkJoinFetchAnnotation; -import org.eclipse.jpt.jpa.eclipselink.core.resource.java.EclipseLinkObjectTypeConverterAnnotation; -import org.eclipse.jpt.jpa.eclipselink.core.resource.java.EclipseLinkStructConverterAnnotation; -import org.eclipse.jpt.jpa.eclipselink.core.resource.java.EclipseLinkTypeConverterAnnotation; - -public class EclipseLinkJavaManyToManyMappingDefinition - extends JavaAttributeMappingDefinitionWrapper -{ - private static final JavaAttributeMappingDefinition DELEGATE = JavaManyToManyMappingDefinition.instance(); - - // singleton - private static final JavaAttributeMappingDefinition INSTANCE = new EclipseLinkJavaManyToManyMappingDefinition(); - - /** - * Return the singleton. - */ - public static JavaAttributeMappingDefinition instance() { - return INSTANCE; - } - - - /** - * Enforce singleton usage - */ - private EclipseLinkJavaManyToManyMappingDefinition() { - super(); - } - - @Override - protected JavaAttributeMappingDefinition getDelegate() { - return DELEGATE; - } - - @Override - public Iterable<String> getSupportingAnnotationNames() { - return COMBINED_SUPPORTING_ANNOTATION_NAMES; - } - - public static final String[] ECLIPSE_LINK_SUPPORTING_ANNOTATION_NAMES_ARRAY = new String[] { - EclipseLinkConverterAnnotation.ANNOTATION_NAME, - EclipseLinkJoinFetchAnnotation.ANNOTATION_NAME, - EclipseLinkObjectTypeConverterAnnotation.ANNOTATION_NAME, - EclipseLinkStructConverterAnnotation.ANNOTATION_NAME, - EclipseLinkTypeConverterAnnotation.ANNOTATION_NAME, - }; - public static final Iterable<String> ECLIPSE_LINK_SUPPORTING_ANNOTATION_NAMES = new ArrayIterable<String>(ECLIPSE_LINK_SUPPORTING_ANNOTATION_NAMES_ARRAY); - - @SuppressWarnings("unchecked") - private static final Iterable<String> COMBINED_SUPPORTING_ANNOTATION_NAMES = new CompositeIterable<String>( - DELEGATE.getSupportingAnnotationNames(), - ECLIPSE_LINK_SUPPORTING_ANNOTATION_NAMES - ); -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/java/EclipseLinkJavaManyToManyMappingDefinition2_0.java b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/java/EclipseLinkJavaManyToManyMappingDefinition2_0.java deleted file mode 100644 index 1a57786e09..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/java/EclipseLinkJavaManyToManyMappingDefinition2_0.java +++ /dev/null @@ -1,55 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010, 2011 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.eclipselink.core.internal.context.java; - -import org.eclipse.jpt.common.utility.internal.iterables.CompositeIterable; -import org.eclipse.jpt.jpa.core.context.java.JavaAttributeMappingDefinition; -import org.eclipse.jpt.jpa.core.internal.context.java.JavaAttributeMappingDefinitionWrapper; -import org.eclipse.jpt.jpa.core.internal.jpa2.context.java.JavaManyToManyMappingDefinition2_0; - -public class EclipseLinkJavaManyToManyMappingDefinition2_0 - extends JavaAttributeMappingDefinitionWrapper -{ - private static final JavaAttributeMappingDefinition DELEGATE = JavaManyToManyMappingDefinition2_0.instance(); - - // singleton - private static final JavaAttributeMappingDefinition INSTANCE = new EclipseLinkJavaManyToManyMappingDefinition2_0(); - - /** - * Return the singleton. - */ - public static JavaAttributeMappingDefinition instance() { - return INSTANCE; - } - - - /** - * Enforce singleton usage - */ - private EclipseLinkJavaManyToManyMappingDefinition2_0() { - super(); - } - - @Override - protected JavaAttributeMappingDefinition getDelegate() { - return DELEGATE; - } - - @Override - public Iterable<String> getSupportingAnnotationNames() { - return COMBINED_SUPPORTING_ANNOTATION_NAMES; - } - - @SuppressWarnings("unchecked") - private static final Iterable<String> COMBINED_SUPPORTING_ANNOTATION_NAMES = new CompositeIterable<String>( - DELEGATE.getSupportingAnnotationNames(), - EclipseLinkJavaManyToManyMappingDefinition.ECLIPSE_LINK_SUPPORTING_ANNOTATION_NAMES - ); -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/java/EclipseLinkJavaManyToManyMappingDefinition2_2.java b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/java/EclipseLinkJavaManyToManyMappingDefinition2_2.java deleted file mode 100644 index 97e7e61618..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/java/EclipseLinkJavaManyToManyMappingDefinition2_2.java +++ /dev/null @@ -1,54 +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, 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.eclipselink.core.internal.context.java; - -import org.eclipse.jpt.common.utility.internal.iterables.CompositeIterable; -import org.eclipse.jpt.jpa.core.context.java.JavaAttributeMappingDefinition; -import org.eclipse.jpt.jpa.core.internal.context.java.JavaAttributeMappingDefinitionWrapper; - -public class EclipseLinkJavaManyToManyMappingDefinition2_2 - extends JavaAttributeMappingDefinitionWrapper -{ - private static final JavaAttributeMappingDefinition DELEGATE = EclipseLinkJavaManyToManyMappingDefinition2_0.instance(); - - // singleton - private static final JavaAttributeMappingDefinition INSTANCE = new EclipseLinkJavaManyToManyMappingDefinition2_2(); - - /** - * Return the singleton. - */ - public static JavaAttributeMappingDefinition instance() { - return INSTANCE; - } - - - /** - * Enforce singleton usage - */ - private EclipseLinkJavaManyToManyMappingDefinition2_2() { - super(); - } - - @Override - protected JavaAttributeMappingDefinition getDelegate() { - return DELEGATE; - } - - @Override - public Iterable<String> getSupportingAnnotationNames() { - return COMBINED_SUPPORTING_ANNOTATION_NAMES; - } - - @SuppressWarnings("unchecked") - private static final Iterable<String> COMBINED_SUPPORTING_ANNOTATION_NAMES = new CompositeIterable<String>( - DELEGATE.getSupportingAnnotationNames(), - EclipseLinkJavaBasicMappingDefinition2_2.ECLIPSE_LINK2_2_SUPPORTING_ANNOTATION_NAMES - ); -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/java/EclipseLinkJavaManyToOneMappingDefinition.java b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/java/EclipseLinkJavaManyToOneMappingDefinition.java deleted file mode 100644 index 9e1b33baf4..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/java/EclipseLinkJavaManyToOneMappingDefinition.java +++ /dev/null @@ -1,70 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010, 2011 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.eclipselink.core.internal.context.java; - -import org.eclipse.jpt.common.utility.internal.iterables.ArrayIterable; -import org.eclipse.jpt.common.utility.internal.iterables.CompositeIterable; -import org.eclipse.jpt.jpa.core.context.java.JavaAttributeMappingDefinition; -import org.eclipse.jpt.jpa.core.internal.context.java.JavaAttributeMappingDefinitionWrapper; -import org.eclipse.jpt.jpa.core.internal.context.java.JavaManyToOneMappingDefinition; -import org.eclipse.jpt.jpa.eclipselink.core.resource.java.EclipseLinkConverterAnnotation; -import org.eclipse.jpt.jpa.eclipselink.core.resource.java.EclipseLinkJoinFetchAnnotation; -import org.eclipse.jpt.jpa.eclipselink.core.resource.java.EclipseLinkObjectTypeConverterAnnotation; -import org.eclipse.jpt.jpa.eclipselink.core.resource.java.EclipseLinkStructConverterAnnotation; -import org.eclipse.jpt.jpa.eclipselink.core.resource.java.EclipseLinkTypeConverterAnnotation; - -public class EclipseLinkJavaManyToOneMappingDefinition - extends JavaAttributeMappingDefinitionWrapper -{ - private static final JavaAttributeMappingDefinition DELEGATE = JavaManyToOneMappingDefinition.instance(); - - // singleton - private static final JavaAttributeMappingDefinition INSTANCE = new EclipseLinkJavaManyToOneMappingDefinition(); - - /** - * Return the singleton. - */ - public static JavaAttributeMappingDefinition instance() { - return INSTANCE; - } - - - /** - * Enforce singleton usage - */ - private EclipseLinkJavaManyToOneMappingDefinition() { - super(); - } - - @Override - protected JavaAttributeMappingDefinition getDelegate() { - return DELEGATE; - } - - @Override - public Iterable<String> getSupportingAnnotationNames() { - return COMBINED_SUPPORTING_ANNOTATION_NAMES; - } - - private static final String[] ECLIPSE_LINK_SUPPORTING_ANNOTATION_NAMES_ARRAY = new String[] { - EclipseLinkConverterAnnotation.ANNOTATION_NAME, - EclipseLinkJoinFetchAnnotation.ANNOTATION_NAME, - EclipseLinkObjectTypeConverterAnnotation.ANNOTATION_NAME, - EclipseLinkStructConverterAnnotation.ANNOTATION_NAME, - EclipseLinkTypeConverterAnnotation.ANNOTATION_NAME, - }; - public static final Iterable<String> ECLIPSE_LINK_SUPPORTING_ANNOTATION_NAMES = new ArrayIterable<String>(ECLIPSE_LINK_SUPPORTING_ANNOTATION_NAMES_ARRAY); - - @SuppressWarnings("unchecked") - private static final Iterable<String> COMBINED_SUPPORTING_ANNOTATION_NAMES = new CompositeIterable<String>( - DELEGATE.getSupportingAnnotationNames(), - ECLIPSE_LINK_SUPPORTING_ANNOTATION_NAMES - ); -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/java/EclipseLinkJavaManyToOneMappingDefinition2_0.java b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/java/EclipseLinkJavaManyToOneMappingDefinition2_0.java deleted file mode 100644 index 74c6d4ea0f..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/java/EclipseLinkJavaManyToOneMappingDefinition2_0.java +++ /dev/null @@ -1,55 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010, 2011 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.eclipselink.core.internal.context.java; - -import org.eclipse.jpt.common.utility.internal.iterables.CompositeIterable; -import org.eclipse.jpt.jpa.core.context.java.JavaAttributeMappingDefinition; -import org.eclipse.jpt.jpa.core.internal.context.java.JavaAttributeMappingDefinitionWrapper; -import org.eclipse.jpt.jpa.core.internal.jpa2.context.java.JavaManyToOneMappingDefinition2_0; - -public class EclipseLinkJavaManyToOneMappingDefinition2_0 - extends JavaAttributeMappingDefinitionWrapper -{ - private static final JavaAttributeMappingDefinition DELEGATE = JavaManyToOneMappingDefinition2_0.instance(); - - // singleton - private static final JavaAttributeMappingDefinition INSTANCE = new EclipseLinkJavaManyToOneMappingDefinition2_0(); - - /** - * Return the singleton. - */ - public static JavaAttributeMappingDefinition instance() { - return INSTANCE; - } - - - /** - * Enforce singleton usage - */ - private EclipseLinkJavaManyToOneMappingDefinition2_0() { - super(); - } - - @Override - protected JavaAttributeMappingDefinition getDelegate() { - return DELEGATE; - } - - @Override - public Iterable<String> getSupportingAnnotationNames() { - return COMBINED_SUPPORTING_ANNOTATION_NAMES; - } - - @SuppressWarnings("unchecked") - private static final Iterable<String> COMBINED_SUPPORTING_ANNOTATION_NAMES = new CompositeIterable<String>( - DELEGATE.getSupportingAnnotationNames(), - EclipseLinkJavaManyToOneMappingDefinition.ECLIPSE_LINK_SUPPORTING_ANNOTATION_NAMES - ); -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/java/EclipseLinkJavaManyToOneMappingDefinition2_2.java b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/java/EclipseLinkJavaManyToOneMappingDefinition2_2.java deleted file mode 100644 index 4130039f91..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/java/EclipseLinkJavaManyToOneMappingDefinition2_2.java +++ /dev/null @@ -1,54 +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, 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.eclipselink.core.internal.context.java; - -import org.eclipse.jpt.common.utility.internal.iterables.CompositeIterable; -import org.eclipse.jpt.jpa.core.context.java.JavaAttributeMappingDefinition; -import org.eclipse.jpt.jpa.core.internal.context.java.JavaAttributeMappingDefinitionWrapper; - -public class EclipseLinkJavaManyToOneMappingDefinition2_2 - extends JavaAttributeMappingDefinitionWrapper -{ - private static final JavaAttributeMappingDefinition DELEGATE = EclipseLinkJavaManyToOneMappingDefinition2_0.instance(); - - // singleton - private static final JavaAttributeMappingDefinition INSTANCE = new EclipseLinkJavaManyToOneMappingDefinition2_2(); - - /** - * Return the singleton. - */ - public static JavaAttributeMappingDefinition instance() { - return INSTANCE; - } - - - /** - * Enforce singleton usage - */ - private EclipseLinkJavaManyToOneMappingDefinition2_2() { - super(); - } - - @Override - protected JavaAttributeMappingDefinition getDelegate() { - return DELEGATE; - } - - @Override - public Iterable<String> getSupportingAnnotationNames() { - return COMBINED_SUPPORTING_ANNOTATION_NAMES; - } - - @SuppressWarnings("unchecked") - private static final Iterable<String> COMBINED_SUPPORTING_ANNOTATION_NAMES = new CompositeIterable<String>( - DELEGATE.getSupportingAnnotationNames(), - EclipseLinkJavaBasicMappingDefinition2_2.ECLIPSE_LINK2_2_SUPPORTING_ANNOTATION_NAMES - ); -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/java/EclipseLinkJavaMappedSuperclassDefinition.java b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/java/EclipseLinkJavaMappedSuperclassDefinition.java deleted file mode 100644 index 2bcb1ca038..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/java/EclipseLinkJavaMappedSuperclassDefinition.java +++ /dev/null @@ -1,54 +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, 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.eclipselink.core.internal.context.java; - -import org.eclipse.jpt.common.utility.internal.iterables.CompositeIterable; -import org.eclipse.jpt.jpa.core.context.java.JavaTypeMappingDefinition; -import org.eclipse.jpt.jpa.core.internal.context.java.JavaMappedSuperclassDefinition; -import org.eclipse.jpt.jpa.core.internal.context.java.JavaTypeMappingDefinitionWrapper; - -public class EclipseLinkJavaMappedSuperclassDefinition - extends JavaTypeMappingDefinitionWrapper -{ - private static final JavaTypeMappingDefinition DELEGATE = JavaMappedSuperclassDefinition.instance(); - - // singleton - private static final JavaTypeMappingDefinition INSTANCE = new EclipseLinkJavaMappedSuperclassDefinition(); - - /** - * Return the singleton. - */ - public static JavaTypeMappingDefinition instance() { - return INSTANCE; - } - - - /** - * Enforce singleton usage - */ - private EclipseLinkJavaMappedSuperclassDefinition() { - super(); - } - - @Override - protected JavaTypeMappingDefinition getDelegate() { - return DELEGATE; - } - - @Override - public Iterable<String> getSupportingAnnotationNames() { - return COMBINED_SUPPORTING_ANNOTATION_NAMES; - } - @SuppressWarnings("unchecked") - private static final Iterable<String> COMBINED_SUPPORTING_ANNOTATION_NAMES = new CompositeIterable<String>( - DELEGATE.getSupportingAnnotationNames(), - EclipseLinkJavaEntityDefinition.ECLIPSE_LINK_SUPPORTING_ANNOTATION_NAMES - ); -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/java/EclipseLinkJavaMappedSuperclassDefinition2_0.java b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/java/EclipseLinkJavaMappedSuperclassDefinition2_0.java deleted file mode 100644 index 8c407f5460..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/java/EclipseLinkJavaMappedSuperclassDefinition2_0.java +++ /dev/null @@ -1,54 +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, 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.eclipselink.core.internal.context.java; - -import org.eclipse.jpt.common.utility.internal.iterables.CompositeIterable; -import org.eclipse.jpt.jpa.core.context.java.JavaTypeMappingDefinition; -import org.eclipse.jpt.jpa.core.internal.context.java.JavaTypeMappingDefinitionWrapper; -import org.eclipse.jpt.jpa.core.internal.jpa2.context.java.JavaMappedSuperclassDefinition2_0; - -public class EclipseLinkJavaMappedSuperclassDefinition2_0 - extends JavaTypeMappingDefinitionWrapper -{ - private static final JavaTypeMappingDefinition DELEGATE = JavaMappedSuperclassDefinition2_0.instance(); - - // singleton - private static final JavaTypeMappingDefinition INSTANCE = new EclipseLinkJavaMappedSuperclassDefinition2_0(); - - /** - * Return the singleton. - */ - public static JavaTypeMappingDefinition instance() { - return INSTANCE; - } - - - /** - * Enforce singleton usage - */ - private EclipseLinkJavaMappedSuperclassDefinition2_0() { - super(); - } - - @Override - protected JavaTypeMappingDefinition getDelegate() { - return DELEGATE; - } - - @Override - public Iterable<String> getSupportingAnnotationNames() { - return COMBINED_SUPPORTING_ANNOTATION_NAMES; - } - @SuppressWarnings("unchecked") - private static final Iterable<String> COMBINED_SUPPORTING_ANNOTATION_NAMES = new CompositeIterable<String>( - DELEGATE.getSupportingAnnotationNames(), - EclipseLinkJavaEntityDefinition.ECLIPSE_LINK_SUPPORTING_ANNOTATION_NAMES - ); -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/java/EclipseLinkJavaMappedSuperclassDefinition2_2.java b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/java/EclipseLinkJavaMappedSuperclassDefinition2_2.java deleted file mode 100644 index 489129227c..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/java/EclipseLinkJavaMappedSuperclassDefinition2_2.java +++ /dev/null @@ -1,64 +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, 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.eclipselink.core.internal.context.java; - -import org.eclipse.jpt.common.utility.internal.iterables.ArrayIterable; -import org.eclipse.jpt.common.utility.internal.iterables.CompositeIterable; -import org.eclipse.jpt.jpa.core.context.java.JavaTypeMappingDefinition; -import org.eclipse.jpt.jpa.core.internal.context.java.JavaTypeMappingDefinitionWrapper; -import org.eclipse.jpt.jpa.eclipselink.core.resource.java.EclipseLink; - -public class EclipseLinkJavaMappedSuperclassDefinition2_2 - extends JavaTypeMappingDefinitionWrapper -{ - private static final JavaTypeMappingDefinition DELEGATE = EclipseLinkJavaMappedSuperclassDefinition2_0.instance(); - - // singleton - private static final JavaTypeMappingDefinition INSTANCE = new EclipseLinkJavaMappedSuperclassDefinition2_2(); - - /** - * Return the singleton. - */ - public static JavaTypeMappingDefinition instance() { - return INSTANCE; - } - - - /** - * Enforce singleton usage - */ - private EclipseLinkJavaMappedSuperclassDefinition2_2() { - super(); - } - - @Override - protected JavaTypeMappingDefinition getDelegate() { - return DELEGATE; - } - - @Override - public Iterable<String> getSupportingAnnotationNames() { - return COMBINED_SUPPORTING_ANNOTATION_NAMES; - } - - public static final String[] ECLIPSE_LINK2_2_SUPPORTING_ANNOTATION_NAMES_ARRAY = new String[] { - EclipseLink.CONVERTERS, - EclipseLink.OBJECT_TYPE_CONVERTERS, - EclipseLink.STRUCT_CONVERTERS, - EclipseLink.TYPE_CONVERTERS, - }; - public static final Iterable<String> ECLIPSE_LINK2_2_SUPPORTING_ANNOTATION_NAMES = new ArrayIterable<String>(ECLIPSE_LINK2_2_SUPPORTING_ANNOTATION_NAMES_ARRAY); - - @SuppressWarnings("unchecked") - private static final Iterable<String> COMBINED_SUPPORTING_ANNOTATION_NAMES = new CompositeIterable<String>( - DELEGATE.getSupportingAnnotationNames(), - ECLIPSE_LINK2_2_SUPPORTING_ANNOTATION_NAMES - ); -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/java/EclipseLinkJavaMappedSuperclassDefinition2_3.java b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/java/EclipseLinkJavaMappedSuperclassDefinition2_3.java deleted file mode 100644 index 18c3788321..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/java/EclipseLinkJavaMappedSuperclassDefinition2_3.java +++ /dev/null @@ -1,54 +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, 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.eclipselink.core.internal.context.java; - -import org.eclipse.jpt.common.utility.internal.iterables.CompositeIterable; -import org.eclipse.jpt.jpa.core.context.java.JavaTypeMappingDefinition; -import org.eclipse.jpt.jpa.core.internal.context.java.JavaTypeMappingDefinitionWrapper; - -public class EclipseLinkJavaMappedSuperclassDefinition2_3 - extends JavaTypeMappingDefinitionWrapper -{ - private static final JavaTypeMappingDefinition DELEGATE = EclipseLinkJavaMappedSuperclassDefinition2_2.instance(); - - // singleton - private static final JavaTypeMappingDefinition INSTANCE = new EclipseLinkJavaMappedSuperclassDefinition2_3(); - - /** - * Return the singleton. - */ - public static JavaTypeMappingDefinition instance() { - return INSTANCE; - } - - - /** - * Enforce singleton usage - */ - private EclipseLinkJavaMappedSuperclassDefinition2_3() { - super(); - } - - @Override - protected JavaTypeMappingDefinition getDelegate() { - return DELEGATE; - } - - @Override - public Iterable<String> getSupportingAnnotationNames() { - return COMBINED_SUPPORTING_ANNOTATION_NAMES; - } - - @SuppressWarnings("unchecked") - private static final Iterable<String> COMBINED_SUPPORTING_ANNOTATION_NAMES = new CompositeIterable<String>( - DELEGATE.getSupportingAnnotationNames(), - EclipseLinkJavaEntityDefinition2_3.ECLIPSE_LINK2_3_SUPPORTING_ANNOTATION_NAMES - ); -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/java/EclipseLinkJavaOneToManyMappingDefinition.java b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/java/EclipseLinkJavaOneToManyMappingDefinition.java deleted file mode 100644 index 420ed0e417..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/java/EclipseLinkJavaOneToManyMappingDefinition.java +++ /dev/null @@ -1,81 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2008, 2011 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.eclipselink.core.internal.context.java; - -import org.eclipse.jpt.common.utility.internal.iterables.ArrayIterable; -import org.eclipse.jpt.common.utility.internal.iterables.CompositeIterable; -import org.eclipse.jpt.jpa.core.context.java.DefaultJavaAttributeMappingDefinition; -import org.eclipse.jpt.jpa.core.context.java.JavaAttributeMappingDefinition; -import org.eclipse.jpt.jpa.core.context.java.JavaPersistentAttribute; -import org.eclipse.jpt.jpa.core.internal.context.java.JavaAttributeMappingDefinitionWrapper; -import org.eclipse.jpt.jpa.core.internal.context.java.JavaOneToManyMappingDefinition; -import org.eclipse.jpt.jpa.eclipselink.core.resource.java.EclipseLinkConverterAnnotation; -import org.eclipse.jpt.jpa.eclipselink.core.resource.java.EclipseLinkJoinFetchAnnotation; -import org.eclipse.jpt.jpa.eclipselink.core.resource.java.EclipseLinkObjectTypeConverterAnnotation; -import org.eclipse.jpt.jpa.eclipselink.core.resource.java.EclipseLinkPrivateOwnedAnnotation; -import org.eclipse.jpt.jpa.eclipselink.core.resource.java.EclipseLinkStructConverterAnnotation; -import org.eclipse.jpt.jpa.eclipselink.core.resource.java.EclipseLinkTypeConverterAnnotation; - -public class EclipseLinkJavaOneToManyMappingDefinition - extends JavaAttributeMappingDefinitionWrapper - implements DefaultJavaAttributeMappingDefinition -{ - private static final JavaAttributeMappingDefinition DELEGATE = JavaOneToManyMappingDefinition.instance(); - - // singleton - private static final DefaultJavaAttributeMappingDefinition INSTANCE = new EclipseLinkJavaOneToManyMappingDefinition(); - - /** - * Return the singleton. - */ - public static DefaultJavaAttributeMappingDefinition instance() { - return INSTANCE; - } - - - /** - * Enforce singleton usage - */ - private EclipseLinkJavaOneToManyMappingDefinition() { - super(); - } - - @Override - protected JavaAttributeMappingDefinition getDelegate() { - return DELEGATE; - } - - @Override - public Iterable<String> getSupportingAnnotationNames() { - return COMBINED_SUPPORTING_ANNOTATION_NAMES; - } - - private static final String[] ECLIPSE_LINK_SUPPORTING_ANNOTATION_NAMES_ARRAY = new String[] { - EclipseLinkConverterAnnotation.ANNOTATION_NAME, - EclipseLinkJoinFetchAnnotation.ANNOTATION_NAME, - EclipseLinkObjectTypeConverterAnnotation.ANNOTATION_NAME, - EclipseLinkPrivateOwnedAnnotation.ANNOTATION_NAME, - EclipseLinkStructConverterAnnotation.ANNOTATION_NAME, - EclipseLinkTypeConverterAnnotation.ANNOTATION_NAME, - }; - public static final Iterable<String> ECLIPSE_LINK_SUPPORTING_ANNOTATION_NAMES = new ArrayIterable<String>(ECLIPSE_LINK_SUPPORTING_ANNOTATION_NAMES_ARRAY); - - @SuppressWarnings("unchecked") - private static final Iterable<String> COMBINED_SUPPORTING_ANNOTATION_NAMES = new CompositeIterable<String>( - DELEGATE.getSupportingAnnotationNames(), - ECLIPSE_LINK_SUPPORTING_ANNOTATION_NAMES - ); - - public boolean isDefault(JavaPersistentAttribute persistentAttribute) { - String targetEntity = persistentAttribute.getMultiReferenceTargetTypeName(); - return (targetEntity != null) - && (persistentAttribute.getPersistenceUnit().getEntity(targetEntity) != null); - } -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/java/EclipseLinkJavaOneToManyMappingDefinition2_0.java b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/java/EclipseLinkJavaOneToManyMappingDefinition2_0.java deleted file mode 100644 index ebae8afb9b..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/java/EclipseLinkJavaOneToManyMappingDefinition2_0.java +++ /dev/null @@ -1,62 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010, 2011 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.eclipselink.core.internal.context.java; - -import org.eclipse.jpt.common.utility.internal.iterables.CompositeIterable; -import org.eclipse.jpt.jpa.core.context.java.DefaultJavaAttributeMappingDefinition; -import org.eclipse.jpt.jpa.core.context.java.JavaAttributeMappingDefinition; -import org.eclipse.jpt.jpa.core.context.java.JavaPersistentAttribute; -import org.eclipse.jpt.jpa.core.internal.context.java.JavaAttributeMappingDefinitionWrapper; -import org.eclipse.jpt.jpa.core.internal.jpa2.context.java.JavaOneToManyMappingDefinition2_0; - -public class EclipseLinkJavaOneToManyMappingDefinition2_0 - extends JavaAttributeMappingDefinitionWrapper - implements DefaultJavaAttributeMappingDefinition -{ - private static final JavaAttributeMappingDefinition DELEGATE = JavaOneToManyMappingDefinition2_0.instance(); - - // singleton - private static final DefaultJavaAttributeMappingDefinition INSTANCE = new EclipseLinkJavaOneToManyMappingDefinition2_0(); - - /** - * Return the singleton. - */ - public static DefaultJavaAttributeMappingDefinition instance() { - return INSTANCE; - } - - - /** - * Enforce singleton usage - */ - private EclipseLinkJavaOneToManyMappingDefinition2_0() { - super(); - } - - @Override - protected JavaAttributeMappingDefinition getDelegate() { - return DELEGATE; - } - - @Override - public Iterable<String> getSupportingAnnotationNames() { - return COMBINED_SUPPORTING_ANNOTATION_NAMES; - } - - @SuppressWarnings("unchecked") - private static final Iterable<String> COMBINED_SUPPORTING_ANNOTATION_NAMES = new CompositeIterable<String>( - DELEGATE.getSupportingAnnotationNames(), - EclipseLinkJavaOneToManyMappingDefinition.ECLIPSE_LINK_SUPPORTING_ANNOTATION_NAMES - ); - - public boolean isDefault(JavaPersistentAttribute persistentAttribute) { - return EclipseLinkJavaOneToManyMappingDefinition.instance().isDefault(persistentAttribute); - } -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/java/EclipseLinkJavaOneToManyMappingDefinition2_2.java b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/java/EclipseLinkJavaOneToManyMappingDefinition2_2.java deleted file mode 100644 index b3c989bdcc..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/java/EclipseLinkJavaOneToManyMappingDefinition2_2.java +++ /dev/null @@ -1,55 +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, 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.eclipselink.core.internal.context.java; - -import org.eclipse.jpt.common.utility.internal.iterables.CompositeIterable; -import org.eclipse.jpt.jpa.core.context.java.DefaultJavaAttributeMappingDefinition; -import org.eclipse.jpt.jpa.core.internal.context.java.DefaultJavaAttributeMappingDefinitionWrapper; - -public class EclipseLinkJavaOneToManyMappingDefinition2_2 - extends DefaultJavaAttributeMappingDefinitionWrapper - implements DefaultJavaAttributeMappingDefinition -{ - private static final DefaultJavaAttributeMappingDefinition DELEGATE = EclipseLinkJavaOneToManyMappingDefinition2_0.instance(); - - // singleton - private static final DefaultJavaAttributeMappingDefinition INSTANCE = new EclipseLinkJavaOneToManyMappingDefinition2_2(); - - /** - * Return the singleton. - */ - public static DefaultJavaAttributeMappingDefinition instance() { - return INSTANCE; - } - - - /** - * Enforce singleton usage - */ - private EclipseLinkJavaOneToManyMappingDefinition2_2() { - super(); - } - - @Override - protected DefaultJavaAttributeMappingDefinition getDelegate() { - return DELEGATE; - } - - @Override - public Iterable<String> getSupportingAnnotationNames() { - return COMBINED_SUPPORTING_ANNOTATION_NAMES; - } - - @SuppressWarnings("unchecked") - private static final Iterable<String> COMBINED_SUPPORTING_ANNOTATION_NAMES = new CompositeIterable<String>( - DELEGATE.getSupportingAnnotationNames(), - EclipseLinkJavaBasicMappingDefinition2_2.ECLIPSE_LINK2_2_SUPPORTING_ANNOTATION_NAMES - ); -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/java/EclipseLinkJavaOneToManyRelationship.java b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/java/EclipseLinkJavaOneToManyRelationship.java deleted file mode 100644 index 1da55872e5..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/java/EclipseLinkJavaOneToManyRelationship.java +++ /dev/null @@ -1,28 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010, 2011 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.eclipselink.core.internal.context.java; - -import org.eclipse.jpt.jpa.core.context.java.JavaOneToManyMapping; -import org.eclipse.jpt.jpa.core.internal.context.java.GenericJavaOneToManyRelationship; -import org.eclipse.jpt.jpa.eclipselink.core.context.java.EclipseLinkJavaOneToManyRelationship2_0; - -/** - * We need this class because the EclipseLink 1.0 1:m mapping supports a join - * column strategy while JPA did not until JPA 2.0. As a result, we need a class - * that implements EclipseLink 1.0. - */ -public class EclipseLinkJavaOneToManyRelationship - extends GenericJavaOneToManyRelationship - implements EclipseLinkJavaOneToManyRelationship2_0 -{ - public EclipseLinkJavaOneToManyRelationship(JavaOneToManyMapping parent) { - super(parent, true); // true=supports join column strategy - } -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/java/EclipseLinkJavaOneToOneMappingDefinition.java b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/java/EclipseLinkJavaOneToOneMappingDefinition.java deleted file mode 100644 index f98b13b3d5..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/java/EclipseLinkJavaOneToOneMappingDefinition.java +++ /dev/null @@ -1,81 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2008, 2011 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.eclipselink.core.internal.context.java; - -import org.eclipse.jpt.common.utility.internal.iterables.ArrayIterable; -import org.eclipse.jpt.common.utility.internal.iterables.CompositeIterable; -import org.eclipse.jpt.jpa.core.context.java.DefaultJavaAttributeMappingDefinition; -import org.eclipse.jpt.jpa.core.context.java.JavaAttributeMappingDefinition; -import org.eclipse.jpt.jpa.core.context.java.JavaPersistentAttribute; -import org.eclipse.jpt.jpa.core.internal.context.java.JavaAttributeMappingDefinitionWrapper; -import org.eclipse.jpt.jpa.core.internal.context.java.JavaOneToOneMappingDefinition; -import org.eclipse.jpt.jpa.eclipselink.core.resource.java.EclipseLinkConverterAnnotation; -import org.eclipse.jpt.jpa.eclipselink.core.resource.java.EclipseLinkJoinFetchAnnotation; -import org.eclipse.jpt.jpa.eclipselink.core.resource.java.EclipseLinkObjectTypeConverterAnnotation; -import org.eclipse.jpt.jpa.eclipselink.core.resource.java.EclipseLinkPrivateOwnedAnnotation; -import org.eclipse.jpt.jpa.eclipselink.core.resource.java.EclipseLinkStructConverterAnnotation; -import org.eclipse.jpt.jpa.eclipselink.core.resource.java.EclipseLinkTypeConverterAnnotation; - -public class EclipseLinkJavaOneToOneMappingDefinition - extends JavaAttributeMappingDefinitionWrapper - implements DefaultJavaAttributeMappingDefinition -{ - private static final JavaAttributeMappingDefinition DELEGATE = JavaOneToOneMappingDefinition.instance(); - - // singleton - private static final DefaultJavaAttributeMappingDefinition INSTANCE = new EclipseLinkJavaOneToOneMappingDefinition(); - - /** - * Return the singleton. - */ - public static DefaultJavaAttributeMappingDefinition instance() { - return INSTANCE; - } - - - /** - * Enforce singleton usage - */ - private EclipseLinkJavaOneToOneMappingDefinition() { - super(); - } - - @Override - protected JavaAttributeMappingDefinition getDelegate() { - return DELEGATE; - } - - @Override - public Iterable<String> getSupportingAnnotationNames() { - return COMBINED_SUPPORTING_ANNOTATION_NAMES; - } - - private static final String[] ECLIPSE_LINK_SUPPORTING_ANNOTATION_NAMES_ARRAY = new String[] { - EclipseLinkConverterAnnotation.ANNOTATION_NAME, - EclipseLinkJoinFetchAnnotation.ANNOTATION_NAME, - EclipseLinkObjectTypeConverterAnnotation.ANNOTATION_NAME, - EclipseLinkPrivateOwnedAnnotation.ANNOTATION_NAME, - EclipseLinkStructConverterAnnotation.ANNOTATION_NAME, - EclipseLinkTypeConverterAnnotation.ANNOTATION_NAME, - }; - public static final Iterable<String> ECLIPSE_LINK_SUPPORTING_ANNOTATION_NAMES = new ArrayIterable<String>(ECLIPSE_LINK_SUPPORTING_ANNOTATION_NAMES_ARRAY); - - @SuppressWarnings("unchecked") - private static final Iterable<String> COMBINED_SUPPORTING_ANNOTATION_NAMES = new CompositeIterable<String>( - DELEGATE.getSupportingAnnotationNames(), - ECLIPSE_LINK_SUPPORTING_ANNOTATION_NAMES - ); - - public boolean isDefault(JavaPersistentAttribute persistentAttribute) { - String targetEntity = persistentAttribute.getSingleReferenceTargetTypeName(); - return (targetEntity != null) - && (persistentAttribute.getPersistenceUnit().getEntity(targetEntity) != null); - } -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/java/EclipseLinkJavaOneToOneMappingDefinition2_0.java b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/java/EclipseLinkJavaOneToOneMappingDefinition2_0.java deleted file mode 100644 index 5782117eb9..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/java/EclipseLinkJavaOneToOneMappingDefinition2_0.java +++ /dev/null @@ -1,62 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010, 2011 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.eclipselink.core.internal.context.java; - -import org.eclipse.jpt.common.utility.internal.iterables.CompositeIterable; -import org.eclipse.jpt.jpa.core.context.java.DefaultJavaAttributeMappingDefinition; -import org.eclipse.jpt.jpa.core.context.java.JavaAttributeMappingDefinition; -import org.eclipse.jpt.jpa.core.context.java.JavaPersistentAttribute; -import org.eclipse.jpt.jpa.core.internal.context.java.JavaAttributeMappingDefinitionWrapper; -import org.eclipse.jpt.jpa.core.internal.jpa2.context.java.JavaOneToOneMappingDefinition2_0; - -public class EclipseLinkJavaOneToOneMappingDefinition2_0 - extends JavaAttributeMappingDefinitionWrapper - implements DefaultJavaAttributeMappingDefinition -{ - private static final JavaAttributeMappingDefinition DELEGATE = JavaOneToOneMappingDefinition2_0.instance(); - - // singleton - private static final DefaultJavaAttributeMappingDefinition INSTANCE = new EclipseLinkJavaOneToOneMappingDefinition2_0(); - - /** - * Return the singleton. - */ - public static DefaultJavaAttributeMappingDefinition instance() { - return INSTANCE; - } - - - /** - * Enforce singleton usage - */ - private EclipseLinkJavaOneToOneMappingDefinition2_0() { - super(); - } - - @Override - protected JavaAttributeMappingDefinition getDelegate() { - return DELEGATE; - } - - @Override - public Iterable<String> getSupportingAnnotationNames() { - return COMBINED_SUPPORTING_ANNOTATION_NAMES; - } - - @SuppressWarnings("unchecked") - private static final Iterable<String> COMBINED_SUPPORTING_ANNOTATION_NAMES = new CompositeIterable<String>( - DELEGATE.getSupportingAnnotationNames(), - EclipseLinkJavaOneToOneMappingDefinition.ECLIPSE_LINK_SUPPORTING_ANNOTATION_NAMES - ); - - public boolean isDefault(JavaPersistentAttribute persistentAttribute) { - return EclipseLinkJavaOneToOneMappingDefinition.instance().isDefault(persistentAttribute); - } -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/java/EclipseLinkJavaOneToOneMappingDefinition2_2.java b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/java/EclipseLinkJavaOneToOneMappingDefinition2_2.java deleted file mode 100644 index 5a467be72f..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/java/EclipseLinkJavaOneToOneMappingDefinition2_2.java +++ /dev/null @@ -1,55 +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, 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.eclipselink.core.internal.context.java; - -import org.eclipse.jpt.common.utility.internal.iterables.CompositeIterable; -import org.eclipse.jpt.jpa.core.context.java.DefaultJavaAttributeMappingDefinition; -import org.eclipse.jpt.jpa.core.internal.context.java.DefaultJavaAttributeMappingDefinitionWrapper; - -public class EclipseLinkJavaOneToOneMappingDefinition2_2 - extends DefaultJavaAttributeMappingDefinitionWrapper -{ - private static final DefaultJavaAttributeMappingDefinition DELEGATE = EclipseLinkJavaOneToOneMappingDefinition2_0.instance(); - - // singleton - private static final DefaultJavaAttributeMappingDefinition INSTANCE = new EclipseLinkJavaOneToOneMappingDefinition2_2(); - - /** - * Return the singleton. - */ - public static DefaultJavaAttributeMappingDefinition instance() { - return INSTANCE; - } - - - /** - * Enforce singleton usage - */ - private EclipseLinkJavaOneToOneMappingDefinition2_2() { - super(); - } - - @Override - protected DefaultJavaAttributeMappingDefinition getDelegate() { - return DELEGATE; - } - - @Override - public Iterable<String> getSupportingAnnotationNames() { - return COMBINED_SUPPORTING_ANNOTATION_NAMES; - } - - @SuppressWarnings("unchecked") - private static final Iterable<String> COMBINED_SUPPORTING_ANNOTATION_NAMES = new CompositeIterable<String>( - DELEGATE.getSupportingAnnotationNames(), - EclipseLinkJavaBasicMappingDefinition2_2.ECLIPSE_LINK2_2_SUPPORTING_ANNOTATION_NAMES - ); - -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/java/EclipseLinkJavaStructureMappingDefinition2_3.java b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/java/EclipseLinkJavaStructureMappingDefinition2_3.java deleted file mode 100644 index 1ed2035920..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/java/EclipseLinkJavaStructureMappingDefinition2_3.java +++ /dev/null @@ -1,65 +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, 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.eclipselink.core.internal.context.java; - -import org.eclipse.jpt.common.utility.internal.iterables.EmptyIterable; -import org.eclipse.jpt.jpa.core.JpaFactory; -import org.eclipse.jpt.jpa.core.context.java.JavaAttributeMapping; -import org.eclipse.jpt.jpa.core.context.java.JavaAttributeMappingDefinition; -import org.eclipse.jpt.jpa.core.context.java.JavaPersistentAttribute; -import org.eclipse.jpt.jpa.eclipselink.core.EclipseLinkMappingKeys; -import org.eclipse.jpt.jpa.eclipselink.core.resource.java.EclipseLinkStructureAnnotation2_3; - -public class EclipseLinkJavaStructureMappingDefinition2_3 - implements JavaAttributeMappingDefinition -{ - // singleton - private static final JavaAttributeMappingDefinition INSTANCE = new EclipseLinkJavaStructureMappingDefinition2_3(); - - /** - * Return the singleton. - */ - public static JavaAttributeMappingDefinition instance() { - return INSTANCE; - } - - - /** - * Enforce singleton usage - */ - private EclipseLinkJavaStructureMappingDefinition2_3() { - super(); - } - - public String getKey() { - return EclipseLinkMappingKeys.STRUCTURE_ATTRIBUTE_MAPPING_KEY; - } - - public String getAnnotationName() { - return EclipseLinkStructureAnnotation2_3.ANNOTATION_NAME; - } - - public boolean isSpecified(JavaPersistentAttribute persistentAttribute) { - return persistentAttribute.getResourceAttribute().getAnnotation(this.getAnnotationName()) != null; - } - - public Iterable<String> getSupportingAnnotationNames() { - return EmptyIterable.instance(); - } - - public JavaAttributeMapping buildMapping(JavaPersistentAttribute persistentAttribute, JpaFactory factory) { - return new JavaEclipseLinkStructureMapping2_3(persistentAttribute); - } - - @Override - public String toString() { - return this.getClass().getSimpleName(); - } -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/java/EclipseLinkJavaTenantDiscriminatorColumn2_3.java b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/java/EclipseLinkJavaTenantDiscriminatorColumn2_3.java deleted file mode 100644 index 4d558ee500..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/java/EclipseLinkJavaTenantDiscriminatorColumn2_3.java +++ /dev/null @@ -1,281 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2011, 2012 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.eclipselink.core.internal.context.java; - -import org.eclipse.jdt.core.dom.CompilationUnit; -import org.eclipse.jpt.common.core.resource.java.JavaResourceType; -import org.eclipse.jpt.common.core.utility.TextRange; -import org.eclipse.jpt.common.utility.Filter; -import org.eclipse.jpt.common.utility.internal.StringTools; -import org.eclipse.jpt.common.utility.internal.iterables.FilteringIterable; -import org.eclipse.jpt.jpa.core.context.java.JavaJpaContextNode; -import org.eclipse.jpt.jpa.core.internal.context.NamedColumnTextRangeResolver; -import org.eclipse.jpt.jpa.core.internal.context.java.AbstractJavaNamedColumn; -import org.eclipse.jpt.jpa.core.internal.context.java.JavaTableColumnTextRangeResolver; -import org.eclipse.jpt.jpa.core.internal.jpa1.context.java.AbstractJavaNamedDiscriminatorColumn; -import org.eclipse.jpt.jpa.eclipselink.core.context.java.JavaReadOnlyTenantDiscriminatorColumn2_3; -import org.eclipse.jpt.jpa.eclipselink.core.context.java.JavaTenantDiscriminatorColumn2_3; -import org.eclipse.jpt.jpa.eclipselink.core.resource.java.EclipseLinkTenantDiscriminatorColumnAnnotation2_3; - -/** - * Java tenant discriminator column - */ -public class EclipseLinkJavaTenantDiscriminatorColumn2_3 - extends AbstractJavaNamedDiscriminatorColumn<EclipseLinkTenantDiscriminatorColumnAnnotation2_3, JavaReadOnlyTenantDiscriminatorColumn2_3.Owner> - implements JavaTenantDiscriminatorColumn2_3 -{ - /** @see AbstractJavaNamedColumn#AbstractJavaNamedColumn(JavaJpaContextNode, org.eclipse.jpt.jpa.core.context.java.JavaReadOnlyNamedColumn.Owner, org.eclipse.jpt.jpa.core.resource.java.NamedColumnAnnotation) */ - protected /* final */ EclipseLinkTenantDiscriminatorColumnAnnotation2_3 columnAnnotation; // never null - - protected String specifiedTable; - protected String defaultTable; - - protected String specifiedContextProperty; - protected String defaultContextProperty; - - protected Boolean specifiedPrimaryKey; - protected boolean defaultPrimaryKey = DEFAULT_PRIMARY_KEY; - - public EclipseLinkJavaTenantDiscriminatorColumn2_3(JavaEclipseLinkMultitenancyImpl2_3 parent, JavaReadOnlyTenantDiscriminatorColumn2_3.Owner owner, EclipseLinkTenantDiscriminatorColumnAnnotation2_3 columnAnnotation) { - super(parent, owner, columnAnnotation); - this.specifiedTable = this.buildSpecifiedTable(); - this.specifiedContextProperty = this.buildSpecifiedContextProperty(); - this.specifiedPrimaryKey = this.buildSpecifiedPrimaryKey(); - } - - - // ********** synchronize/update ********** - - @Override - public void synchronizeWithResourceModel() { - super.synchronizeWithResourceModel(); - this.setSpecifiedTable_(this.buildSpecifiedTable()); - this.setSpecifiedContextProperty_(this.buildSpecifiedContextProperty()); - this.setSpecifiedPrimaryKey_(this.buildSpecifiedPrimaryKey()); - } - - @Override - public void update() { - super.update(); - this.setDefaultTable(this.buildDefaultTable()); - this.setDefaultContextProperty(this.buildDefaultContextProperty()); - this.setDefaultPrimaryKey(this.buildDefaultPrimaryKey()); - } - - // ********** column annotation ********** - - @Override - public EclipseLinkTenantDiscriminatorColumnAnnotation2_3 getColumnAnnotation() { - return this.columnAnnotation; - } - - @Override - protected void setColumnAnnotation(EclipseLinkTenantDiscriminatorColumnAnnotation2_3 columnAnnotation) { - this.columnAnnotation = columnAnnotation; - } - - @Override - protected void removeColumnAnnotation() { - // we don't remove a tenant discriminator column annotation when it is empty - } - - - // ********** table ********** - - @Override - public String getTable() { - return (this.specifiedTable != null) ? this.specifiedTable : this.defaultTable; - } - - public String getSpecifiedTable() { - return this.specifiedTable; - } - - public void setSpecifiedTable(String table) { - if (this.valuesAreDifferent(this.specifiedTable, table)) { - this.getColumnAnnotation().setTable(table); - this.removeColumnAnnotationIfUnset(); - this.setSpecifiedTable_(table); - } - } - - protected void setSpecifiedTable_(String table) { - String old = this.specifiedTable; - this.specifiedTable = table; - this.firePropertyChanged(SPECIFIED_TABLE_PROPERTY, old, table); - } - - protected String buildSpecifiedTable() { - return this.getColumnAnnotation().getTable(); - } - - public String getDefaultTable() { - return this.defaultTable; - } - - protected void setDefaultTable(String table) { - String old = this.defaultTable; - this.defaultTable = table; - this.firePropertyChanged(DEFAULT_TABLE_PROPERTY, old, table); - } - - protected String buildDefaultTable() { - return this.owner.getDefaultTableName(); - } - - public TextRange getTableTextRange(CompilationUnit astRoot) { - return this.getValidationTextRange(this.getColumnAnnotation().getTableTextRange(), astRoot); - } - - - // ********** contextProperty ********** - - public String getContextProperty() { - return (this.specifiedContextProperty != null) ? this.specifiedContextProperty : this.defaultContextProperty; - } - - public String getSpecifiedContextProperty() { - return this.specifiedContextProperty; - } - - public void setSpecifiedContextProperty(String contextProperty) { - if (this.valuesAreDifferent(this.specifiedContextProperty, contextProperty)) { - this.getColumnAnnotation().setContextProperty(contextProperty); - this.removeColumnAnnotationIfUnset(); - this.setSpecifiedContextProperty_(contextProperty); - } - } - - protected void setSpecifiedContextProperty_(String contextProperty) { - String old = this.specifiedContextProperty; - this.specifiedContextProperty = contextProperty; - this.firePropertyChanged(SPECIFIED_CONTEXT_PROPERTY_PROPERTY, old, contextProperty); - } - - protected String buildSpecifiedContextProperty() { - return this.getColumnAnnotation().getContextProperty(); - } - - public String getDefaultContextProperty() { - return this.defaultContextProperty; - } - - protected void setDefaultContextProperty(String contextProperty) { - String old = this.defaultContextProperty; - this.defaultContextProperty = contextProperty; - this.firePropertyChanged(DEFAULT_CONTEXT_PROPERTY_PROPERTY, old, contextProperty); - } - - protected String buildDefaultContextProperty() { - return this.owner.getDefaultContextPropertyName(); - } - - public TextRange getContextPropertyTextRange(CompilationUnit astRoot) { - return this.getValidationTextRange(this.getColumnAnnotation().getContextPropertyTextRange(), astRoot); - } - - - // ********** primaryKey ********** - - public boolean isPrimaryKey() { - return (this.specifiedPrimaryKey != null) ? this.specifiedPrimaryKey.booleanValue() : this.isDefaultPrimaryKey(); - } - - public Boolean getSpecifiedPrimaryKey() { - return this.specifiedPrimaryKey; - } - - public void setSpecifiedPrimaryKey(Boolean primaryKey) { - if (this.valuesAreDifferent(this.specifiedPrimaryKey, primaryKey)) { - this.getColumnAnnotation().setPrimaryKey(primaryKey); - this.removeColumnAnnotationIfUnset(); - this.setSpecifiedPrimaryKey_(primaryKey); - } - } - - protected void setSpecifiedPrimaryKey_(Boolean primaryKey) { - Boolean old = this.specifiedPrimaryKey; - this.specifiedPrimaryKey = primaryKey; - this.firePropertyChanged(SPECIFIED_PRIMARY_KEY_PROPERTY, old, primaryKey); - } - - protected Boolean buildSpecifiedPrimaryKey() { - return this.getColumnAnnotation().getPrimaryKey(); - } - - public boolean isDefaultPrimaryKey() { - return this.defaultPrimaryKey; - } - - protected void setDefaultPrimaryKey(boolean primaryKey) { - boolean old = this.defaultPrimaryKey; - this.defaultPrimaryKey = primaryKey; - this.firePropertyChanged(DEFAULT_PRIMARY_KEY_PROPERTY, old, primaryKey); - } - - protected boolean buildDefaultPrimaryKey() { - return DEFAULT_PRIMARY_KEY; - } - - - // ********** misc ********** - - @Override - public JavaEclipseLinkMultitenancyImpl2_3 getParent() { - return (JavaEclipseLinkMultitenancyImpl2_3) super.getParent(); - } - - protected JavaResourceType getJavaResourceType() { - return this.getParent().getJavaResourceType(); - } - - - // ********** Java completion proposals ********** - - @Override - public Iterable<String> getJavaCompletionProposals(int pos, Filter<String> filter, CompilationUnit astRoot) { - Iterable<String> result = super.getJavaCompletionProposals(pos, filter, astRoot); - if (result != null) { - return result; - } - if (this.tableTouches(pos)) { - return this.getJavaCandidateTableNames(filter); - } - return null; - } - - protected boolean tableTouches(int pos) { - return this.getColumnAnnotation().tableTouches(pos); - } - - protected Iterable<String> getJavaCandidateTableNames(Filter<String> filter) { - return StringTools.convertToJavaStringLiterals(this.getCandidateTableNames(filter)); - } - - protected Iterable<String> getCandidateTableNames(Filter<String> filter) { - return new FilteringIterable<String>(this.getCandidateTableNames(), filter); - } - - public Iterable<String> getCandidateTableNames() { - return this.owner.getCandidateTableNames(); - } - - - // ********** validation ********** - - public boolean tableNameIsInvalid() { - return this.owner.tableNameIsInvalid(this.getTable()); - } - - @Override - protected NamedColumnTextRangeResolver buildTextRangeResolver(CompilationUnit astRoot) { - return new JavaTableColumnTextRangeResolver(this, astRoot); - } -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/java/EclipseLinkJavaTimeOfDay.java b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/java/EclipseLinkJavaTimeOfDay.java deleted file mode 100644 index d04f0dc00b..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/java/EclipseLinkJavaTimeOfDay.java +++ /dev/null @@ -1,147 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2008, 2011 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.eclipselink.core.internal.context.java; - -import org.eclipse.jdt.core.dom.CompilationUnit; -import org.eclipse.jpt.common.core.utility.TextRange; -import org.eclipse.jpt.jpa.core.internal.context.java.AbstractJavaJpaContextNode; -import org.eclipse.jpt.jpa.eclipselink.core.context.EclipseLinkTimeOfDay; -import org.eclipse.jpt.jpa.eclipselink.core.context.java.JavaEclipseLinkCaching; -import org.eclipse.jpt.jpa.eclipselink.core.resource.java.EclipseLinkTimeOfDayAnnotation; - -public class EclipseLinkJavaTimeOfDay - extends AbstractJavaJpaContextNode - implements EclipseLinkTimeOfDay -{ - protected final EclipseLinkTimeOfDayAnnotation todAnnotation; - - protected Integer hour; - protected Integer minute; - protected Integer second; - protected Integer millisecond; - - - public EclipseLinkJavaTimeOfDay(JavaEclipseLinkCaching parent, EclipseLinkTimeOfDayAnnotation todAnnotation) { - super(parent); - this.todAnnotation = todAnnotation; - this.hour = todAnnotation.getHour(); - this.minute = todAnnotation.getMinute(); - this.second = todAnnotation.getSecond(); - this.millisecond = todAnnotation.getMillisecond(); - } - - - // ********** synchronize/update ********** - - @Override - public void synchronizeWithResourceModel() { - super.synchronizeWithResourceModel(); - this.setHour_(this.todAnnotation.getHour()); - this.setMinute_(this.todAnnotation.getMinute()); - this.setSecond_(this.todAnnotation.getSecond()); - this.setMillisecond_(this.todAnnotation.getMillisecond()); - } - - - // ********** hour ********** - - public Integer getHour() { - return this.hour; - } - - public void setHour(Integer hour) { - this.todAnnotation.setHour(hour); - this.setHour_(hour); - } - - protected void setHour_(Integer hour) { - Integer old = this.hour; - this.hour = hour; - this.firePropertyChanged(HOUR_PROPERTY, old, hour); - } - - - // ********** minute ********** - - public Integer getMinute() { - return this.minute; - } - - public void setMinute(Integer minute) { - this.todAnnotation.setMinute(minute); - this.setMinute_(minute); - } - - protected void setMinute_(Integer minute) { - Integer old = this.minute; - this.minute = minute; - this.firePropertyChanged(MINUTE_PROPERTY, old, minute); - } - - - // ********** second ********** - - public Integer getSecond() { - return this.second; - } - - public void setSecond(Integer second) { - this.todAnnotation.setSecond(second); - this.setSecond_(second); - } - - protected void setSecond_(Integer second) { - Integer old = this.second; - this.second = second; - this.firePropertyChanged(SECOND_PROPERTY, old, second); - } - - - // ********** millisecond ********** - - public Integer getMillisecond() { - return this.millisecond; - } - - public void setMillisecond(Integer millisecond) { - this.todAnnotation.setMillisecond(millisecond); - this.setMillisecond_(millisecond); - } - - protected void setMillisecond_(Integer millisecond) { - Integer old = this.millisecond; - this.millisecond = millisecond; - this.firePropertyChanged(MILLISECOND_PROPERTY, old, millisecond); - } - - - // ********** misc ********** - - @Override - public JavaEclipseLinkCaching getParent() { - return (JavaEclipseLinkCaching) super.getParent(); - } - - public JavaEclipseLinkCaching getCaching() { - return this.getParent(); - } - - public EclipseLinkTimeOfDayAnnotation getTimeOfDayAnnotation() { - return this.todAnnotation; - } - - - // ********** validation ********** - - public TextRange getValidationTextRange(CompilationUnit astRoot) { - TextRange textRange = this.todAnnotation.getTextRange(astRoot); - return (textRange != null) ? textRange : this.getCaching().getValidationTextRange(astRoot); - } -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/java/EclipseLinkJavaTransformationMappingDefinition.java b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/java/EclipseLinkJavaTransformationMappingDefinition.java deleted file mode 100644 index 5319654deb..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/java/EclipseLinkJavaTransformationMappingDefinition.java +++ /dev/null @@ -1,66 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2008, 2011 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.eclipselink.core.internal.context.java; - -import org.eclipse.jpt.common.utility.internal.iterables.EmptyIterable; -import org.eclipse.jpt.jpa.core.JpaFactory; -import org.eclipse.jpt.jpa.core.context.java.JavaAttributeMapping; -import org.eclipse.jpt.jpa.core.context.java.JavaAttributeMappingDefinition; -import org.eclipse.jpt.jpa.core.context.java.JavaPersistentAttribute; -import org.eclipse.jpt.jpa.eclipselink.core.EclipseLinkMappingKeys; -import org.eclipse.jpt.jpa.eclipselink.core.internal.EclipseLinkJpaFactory; -import org.eclipse.jpt.jpa.eclipselink.core.resource.java.EclipseLinkTransformationAnnotation; - -public class EclipseLinkJavaTransformationMappingDefinition - implements JavaAttributeMappingDefinition -{ - // singleton - private static final JavaAttributeMappingDefinition INSTANCE = new EclipseLinkJavaTransformationMappingDefinition(); - - /** - * Return the singleton. - */ - public static JavaAttributeMappingDefinition instance() { - return INSTANCE; - } - - - /** - * Enforce singleton usage - */ - private EclipseLinkJavaTransformationMappingDefinition() { - super(); - } - - public String getKey() { - return EclipseLinkMappingKeys.TRANSFORMATION_ATTRIBUTE_MAPPING_KEY; - } - - public String getAnnotationName() { - return EclipseLinkTransformationAnnotation.ANNOTATION_NAME; - } - - public boolean isSpecified(JavaPersistentAttribute persistentAttribute) { - return persistentAttribute.getResourceAttribute().getAnnotation(this.getAnnotationName()) != null; - } - - public Iterable<String> getSupportingAnnotationNames() { - return EmptyIterable.instance(); - } - - public JavaAttributeMapping buildMapping(JavaPersistentAttribute persistentAttribute, JpaFactory factory) { - return ((EclipseLinkJpaFactory) factory).buildJavaEclipseLinkTransformationMapping(persistentAttribute); - } - - @Override - public String toString() { - return this.getClass().getSimpleName(); - } -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/java/EclipseLinkJavaTransformationMappingDefinition2_0.java b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/java/EclipseLinkJavaTransformationMappingDefinition2_0.java deleted file mode 100644 index 822c576a36..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/java/EclipseLinkJavaTransformationMappingDefinition2_0.java +++ /dev/null @@ -1,62 +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, 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.eclipselink.core.internal.context.java; - -import org.eclipse.jpt.common.utility.internal.iterables.ArrayIterable; -import org.eclipse.jpt.common.utility.internal.iterables.CompositeIterable; -import org.eclipse.jpt.jpa.core.context.java.JavaAttributeMappingDefinition; -import org.eclipse.jpt.jpa.core.internal.context.java.JavaAttributeMappingDefinitionWrapper; -import org.eclipse.jpt.jpa.core.jpa2.resource.java.Access2_0Annotation; - -public class EclipseLinkJavaTransformationMappingDefinition2_0 - extends JavaAttributeMappingDefinitionWrapper -{ - private static final JavaAttributeMappingDefinition DELEGATE = EclipseLinkJavaTransformationMappingDefinition.instance(); - - // singleton - private static final JavaAttributeMappingDefinition INSTANCE = new EclipseLinkJavaTransformationMappingDefinition2_0(); - - /** - * Return the singleton. - */ - public static JavaAttributeMappingDefinition instance() { - return INSTANCE; - } - - - /** - * Enforce singleton usage - */ - private EclipseLinkJavaTransformationMappingDefinition2_0() { - super(); - } - - @Override - protected JavaAttributeMappingDefinition getDelegate() { - return DELEGATE; - } - - @Override - public Iterable<String> getSupportingAnnotationNames() { - return COMBINED_SUPPORTING_ANNOTATION_NAMES; - } - - public static final String[] SUPPORTING_ANNOTATION_NAMES_ARRAY_2_0 = new String[] { - Access2_0Annotation.ANNOTATION_NAME, - }; - private static final Iterable<String> SUPPORTING_ANNOTATION_NAMES_2_0 = new ArrayIterable<String>(SUPPORTING_ANNOTATION_NAMES_ARRAY_2_0); - - @SuppressWarnings("unchecked") - private static final Iterable<String> COMBINED_SUPPORTING_ANNOTATION_NAMES = new CompositeIterable<String>( - DELEGATE.getSupportingAnnotationNames(), - SUPPORTING_ANNOTATION_NAMES_2_0 - ); - -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/java/EclipseLinkJavaVariableOneToOneMappingDefinition.java b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/java/EclipseLinkJavaVariableOneToOneMappingDefinition.java deleted file mode 100644 index 75bcf45dc8..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/java/EclipseLinkJavaVariableOneToOneMappingDefinition.java +++ /dev/null @@ -1,71 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2009, 2012 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.eclipselink.core.internal.context.java; - -import org.eclipse.jpt.common.utility.internal.iterables.EmptyIterable; -import org.eclipse.jpt.jpa.core.JpaFactory; -import org.eclipse.jpt.jpa.core.context.java.DefaultJavaAttributeMappingDefinition; -import org.eclipse.jpt.jpa.core.context.java.JavaAttributeMapping; -import org.eclipse.jpt.jpa.core.context.java.JavaPersistentAttribute; -import org.eclipse.jpt.jpa.eclipselink.core.EclipseLinkMappingKeys; -import org.eclipse.jpt.jpa.eclipselink.core.context.java.JavaEclipseLinkPersistentAttribute; -import org.eclipse.jpt.jpa.eclipselink.core.internal.EclipseLinkJpaFactory; -import org.eclipse.jpt.jpa.eclipselink.core.resource.java.EclipseLinkVariableOneToOneAnnotation; - -public class EclipseLinkJavaVariableOneToOneMappingDefinition - implements DefaultJavaAttributeMappingDefinition -{ - // singleton - private static final DefaultJavaAttributeMappingDefinition INSTANCE = new EclipseLinkJavaVariableOneToOneMappingDefinition(); - - /** - * Return the singleton. - */ - public static DefaultJavaAttributeMappingDefinition instance() { - return INSTANCE; - } - - - /** - * Enforce singleton usage - */ - private EclipseLinkJavaVariableOneToOneMappingDefinition() { - super(); - } - - public String getKey() { - return EclipseLinkMappingKeys.VARIABLE_ONE_TO_ONE_ATTRIBUTE_MAPPING_KEY; - } - - public String getAnnotationName() { - return EclipseLinkVariableOneToOneAnnotation.ANNOTATION_NAME; - } - - public boolean isSpecified(JavaPersistentAttribute persistentAttribute) { - return persistentAttribute.getResourceAttribute().getAnnotation(this.getAnnotationName()) != null; - } - - public Iterable<String> getSupportingAnnotationNames() { - return EmptyIterable.instance(); - } - - public JavaAttributeMapping buildMapping(JavaPersistentAttribute persistentAttribute, JpaFactory factory) { - return ((EclipseLinkJpaFactory) factory).buildJavaEclipseLinkVariableOneToOneMapping(persistentAttribute); - } - - public boolean isDefault(JavaPersistentAttribute persistentAttribute) { - return ((JavaEclipseLinkPersistentAttribute) persistentAttribute).typeIsValidForVariableOneToOne(); - } - - @Override - public String toString() { - return this.getClass().getSimpleName(); - } -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/java/EclipseLinkJavaVariableOneToOneMappingDefinition2_0.java b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/java/EclipseLinkJavaVariableOneToOneMappingDefinition2_0.java deleted file mode 100644 index f67c17b0de..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/java/EclipseLinkJavaVariableOneToOneMappingDefinition2_0.java +++ /dev/null @@ -1,62 +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, 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.eclipselink.core.internal.context.java; - -import org.eclipse.jpt.common.utility.internal.iterables.ArrayIterable; -import org.eclipse.jpt.common.utility.internal.iterables.CompositeIterable; -import org.eclipse.jpt.jpa.core.context.java.DefaultJavaAttributeMappingDefinition; -import org.eclipse.jpt.jpa.core.internal.context.java.DefaultJavaAttributeMappingDefinitionWrapper; -import org.eclipse.jpt.jpa.core.jpa2.resource.java.Access2_0Annotation; - -public class EclipseLinkJavaVariableOneToOneMappingDefinition2_0 - extends DefaultJavaAttributeMappingDefinitionWrapper -{ - private static final DefaultJavaAttributeMappingDefinition DELEGATE = EclipseLinkJavaVariableOneToOneMappingDefinition.instance(); - - // singleton - private static final DefaultJavaAttributeMappingDefinition INSTANCE = new EclipseLinkJavaVariableOneToOneMappingDefinition2_0(); - - /** - * Return the singleton. - */ - public static DefaultJavaAttributeMappingDefinition instance() { - return INSTANCE; - } - - - /** - * Enforce singleton usage - */ - private EclipseLinkJavaVariableOneToOneMappingDefinition2_0() { - super(); - } - - @Override - protected DefaultJavaAttributeMappingDefinition getDelegate() { - return DELEGATE; - } - - @Override - public Iterable<String> getSupportingAnnotationNames() { - return COMBINED_SUPPORTING_ANNOTATION_NAMES; - } - - public static final String[] SUPPORTING_ANNOTATION_NAMES_ARRAY_2_0 = new String[] { - Access2_0Annotation.ANNOTATION_NAME, - }; - private static final Iterable<String> SUPPORTING_ANNOTATION_NAMES_2_0 = new ArrayIterable<String>(SUPPORTING_ANNOTATION_NAMES_ARRAY_2_0); - - @SuppressWarnings("unchecked") - private static final Iterable<String> COMBINED_SUPPORTING_ANNOTATION_NAMES = new CompositeIterable<String>( - DELEGATE.getSupportingAnnotationNames(), - SUPPORTING_ANNOTATION_NAMES_2_0 - ); - -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/java/EclipseLinkJavaVersionMappingDefinition.java b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/java/EclipseLinkJavaVersionMappingDefinition.java deleted file mode 100644 index 71d233c1ec..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/java/EclipseLinkJavaVersionMappingDefinition.java +++ /dev/null @@ -1,55 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010, 2011 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.eclipselink.core.internal.context.java; - -import org.eclipse.jpt.common.utility.internal.iterables.CompositeIterable; -import org.eclipse.jpt.jpa.core.context.java.JavaAttributeMappingDefinition; -import org.eclipse.jpt.jpa.core.internal.context.java.JavaAttributeMappingDefinitionWrapper; -import org.eclipse.jpt.jpa.core.internal.context.java.JavaVersionMappingDefinition; - -public class EclipseLinkJavaVersionMappingDefinition - extends JavaAttributeMappingDefinitionWrapper -{ - private static final JavaAttributeMappingDefinition DELEGATE = JavaVersionMappingDefinition.instance(); - - // singleton - private static final JavaAttributeMappingDefinition INSTANCE = new EclipseLinkJavaVersionMappingDefinition(); - - /** - * Return the singleton. - */ - public static JavaAttributeMappingDefinition instance() { - return INSTANCE; - } - - - /** - * Enforce singleton usage - */ - private EclipseLinkJavaVersionMappingDefinition() { - super(); - } - - @Override - protected JavaAttributeMappingDefinition getDelegate() { - return DELEGATE; - } - - @Override - public Iterable<String> getSupportingAnnotationNames() { - return COMBINED_SUPPORTING_ANNOTATION_NAMES; - } - - @SuppressWarnings("unchecked") - private static final Iterable<String> COMBINED_SUPPORTING_ANNOTATION_NAMES = new CompositeIterable<String>( - DELEGATE.getSupportingAnnotationNames(), - EclipseLinkJavaBasicMappingDefinition.ECLIPSE_LINK_SUPPORTING_ANNOTATION_NAMES - ); -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/java/EclipseLinkJavaVersionMappingDefinition2_0.java b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/java/EclipseLinkJavaVersionMappingDefinition2_0.java deleted file mode 100644 index aafeb2e933..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/java/EclipseLinkJavaVersionMappingDefinition2_0.java +++ /dev/null @@ -1,55 +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, 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.eclipselink.core.internal.context.java; - -import org.eclipse.jpt.common.utility.internal.iterables.CompositeIterable; -import org.eclipse.jpt.jpa.core.context.java.JavaAttributeMappingDefinition; -import org.eclipse.jpt.jpa.core.internal.context.java.JavaAttributeMappingDefinitionWrapper; -import org.eclipse.jpt.jpa.core.internal.jpa2.context.java.JavaVersionMappingDefinition2_0; - -public class EclipseLinkJavaVersionMappingDefinition2_0 - extends JavaAttributeMappingDefinitionWrapper -{ - private static final JavaAttributeMappingDefinition DELEGATE = JavaVersionMappingDefinition2_0.instance(); - - // singleton - private static final JavaAttributeMappingDefinition INSTANCE = new EclipseLinkJavaVersionMappingDefinition2_0(); - - /** - * Return the singleton. - */ - public static JavaAttributeMappingDefinition instance() { - return INSTANCE; - } - - - /** - * Enforce singleton usage - */ - private EclipseLinkJavaVersionMappingDefinition2_0() { - super(); - } - - @Override - protected JavaAttributeMappingDefinition getDelegate() { - return DELEGATE; - } - - @Override - public Iterable<String> getSupportingAnnotationNames() { - return COMBINED_SUPPORTING_ANNOTATION_NAMES; - } - - @SuppressWarnings("unchecked") - private static final Iterable<String> COMBINED_SUPPORTING_ANNOTATION_NAMES = new CompositeIterable<String>( - DELEGATE.getSupportingAnnotationNames(), - EclipseLinkJavaBasicMappingDefinition.ECLIPSE_LINK_SUPPORTING_ANNOTATION_NAMES - ); -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/java/EclipseLinkJavaVersionMappingDefinition2_2.java b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/java/EclipseLinkJavaVersionMappingDefinition2_2.java deleted file mode 100644 index 63a10847c5..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/java/EclipseLinkJavaVersionMappingDefinition2_2.java +++ /dev/null @@ -1,54 +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, 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.eclipselink.core.internal.context.java; - -import org.eclipse.jpt.common.utility.internal.iterables.CompositeIterable; -import org.eclipse.jpt.jpa.core.context.java.JavaAttributeMappingDefinition; -import org.eclipse.jpt.jpa.core.internal.context.java.JavaAttributeMappingDefinitionWrapper; - -public class EclipseLinkJavaVersionMappingDefinition2_2 - extends JavaAttributeMappingDefinitionWrapper -{ - private static final JavaAttributeMappingDefinition DELEGATE = EclipseLinkJavaVersionMappingDefinition2_0.instance(); - - // singleton - private static final JavaAttributeMappingDefinition INSTANCE = new EclipseLinkJavaVersionMappingDefinition2_2(); - - /** - * Return the singleton. - */ - public static JavaAttributeMappingDefinition instance() { - return INSTANCE; - } - - - /** - * Enforce singleton usage - */ - private EclipseLinkJavaVersionMappingDefinition2_2() { - super(); - } - - @Override - protected JavaAttributeMappingDefinition getDelegate() { - return DELEGATE; - } - - @Override - public Iterable<String> getSupportingAnnotationNames() { - return COMBINED_SUPPORTING_ANNOTATION_NAMES; - } - - @SuppressWarnings("unchecked") - private static final Iterable<String> COMBINED_SUPPORTING_ANNOTATION_NAMES = new CompositeIterable<String>( - DELEGATE.getSupportingAnnotationNames(), - EclipseLinkJavaBasicMappingDefinition2_2.ECLIPSE_LINK2_2_SUPPORTING_ANNOTATION_NAMES - ); -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/java/EclipseLinkJavaVirtualTenantDiscriminatorColumn2_3.java b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/java/EclipseLinkJavaVirtualTenantDiscriminatorColumn2_3.java deleted file mode 100644 index cc66614cf4..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/java/EclipseLinkJavaVirtualTenantDiscriminatorColumn2_3.java +++ /dev/null @@ -1,197 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2011, 2012 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.eclipselink.core.internal.context.java; - -import org.eclipse.jdt.core.dom.CompilationUnit; -import org.eclipse.jpt.common.core.utility.TextRange; -import org.eclipse.jpt.jpa.core.context.java.JavaJpaContextNode; -import org.eclipse.jpt.jpa.core.internal.context.NamedColumnTextRangeResolver; -import org.eclipse.jpt.jpa.core.internal.context.java.AbstractJavaVirtualNamedDiscriminatorColumn; -import org.eclipse.jpt.jpa.core.internal.context.java.JavaTableColumnTextRangeResolver; -import org.eclipse.jpt.jpa.eclipselink.core.context.ReadOnlyTenantDiscriminatorColumn2_3; -import org.eclipse.jpt.jpa.eclipselink.core.context.java.JavaReadOnlyTenantDiscriminatorColumn2_3; -import org.eclipse.jpt.jpa.eclipselink.core.context.java.JavaVirtualTenantDiscriminatorColumn2_3; - -/** - * Java virtual tenant discriminator column - */ -public class EclipseLinkJavaVirtualTenantDiscriminatorColumn2_3 - extends AbstractJavaVirtualNamedDiscriminatorColumn<JavaReadOnlyTenantDiscriminatorColumn2_3.Owner, ReadOnlyTenantDiscriminatorColumn2_3> - implements JavaVirtualTenantDiscriminatorColumn2_3 -{ - protected final ReadOnlyTenantDiscriminatorColumn2_3 overriddenColumn; - - protected String specifiedTable; - protected String defaultTable; - - protected String specifiedContextProperty; - protected String defaultContextProperty; - - protected Boolean specifiedPrimaryKey; - protected boolean defaultPrimaryKey; - - - public EclipseLinkJavaVirtualTenantDiscriminatorColumn2_3(JavaJpaContextNode parent, JavaReadOnlyTenantDiscriminatorColumn2_3.Owner owner, ReadOnlyTenantDiscriminatorColumn2_3 overriddenColumn) { - super(parent, owner); - this.overriddenColumn = overriddenColumn; - } - - - // ********** synchronize/update ********** - - @Override - public void update() { - super.update(); - - this.setSpecifiedTable(this.buildSpecifiedTable()); - this.setDefaultTable(this.buildDefaultTable()); - - this.setSpecifiedContextProperty(this.buildSpecifiedContextProperty()); - this.setDefaultContextProperty(this.buildDefaultContextProperty()); - - this.setSpecifiedPrimaryKey(this.buildSpecifiedPrimaryKey()); - this.setDefaultPrimaryKey(this.buildDefaultPrimaryKey()); - } - - - // ********** column ********** - - @Override - public ReadOnlyTenantDiscriminatorColumn2_3 getOverriddenColumn() { - return this.overriddenColumn; - } - - // ********** table ********** - - @Override - public String getTable() { - return (this.specifiedTable != null) ? this.specifiedTable : this.defaultTable; - } - - public String getSpecifiedTable() { - return this.specifiedTable; - } - - protected void setSpecifiedTable(String table) { - String old = this.specifiedTable; - this.specifiedTable = table; - this.firePropertyChanged(SPECIFIED_TABLE_PROPERTY, old, table); - } - - protected String buildSpecifiedTable() { - return this.getOverriddenColumn().getSpecifiedTable(); - } - - public String getDefaultTable() { - return this.defaultTable; - } - - protected void setDefaultTable(String table) { - String old = this.defaultTable; - this.defaultTable = table; - this.firePropertyChanged(DEFAULT_TABLE_PROPERTY, old, table); - } - - protected String buildDefaultTable() { - return this.owner.getDefaultTableName(); - } - - - // ********** context property ********** - - public String getContextProperty() { - return (this.specifiedContextProperty != null) ? this.specifiedContextProperty : this.defaultContextProperty; - } - - public String getSpecifiedContextProperty() { - return this.specifiedContextProperty; - } - - protected void setSpecifiedContextProperty(String contextProperty) { - String old = this.specifiedContextProperty; - this.specifiedContextProperty = contextProperty; - this.firePropertyChanged(SPECIFIED_CONTEXT_PROPERTY_PROPERTY, old, contextProperty); - } - - protected String buildSpecifiedContextProperty() { - return this.getOverriddenColumn().getSpecifiedContextProperty(); - } - - public String getDefaultContextProperty() { - return this.defaultContextProperty; - } - - protected void setDefaultContextProperty(String contextProperty) { - String old = this.defaultContextProperty; - this.defaultContextProperty = contextProperty; - this.firePropertyChanged(DEFAULT_CONTEXT_PROPERTY_PROPERTY, old, contextProperty); - } - - protected String buildDefaultContextProperty() { - return this.owner.getDefaultContextPropertyName(); - } - - - // ********** primary key ********** - - public boolean isPrimaryKey() { - return (this.specifiedPrimaryKey != null) ? this.specifiedPrimaryKey.booleanValue() : this.defaultPrimaryKey; - } - - public Boolean getSpecifiedPrimaryKey() { - return this.specifiedPrimaryKey; - } - - protected void setSpecifiedPrimaryKey(Boolean primaryKey) { - Boolean old = this.specifiedPrimaryKey; - this.specifiedPrimaryKey = primaryKey; - this.firePropertyChanged(SPECIFIED_PRIMARY_KEY_PROPERTY, old, primaryKey); - } - - protected Boolean buildSpecifiedPrimaryKey() { - return this.getOverriddenColumn().getSpecifiedPrimaryKey(); - } - - public boolean isDefaultPrimaryKey() { - return this.defaultPrimaryKey; - } - - protected void setDefaultPrimaryKey(boolean primaryKey) { - boolean old = this.defaultPrimaryKey; - this.defaultPrimaryKey = primaryKey; - this.firePropertyChanged(DEFAULT_PRIMARY_KEY_PROPERTY, old, primaryKey); - } - - protected boolean buildDefaultPrimaryKey() { - return this.owner.getDefaultPrimaryKey(); - } - - // ********** misc ********** - - public boolean tableNameIsInvalid() { - return this.owner.tableNameIsInvalid(this.getTable()); - } - - public Iterable<String> getCandidateTableNames() { - return this.owner.getCandidateTableNames(); - } - - - // ********** validation ********** - - public TextRange getTableTextRange(CompilationUnit astRoot) { - return this.getValidationTextRange(astRoot); - } - - @Override - protected NamedColumnTextRangeResolver buildTextRangeResolver(CompilationUnit astRoot) { - return new JavaTableColumnTextRangeResolver(this, astRoot); - } -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/java/JavaEclipseLinkArrayMapping2_3.java b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/java/JavaEclipseLinkArrayMapping2_3.java deleted file mode 100644 index 1795808f8b..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/java/JavaEclipseLinkArrayMapping2_3.java +++ /dev/null @@ -1,332 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2011, 2012 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.eclipselink.core.internal.context.java; - -import java.util.List; -import org.eclipse.jdt.core.dom.CompilationUnit; -import org.eclipse.jpt.common.core.resource.java.Annotation; -import org.eclipse.jpt.common.core.resource.java.JavaResourceAnnotatedElement; -import org.eclipse.jpt.common.core.resource.java.JavaResourceAttribute; -import org.eclipse.jpt.common.utility.Filter; -import org.eclipse.jpt.common.utility.internal.Association; -import org.eclipse.jpt.common.utility.internal.SimpleAssociation; -import org.eclipse.jpt.common.utility.internal.iterables.ArrayIterable; -import org.eclipse.jpt.jpa.core.JpaFactory; -import org.eclipse.jpt.jpa.core.context.Converter; -import org.eclipse.jpt.jpa.core.context.ReadOnlyBaseColumn; -import org.eclipse.jpt.jpa.core.context.ReadOnlyNamedColumn; -import org.eclipse.jpt.jpa.core.context.java.JavaColumn; -import org.eclipse.jpt.jpa.core.context.java.JavaColumnMapping; -import org.eclipse.jpt.jpa.core.context.java.JavaConverter; -import org.eclipse.jpt.jpa.core.context.java.JavaEnumeratedConverter; -import org.eclipse.jpt.jpa.core.context.java.JavaJpaContextNode; -import org.eclipse.jpt.jpa.core.context.java.JavaLobConverter; -import org.eclipse.jpt.jpa.core.context.java.JavaPersistentAttribute; -import org.eclipse.jpt.jpa.core.context.java.JavaTemporalConverter; -import org.eclipse.jpt.jpa.core.internal.context.JptValidator; -import org.eclipse.jpt.jpa.core.internal.context.NamedColumnTextRangeResolver; -import org.eclipse.jpt.jpa.core.internal.context.TableColumnTextRangeResolver; -import org.eclipse.jpt.jpa.core.internal.context.java.AbstractJavaAttributeMapping; -import org.eclipse.jpt.jpa.core.internal.jpa1.context.EntityTableDescriptionProvider; -import org.eclipse.jpt.jpa.core.internal.jpa1.context.NamedColumnValidator; -import org.eclipse.jpt.jpa.core.internal.jpa1.context.java.NullJavaConverter; -import org.eclipse.jpt.jpa.core.jpa2.context.MetamodelField; -import org.eclipse.jpt.jpa.core.jpa2.context.java.JavaPersistentAttribute2_0; -import org.eclipse.jpt.jpa.core.resource.java.ColumnAnnotation; -import org.eclipse.jpt.jpa.eclipselink.core.EclipseLinkMappingKeys; -import org.eclipse.jpt.jpa.eclipselink.core.context.EclipseLinkArrayMapping2_3; -import org.eclipse.jpt.jpa.eclipselink.core.context.java.EclipseLinkJavaConvertibleMapping; -import org.eclipse.jpt.jpa.eclipselink.core.context.java.JavaEclipseLinkConverterContainer; -import org.eclipse.jpt.jpa.eclipselink.core.resource.java.EclipseLinkArrayAnnotation2_3; -import org.eclipse.wst.validation.internal.provisional.core.IMessage; -import org.eclipse.wst.validation.internal.provisional.core.IReporter; - -public class JavaEclipseLinkArrayMapping2_3 - extends AbstractJavaAttributeMapping<EclipseLinkArrayAnnotation2_3> - implements - EclipseLinkArrayMapping2_3, - EclipseLinkJavaConvertibleMapping, - JavaColumnMapping -{ - - protected final JavaColumn column; - - protected JavaConverter converter; // never null - - - protected static final JavaConverter.Adapter[] CONVERTER_ADAPTER_ARRAY = new JavaConverter.Adapter[] { - JavaEnumeratedConverter.Adapter.instance(), - JavaTemporalConverter.BasicAdapter.instance(), - JavaLobConverter.Adapter.instance(), - JavaEclipseLinkConvert.Adapter.instance() - }; - - protected static final Iterable<JavaConverter.Adapter> CONVERTER_ADAPTERS = new ArrayIterable<JavaConverter.Adapter>(CONVERTER_ADAPTER_ARRAY); - - protected final JavaEclipseLinkConverterContainer converterContainer; - - public JavaEclipseLinkArrayMapping2_3(JavaPersistentAttribute parent) { - super(parent); - this.column = this.buildColumn(); - this.converter = this.buildConverter(); - this.converterContainer = this.buildConverterContainer(); - } - - // ********** synchronize/update ********** - - @Override - public void synchronizeWithResourceModel() { - super.synchronizeWithResourceModel(); - this.column.synchronizeWithResourceModel(); - this.syncConverter(); - this.converterContainer.synchronizeWithResourceModel(); - } - - @Override - public void update() { - super.update(); - this.column.update(); - this.syncConverter(); - this.converterContainer.update(); - } - - // ********** column ********** - - public JavaColumn getColumn() { - return this.column; - } - - protected JavaColumn buildColumn() { - return this.getJpaFactory().buildJavaColumn(this, this); - } - - // ********** converter ********** - - public JavaConverter getConverter() { - return this.converter; - } - - public void setConverter(Class<? extends Converter> converterType) { - if (this.converter.getType() != converterType) { - this.converter.dispose(); - JavaConverter.Adapter converterAdapter = this.getConverterAdapter(converterType); - this.retainConverterAnnotation(converterAdapter); - this.setConverter_(this.buildConverter(converterAdapter)); - } - } - - protected JavaConverter buildConverter(JavaConverter.Adapter converterAdapter) { - return (converterAdapter != null) ? - converterAdapter.buildNewConverter(this, this.getJpaFactory()) : - this.buildNullConverter(); - } - - protected void setConverter_(JavaConverter converter) { - Converter old = this.converter; - this.converter = converter; - this.firePropertyChanged(CONVERTER_PROPERTY, old, converter); - } - - /** - * Clear all the converter annotations <em>except</em> for the annotation - * corresponding to the specified adapter. If the specified adapter is - * <code>null</code>, remove <em>all</em> the converter annotations. - */ - protected void retainConverterAnnotation(JavaConverter.Adapter converterAdapter) { - JavaResourceAttribute resourceAttribute = this.getResourceAttribute(); - for (JavaConverter.Adapter adapter : this.getConverterAdapters()) { - if (adapter != converterAdapter) { - adapter.removeConverterAnnotation(resourceAttribute); - } - } - } - - protected JavaConverter buildConverter() { - JpaFactory jpaFactory = this.getJpaFactory(); - for (JavaConverter.Adapter adapter : this.getConverterAdapters()) { - JavaConverter javaConverter = adapter.buildConverter(this, jpaFactory); - if (javaConverter != null) { - return javaConverter; - } - } - return this.buildNullConverter(); - } - - protected void syncConverter() { - Association<JavaConverter.Adapter, Annotation> assoc = this.getConverterAnnotation(); - if (assoc == null) { - if (this.converter.getType() != null) { - this.setConverter_(this.buildNullConverter()); - } - } else { - JavaConverter.Adapter adapter = assoc.getKey(); - Annotation annotation = assoc.getValue(); - if ((this.converter.getType() == adapter.getConverterType()) && - (this.converter.getConverterAnnotation() == annotation)) { - this.converter.synchronizeWithResourceModel(); - } else { - this.setConverter_(adapter.buildConverter(annotation, this, this.getJpaFactory())); - } - } - } - - /** - * Return the first converter annotation we find along with its corresponding - * adapter. Return <code>null</code> if there are no converter annotations. - */ - protected Association<JavaConverter.Adapter, Annotation> getConverterAnnotation() { - JavaResourceAttribute resourceAttribute = this.getResourceAttribute(); - for (JavaConverter.Adapter adapter : this.getConverterAdapters()) { - Annotation annotation = adapter.getConverterAnnotation(resourceAttribute); - if (annotation != null) { - return new SimpleAssociation<JavaConverter.Adapter, Annotation>(adapter, annotation); - } - } - return null; - } - - protected JavaConverter buildNullConverter() { - return new NullJavaConverter(this); - } - - - // ********** converter adapters ********** - - /** - * Return the converter adapter for the specified converter type. - */ - protected JavaConverter.Adapter getConverterAdapter(Class<? extends Converter> converterType) { - for (JavaConverter.Adapter adapter : this.getConverterAdapters()) { - if (adapter.getConverterType() == converterType) { - return adapter; - } - } - return null; - } - - protected Iterable<JavaConverter.Adapter> getConverterAdapters() { - return CONVERTER_ADAPTERS; - } - - - // ********** converters ********** - - public JavaEclipseLinkConverterContainer getConverterContainer() { - return this.converterContainer; - } - - protected JavaEclipseLinkConverterContainer buildConverterContainer() { - return new JavaEclipseLinkConverterContainerImpl(this); - } - - // ********** converter container parent adapter ********** - - public JavaJpaContextNode getConverterContainerParent() { - return this; // no adapter - } - - public JavaResourceAnnotatedElement getJavaResourceAnnotatedElement() { - return this.getResourceAttribute(); - } - - public boolean parentSupportsConverters() { - return ! this.getPersistentAttribute().isVirtual(); - } - - // ********** metamodel ********** - @Override - protected String getMetamodelFieldTypeName() { - return ((JavaPersistentAttribute2_0) this.getPersistentAttribute()).getMetamodelContainerFieldTypeName(); - } - - @Override - public String getMetamodelTypeName() { - //TODO should get this from targetClass - String targetTypeName = this.getPersistentAttribute().getMultiReferenceTargetTypeName(); - return (targetTypeName != null) ? targetTypeName : MetamodelField.DEFAULT_TYPE_NAME; - } - - - // ********** misc ********** - - public String getKey() { - return EclipseLinkMappingKeys.ARRAY_ATTRIBUTE_MAPPING_KEY; - } - - @Override - protected String getAnnotationName() { - return EclipseLinkArrayAnnotation2_3.ANNOTATION_NAME; - } - - @Override - public boolean isOverridableAttributeMapping() { - return true; - } - - - // ********** JavaColumn.Owner implementation ********** - - public ColumnAnnotation getColumnAnnotation() { - return (ColumnAnnotation) this.getResourceAttribute().getNonNullAnnotation(ColumnAnnotation.ANNOTATION_NAME); - } - - public void removeColumnAnnotation() { - this.getResourceAttribute().removeAnnotation(ColumnAnnotation.ANNOTATION_NAME); - } - - public String getDefaultColumnName(ReadOnlyNamedColumn column) { - return this.getName(); - } - - public String getDefaultTableName() { - return this.getTypeMapping().getPrimaryTableName(); - } - - public boolean tableNameIsInvalid(String tableName) { - return this.getTypeMapping().tableNameIsInvalid(tableName); - } - - public Iterable<String> getCandidateTableNames() { - return this.getTypeMapping().getAllAssociatedTableNames(); - } - - public JptValidator buildColumnValidator(ReadOnlyNamedColumn col, NamedColumnTextRangeResolver textRangeResolver) { - return new NamedColumnValidator(this.getPersistentAttribute(), (ReadOnlyBaseColumn) col, (TableColumnTextRangeResolver) textRangeResolver, new EntityTableDescriptionProvider()); - } - - // ********** Java completion proposals ********** - - @Override - public Iterable<String> getJavaCompletionProposals(int pos, Filter<String> filter, CompilationUnit astRoot) { - Iterable<String> result = super.getJavaCompletionProposals(pos, filter, astRoot); - if (result != null) { - return result; - } - result = this.column.getJavaCompletionProposals(pos, filter, astRoot); - if (result != null) { - return result; - } - result = this.converter.getJavaCompletionProposals(pos, filter, astRoot); - if (result != null) { - return result; - } - return null; - } - - - // ********** validation ********** - - @Override - public void validate(List<IMessage> messages, IReporter reporter, CompilationUnit astRoot) { - super.validate(messages, reporter, astRoot); - this.column.validate(messages, reporter, astRoot); - this.converter.validate(messages, reporter, astRoot); - } -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/java/JavaEclipseLinkBasicCollectionMapping.java b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/java/JavaEclipseLinkBasicCollectionMapping.java deleted file mode 100644 index 9843285d6b..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/java/JavaEclipseLinkBasicCollectionMapping.java +++ /dev/null @@ -1,98 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2008, 2012 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.eclipselink.core.internal.context.java; - -import org.eclipse.jpt.common.core.resource.java.JavaResourceAnnotatedElement; -import org.eclipse.jpt.jpa.core.context.java.JavaJpaContextNode; -import org.eclipse.jpt.jpa.core.context.java.JavaPersistentAttribute; -import org.eclipse.jpt.jpa.core.internal.context.java.AbstractJavaAttributeMapping; -import org.eclipse.jpt.jpa.core.jpa2.context.MetamodelField; -import org.eclipse.jpt.jpa.core.jpa2.context.java.JavaPersistentAttribute2_0; -import org.eclipse.jpt.jpa.eclipselink.core.EclipseLinkMappingKeys; -import org.eclipse.jpt.jpa.eclipselink.core.context.EclipseLinkBasicCollectionMapping; -import org.eclipse.jpt.jpa.eclipselink.core.context.java.EclipseLinkJavaConvertibleMapping; -import org.eclipse.jpt.jpa.eclipselink.core.context.java.JavaEclipseLinkConverterContainer; -import org.eclipse.jpt.jpa.eclipselink.core.resource.java.EclipseLinkBasicCollectionAnnotation; - -public class JavaEclipseLinkBasicCollectionMapping - extends AbstractJavaAttributeMapping<EclipseLinkBasicCollectionAnnotation> - implements EclipseLinkBasicCollectionMapping, EclipseLinkJavaConvertibleMapping -{ - - protected final JavaEclipseLinkConverterContainer converterContainer; - - public JavaEclipseLinkBasicCollectionMapping(JavaPersistentAttribute parent) { - super(parent); - this.converterContainer = this.buildConverterContainer(); - } - - // ********** synchronize/update ********** - - @Override - public void synchronizeWithResourceModel() { - super.synchronizeWithResourceModel(); - this.converterContainer.synchronizeWithResourceModel(); - } - - @Override - public void update() { - super.update(); - this.converterContainer.update(); - } - - - // ********** converters ********** - - public JavaEclipseLinkConverterContainer getConverterContainer() { - return this.converterContainer; - } - - protected JavaEclipseLinkConverterContainer buildConverterContainer() { - return new JavaEclipseLinkConverterContainerImpl(this); - } - - // ********** converter container parent adapter ********** - - public JavaJpaContextNode getConverterContainerParent() { - return this; // no adapter - } - - public JavaResourceAnnotatedElement getJavaResourceAnnotatedElement() { - return this.getResourceAttribute(); - } - - public boolean parentSupportsConverters() { - return ! this.getPersistentAttribute().isVirtual(); - } - - // ********** metamodel ********** - @Override - protected String getMetamodelFieldTypeName() { - return ((JavaPersistentAttribute2_0) this.getPersistentAttribute()).getMetamodelContainerFieldTypeName(); - } - - @Override - public String getMetamodelTypeName() { - String targetTypeName = this.getPersistentAttribute().getMultiReferenceTargetTypeName(); - return (targetTypeName != null) ? targetTypeName : MetamodelField.DEFAULT_TYPE_NAME; - } - - - // ********** misc ********** - - public String getKey() { - return EclipseLinkMappingKeys.BASIC_COLLECTION_ATTRIBUTE_MAPPING_KEY; - } - - @Override - protected String getAnnotationName() { - return EclipseLinkBasicCollectionAnnotation.ANNOTATION_NAME; - } -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/java/JavaEclipseLinkBasicMapMapping.java b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/java/JavaEclipseLinkBasicMapMapping.java deleted file mode 100644 index 2f303a45bf..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/java/JavaEclipseLinkBasicMapMapping.java +++ /dev/null @@ -1,112 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2008, 2012 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.eclipselink.core.internal.context.java; - -import java.util.ArrayList; -import org.eclipse.jpt.common.core.resource.java.JavaResourceAnnotatedElement; -import org.eclipse.jpt.jpa.core.context.java.JavaJpaContextNode; -import org.eclipse.jpt.jpa.core.context.java.JavaPersistentAttribute; -import org.eclipse.jpt.jpa.core.internal.context.java.AbstractJavaAttributeMapping; -import org.eclipse.jpt.jpa.core.jpa2.context.MetamodelField; -import org.eclipse.jpt.jpa.core.jpa2.context.java.JavaPersistentAttribute2_0; -import org.eclipse.jpt.jpa.eclipselink.core.EclipseLinkMappingKeys; -import org.eclipse.jpt.jpa.eclipselink.core.context.EclipseLinkBasicMapMapping; -import org.eclipse.jpt.jpa.eclipselink.core.context.java.EclipseLinkJavaConvertibleMapping; -import org.eclipse.jpt.jpa.eclipselink.core.context.java.JavaEclipseLinkConverterContainer; -import org.eclipse.jpt.jpa.eclipselink.core.resource.java.EclipseLinkBasicMapAnnotation; - -public class JavaEclipseLinkBasicMapMapping - extends AbstractJavaAttributeMapping<EclipseLinkBasicMapAnnotation> - implements EclipseLinkBasicMapMapping, EclipseLinkJavaConvertibleMapping -{ - - protected final JavaEclipseLinkConverterContainer converterContainer; - - public JavaEclipseLinkBasicMapMapping(JavaPersistentAttribute parent) { - super(parent); - this.converterContainer = this.buildConverterContainer(); - } - - - // ********** synchronize/update ********** - - @Override - public void synchronizeWithResourceModel() { - super.synchronizeWithResourceModel(); - this.converterContainer.synchronizeWithResourceModel(); - } - - @Override - public void update() { - super.update(); - this.converterContainer.update(); - } - - - // ********** converters ********** - - public JavaEclipseLinkConverterContainer getConverterContainer() { - return this.converterContainer; - } - - protected JavaEclipseLinkConverterContainer buildConverterContainer() { - return new JavaEclipseLinkConverterContainerImpl(this); - } - - // ********** converter container parent adapter ********** - - public JavaJpaContextNode getConverterContainerParent() { - return this; // no adapter - } - - public JavaResourceAnnotatedElement getJavaResourceAnnotatedElement() { - return this.getResourceAttribute(); - } - - public boolean parentSupportsConverters() { - return ! this.getPersistentAttribute().isVirtual(); - } - - // ********** misc ********** - - public String getKey() { - return EclipseLinkMappingKeys.BASIC_MAP_ATTRIBUTE_MAPPING_KEY; - } - - @Override - protected String getAnnotationName() { - return EclipseLinkBasicMapAnnotation.ANNOTATION_NAME; - } - - - // ********** metamodel ********** - @Override - protected String getMetamodelFieldTypeName() { - return ((JavaPersistentAttribute2_0) this.getPersistentAttribute()).getMetamodelContainerFieldTypeName(); - } - - @Override - public String getMetamodelTypeName() { - String targetTypeName = this.getPersistentAttribute().getMultiReferenceTargetTypeName(); - return (targetTypeName != null) ? targetTypeName : MetamodelField.DEFAULT_TYPE_NAME; - } - - @Override - protected void addMetamodelFieldTypeArgumentNamesTo(ArrayList<String> typeArgumentNames) { - this.addMetamodelFieldMapKeyTypeArgumentNameTo(typeArgumentNames); - super.addMetamodelFieldTypeArgumentNamesTo(typeArgumentNames); - } - - protected void addMetamodelFieldMapKeyTypeArgumentNameTo(ArrayList<String> typeArgumentNames) { - String mapKeyTypeName = this.getPersistentAttribute().getMultiReferenceMapKeyTypeName(); - mapKeyTypeName = mapKeyTypeName != null ? mapKeyTypeName : MetamodelField.DEFAULT_TYPE_NAME; - typeArgumentNames.add(mapKeyTypeName); - } -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/java/JavaEclipseLinkBasicMapping.java b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/java/JavaEclipseLinkBasicMapping.java deleted file mode 100644 index 131a82acea..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/java/JavaEclipseLinkBasicMapping.java +++ /dev/null @@ -1,112 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2008, 2012 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.eclipselink.core.internal.context.java; - -import java.util.List; -import org.eclipse.jdt.core.dom.CompilationUnit; -import org.eclipse.jpt.common.core.resource.java.JavaResourceAnnotatedElement; -import org.eclipse.jpt.common.utility.internal.iterables.CompositeIterable; -import org.eclipse.jpt.jpa.core.context.java.JavaConverter; -import org.eclipse.jpt.jpa.core.context.java.JavaJpaContextNode; -import org.eclipse.jpt.jpa.core.context.java.JavaPersistentAttribute; -import org.eclipse.jpt.jpa.core.internal.context.java.AbstractJavaBasicMapping; -import org.eclipse.jpt.jpa.eclipselink.core.context.EclipseLinkBasicMapping; -import org.eclipse.jpt.jpa.eclipselink.core.context.EclipseLinkMutable; -import org.eclipse.jpt.jpa.eclipselink.core.context.java.EclipseLinkJavaConvertibleMapping; -import org.eclipse.jpt.jpa.eclipselink.core.context.java.JavaEclipseLinkConverterContainer; -import org.eclipse.wst.validation.internal.provisional.core.IMessage; -import org.eclipse.wst.validation.internal.provisional.core.IReporter; - -public class JavaEclipseLinkBasicMapping - extends AbstractJavaBasicMapping - implements EclipseLinkBasicMapping, EclipseLinkJavaConvertibleMapping -{ - protected final JavaEclipseLinkMutable mutable; - - protected final JavaEclipseLinkConverterContainer converterContainer; - - - public JavaEclipseLinkBasicMapping(JavaPersistentAttribute parent) { - super(parent); - this.mutable = new JavaEclipseLinkMutable(this); - this.converterContainer = this.buildConverterContainer(); - } - - - // ********** synchronize/update ********** - - @Override - public void synchronizeWithResourceModel() { - super.synchronizeWithResourceModel(); - this.mutable.synchronizeWithResourceModel(); - this.converterContainer.synchronizeWithResourceModel(); - } - - @Override - public void update() { - super.update(); - this.mutable.update(); - this.converterContainer.update(); - } - - - // ********** mutable ********** - - public EclipseLinkMutable getMutable() { - return this.mutable; - } - - - // ********** converters ********** - - public JavaEclipseLinkConverterContainer getConverterContainer() { - return this.converterContainer; - } - - protected JavaEclipseLinkConverterContainer buildConverterContainer() { - return new JavaEclipseLinkConverterContainerImpl(this); - } - - // ********** converter container parent adapter ********** - - public JavaJpaContextNode getConverterContainerParent() { - return this; // no adapter - } - - public JavaResourceAnnotatedElement getJavaResourceAnnotatedElement() { - return this.getResourceAttribute(); - } - - public boolean parentSupportsConverters() { - return ! this.getPersistentAttribute().isVirtual(); - } - - // ********** converter adapters ********** - - /** - * put the EclipseLink convert adapter first - this is the order EclipseLink searches - */ - @Override - protected Iterable<JavaConverter.Adapter> getConverterAdapters() { - return new CompositeIterable<JavaConverter.Adapter>( - JavaEclipseLinkConvert.Adapter.instance(), - super.getConverterAdapters() - ); - } - - - // ********** validation ********** - - @Override - public void validate(List<IMessage> messages, IReporter reporter, CompilationUnit astRoot) { - super.validate(messages, reporter, astRoot); - this.mutable.validate(messages, reporter, astRoot); - } -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/java/JavaEclipseLinkCachingImpl.java b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/java/JavaEclipseLinkCachingImpl.java deleted file mode 100644 index dcb40f9adc..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/java/JavaEclipseLinkCachingImpl.java +++ /dev/null @@ -1,655 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2008, 2011 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.eclipselink.core.internal.context.java; - -import java.util.List; -import org.eclipse.jdt.core.dom.CompilationUnit; -import org.eclipse.jpt.common.core.resource.java.JavaResourceType; -import org.eclipse.jpt.common.core.utility.TextRange; -import org.eclipse.jpt.common.utility.internal.StringTools; -import org.eclipse.jpt.jpa.core.context.PersistentType; -import org.eclipse.jpt.jpa.core.context.TypeMapping; -import org.eclipse.jpt.jpa.core.context.java.JavaPersistentType; -import org.eclipse.jpt.jpa.core.internal.context.java.AbstractJavaJpaContextNode; -import org.eclipse.jpt.jpa.core.internal.jpa2.context.java.NullJavaCacheable2_0; -import org.eclipse.jpt.jpa.core.jpa2.context.CacheableHolder2_0; -import org.eclipse.jpt.jpa.core.jpa2.context.java.JavaCacheable2_0; -import org.eclipse.jpt.jpa.core.jpa2.context.java.JavaCacheableHolder2_0; -import org.eclipse.jpt.jpa.core.jpa2.context.persistence.PersistenceUnit2_0; -import org.eclipse.jpt.jpa.eclipselink.core.context.EclipseLinkCacheCoordinationType; -import org.eclipse.jpt.jpa.eclipselink.core.context.EclipseLinkCacheIsolationType2_2; -import org.eclipse.jpt.jpa.eclipselink.core.context.EclipseLinkCacheType; -import org.eclipse.jpt.jpa.eclipselink.core.context.EclipseLinkExistenceType; -import org.eclipse.jpt.jpa.eclipselink.core.context.EclipseLinkTimeOfDay; -import org.eclipse.jpt.jpa.eclipselink.core.context.java.JavaEclipseLinkCaching; -import org.eclipse.jpt.jpa.eclipselink.core.context.java.JavaEclipseLinkNonEmbeddableTypeMapping; -import org.eclipse.jpt.jpa.eclipselink.core.context.persistence.EclipseLinkPersistenceUnit; -import org.eclipse.jpt.jpa.eclipselink.core.internal.DefaultEclipseLinkJpaValidationMessages; -import org.eclipse.jpt.jpa.eclipselink.core.internal.EclipseLinkJpaValidationMessages; -import org.eclipse.jpt.jpa.eclipselink.core.resource.java.EclipseLinkCacheAnnotation; -import org.eclipse.jpt.jpa.eclipselink.core.resource.java.EclipseLinkExistenceCheckingAnnotation; -import org.eclipse.jpt.jpa.eclipselink.core.resource.java.EclipseLinkTimeOfDayAnnotation; -import org.eclipse.wst.validation.internal.provisional.core.IMessage; -import org.eclipse.wst.validation.internal.provisional.core.IReporter; - -public class JavaEclipseLinkCachingImpl - extends AbstractJavaJpaContextNode - implements JavaEclipseLinkCaching, JavaCacheableHolder2_0 -{ - protected EclipseLinkCacheType specifiedType; - protected Integer specifiedSize; - protected Boolean specifiedShared; - protected Boolean specifiedAlwaysRefresh; - protected Boolean specifiedRefreshOnlyIfNewer; - protected Boolean specifiedDisableHits; - - protected EclipseLinkCacheCoordinationType specifiedCoordinationType; - - protected Integer expiry; - protected EclipseLinkJavaTimeOfDay expiryTimeOfDay; - - protected boolean existenceChecking; - protected EclipseLinkExistenceType specifiedExistenceType; - protected EclipseLinkExistenceType defaultExistenceType; - - protected final JavaCacheable2_0 cacheable; - - protected EclipseLinkCacheIsolationType2_2 specifiedIsolation; - - public JavaEclipseLinkCachingImpl(JavaEclipseLinkNonEmbeddableTypeMapping parent) { - super(parent); - - EclipseLinkCacheAnnotation cacheAnnotation = this.getCacheAnnotation(); - this.specifiedType = EclipseLinkCacheType.fromJavaResourceModel(cacheAnnotation.getType()); - this.specifiedSize = cacheAnnotation.getSize(); - this.specifiedShared = cacheAnnotation.getShared(); - this.specifiedAlwaysRefresh = cacheAnnotation.getAlwaysRefresh(); - this.specifiedRefreshOnlyIfNewer = cacheAnnotation.getRefreshOnlyIfNewer(); - this.specifiedDisableHits = cacheAnnotation.getDisableHits(); - - this.specifiedCoordinationType = EclipseLinkCacheCoordinationType.fromJavaResourceModel(cacheAnnotation.getCoordinationType()); - - this.expiry = cacheAnnotation.getExpiry(); - this.expiryTimeOfDay = this.buildExpiryTimeOfDay(cacheAnnotation.getExpiryTimeOfDay()); - - EclipseLinkExistenceCheckingAnnotation ecAnnotation = this.getExistenceCheckingAnnotation(); - this.existenceChecking = (ecAnnotation != null); - this.specifiedExistenceType = this.buildSpecifiedExistenceType(ecAnnotation); - - this.cacheable = this.buildCacheable(); - - this.specifiedIsolation = EclipseLinkCacheIsolationType2_2.fromJavaResourceModel(cacheAnnotation.getIsolation()); - } - - - // ********** synchronize/update ********** - - @Override - public void synchronizeWithResourceModel() { - super.synchronizeWithResourceModel(); - - EclipseLinkCacheAnnotation cacheAnnotation = this.getCacheAnnotation(); - this.setSpecifiedType_(EclipseLinkCacheType.fromJavaResourceModel(cacheAnnotation.getType())); - this.setSpecifiedSize_(cacheAnnotation.getSize()); - this.setSpecifiedShared_(cacheAnnotation.getShared()); - this.setSpecifiedAlwaysRefresh_(cacheAnnotation.getAlwaysRefresh()); - this.setSpecifiedRefreshOnlyIfNewer_(cacheAnnotation.getRefreshOnlyIfNewer()); - this.setSpecifiedDisableHits_(cacheAnnotation.getDisableHits()); - - this.setSpecifiedCoordinationType_(EclipseLinkCacheCoordinationType.fromJavaResourceModel(cacheAnnotation.getCoordinationType())); - - this.setExpiry_(cacheAnnotation.getExpiry()); - this.syncExpiryTimeOfDay(cacheAnnotation.getExpiryTimeOfDay()); - - EclipseLinkExistenceCheckingAnnotation ecAnnotation = this.getExistenceCheckingAnnotation(); - this.setExistenceChecking_(ecAnnotation != null); - this.setSpecifiedExistenceType_(this.buildSpecifiedExistenceType(ecAnnotation)); - - this.cacheable.synchronizeWithResourceModel(); - - this.setSpecifiedIsolation_(EclipseLinkCacheIsolationType2_2.fromJavaResourceModel(cacheAnnotation.getIsolation())); - } - - @Override - public void update() { - super.update(); - if (this.expiryTimeOfDay != null) { - this.expiryTimeOfDay.update(); - } - this.setDefaultExistenceType(this.buildDefaultExistenceType()); - this.cacheable.update(); - } - - - // ********** type ********** - - public EclipseLinkCacheType getType() { - return (this.specifiedType != null) ? this.specifiedType : this.getDefaultType(); - } - - public EclipseLinkCacheType getSpecifiedType() { - return this.specifiedType; - } - - public void setSpecifiedType(EclipseLinkCacheType type) { - this.getCacheAnnotation().setType(EclipseLinkCacheType.toJavaResourceModel(type)); - this.setSpecifiedType_(type); - - if (type != null) { - this.setSpecifiedShared(null); - } - } - - protected void setSpecifiedType_(EclipseLinkCacheType type) { - EclipseLinkCacheType old = this.specifiedType; - this.specifiedType = type; - this.firePropertyChanged(SPECIFIED_TYPE_PROPERTY, old, type); - } - - public EclipseLinkCacheType getDefaultType() { - String puDefaultCacheTypeName = ((EclipseLinkPersistenceUnit)getPersistenceUnit()).getDefaultCacheTypePropertyValue(); - if (!StringTools.stringIsEmpty(puDefaultCacheTypeName)) { - try { - return EclipseLinkCacheType.valueOf(StringTools.convertCamelCaseToAllCaps(puDefaultCacheTypeName)); - } catch (IllegalArgumentException exception) { - //no match, return default - } - } - return DEFAULT_TYPE; - } - - // ********** size ********** - - public int getSize() { - return (this.specifiedSize != null) ? this.specifiedSize.intValue() : this.getDefaultSize(); - } - - public Integer getSpecifiedSize() { - return this.specifiedSize; - } - - public void setSpecifiedSize(Integer size) { - this.getCacheAnnotation().setSize(size); - this.setSpecifiedSize_(size); - - if (size != null) { - this.setSpecifiedShared(null); - } - } - - protected void setSpecifiedSize_(Integer size) { - Integer old = this.specifiedSize; - this.specifiedSize = size; - this.firePropertyChanged(SPECIFIED_SIZE_PROPERTY, old, size); - } - - public int getDefaultSize() { - String puDefaultCacheSize = ((EclipseLinkPersistenceUnit)getPersistenceUnit()).getDefaultCacheSizePropertyValue(); - if (!StringTools.stringIsEmpty(puDefaultCacheSize)) { - try { - return Integer.valueOf(puDefaultCacheSize).intValue(); - } catch (NumberFormatException exception) { - //couldn't parse, return default - } - } - return DEFAULT_SIZE; - } - - - // ********** shared ********** - - public boolean isShared() { - return (this.specifiedShared != null) ? this.specifiedShared.booleanValue() : this.isDefaultShared(); - } - - public Boolean getSpecifiedShared() { - return this.specifiedShared; - } - - public void setSpecifiedShared(Boolean shared) { - this.getCacheAnnotation().setShared(shared); - this.setSpecifiedShared_(shared); - - if ((shared != null) && ! shared.booleanValue()) { // Boolean.FALSE - this.setSpecifiedType(null); - this.setSpecifiedSize(null); - this.setSpecifiedAlwaysRefresh(null); - this.setSpecifiedRefreshOnlyIfNewer(null); - this.setSpecifiedDisableHits(null); - this.setSpecifiedCoordinationType(null); - this.setExpiry(null); - this.removeExpiryTimeOfDayIfNecessary(); - } - } - - protected void setSpecifiedShared_(Boolean shared) { - Boolean old = this.specifiedShared; - this.specifiedShared = shared; - this.firePropertyChanged(SPECIFIED_SHARED_PROPERTY, old, shared); - } - - public boolean isDefaultShared() { - String puDefaultSharedCache = ((EclipseLinkPersistenceUnit)getPersistenceUnit()).getDefaultCacheSharedPropertyValue(); - return !StringTools.stringIsEmpty(puDefaultSharedCache) ? Boolean.valueOf(puDefaultSharedCache).booleanValue() : DEFAULT_SHARED; - } - - - // ********** always refresh ********** - - public boolean isAlwaysRefresh() { - return (this.specifiedAlwaysRefresh != null) ? this.specifiedAlwaysRefresh.booleanValue() : this.isDefaultAlwaysRefresh(); - } - - public Boolean getSpecifiedAlwaysRefresh() { - return this.specifiedAlwaysRefresh; - } - - public void setSpecifiedAlwaysRefresh(Boolean alwaysRefresh) { - this.getCacheAnnotation().setAlwaysRefresh(alwaysRefresh); - this.setSpecifiedAlwaysRefresh_(alwaysRefresh); - - if (alwaysRefresh != null) { - this.setSpecifiedShared(null); - } - } - - protected void setSpecifiedAlwaysRefresh_(Boolean alwaysRefresh) { - Boolean old = this.specifiedAlwaysRefresh; - this.specifiedAlwaysRefresh = alwaysRefresh; - this.firePropertyChanged(SPECIFIED_ALWAYS_REFRESH_PROPERTY, old, alwaysRefresh); - } - - public boolean isDefaultAlwaysRefresh() { - return DEFAULT_ALWAYS_REFRESH; - } - - - // ********** refresh only if newer ********** - - public boolean isRefreshOnlyIfNewer() { - return (this.specifiedRefreshOnlyIfNewer != null) ? this.specifiedRefreshOnlyIfNewer.booleanValue() : this.isDefaultRefreshOnlyIfNewer(); - } - - public Boolean getSpecifiedRefreshOnlyIfNewer() { - return this.specifiedRefreshOnlyIfNewer; - } - - public void setSpecifiedRefreshOnlyIfNewer(Boolean refreshOnlyIfNewer) { - this.getCacheAnnotation().setRefreshOnlyIfNewer(refreshOnlyIfNewer); - this.setSpecifiedRefreshOnlyIfNewer_(refreshOnlyIfNewer); - - if (refreshOnlyIfNewer != null) { - this.setSpecifiedShared(null); - } - } - - protected void setSpecifiedRefreshOnlyIfNewer_(Boolean refreshOnlyIfNewer) { - Boolean old = this.specifiedRefreshOnlyIfNewer; - this.specifiedRefreshOnlyIfNewer = refreshOnlyIfNewer; - this.firePropertyChanged(SPECIFIED_REFRESH_ONLY_IF_NEWER_PROPERTY, old, refreshOnlyIfNewer); - } - - public boolean isDefaultRefreshOnlyIfNewer() { - return DEFAULT_REFRESH_ONLY_IF_NEWER; - } - - - // ********** disable hits ********** - - public boolean isDisableHits() { - return (this.specifiedDisableHits != null) ? this.specifiedDisableHits.booleanValue() : this.isDefaultDisableHits(); - } - - public Boolean getSpecifiedDisableHits() { - return this.specifiedDisableHits; - } - - public void setSpecifiedDisableHits(Boolean disableHits) { - this.getCacheAnnotation().setDisableHits(disableHits); - this.setSpecifiedDisableHits_(disableHits); - - if (disableHits != null) { - this.setSpecifiedShared(null); - } - } - - protected void setSpecifiedDisableHits_(Boolean disableHits) { - Boolean old = this.specifiedDisableHits; - this.specifiedDisableHits = disableHits; - this.firePropertyChanged(SPECIFIED_DISABLE_HITS_PROPERTY, old, disableHits); - } - - public boolean isDefaultDisableHits() { - return DEFAULT_DISABLE_HITS; - } - - - // ********** coordination type ********** - - public EclipseLinkCacheCoordinationType getCoordinationType() { - return (this.specifiedCoordinationType != null) ? this.specifiedCoordinationType : this.getDefaultCoordinationType(); - } - - public EclipseLinkCacheCoordinationType getSpecifiedCoordinationType() { - return this.specifiedCoordinationType; - } - - public void setSpecifiedCoordinationType(EclipseLinkCacheCoordinationType type) { - this.getCacheAnnotation().setCoordinationType(EclipseLinkCacheCoordinationType.toJavaResourceModel(type)); - this.setSpecifiedCoordinationType_(type); - - if (type != null) { - this.setSpecifiedShared(null); - } - } - - protected void setSpecifiedCoordinationType_(EclipseLinkCacheCoordinationType type) { - EclipseLinkCacheCoordinationType old = this.specifiedCoordinationType; - this.specifiedCoordinationType = type; - this.firePropertyChanged(SPECIFIED_COORDINATION_TYPE_PROPERTY, old, type); - } - - public EclipseLinkCacheCoordinationType getDefaultCoordinationType() { - return DEFAULT_COORDINATION_TYPE; - } - - - // ********** expiry ********** - - public Integer getExpiry() { - return this.expiry; - } - - public void setExpiry(Integer expiry) { - this.getCacheAnnotation().setExpiry(expiry); - this.setExpiry_(expiry); - - if (expiry != null) { - this.removeExpiryTimeOfDayIfNecessary(); - this.setSpecifiedShared(null); - } - } - - protected void setExpiry_(Integer expiry) { - Integer old = this.expiry; - this.expiry = expiry; - this.firePropertyChanged(EXPIRY_PROPERTY, old, expiry); - } - - - // ********** expiry time of day ********** - - public EclipseLinkTimeOfDay getExpiryTimeOfDay() { - return this.expiryTimeOfDay; - } - - public EclipseLinkTimeOfDay addExpiryTimeOfDay() { - if (this.expiryTimeOfDay != null) { - throw new IllegalStateException("expiry time of day already exists: " + this.expiryTimeOfDay); //$NON-NLS-1$ - } - EclipseLinkTimeOfDayAnnotation timeOfDayAnnotation = this.getCacheAnnotation().addExpiryTimeOfDay(); - EclipseLinkJavaTimeOfDay timeOfDay = this.buildExpiryTimeOfDay(timeOfDayAnnotation); - this.setExpiryTimeOfDay(timeOfDay); - - this.setExpiry(null); - this.setSpecifiedShared(null); - - return timeOfDay; - } - - public void removeExpiryTimeOfDay() { - if (this.expiryTimeOfDay == null) { - throw new IllegalStateException("expiry time of day does not exist"); //$NON-NLS-1$ - } - this.removeExpiryTimeOfDay_(); - } - - protected void removeExpiryTimeOfDayIfNecessary() { - if (this.expiryTimeOfDay != null) { - this.removeExpiryTimeOfDay_(); - } - } - - protected void removeExpiryTimeOfDay_() { - this.getCacheAnnotation().removeExpiryTimeOfDay(); - this.setExpiryTimeOfDay(null); - } - - public void setExpiryTimeOfDay(EclipseLinkJavaTimeOfDay timeOfDay) { - EclipseLinkJavaTimeOfDay old = this.expiryTimeOfDay; - this.expiryTimeOfDay = timeOfDay; - this.firePropertyChanged(EXPIRY_TIME_OF_DAY_PROPERTY, old, timeOfDay); - } - - protected void syncExpiryTimeOfDay(EclipseLinkTimeOfDayAnnotation timeOfDayAnnotation) { - if (timeOfDayAnnotation == null) { - if (this.expiryTimeOfDay != null) { - this.setExpiryTimeOfDay(null); - } - } else { - if ((this.expiryTimeOfDay != null) && (this.expiryTimeOfDay.getTimeOfDayAnnotation() == timeOfDayAnnotation)) { - this.expiryTimeOfDay.synchronizeWithResourceModel(); - } else { - this.setExpiryTimeOfDay(this.buildExpiryTimeOfDay(timeOfDayAnnotation)); - } - } - } - - protected EclipseLinkJavaTimeOfDay buildExpiryTimeOfDay(EclipseLinkTimeOfDayAnnotation timeOfDayAnnotation) { - return (timeOfDayAnnotation == null) ? null : new EclipseLinkJavaTimeOfDay(this, timeOfDayAnnotation); - } - - - // ********** existence checking ********** - - public boolean isExistenceChecking() { - return this.existenceChecking; - } - - public void setExistenceChecking(boolean existenceChecking) { - if (existenceChecking != this.existenceChecking) { - if (existenceChecking) { - this.addExistenceCheckingAnnotation(); - } else { - this.removeExistenceCheckingAnnotation(); - this.setSpecifiedExistenceType(null); - } - this.setExistenceChecking_(existenceChecking); - } - } - - protected void setExistenceChecking_(boolean existenceChecking) { - boolean old = this.existenceChecking; - this.existenceChecking = existenceChecking; - this.firePropertyChanged(EXISTENCE_CHECKING_PROPERTY, old, existenceChecking); - } - - - // ********** existence type ********** - - public EclipseLinkExistenceType getExistenceType() { - return (this.specifiedExistenceType != null) ? this.specifiedExistenceType : this.defaultExistenceType; - } - - public EclipseLinkExistenceType getSpecifiedExistenceType() { - return this.specifiedExistenceType; - } - - public void setSpecifiedExistenceType(EclipseLinkExistenceType type) { - if (this.valuesAreDifferent(type, this.specifiedExistenceType)) { - if (type != null) { - this.setExistenceChecking(true); - } - this.getExistenceCheckingAnnotation().setValue(EclipseLinkExistenceType.toJavaResourceModel(type)); - this.setSpecifiedExistenceType_(type); - } - } - - protected void setSpecifiedExistenceType_(EclipseLinkExistenceType type) { - EclipseLinkExistenceType old = this.specifiedExistenceType; - this.specifiedExistenceType = type; - this.firePropertyChanged(SPECIFIED_EXISTENCE_TYPE_PROPERTY, old, type); - } - - protected EclipseLinkExistenceType buildSpecifiedExistenceType(EclipseLinkExistenceCheckingAnnotation ecAnnotation) { - return (ecAnnotation == null) ? null : EclipseLinkExistenceType.fromJavaResourceModel(ecAnnotation.getValue()); - } - - public EclipseLinkExistenceType getDefaultExistenceType() { - return this.defaultExistenceType; - } - - protected void setDefaultExistenceType(EclipseLinkExistenceType type) { - EclipseLinkExistenceType old = this.defaultExistenceType; - this.defaultExistenceType = type; - this.firePropertyChanged(DEFAULT_EXISTENCE_TYPE_PROPERTY, old, type); - } - - protected EclipseLinkExistenceType buildDefaultExistenceType() { - return this.existenceChecking ? EclipseLinkExistenceType.CHECK_CACHE : DEFAULT_EXISTENCE_TYPE; - } - - - // ********** cacheable ********** - - public JavaCacheable2_0 getCacheable() { - return this.cacheable; - } - - public boolean calculateDefaultCacheable() { - CacheableHolder2_0 superCacheableHolder = this.getCacheableSuperPersistentType(this.getPersistentType()); - return (superCacheableHolder != null) ? - superCacheableHolder.getCacheable().isCacheable() : - ((PersistenceUnit2_0) this.getPersistenceUnit()).calculateDefaultCacheable(); - } - - protected CacheableHolder2_0 getCacheableSuperPersistentType(PersistentType persistentType) { - PersistentType superPersistentType = persistentType.getSuperPersistentType(); - if (superPersistentType == null) { - return null; - } - TypeMapping superMapping = superPersistentType.getMapping(); - return (superMapping instanceof CacheableHolder2_0) ? - (CacheableHolder2_0) superMapping : - this.getCacheableSuperPersistentType(superPersistentType); // recurse - } - - protected JavaCacheable2_0 buildCacheable() { - return this.isJpa2_0Compatible() ? - this.getJpaFactory2_0().buildJavaCacheable(this) : - new NullJavaCacheable2_0(this); - } - - - // ********** isolation ********** - - public EclipseLinkCacheIsolationType2_2 getIsolation() { - return (this.specifiedIsolation != null) ? this.specifiedIsolation : this.getDefaultIsolation(); - } - - public EclipseLinkCacheIsolationType2_2 getSpecifiedIsolation() { - return this.specifiedIsolation; - } - - public void setSpecifiedIsolation(EclipseLinkCacheIsolationType2_2 isolation) { - this.getCacheAnnotation().setIsolation(EclipseLinkCacheIsolationType2_2.toJavaResourceModel(isolation)); - this.setSpecifiedIsolation_(isolation); - - if (isolation != null) { - this.setSpecifiedShared(null); - } - } - - protected void setSpecifiedIsolation_(EclipseLinkCacheIsolationType2_2 isolation) { - EclipseLinkCacheIsolationType2_2 old = this.specifiedIsolation; - this.specifiedIsolation = isolation; - this.firePropertyChanged(SPECIFIED_ISOLATION_PROPERTY, old, isolation); - } - - public EclipseLinkCacheIsolationType2_2 getDefaultIsolation() { - return DEFAULT_ISOLATION; - } - - // ********** cache annotation ********** - - protected EclipseLinkCacheAnnotation getCacheAnnotation() { - return (EclipseLinkCacheAnnotation) this.getJavaResourceType().getNonNullAnnotation(this.getCacheAnnotationName()); - } - - protected String getCacheAnnotationName() { - return EclipseLinkCacheAnnotation.ANNOTATION_NAME; - } - - - // ********** existence checking annotation ********** - - protected EclipseLinkExistenceCheckingAnnotation getExistenceCheckingAnnotation() { - return (EclipseLinkExistenceCheckingAnnotation) this.getJavaResourceType().getAnnotation(this.getExistenceCheckingAnnotationName()); - } - - protected EclipseLinkExistenceCheckingAnnotation addExistenceCheckingAnnotation() { - return (EclipseLinkExistenceCheckingAnnotation) this.getJavaResourceType().addAnnotation(this.getExistenceCheckingAnnotationName()); - } - - protected void removeExistenceCheckingAnnotation() { - this.getJavaResourceType().removeAnnotation(this.getExistenceCheckingAnnotationName()); - } - - protected String getExistenceCheckingAnnotationName() { - return EclipseLinkExistenceCheckingAnnotation.ANNOTATION_NAME; - } - - - // ********** misc ********** - - @Override - public JavaEclipseLinkNonEmbeddableTypeMapping getParent() { - return (JavaEclipseLinkNonEmbeddableTypeMapping) super.getParent(); - } - - protected JavaEclipseLinkNonEmbeddableTypeMapping getTypeMapping() { - return this.getParent(); - } - - protected JavaPersistentType getPersistentType() { - return this.getTypeMapping().getPersistentType(); - } - - public JavaResourceType getJavaResourceType() { - return this.getTypeMapping().getJavaResourceType(); - } - - // ********** validation ********** - - @Override - public void validate(List<IMessage> messages, IReporter reporter, CompilationUnit astRoot) { - super.validate(messages, reporter, astRoot); - this.validateExpiry(messages, astRoot); - } - - protected void validateExpiry(List<IMessage> messages, CompilationUnit astRoot) { - if ((this.expiry != null) && (this.expiryTimeOfDay != null)) { - messages.add( - DefaultEclipseLinkJpaValidationMessages.buildMessage( - IMessage.HIGH_SEVERITY, - EclipseLinkJpaValidationMessages.CACHE_EXPIRY_AND_EXPIRY_TIME_OF_DAY_BOTH_SPECIFIED, - new String[] {this.getPersistentType().getName()}, - this, - this.getValidationTextRange(astRoot) - ) - ); - } - } - - public TextRange getValidationTextRange(CompilationUnit astRoot) { - TextRange textRange = this.getCacheAnnotation().getTextRange(astRoot); - return (textRange != null) ? textRange : this.getTypeMapping().getValidationTextRange(astRoot); - } -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/java/JavaEclipseLinkChangeTracking.java b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/java/JavaEclipseLinkChangeTracking.java deleted file mode 100644 index b391bc8ddf..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/java/JavaEclipseLinkChangeTracking.java +++ /dev/null @@ -1,142 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2008, 2011 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.eclipselink.core.internal.context.java; - -import org.eclipse.jdt.core.dom.CompilationUnit; -import org.eclipse.jpt.common.core.resource.java.JavaResourceType; -import org.eclipse.jpt.common.core.utility.TextRange; -import org.eclipse.jpt.jpa.core.context.java.JavaPersistentType; -import org.eclipse.jpt.jpa.core.context.java.JavaTypeMapping; -import org.eclipse.jpt.jpa.core.internal.context.java.AbstractJavaJpaContextNode; -import org.eclipse.jpt.jpa.eclipselink.core.context.EclipseLinkChangeTracking; -import org.eclipse.jpt.jpa.eclipselink.core.context.EclipseLinkChangeTrackingType; -import org.eclipse.jpt.jpa.eclipselink.core.resource.java.ChangeTrackingType; -import org.eclipse.jpt.jpa.eclipselink.core.resource.java.EclipseLinkChangeTrackingAnnotation; - -public class JavaEclipseLinkChangeTracking - extends AbstractJavaJpaContextNode - implements EclipseLinkChangeTracking -{ - protected EclipseLinkChangeTrackingType specifiedType; - - - public JavaEclipseLinkChangeTracking(JavaTypeMapping parent) { - super(parent); - this.specifiedType = this.buildSpecifiedType(); - } - - - // ********** synchronize/update ********** - - @Override - public void synchronizeWithResourceModel() { - super.synchronizeWithResourceModel(); - this.setSpecifiedType_(this.buildSpecifiedType()); - } - - - // ********** type ********** - - public EclipseLinkChangeTrackingType getType() { - return (this.specifiedType != null) ? this.specifiedType : this.getDefaultType(); - } - - public EclipseLinkChangeTrackingType getSpecifiedType() { - return this.specifiedType; - } - - public void setSpecifiedType(EclipseLinkChangeTrackingType type) { - if (this.valuesAreDifferent(type, this.specifiedType)) { - EclipseLinkChangeTrackingAnnotation annotation = this.getChangeTrackingAnnotation(); - if (type == null) { - if (annotation != null) { - this.removeChangeTrackingAnnotation(); - } - } else { - if (annotation == null) { - annotation = this.addChangeTrackingAnnotation(); - } - annotation.setValue(EclipseLinkChangeTrackingType.toJavaResourceModel(type)); - } - this.setSpecifiedType_(type); - } - } - - protected void setSpecifiedType_(EclipseLinkChangeTrackingType type) { - EclipseLinkChangeTrackingType old = this.specifiedType; - this.specifiedType = type; - this.firePropertyChanged(SPECIFIED_TYPE_PROPERTY, old, type); - } - - protected EclipseLinkChangeTrackingType buildSpecifiedType() { - EclipseLinkChangeTrackingAnnotation annotation = this.getChangeTrackingAnnotation(); - if (annotation == null) { - return null; - } - ChangeTrackingType value = annotation.getValue(); - return (value == null) ? DEFAULT_TYPE : EclipseLinkChangeTrackingType.fromJavaResourceModel(value); - } - - public EclipseLinkChangeTrackingType getDefaultType() { - return DEFAULT_TYPE; - } - - - // ********** change tracking annotation ********** - - protected EclipseLinkChangeTrackingAnnotation getChangeTrackingAnnotation() { - return (EclipseLinkChangeTrackingAnnotation) this.getJavaResourceType().getAnnotation(this.getChangeTrackingAnnotationName()); - } - - protected EclipseLinkChangeTrackingAnnotation addChangeTrackingAnnotation() { - return (EclipseLinkChangeTrackingAnnotation) this.getJavaResourceType().addAnnotation(this.getChangeTrackingAnnotationName()); - } - - protected void removeChangeTrackingAnnotation() { - this.getJavaResourceType().removeAnnotation(this.getChangeTrackingAnnotationName()); - } - - protected String getChangeTrackingAnnotationName() { - return EclipseLinkChangeTrackingAnnotation.ANNOTATION_NAME; - } - - - // ********** misc ********** - - @Override - public JavaTypeMapping getParent() { - return (JavaTypeMapping) super.getParent(); - } - - protected JavaTypeMapping getTypeMapping() { - return this.getParent(); - } - - protected JavaPersistentType getPersistentType() { - return this.getTypeMapping().getPersistentType(); - } - - protected JavaResourceType getJavaResourceType() { - return this.getPersistentType().getJavaResourceType(); - } - - - // ********** validation ********** - - public TextRange getValidationTextRange(CompilationUnit astRoot) { - TextRange textRange = this.getAnnotationTextRange(astRoot); - return (textRange != null) ? textRange : this.getTypeMapping().getValidationTextRange(astRoot); - } - - protected TextRange getAnnotationTextRange(CompilationUnit astRoot) { - EclipseLinkChangeTrackingAnnotation annotation = this.getChangeTrackingAnnotation(); - return (annotation == null) ? null : annotation.getTextRange(astRoot); - } -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/java/JavaEclipseLinkConversionValue.java b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/java/JavaEclipseLinkConversionValue.java deleted file mode 100644 index 41c83ced16..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/java/JavaEclipseLinkConversionValue.java +++ /dev/null @@ -1,127 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2008, 2012 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.eclipselink.core.internal.context.java; - -import java.util.List; -import org.eclipse.jdt.core.dom.CompilationUnit; -import org.eclipse.jpt.common.core.utility.TextRange; -import org.eclipse.jpt.common.utility.internal.Tools; -import org.eclipse.jpt.jpa.core.internal.context.java.AbstractJavaJpaContextNode; -import org.eclipse.jpt.jpa.eclipselink.core.context.EclipseLinkConversionValue; -import org.eclipse.jpt.jpa.eclipselink.core.resource.java.EclipseLinkConversionValueAnnotation; -import org.eclipse.wst.validation.internal.provisional.core.IMessage; -import org.eclipse.wst.validation.internal.provisional.core.IReporter; - -public class JavaEclipseLinkConversionValue - extends AbstractJavaJpaContextNode - implements EclipseLinkConversionValue -{ - private final EclipseLinkConversionValueAnnotation conversionValueAnnotation; - - private String dataValue; - - private String objectValue; - - - public JavaEclipseLinkConversionValue(JavaEclipseLinkObjectTypeConverter parent, EclipseLinkConversionValueAnnotation conversionValueAnnotation) { - super(parent); - this.conversionValueAnnotation = conversionValueAnnotation; - this.dataValue = conversionValueAnnotation.getDataValue(); - this.objectValue = conversionValueAnnotation.getObjectValue(); - } - - - // ********** synchronize/update ********** - - @Override - public void synchronizeWithResourceModel() { - super.synchronizeWithResourceModel(); - this.setDataValue_(this.conversionValueAnnotation.getDataValue()); - this.setObjectValue_(this.conversionValueAnnotation.getObjectValue()); - } - - - // ********** data value ********** - - public String getDataValue() { - return this.dataValue; - } - - public void setDataValue(String value) { - this.conversionValueAnnotation.setDataValue(value); - this.setDataValue_(value); - } - - protected void setDataValue_(String value) { - String old = this.dataValue; - this.dataValue = value; - this.firePropertyChanged(DATA_VALUE_PROPERTY, old, value); - } - - - // ********** object value ********** - - public String getObjectValue() { - return this.objectValue; - } - - public void setObjectValue(String value) { - this.conversionValueAnnotation.setObjectValue(value); - this.setObjectValue_(value); - } - - protected void setObjectValue_(String value) { - String old = this.objectValue; - this.objectValue = value; - this.firePropertyChanged(OBJECT_VALUE_PROPERTY, old, value); - } - - - // ********** misc ********** - - @Override - public JavaEclipseLinkObjectTypeConverter getParent() { - return (JavaEclipseLinkObjectTypeConverter) super.getParent(); - } - - protected JavaEclipseLinkObjectTypeConverter getObjectTypeConverter() { - return this.getParent(); - } - - public EclipseLinkConversionValueAnnotation getConversionValueAnnotation() { - return this.conversionValueAnnotation; - } - - - // ********** validation ********** - - @Override - public void validate(List<IMessage> messages, IReporter reporter, CompilationUnit astRoot) { - super.validate(messages, reporter, astRoot); - } - - public TextRange getDataValueTextRange(CompilationUnit astRoot) { - return this.getValidationTextRange(this.conversionValueAnnotation.getDataValueTextRange(), astRoot); - } - - protected TextRange getObjectValueTextRange(CompilationUnit astRoot) { - return this.getValidationTextRange(this.conversionValueAnnotation.getObjectValueTextRange(), astRoot); - } - - public TextRange getValidationTextRange(CompilationUnit astRoot) { - TextRange textRange = this.conversionValueAnnotation.getTextRange(astRoot); - return (textRange != null) ? textRange : this.getObjectTypeConverter().getValidationTextRange(astRoot); - } - - public boolean isEquivalentTo(EclipseLinkConversionValue conversionValue) { - return Tools.valuesAreEqual(this.dataValue, conversionValue.getDataValue()) && - Tools.valuesAreEqual(this.objectValue, conversionValue.getObjectValue()); - } -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/java/JavaEclipseLinkConvert.java b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/java/JavaEclipseLinkConvert.java deleted file mode 100644 index 5704051483..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/java/JavaEclipseLinkConvert.java +++ /dev/null @@ -1,199 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2008, 2012 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.eclipselink.core.internal.context.java; - -import java.util.Arrays; -import org.eclipse.jdt.core.dom.CompilationUnit; -import org.eclipse.jpt.common.core.resource.java.Annotation; -import org.eclipse.jpt.common.utility.Filter; -import org.eclipse.jpt.common.utility.internal.StringTools; -import org.eclipse.jpt.common.utility.internal.iterables.CompositeIterable; -import org.eclipse.jpt.common.utility.internal.iterables.FilteringIterable; -import org.eclipse.jpt.jpa.core.JpaFactory; -import org.eclipse.jpt.jpa.core.context.Converter; -import org.eclipse.jpt.jpa.core.context.java.JavaAttributeMapping; -import org.eclipse.jpt.jpa.core.context.java.JavaConverter; -import org.eclipse.jpt.jpa.core.internal.context.JptValidator; -import org.eclipse.jpt.jpa.core.internal.jpa1.context.ConverterTextRangeResolver; -import org.eclipse.jpt.jpa.core.internal.jpa1.context.java.AbstractJavaConverter; -import org.eclipse.jpt.jpa.eclipselink.core.context.EclipseLinkConvert; -import org.eclipse.jpt.jpa.eclipselink.core.context.persistence.EclipseLinkPersistenceUnit; -import org.eclipse.jpt.jpa.eclipselink.core.internal.context.EclipseLinkConvertValidator; -import org.eclipse.jpt.jpa.eclipselink.core.resource.java.EclipseLinkConvertAnnotation; - -public class JavaEclipseLinkConvert - extends AbstractJavaConverter - implements EclipseLinkConvert -{ - private final EclipseLinkConvertAnnotation convertAnnotation; - - private String specifiedConverterName; - private String defaultConverterName; - - - public JavaEclipseLinkConvert(JavaAttributeMapping parent, EclipseLinkConvertAnnotation convertAnnotation, JavaConverter.Owner owner) { - super(parent, owner); - this.convertAnnotation = convertAnnotation; - this.specifiedConverterName = convertAnnotation.getValue(); - } - - public EclipseLinkConvertAnnotation getConverterAnnotation() { - return this.convertAnnotation; - } - - // ********** synchronize/update ********** - - @Override - public void synchronizeWithResourceModel() { - super.synchronizeWithResourceModel(); - this.setSpecifiedConverterName_(this.convertAnnotation.getValue()); - } - - @Override - public void update() { - super.update(); - this.setDefaultConverterName(this.buildDefaultConverterName()); - } - - - // ********** converter name ********** - - public String getConverterName() { - return (this.specifiedConverterName != null) ? this.specifiedConverterName : this.defaultConverterName; - } - - public String getSpecifiedConverterName() { - return this.specifiedConverterName; - } - - public void setSpecifiedConverterName(String name) { - this.convertAnnotation.setValue(name); - this.setSpecifiedConverterName_(name); - } - - protected void setSpecifiedConverterName_(String name) { - String old = this.specifiedConverterName; - this.specifiedConverterName = name; - this.firePropertyChanged(SPECIFIED_CONVERTER_NAME_PROPERTY, old, name); - } - - public String getDefaultConverterName() { - return this.defaultConverterName; - } - - protected void setDefaultConverterName(String name) { - String old = this.defaultConverterName; - this.defaultConverterName = name; - this.firePropertyChanged(DEFAULT_CONVERTER_NAME_PROPERTY, old, name); - } - - protected String buildDefaultConverterName() { - return DEFAULT_CONVERTER_NAME; - } - - - // ********** misc ********** - - public Class<? extends Converter> getType() { - return EclipseLinkConvert.class; - } - - /** - * Return whether the convert is <em>virtual</em> and, as a result, does - * not have a converter. - */ - protected boolean isVirtual() { - return this.getAttributeMapping().getPersistentAttribute().isVirtual(); - } - - - // ********** Java completion proposals ********** - - @Override - public Iterable<String> getJavaCompletionProposals(int pos, Filter<String> filter, CompilationUnit astRoot) { - Iterable<String> result = super.getJavaCompletionProposals(pos, filter, astRoot); - if (result != null) { - return result; - } - if (this.convertValueTouches(pos)) { - result = this.getJavaCandidateConverterNames(filter); - if (result != null) { - return result; - } - } - return null; - } - - protected boolean convertValueTouches(int pos) { - return this.convertAnnotation.valueTouches(pos); - } - - protected Iterable<String> getJavaCandidateConverterNames(Filter<String> filter) { - return StringTools.convertToJavaStringLiterals(this.getCandidateConverterNames(filter)); - } - - protected Iterable<String> getCandidateConverterNames(Filter<String> filter) { - return new FilteringIterable<String>(this.getConverterNames(), filter); - } - - /** - * @return names of the user-defined converters and of reserved converters - */ - @SuppressWarnings("unchecked") - protected Iterable<String> getConverterNames() { - return new CompositeIterable<String>( - this.getPersistenceUnit().getUniqueConverterNames(), - Arrays.asList(EclipseLinkConvert.RESERVED_CONVERTER_NAMES) - ); - } - - @Override - public EclipseLinkPersistenceUnit getPersistenceUnit() { - return (EclipseLinkPersistenceUnit) super.getPersistenceUnit(); - } - - - // ********** adapter ********** - - public static class Adapter - extends JavaConverter.AbstractAdapter - { - private static final Adapter INSTANCE = new Adapter(); - public static Adapter instance() { - return INSTANCE; - } - - private Adapter() { - super(); - } - - public Class<? extends Converter> getConverterType() { - return EclipseLinkConvert.class; - } - - @Override - protected String getAnnotationName() { - return EclipseLinkConvertAnnotation.ANNOTATION_NAME; - } - - public JavaConverter buildConverter(Annotation converterAnnotation, JavaAttributeMapping parent, JpaFactory factory) { - return new JavaEclipseLinkConvert(parent, (EclipseLinkConvertAnnotation) converterAnnotation, this.buildOwner()); - } - - @Override - protected Owner buildOwner() { - return new Owner() { - public JptValidator buildValidator(Converter converter, ConverterTextRangeResolver textRangeResolver) { - return new EclipseLinkConvertValidator((EclipseLinkConvert) converter, textRangeResolver); - } - }; - } - } -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/java/JavaEclipseLinkConverter.java b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/java/JavaEclipseLinkConverter.java deleted file mode 100644 index 0b15ca6dce..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/java/JavaEclipseLinkConverter.java +++ /dev/null @@ -1,171 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2008, 2012 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.eclipselink.core.internal.context.java; - -import java.util.List; -import org.eclipse.jdt.core.dom.CompilationUnit; -import org.eclipse.jpt.common.core.utility.TextRange; -import org.eclipse.jpt.common.utility.internal.ArrayTools; -import org.eclipse.jpt.common.utility.internal.StringTools; -import org.eclipse.jpt.common.utility.internal.Tools; -import org.eclipse.jpt.jpa.core.context.JpaNamedContextNode; -import org.eclipse.jpt.jpa.core.context.java.JavaJpaContextNode; -import org.eclipse.jpt.jpa.core.internal.context.java.AbstractJavaJpaContextNode; -import org.eclipse.jpt.jpa.eclipselink.core.context.EclipseLinkConvert; -import org.eclipse.jpt.jpa.eclipselink.core.context.EclipseLinkConverter; -import org.eclipse.jpt.jpa.eclipselink.core.context.java.JavaEclipseLinkConverterContainer; -import org.eclipse.jpt.jpa.eclipselink.core.context.orm.OrmEclipseLinkConverterContainer; -import org.eclipse.jpt.jpa.eclipselink.core.context.persistence.EclipseLinkPersistenceUnit; -import org.eclipse.jpt.jpa.eclipselink.core.internal.DefaultEclipseLinkJpaValidationMessages; -import org.eclipse.jpt.jpa.eclipselink.core.internal.EclipseLinkJpaValidationMessages; -import org.eclipse.jpt.jpa.eclipselink.core.resource.java.EclipseLinkNamedConverterAnnotation; -import org.eclipse.wst.validation.internal.provisional.core.IMessage; -import org.eclipse.wst.validation.internal.provisional.core.IReporter; - -/** - * <code> - * <ul> - * <li>org.eclipse.persistence.annotations.Converter - * <li>org.eclipse.persistence.annotations.StructConverter - * <li>org.eclipse.persistence.annotations.ObjectTypeConverter - * <li>org.eclipse.persistence.annotations.TypeConverter - * </ul> - * </code> - */ -public abstract class JavaEclipseLinkConverter<A extends EclipseLinkNamedConverterAnnotation> - extends AbstractJavaJpaContextNode - implements EclipseLinkConverter -{ - protected final A converterAnnotation; - - protected String name; - - - protected JavaEclipseLinkConverter(JavaJpaContextNode parent, A converterAnnotation) { - super(parent); - this.converterAnnotation = converterAnnotation; - this.name = converterAnnotation.getName(); - } - - - // ********** synchronize/update ********** - - @Override - public void synchronizeWithResourceModel() { - super.synchronizeWithResourceModel(); - this.setName_(this.converterAnnotation.getName()); - } - - @Override - public void update() { - super.update(); - } - - - // ********** name ********** - - public String getName() { - return this.name; - } - - public void setName(String name) { - this.converterAnnotation.setName(name); - this.setName_(name); - } - - protected void setName_(String name) { - String old = this.name; - this.name = name; - this.firePropertyChanged(NAME_PROPERTY, old, name); - } - - - // ********** misc ********** - - @Override - public JavaEclipseLinkConverterContainer getParent() { - return (JavaEclipseLinkConverterContainer) super.getParent(); - } - - public A getConverterAnnotation() { - return this.converterAnnotation; - } - - @Override - public EclipseLinkPersistenceUnit getPersistenceUnit() { - return (EclipseLinkPersistenceUnit) super.getPersistenceUnit(); - } - - public char getEnclosingTypeSeparator() { - return '.'; - } - - @Override - public void toString(StringBuilder sb) { - sb.append(this.name); - } - - - // ********** validation ********** - - @Override - public void validate(List<IMessage> messages, IReporter reporter, CompilationUnit astRoot) { - super.validate(messages, reporter, astRoot); - this.validateName(messages, astRoot); - } - - protected void validateName(List<IMessage> messages, CompilationUnit astRoot) { - if (StringTools.stringIsEmpty(this.name)) { - messages.add( - DefaultEclipseLinkJpaValidationMessages.buildMessage( - IMessage.HIGH_SEVERITY, - EclipseLinkJpaValidationMessages.CONVERTER_NAME_UNDEFINED, - EMPTY_STRING_ARRAY, - this, - this.getNameTextRange(astRoot) - ) - ); - return; - } - - if (ArrayTools.contains(EclipseLinkConvert.RESERVED_CONVERTER_NAMES, this.name)) { - messages.add( - DefaultEclipseLinkJpaValidationMessages.buildMessage( - IMessage.HIGH_SEVERITY, - EclipseLinkJpaValidationMessages.RESERVED_CONVERTER_NAME, - EMPTY_STRING_ARRAY, - this, - this.getNameTextRange(astRoot) - ) - ); - } - } - - public TextRange getValidationTextRange(CompilationUnit astRoot) { - TextRange textRange = this.converterAnnotation.getTextRange(astRoot); - return (textRange != null) ? textRange : this.getParent().getValidationTextRange(astRoot); - } - - public TextRange getNameTextRange(CompilationUnit astRoot){ - return this.getValidationTextRange(this.getConverterAnnotation().getNameTextRange(), astRoot); - } - - public boolean isEquivalentTo(JpaNamedContextNode node) { - return (this != node) && - (this.getType() == node.getType()) && - Tools.valuesAreEqual(this.name, node.getName()); - } - - // ********** metadata conversion ********** - - public abstract void convertTo(OrmEclipseLinkConverterContainer ormConverterContainer); - - public abstract void delete(); -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/java/JavaEclipseLinkConverterClassConverter.java b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/java/JavaEclipseLinkConverterClassConverter.java deleted file mode 100644 index 549acbf736..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/java/JavaEclipseLinkConverterClassConverter.java +++ /dev/null @@ -1,185 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2011, 2012 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.eclipselink.core.internal.context.java; - -import java.util.List; -import org.eclipse.jdt.core.dom.CompilationUnit; -import org.eclipse.jpt.common.core.internal.utility.JDTTools; -import org.eclipse.jpt.common.core.utility.TextRange; -import org.eclipse.jpt.common.utility.internal.StringTools; -import org.eclipse.jpt.common.utility.internal.Tools; -import org.eclipse.jpt.jpa.core.context.JpaNamedContextNode; -import org.eclipse.jpt.jpa.core.context.java.JavaJpaContextNode; -import org.eclipse.jpt.jpa.eclipselink.core.context.EclipseLinkConverterClassConverter; -import org.eclipse.jpt.jpa.eclipselink.core.internal.DefaultEclipseLinkJpaValidationMessages; -import org.eclipse.jpt.jpa.eclipselink.core.internal.EclipseLinkJpaValidationMessages; -import org.eclipse.jpt.jpa.eclipselink.core.resource.java.EclipseLinkNamedConverterAnnotation; -import org.eclipse.wst.validation.internal.provisional.core.IMessage; -import org.eclipse.wst.validation.internal.provisional.core.IReporter; - -/** - * <code> - * <ul> - * <li>org.eclipse.persistence.annotations.Converter - * <li>org.eclipse.persistence.annotations.StructConverter - * </ul> - * </code> - */ -public abstract class JavaEclipseLinkConverterClassConverter<A extends EclipseLinkNamedConverterAnnotation> - extends JavaEclipseLinkConverter<A> - implements EclipseLinkConverterClassConverter -{ - private String converterClass; - - - public JavaEclipseLinkConverterClassConverter(JavaJpaContextNode parent, A converterAnnotation, String converterClass) { - super(parent, converterAnnotation); - this.converterClass = converterClass; - } - - - // ********** synchronize/update ********** - - @Override - public void synchronizeWithResourceModel() { - super.synchronizeWithResourceModel(); - this.setConverterClass_(this.getAnnotationConverterClass()); - } - - - // ********** converter class ********** - - public String getConverterClass() { - return this.converterClass; - } - - public void setConverterClass(String converterClass) { - this.setAnnotationConverterClass(converterClass); - this.setConverterClass_(converterClass); - } - - protected void setConverterClass_(String converterClass) { - String old = this.converterClass; - this.converterClass = converterClass; - this.firePropertyChanged(CONVERTER_CLASS_PROPERTY, old, converterClass); - } - - protected abstract String getAnnotationConverterClass(); - - protected abstract void setAnnotationConverterClass(String converterClass); - - - // ********** JDT IType ********** - - /** - * Add <code>null</code> check. - */ - protected boolean typeExists(String typeName) { - return (typeName != null) && - (JDTTools.findType(this.getJavaProject(), typeName) != null); - } - - /** - * Add <code>null</code> check. - */ - protected boolean typeImplementsInterface(String typeName, String interfaceName) { - return (typeName != null) && - JDTTools.typeIsSubType(this.getJavaProject(), typeName, interfaceName); - } - - - //************ validation *************** - - @Override - public void validate(List<IMessage> messages, IReporter reporter, CompilationUnit astRoot) { - super.validate(messages, reporter, astRoot); - this.validateConverterClass(messages, astRoot); - } - - protected void validateConverterClass(List<IMessage> messages, CompilationUnit astRoot) { - if (this.converterClass == null) { - // the annotation will have a compile error if its converter class is missing - return; - } - - if (StringTools.stringIsEmpty(this.converterClass)) { - messages.add( - DefaultEclipseLinkJpaValidationMessages.buildMessage( - IMessage.HIGH_SEVERITY, - EclipseLinkJpaValidationMessages.CONVERTER_CLASS_DEFINED, - this, - this.getConverterClassTextRange(astRoot) - ) - ); - return; - } - - if ( ! this.converterClassExists()) { - this.addConverterClassDoesNotExistMessageTo(messages, astRoot); - return; - } - - if ( ! this.converterClassImplementsInterface(this.getEclipseLinkConverterInterface())) { - messages.add( - DefaultEclipseLinkJpaValidationMessages.buildMessage( - IMessage.HIGH_SEVERITY, - this.getEclipseLinkConverterInterfaceErrorMessage(), - new String[] {this.getFullyQualifiedConverterClass()}, - this, - this.getConverterClassTextRange(astRoot) - ) - ); - } - } - - protected void addConverterClassDoesNotExistMessageTo(List<IMessage> messages, CompilationUnit astRoot) { - messages.add( - DefaultEclipseLinkJpaValidationMessages.buildMessage( - IMessage.HIGH_SEVERITY, - EclipseLinkJpaValidationMessages.CONVERTER_CLASS_EXISTS, - new String[] {this.getFullyQualifiedConverterClass()}, - this, - this.getConverterClassTextRange(astRoot) - ) - ); - } - - /** - * Return the name of the EclipseLink interface the converter class must - * implement. - */ - protected abstract String getEclipseLinkConverterInterface(); - - protected abstract String getEclipseLinkConverterInterfaceErrorMessage(); - - protected boolean converterClassExists() { - return this.typeExists(this.getFullyQualifiedConverterClass()); - } - - protected boolean converterClassImplementsInterface(String interfaceName) { - return this.typeImplementsInterface(this.getFullyQualifiedConverterClass(), interfaceName); - } - - protected TextRange getConverterClassTextRange(CompilationUnit astRoot) { - return this.getValidationTextRange(this.getAnnotationConverterClassTextRange(), astRoot); - } - - protected abstract TextRange getAnnotationConverterClassTextRange(); - - @Override - public boolean isEquivalentTo(JpaNamedContextNode node) { - return super.isEquivalentTo(node) - && this.isEquivalentTo((EclipseLinkConverterClassConverter) node); - } - - protected boolean isEquivalentTo(EclipseLinkConverterClassConverter converter) { - return Tools.valuesAreEqual(this.getFullyQualifiedConverterClass(), converter.getFullyQualifiedConverterClass()); - } -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/java/JavaEclipseLinkConverterContainerImpl.java b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/java/JavaEclipseLinkConverterContainerImpl.java deleted file mode 100644 index 48f7bce159..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/java/JavaEclipseLinkConverterContainerImpl.java +++ /dev/null @@ -1,474 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2008, 2012 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.eclipselink.core.internal.context.java; - -import java.util.List; -import org.eclipse.jdt.core.dom.CompilationUnit; -import org.eclipse.jpt.common.core.resource.java.JavaResourceAnnotatedElement; -import org.eclipse.jpt.common.core.resource.java.NestableAnnotation; -import org.eclipse.jpt.common.core.utility.TextRange; -import org.eclipse.jpt.common.utility.internal.iterables.CompositeIterable; -import org.eclipse.jpt.common.utility.internal.iterables.EmptyListIterable; -import org.eclipse.jpt.common.utility.internal.iterables.ListIterable; -import org.eclipse.jpt.common.utility.internal.iterables.SubListIterableWrapper; -import org.eclipse.jpt.jpa.core.context.java.JavaJpaContextNode; -import org.eclipse.jpt.jpa.core.internal.context.java.AbstractJavaJpaContextNode; -import org.eclipse.jpt.jpa.eclipselink.core.context.EclipseLinkConverter; -import org.eclipse.jpt.jpa.eclipselink.core.context.EclipseLinkCustomConverter; -import org.eclipse.jpt.jpa.eclipselink.core.context.EclipseLinkObjectTypeConverter; -import org.eclipse.jpt.jpa.eclipselink.core.context.EclipseLinkStructConverter; -import org.eclipse.jpt.jpa.eclipselink.core.context.EclipseLinkTypeConverter; -import org.eclipse.jpt.jpa.eclipselink.core.context.java.JavaEclipseLinkConverterContainer; -import org.eclipse.jpt.jpa.eclipselink.core.resource.java.EclipseLinkConverterAnnotation; -import org.eclipse.jpt.jpa.eclipselink.core.resource.java.EclipseLinkObjectTypeConverterAnnotation; -import org.eclipse.jpt.jpa.eclipselink.core.resource.java.EclipseLinkStructConverterAnnotation; -import org.eclipse.jpt.jpa.eclipselink.core.resource.java.EclipseLinkTypeConverterAnnotation; -import org.eclipse.wst.validation.internal.provisional.core.IMessage; -import org.eclipse.wst.validation.internal.provisional.core.IReporter; - -public class JavaEclipseLinkConverterContainerImpl - extends AbstractJavaJpaContextNode - implements JavaEclipseLinkConverterContainer -{ - protected final ParentAdapter parentAdapter; - - protected final ContextListContainer<JavaEclipseLinkCustomConverter, EclipseLinkConverterAnnotation> customConverterContainer; - protected final ContextListContainer<JavaEclipseLinkObjectTypeConverter, EclipseLinkObjectTypeConverterAnnotation> objectTypeConverterContainer; - protected final ContextListContainer<JavaEclipseLinkStructConverter, EclipseLinkStructConverterAnnotation> structConverterContainer; - protected final ContextListContainer<JavaEclipseLinkTypeConverter, EclipseLinkTypeConverterAnnotation> typeConverterContainer; - - - public JavaEclipseLinkConverterContainerImpl(ParentAdapter parentAdapter) { - super(parentAdapter.getConverterContainerParent()); - this.parentAdapter = parentAdapter; - this.customConverterContainer = this.buildCustomConverterContainer(); - this.objectTypeConverterContainer = this.buildObjectTypeConverterContainer(); - this.structConverterContainer = this.buildStructConverterContainer(); - this.typeConverterContainer = this.buildTypeConverterContainer(); - } - - - // ********** synchronize/update ********** - - @Override - public void synchronizeWithResourceModel() { - super.synchronizeWithResourceModel(); - this.syncCustomConverters(); - this.syncObjectTypeConverters(); - this.syncStructConverters(); - this.syncTypeConverters(); - } - - @Override - public void update() { - super.update(); - this.updateNodes(this.getCustomConverters()); - this.updateNodes(this.getObjectTypeConverters()); - this.updateNodes(this.getStructConverters()); - this.updateNodes(this.getTypeConverters()); - } - - - // ********** custom converters ********** - - public ListIterable<JavaEclipseLinkCustomConverter> getCustomConverters() { - return this.customConverterContainer.getContextElements(); - } - - public int getCustomConvertersSize() { - return this.customConverterContainer.getContextElementsSize(); - } - - public JavaEclipseLinkCustomConverter addCustomConverter() { - return this.addCustomConverter(this.getCustomConvertersSize()); - } - - public JavaEclipseLinkCustomConverter addCustomConverter(int index) { - EclipseLinkConverterAnnotation annotation = this.addCustomConverterAnnotation(index); - return this.customConverterContainer.addContextElement(index, annotation); - } - - protected EclipseLinkConverterAnnotation addCustomConverterAnnotation(int index) { - return (EclipseLinkConverterAnnotation) this.getJavaResourceAnnotatedElement().addAnnotation(index, EclipseLinkConverterAnnotation.ANNOTATION_NAME); - } - - public void removeCustomConverter(EclipseLinkCustomConverter customConverter) { - this.removeCustomConverter(this.customConverterContainer.indexOfContextElement((JavaEclipseLinkCustomConverter) customConverter)); - } - - public void removeCustomConverter(int index) { - this.getJavaResourceAnnotatedElement().removeAnnotation(index, EclipseLinkConverterAnnotation.ANNOTATION_NAME); - this.customConverterContainer.removeContextElement(index); - } - - public void moveCustomConverter(int targetIndex, int sourceIndex) { - this.getJavaResourceAnnotatedElement().moveAnnotation(targetIndex, sourceIndex, EclipseLinkConverterAnnotation.ANNOTATION_NAME); - this.customConverterContainer.moveContextElement(targetIndex, sourceIndex); - } - - protected JavaEclipseLinkCustomConverter buildCustomConverter(EclipseLinkConverterAnnotation converterAnnotation) { - return new JavaEclipseLinkCustomConverter(this, converterAnnotation); - } - - protected void syncCustomConverters() { - this.customConverterContainer.synchronizeWithResourceModel(); - } - - protected ListIterable<EclipseLinkConverterAnnotation> getCustomConverterAnnotations() { - return this.parentAdapter.parentSupportsConverters() ? - new SubListIterableWrapper<NestableAnnotation, EclipseLinkConverterAnnotation>(this.getNestableCustomConverterAnnotations_()) : - EmptyListIterable.<EclipseLinkConverterAnnotation>instance(); - } - - protected ListIterable<NestableAnnotation> getNestableCustomConverterAnnotations_() { - return this.getJavaResourceAnnotatedElement().getAnnotations(EclipseLinkConverterAnnotation.ANNOTATION_NAME); - } - - protected ContextListContainer<JavaEclipseLinkCustomConverter, EclipseLinkConverterAnnotation> buildCustomConverterContainer() { - CustomConverterContainer container = new CustomConverterContainer(); - container.initialize(); - return container; - } - - /** - * custom converter container - */ - protected class CustomConverterContainer - extends ContextListContainer<JavaEclipseLinkCustomConverter, EclipseLinkConverterAnnotation> - { - @Override - protected String getContextElementsPropertyName() { - return CUSTOM_CONVERTERS_LIST; - } - @Override - protected JavaEclipseLinkCustomConverter buildContextElement(EclipseLinkConverterAnnotation resourceElement) { - return JavaEclipseLinkConverterContainerImpl.this.buildCustomConverter(resourceElement); - } - @Override - protected ListIterable<EclipseLinkConverterAnnotation> getResourceElements() { - return JavaEclipseLinkConverterContainerImpl.this.getCustomConverterAnnotations(); - } - @Override - protected EclipseLinkConverterAnnotation getResourceElement(JavaEclipseLinkCustomConverter contextElement) { - return contextElement.getConverterAnnotation(); - } - } - - // ********** object type converters ********** - - public ListIterable<JavaEclipseLinkObjectTypeConverter> getObjectTypeConverters() { - return this.objectTypeConverterContainer.getContextElements(); - } - - public int getObjectTypeConvertersSize() { - return this.objectTypeConverterContainer.getContextElementsSize(); - } - - public JavaEclipseLinkObjectTypeConverter addObjectTypeConverter() { - return this.addObjectTypeConverter(this.getObjectTypeConvertersSize()); - } - - public JavaEclipseLinkObjectTypeConverter addObjectTypeConverter(int index) { - EclipseLinkObjectTypeConverterAnnotation annotation = this.addObjectTypeConverterAnnotation(index); - return this.objectTypeConverterContainer.addContextElement(index, annotation); - } - - protected EclipseLinkObjectTypeConverterAnnotation addObjectTypeConverterAnnotation(int index) { - return (EclipseLinkObjectTypeConverterAnnotation) this.getJavaResourceAnnotatedElement().addAnnotation(index, EclipseLinkObjectTypeConverterAnnotation.ANNOTATION_NAME); - } - - public void removeObjectTypeConverter(EclipseLinkObjectTypeConverter objectTypeConverter) { - this.removeObjectTypeConverter(this.objectTypeConverterContainer.indexOfContextElement((JavaEclipseLinkObjectTypeConverter) objectTypeConverter)); - } - - public void removeObjectTypeConverter(int index) { - this.getJavaResourceAnnotatedElement().removeAnnotation(index, EclipseLinkObjectTypeConverterAnnotation.ANNOTATION_NAME); - this.objectTypeConverterContainer.removeContextElement(index); - } - - public void moveObjectTypeConverter(int targetIndex, int sourceIndex) { - this.getJavaResourceAnnotatedElement().moveAnnotation(targetIndex, sourceIndex, EclipseLinkObjectTypeConverterAnnotation.ANNOTATION_NAME); - this.objectTypeConverterContainer.moveContextElement(targetIndex, sourceIndex); - } - - protected JavaEclipseLinkObjectTypeConverter buildObjectTypeConverter(EclipseLinkObjectTypeConverterAnnotation converterAnnotation) { - return new JavaEclipseLinkObjectTypeConverter(this, converterAnnotation); - } - - protected void syncObjectTypeConverters() { - this.objectTypeConverterContainer.synchronizeWithResourceModel(); - } - - protected ListIterable<EclipseLinkObjectTypeConverterAnnotation> getObjectTypeConverterAnnotations() { - return this.parentAdapter.parentSupportsConverters() ? - new SubListIterableWrapper<NestableAnnotation, EclipseLinkObjectTypeConverterAnnotation>(this.getNestableObjectTypeConverterAnnotations_()) : - EmptyListIterable.<EclipseLinkObjectTypeConverterAnnotation>instance(); - } - - protected ListIterable<NestableAnnotation> getNestableObjectTypeConverterAnnotations_() { - return this.getJavaResourceAnnotatedElement().getAnnotations(EclipseLinkObjectTypeConverterAnnotation.ANNOTATION_NAME); - } - - protected ContextListContainer<JavaEclipseLinkObjectTypeConverter, EclipseLinkObjectTypeConverterAnnotation> buildObjectTypeConverterContainer() { - ObjectTypeConverterContainer container = new ObjectTypeConverterContainer(); - container.initialize(); - return container; - } - - /** - * objectType converter container - */ - protected class ObjectTypeConverterContainer - extends ContextListContainer<JavaEclipseLinkObjectTypeConverter, EclipseLinkObjectTypeConverterAnnotation> - { - @Override - protected String getContextElementsPropertyName() { - return OBJECT_TYPE_CONVERTERS_LIST; - } - @Override - protected JavaEclipseLinkObjectTypeConverter buildContextElement(EclipseLinkObjectTypeConverterAnnotation resourceElement) { - return JavaEclipseLinkConverterContainerImpl.this.buildObjectTypeConverter(resourceElement); - } - @Override - protected ListIterable<EclipseLinkObjectTypeConverterAnnotation> getResourceElements() { - return JavaEclipseLinkConverterContainerImpl.this.getObjectTypeConverterAnnotations(); - } - @Override - protected EclipseLinkObjectTypeConverterAnnotation getResourceElement(JavaEclipseLinkObjectTypeConverter contextElement) { - return contextElement.getConverterAnnotation(); - } - } - - // ********** struct converters ********** - - public ListIterable<JavaEclipseLinkStructConverter> getStructConverters() { - return this.structConverterContainer.getContextElements(); - } - - public int getStructConvertersSize() { - return this.structConverterContainer.getContextElementsSize(); - } - - public JavaEclipseLinkStructConverter addStructConverter() { - return this.addStructConverter(this.getStructConvertersSize()); - } - - public JavaEclipseLinkStructConverter addStructConverter(int index) { - EclipseLinkStructConverterAnnotation annotation = this.addStructConverterAnnotation(index); - return this.structConverterContainer.addContextElement(index, annotation); - } - - protected EclipseLinkStructConverterAnnotation addStructConverterAnnotation(int index) { - return (EclipseLinkStructConverterAnnotation) this.getJavaResourceAnnotatedElement().addAnnotation(index, EclipseLinkStructConverterAnnotation.ANNOTATION_NAME); - } - - public void removeStructConverter(EclipseLinkStructConverter structConverter) { - this.removeStructConverter(this.structConverterContainer.indexOfContextElement((JavaEclipseLinkStructConverter) structConverter)); - } - - public void removeStructConverter(int index) { - this.getJavaResourceAnnotatedElement().removeAnnotation(index, EclipseLinkStructConverterAnnotation.ANNOTATION_NAME); - this.structConverterContainer.removeContextElement(index); - } - - public void moveStructConverter(int targetIndex, int sourceIndex) { - this.getJavaResourceAnnotatedElement().moveAnnotation(targetIndex, sourceIndex, EclipseLinkStructConverterAnnotation.ANNOTATION_NAME); - this.structConverterContainer.moveContextElement(targetIndex, sourceIndex); - } - - protected JavaEclipseLinkStructConverter buildStructConverter(EclipseLinkStructConverterAnnotation converterAnnotation) { - return new JavaEclipseLinkStructConverter(this, converterAnnotation); - } - - protected void syncStructConverters() { - this.structConverterContainer.synchronizeWithResourceModel(); - } - - protected ListIterable<EclipseLinkStructConverterAnnotation> getStructConverterAnnotations() { - return this.parentAdapter.parentSupportsConverters() ? - new SubListIterableWrapper<NestableAnnotation, EclipseLinkStructConverterAnnotation>(this.getNestableStructConverterAnnotations_()) : - EmptyListIterable.<EclipseLinkStructConverterAnnotation>instance(); - } - - protected ListIterable<NestableAnnotation> getNestableStructConverterAnnotations_() { - return this.getJavaResourceAnnotatedElement().getAnnotations(EclipseLinkStructConverterAnnotation.ANNOTATION_NAME); - } - - protected ContextListContainer<JavaEclipseLinkStructConverter, EclipseLinkStructConverterAnnotation> buildStructConverterContainer() { - StructConverterContainer container = new StructConverterContainer(); - container.initialize(); - return container; - } - - /** - * struct converter container - */ - protected class StructConverterContainer - extends ContextListContainer<JavaEclipseLinkStructConverter, EclipseLinkStructConverterAnnotation> - { - @Override - protected String getContextElementsPropertyName() { - return STRUCT_CONVERTERS_LIST; - } - @Override - protected JavaEclipseLinkStructConverter buildContextElement(EclipseLinkStructConverterAnnotation resourceElement) { - return JavaEclipseLinkConverterContainerImpl.this.buildStructConverter(resourceElement); - } - @Override - protected ListIterable<EclipseLinkStructConverterAnnotation> getResourceElements() { - return JavaEclipseLinkConverterContainerImpl.this.getStructConverterAnnotations(); - } - @Override - protected EclipseLinkStructConverterAnnotation getResourceElement(JavaEclipseLinkStructConverter contextElement) { - return contextElement.getConverterAnnotation(); - } - } - - - // ********** type converters ********** - - public ListIterable<JavaEclipseLinkTypeConverter> getTypeConverters() { - return this.typeConverterContainer.getContextElements(); - } - - public int getTypeConvertersSize() { - return this.typeConverterContainer.getContextElementsSize(); - } - - public JavaEclipseLinkTypeConverter addTypeConverter() { - return this.addTypeConverter(this.getTypeConvertersSize()); - } - - public JavaEclipseLinkTypeConverter addTypeConverter(int index) { - EclipseLinkTypeConverterAnnotation annotation = this.addTypeConverterAnnotation(index); - return this.typeConverterContainer.addContextElement(index, annotation); - } - - protected EclipseLinkTypeConverterAnnotation addTypeConverterAnnotation(int index) { - return (EclipseLinkTypeConverterAnnotation) this.getJavaResourceAnnotatedElement().addAnnotation(index, EclipseLinkTypeConverterAnnotation.ANNOTATION_NAME); - } - - public void removeTypeConverter(EclipseLinkTypeConverter typeConverter) { - this.removeTypeConverter(this.typeConverterContainer.indexOfContextElement((JavaEclipseLinkTypeConverter) typeConverter)); - } - - public void removeTypeConverter(int index) { - this.getJavaResourceAnnotatedElement().removeAnnotation(index, EclipseLinkTypeConverterAnnotation.ANNOTATION_NAME); - this.typeConverterContainer.removeContextElement(index); - } - - public void moveTypeConverter(int targetIndex, int sourceIndex) { - this.getJavaResourceAnnotatedElement().moveAnnotation(targetIndex, sourceIndex, EclipseLinkTypeConverterAnnotation.ANNOTATION_NAME); - this.typeConverterContainer.moveContextElement(targetIndex, sourceIndex); - } - - protected JavaEclipseLinkTypeConverter buildTypeConverter(EclipseLinkTypeConverterAnnotation converterAnnotation) { - return new JavaEclipseLinkTypeConverter(this, converterAnnotation); - } - - protected void syncTypeConverters() { - this.typeConverterContainer.synchronizeWithResourceModel(); - } - - protected ListIterable<EclipseLinkTypeConverterAnnotation> getTypeConverterAnnotations() { - return this.parentAdapter.parentSupportsConverters() ? - new SubListIterableWrapper<NestableAnnotation, EclipseLinkTypeConverterAnnotation>(this.getNestableTypeConverterAnnotations_()) : - EmptyListIterable.<EclipseLinkTypeConverterAnnotation>instance(); - } - - protected ListIterable<NestableAnnotation> getNestableTypeConverterAnnotations_() { - return this.getJavaResourceAnnotatedElement().getAnnotations(EclipseLinkTypeConverterAnnotation.ANNOTATION_NAME); - } - - protected ContextListContainer<JavaEclipseLinkTypeConverter, EclipseLinkTypeConverterAnnotation> buildTypeConverterContainer() { - TypeConverterContainer container = new TypeConverterContainer(); - container.initialize(); - return container; - } - - /** - * type converter container - */ - protected class TypeConverterContainer - extends ContextListContainer<JavaEclipseLinkTypeConverter, EclipseLinkTypeConverterAnnotation> - { - @Override - protected String getContextElementsPropertyName() { - return TYPE_CONVERTERS_LIST; - } - @Override - protected JavaEclipseLinkTypeConverter buildContextElement(EclipseLinkTypeConverterAnnotation resourceElement) { - return JavaEclipseLinkConverterContainerImpl.this.buildTypeConverter(resourceElement); - } - @Override - protected ListIterable<EclipseLinkTypeConverterAnnotation> getResourceElements() { - return JavaEclipseLinkConverterContainerImpl.this.getTypeConverterAnnotations(); - } - @Override - protected EclipseLinkTypeConverterAnnotation getResourceElement(JavaEclipseLinkTypeConverter contextElement) { - return contextElement.getConverterAnnotation(); - } - } - - - // ********** misc ********** - - @Override - public JavaJpaContextNode getParent() { - return (JavaJpaContextNode) super.getParent(); - } - - protected ParentAdapter getParentAdapter() { - return this.parentAdapter; - } - - protected JavaResourceAnnotatedElement getJavaResourceAnnotatedElement() { - return this.getParentAdapter().getJavaResourceAnnotatedElement(); - } - - @SuppressWarnings("unchecked") - public Iterable<EclipseLinkConverter> getConverters() { - return new CompositeIterable<EclipseLinkConverter>( - this.getCustomConverters(), - this.getObjectTypeConverters(), - this.getStructConverters(), - this.getTypeConverters() - ); - } - - public int getConvertersSize() { - return this.getCustomConvertersSize() - + this.getObjectTypeConvertersSize() - + this.getStructConvertersSize() - + this.getTypeConvertersSize(); - } - - public int getNumberSupportedConverters() { - return Integer.MAX_VALUE; - } - - - // ********** validation ********** - - /** - * The converters are validated in the persistence unit. - * @see org.eclipse.jpt.jpa.eclipselink.core.context.persistence.EclipseLinkPersistenceUnit#validateConverters(List, IReporter) - */ - @Override - public void validate(List<IMessage> messages, IReporter reporter, CompilationUnit astRoot) { - super.validate(messages, reporter, astRoot); - // converters are validated in the persistence unit - } - - public TextRange getValidationTextRange(CompilationUnit astRoot) { - TextRange textRange = this.getJavaResourceAnnotatedElement().getTextRange(astRoot); - return (textRange != null) ? textRange : this.getParent().getValidationTextRange(astRoot); - } -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/java/JavaEclipseLinkCustomConverter.java b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/java/JavaEclipseLinkCustomConverter.java deleted file mode 100644 index 70b7d67957..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/java/JavaEclipseLinkCustomConverter.java +++ /dev/null @@ -1,112 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2008, 2012 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.eclipselink.core.internal.context.java; - -import java.util.List; -import org.eclipse.jdt.core.dom.CompilationUnit; -import org.eclipse.jpt.common.core.utility.TextRange; -import org.eclipse.jpt.jpa.eclipselink.core.context.EclipseLinkCustomConverter; -import org.eclipse.jpt.jpa.eclipselink.core.context.java.JavaEclipseLinkConverterContainer; -import org.eclipse.jpt.jpa.eclipselink.core.context.orm.OrmEclipseLinkConverterContainer; -import org.eclipse.jpt.jpa.eclipselink.core.internal.EclipseLinkJpaValidationMessages; -import org.eclipse.jpt.jpa.eclipselink.core.resource.java.EclipseLinkConverterAnnotation; -import org.eclipse.wst.validation.internal.provisional.core.IMessage; - -/** - * <code>org.eclipse.persistence.annotations.Converter</code> - */ -public class JavaEclipseLinkCustomConverter - extends JavaEclipseLinkConverterClassConverter<EclipseLinkConverterAnnotation> - implements EclipseLinkCustomConverter -{ - private String fullyQualifiedConverterClass; - - - public JavaEclipseLinkCustomConverter(JavaEclipseLinkConverterContainer parent, EclipseLinkConverterAnnotation converterAnnotation) { - super(parent, converterAnnotation, converterAnnotation.getConverterClass()); - } - - - // ********** synchronize/update ********** - - @Override - public void update() { - super.update(); - this.setFullyQualifiedConverterClass(this.converterAnnotation.getFullyQualifiedConverterClassName()); - } - - - // ********** converter class ********** - - @Override - protected String getAnnotationConverterClass() { - return this.converterAnnotation.getConverterClass(); - } - - @Override - protected void setAnnotationConverterClass(String converterClass) { - this.converterAnnotation.setConverterClass(converterClass); - } - - - // ********** fully qualified converter class ********** - - public String getFullyQualifiedConverterClass() { - return this.fullyQualifiedConverterClass; - } - - protected void setFullyQualifiedConverterClass(String converterClass) { - String old = this.fullyQualifiedConverterClass; - this.fullyQualifiedConverterClass = converterClass; - this.firePropertyChanged(FULLY_QUALIFIED_CONVERTER_CLASS_PROPERTY, old, converterClass); - } - - - // ********** misc ********** - - public Class<EclipseLinkCustomConverter> getType() { - return EclipseLinkCustomConverter.class; - } - - - //************ validation *************** - - @Override - protected String getEclipseLinkConverterInterface() { - return ECLIPSELINK_CONVERTER_CLASS_NAME; - } - - @Override - protected String getEclipseLinkConverterInterfaceErrorMessage() { - return EclipseLinkJpaValidationMessages.CONVERTER_CLASS_IMPLEMENTS_CONVERTER; - } - - @Override - protected TextRange getAnnotationConverterClassTextRange() { - return this.converterAnnotation.getConverterClassTextRange(); - } - - @Override - protected void addConverterClassDoesNotExistMessageTo(List<IMessage> messages, CompilationUnit astRoot) { - // no need to add message since there will already be a compiler error - } - - // ********** metadata conversion ********** - - @Override - public void convertTo(OrmEclipseLinkConverterContainer ormConverterContainer) { - ormConverterContainer.addCustomConverter().convertFrom(this); - } - - @Override - public void delete() { - this.getParent().removeCustomConverter(this); - } -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/java/JavaEclipseLinkCustomizer.java b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/java/JavaEclipseLinkCustomizer.java deleted file mode 100644 index 55c275757f..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/java/JavaEclipseLinkCustomizer.java +++ /dev/null @@ -1,209 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2008, 2012 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.eclipselink.core.internal.context.java; - -import java.util.List; -import org.eclipse.jdt.core.IType; -import org.eclipse.jdt.core.dom.CompilationUnit; -import org.eclipse.jpt.common.core.internal.utility.JDTTools; -import org.eclipse.jpt.common.core.resource.java.JavaResourceType; -import org.eclipse.jpt.common.core.utility.TextRange; -import org.eclipse.jpt.jpa.core.internal.context.java.AbstractJavaJpaContextNode; -import org.eclipse.jpt.jpa.eclipselink.core.context.EclipseLinkCustomizer; -import org.eclipse.jpt.jpa.eclipselink.core.context.java.EclipseLinkJavaTypeMapping; -import org.eclipse.jpt.jpa.eclipselink.core.internal.DefaultEclipseLinkJpaValidationMessages; -import org.eclipse.jpt.jpa.eclipselink.core.internal.EclipseLinkJpaValidationMessages; -import org.eclipse.jpt.jpa.eclipselink.core.resource.java.EclipseLinkCustomizerAnnotation; -import org.eclipse.wst.validation.internal.provisional.core.IMessage; -import org.eclipse.wst.validation.internal.provisional.core.IReporter; - -public class JavaEclipseLinkCustomizer - extends AbstractJavaJpaContextNode - implements EclipseLinkCustomizer -{ - private String specifiedCustomizerClass; - - private String fullyQualifiedCustomizerClass; - - - public JavaEclipseLinkCustomizer(EclipseLinkJavaTypeMapping parent) { - super(parent); - this.specifiedCustomizerClass = this.buildSpecifiedCustomizerClass(); - } - - - // ********** synchronize/update ********** - - @Override - public void synchronizeWithResourceModel() { - super.synchronizeWithResourceModel(); - this.setSpecifiedCustomizerClass_(this.buildSpecifiedCustomizerClass()); - } - - @Override - public void update() { - super.update(); - this.setFullyQualifiedCustomizerClass(this.buildFullyQualifiedCustomizerClass()); - } - - - // ********** customizer class ********** - - public String getCustomizerClass() { - return (this.specifiedCustomizerClass != null) ? this.specifiedCustomizerClass : null; - } - - public String getSpecifiedCustomizerClass() { - return this.specifiedCustomizerClass; - } - - public void setSpecifiedCustomizerClass(String customizerClass) { - if (this.valuesAreDifferent(customizerClass, this.specifiedCustomizerClass)) { - EclipseLinkCustomizerAnnotation annotation = this.getCustomizerAnnotation(); - if (customizerClass == null) { - if (annotation != null) { - this.removeCustomizerAnnotation(); - } - } else { - if (annotation == null) { - annotation = this.addCustomizerAnnotation(); - } - annotation.setValue(customizerClass); - } - - this.setSpecifiedCustomizerClass_(customizerClass); - } - } - - protected void setSpecifiedCustomizerClass_(String customizerClass) { - String old = this.specifiedCustomizerClass; - this.specifiedCustomizerClass = customizerClass; - this.firePropertyChanged(SPECIFIED_CUSTOMIZER_CLASS_PROPERTY, old, customizerClass); - } - - protected String buildSpecifiedCustomizerClass() { - EclipseLinkCustomizerAnnotation annotation = this.getCustomizerAnnotation(); - return (annotation == null) ? null : annotation.getValue(); - } - - public String getDefaultCustomizerClass() { - return null; // no default for Java - } - - - // ********** fully-qualified customizer class ********** - - public String getFullyQualifiedCustomizerClass() { - return this.fullyQualifiedCustomizerClass; - } - - protected void setFullyQualifiedCustomizerClass(String customizerClass) { - String old = this.fullyQualifiedCustomizerClass; - this.fullyQualifiedCustomizerClass = customizerClass; - this.firePropertyChanged(FULLY_QUALIFIED_CUSTOMIZER_CLASS_PROPERTY, old, customizerClass); - } - - protected String buildFullyQualifiedCustomizerClass() { - EclipseLinkCustomizerAnnotation annotation = this.getCustomizerAnnotation(); - return (annotation == null) ? null : annotation.getFullyQualifiedCustomizerClassName(); - } - - - // ********** customizer annotation ********** - - protected EclipseLinkCustomizerAnnotation getCustomizerAnnotation() { - return (EclipseLinkCustomizerAnnotation) this.getJavaResourceType().getAnnotation(this.getCustomizerAnnotationName()); - } - - protected EclipseLinkCustomizerAnnotation addCustomizerAnnotation() { - return (EclipseLinkCustomizerAnnotation) this.getJavaResourceType().addAnnotation(this.getCustomizerAnnotationName()); - } - - protected void removeCustomizerAnnotation() { - this.getJavaResourceType().removeAnnotation(this.getCustomizerAnnotationName()); - } - - protected String getCustomizerAnnotationName() { - return EclipseLinkCustomizerAnnotation.ANNOTATION_NAME; - } - - - // ********** misc ********** - - @Override - public EclipseLinkJavaTypeMapping getParent() { - return (EclipseLinkJavaTypeMapping) super.getParent(); - } - - protected EclipseLinkJavaTypeMapping getTypeMapping() { - return this.getParent(); - } - - protected JavaResourceType getJavaResourceType() { - return this.getTypeMapping().getJavaResourceType(); - } - - public char getCustomizerClassEnclosingTypeSeparator() { - return '.'; - } - - - // ********** validation ********** - - @Override - public void validate(List<IMessage> messages, IReporter reporter, CompilationUnit astRoot) { - super.validate(messages, reporter, astRoot); - this.validateCustomizerClass(messages, astRoot); - } - - protected void validateCustomizerClass(List<IMessage> messages,CompilationUnit astRoot) { - if (this.getFullyQualifiedCustomizerClass() == null) { - return; - } - //if the type cannot be resolved there is no need to perform the following validation, - //JDT will note the error in the source - IType customizerJdtType = JDTTools.findType(this.getJavaProject(), this.getFullyQualifiedCustomizerClass()); - if (customizerJdtType == null) { - return; - } - if (!JDTTools.typeHasPublicZeroArgConstructor(customizerJdtType)) { - messages.add( - DefaultEclipseLinkJpaValidationMessages.buildMessage( - IMessage.HIGH_SEVERITY, - EclipseLinkJpaValidationMessages.DESCRIPTOR_CUSTOMIZER_CLASS_NOT_VALID, - new String[] {this.getFullyQualifiedCustomizerClass()}, - this, - this.getCustomizerClassTextRange(astRoot) - ) - ); - } - EclipseLinkCustomizerAnnotation annotation = this.getCustomizerAnnotation(); - if (!annotation.customizerClassImplementsInterface(ECLIPSELINK_DESCRIPTOR_CUSTOMIZER_CLASS_NAME, astRoot)) { - messages.add( - DefaultEclipseLinkJpaValidationMessages.buildMessage( - IMessage.HIGH_SEVERITY, - EclipseLinkJpaValidationMessages.DESCRIPTOR_CUSTOMIZER_CLASS_IMPLEMENTS_DESCRIPTOR_CUSTOMIZER, - new String[] {this.getFullyQualifiedCustomizerClass()}, - this, - this.getCustomizerClassTextRange(astRoot) - ) - ); - } - } - - protected TextRange getCustomizerClassTextRange(CompilationUnit astRoot) { - return this.getValidationTextRange(this.getCustomizerAnnotation().getValueTextRange(), astRoot); - } - - public TextRange getValidationTextRange(CompilationUnit astRoot) { - TextRange textRange = this.getCustomizerAnnotation().getTextRange(astRoot); - return (textRange != null) ? textRange : this.getTypeMapping().getValidationTextRange(astRoot); - } -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/java/JavaEclipseLinkElementCollectionMapping2_0.java b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/java/JavaEclipseLinkElementCollectionMapping2_0.java deleted file mode 100644 index f2ba879a37..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/java/JavaEclipseLinkElementCollectionMapping2_0.java +++ /dev/null @@ -1,111 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010, 2012 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.eclipselink.core.internal.context.java; - -import java.util.List; -import org.eclipse.jdt.core.dom.CompilationUnit; -import org.eclipse.jpt.common.core.resource.java.JavaResourceAnnotatedElement; -import org.eclipse.jpt.common.utility.internal.iterables.CompositeIterable; -import org.eclipse.jpt.jpa.core.context.java.JavaConverter; -import org.eclipse.jpt.jpa.core.context.java.JavaJpaContextNode; -import org.eclipse.jpt.jpa.core.context.java.JavaPersistentAttribute; -import org.eclipse.jpt.jpa.core.internal.jpa2.context.java.AbstractJavaElementCollectionMapping2_0; -import org.eclipse.jpt.jpa.eclipselink.core.context.EclipseLinkElementCollectionMapping2_0; -import org.eclipse.jpt.jpa.eclipselink.core.context.EclipseLinkJoinFetch; -import org.eclipse.jpt.jpa.eclipselink.core.context.java.EclipseLinkJavaConvertibleMapping; -import org.eclipse.jpt.jpa.eclipselink.core.context.java.JavaEclipseLinkConverterContainer; -import org.eclipse.wst.validation.internal.provisional.core.IMessage; -import org.eclipse.wst.validation.internal.provisional.core.IReporter; - - -public class JavaEclipseLinkElementCollectionMapping2_0 - extends AbstractJavaElementCollectionMapping2_0 - implements EclipseLinkElementCollectionMapping2_0, EclipseLinkJavaConvertibleMapping -{ - protected final JavaEclipseLinkJoinFetch joinFetch; - - protected final JavaEclipseLinkConverterContainer converterContainer; - - public JavaEclipseLinkElementCollectionMapping2_0(JavaPersistentAttribute parent) { - super(parent); - this.joinFetch = new JavaEclipseLinkJoinFetch(this); - this.converterContainer = this.buildConverterContainer(); - } - - // ********** synchronize/update ********** - - @Override - public void synchronizeWithResourceModel() { - super.synchronizeWithResourceModel(); - this.joinFetch.synchronizeWithResourceModel(); - this.converterContainer.synchronizeWithResourceModel(); - } - - @Override - public void update() { - super.update(); - this.joinFetch.update(); - this.converterContainer.update(); - } - - - // ********** join fetch ********** - - public EclipseLinkJoinFetch getJoinFetch() { - return this.joinFetch; - } - - - // ********** converters ********** - - public JavaEclipseLinkConverterContainer getConverterContainer() { - return this.converterContainer; - } - - protected JavaEclipseLinkConverterContainer buildConverterContainer() { - return new JavaEclipseLinkConverterContainerImpl(this); - } - - // ********** converter container parent adapter ********** - - public JavaJpaContextNode getConverterContainerParent() { - return this; // no adapter - } - - public JavaResourceAnnotatedElement getJavaResourceAnnotatedElement() { - return this.getResourceAttribute(); - } - - public boolean parentSupportsConverters() { - return ! this.getPersistentAttribute().isVirtual(); - } - - // ********** converter adapters ********** - - /** - * put the EclipseLink convert adapter first - this is the order EclipseLink searches - */ - @Override - protected Iterable<JavaConverter.Adapter> getConverterAdapters() { - return new CompositeIterable<JavaConverter.Adapter>( - JavaEclipseLinkConvert.Adapter.instance(), - super.getConverterAdapters() - ); - } - - - // ********** validation ********** - - @Override - public void validate(List<IMessage> messages, IReporter reporter, CompilationUnit astRoot) { - super.validate(messages, reporter, astRoot); - this.joinFetch.validate(messages, reporter, astRoot); - } -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/java/JavaEclipseLinkEmbeddableImpl.java b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/java/JavaEclipseLinkEmbeddableImpl.java deleted file mode 100644 index aa64876362..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/java/JavaEclipseLinkEmbeddableImpl.java +++ /dev/null @@ -1,170 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2008, 2012 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.eclipselink.core.internal.context.java; - -import java.util.List; -import org.eclipse.jdt.core.dom.CompilationUnit; -import org.eclipse.jpt.common.core.resource.java.JavaResourceAnnotatedElement; -import org.eclipse.jpt.common.utility.internal.NotNullFilter; -import org.eclipse.jpt.common.utility.internal.iterables.CompositeIterable; -import org.eclipse.jpt.common.utility.internal.iterables.FilteringIterable; -import org.eclipse.jpt.common.utility.internal.iterables.TransformationIterable; -import org.eclipse.jpt.jpa.core.context.AttributeMapping; -import org.eclipse.jpt.jpa.core.context.java.JavaJpaContextNode; -import org.eclipse.jpt.jpa.core.context.java.JavaPersistentType; -import org.eclipse.jpt.jpa.core.internal.context.JptValidator; -import org.eclipse.jpt.jpa.core.internal.context.java.AbstractJavaEmbeddable; -import org.eclipse.jpt.jpa.core.resource.java.EmbeddableAnnotation; -import org.eclipse.jpt.jpa.eclipselink.core.context.EclipseLinkChangeTracking; -import org.eclipse.jpt.jpa.eclipselink.core.context.EclipseLinkConverter; -import org.eclipse.jpt.jpa.eclipselink.core.context.EclipseLinkCustomizer; -import org.eclipse.jpt.jpa.eclipselink.core.context.java.JavaEclipseLinkConverterContainer; -import org.eclipse.jpt.jpa.eclipselink.core.context.java.JavaEclipseLinkEmbeddable; -import org.eclipse.jpt.jpa.eclipselink.core.internal.context.EclipseLinkTypeMappingValidator; -import org.eclipse.wst.validation.internal.provisional.core.IMessage; -import org.eclipse.wst.validation.internal.provisional.core.IReporter; - -/** - * EclipseLink - * Java embeddable type mapping - */ -public class JavaEclipseLinkEmbeddableImpl - extends AbstractJavaEmbeddable - implements JavaEclipseLinkEmbeddable, JavaEclipseLinkConverterContainer.ParentAdapter -{ - protected final JavaEclipseLinkConverterContainer converterContainer; - - protected final JavaEclipseLinkChangeTracking changeTracking; - - protected final JavaEclipseLinkCustomizer customizer; - - - public JavaEclipseLinkEmbeddableImpl(JavaPersistentType parent, EmbeddableAnnotation mappingAnnotation) { - super(parent, mappingAnnotation); - this.converterContainer = this.buildConverterContainer(); - this.changeTracking = this.buildChangeTracking(); - this.customizer = this.buildCustomizer(); - } - - - // ********** synchronize/update ********** - - @Override - public void synchronizeWithResourceModel() { - super.synchronizeWithResourceModel(); - this.converterContainer.synchronizeWithResourceModel(); - this.changeTracking.synchronizeWithResourceModel(); - this.customizer.synchronizeWithResourceModel(); - } - - @Override - public void update() { - super.update(); - this.converterContainer.update(); - this.changeTracking.update(); - this.customizer.update(); - } - - - // ********** converter container ********** - - public JavaEclipseLinkConverterContainer getConverterContainer() { - return this.converterContainer; - } - - protected JavaEclipseLinkConverterContainer buildConverterContainer() { - return new JavaEclipseLinkConverterContainerImpl(this); - } - - @SuppressWarnings("unchecked") - public Iterable<EclipseLinkConverter> getConverters() { - return new CompositeIterable<EclipseLinkConverter>( - this.converterContainer.getConverters(), - this.getAttributeMappingConverters() - ); - } - - protected Iterable<EclipseLinkConverter> getAttributeMappingConverters() { - return new FilteringIterable<EclipseLinkConverter>(this.getAttributeMappingConverters_(), NotNullFilter.<EclipseLinkConverter>instance()); - } - - protected Iterable<EclipseLinkConverter> getAttributeMappingConverters_() { - return new CompositeIterable<EclipseLinkConverter>(this.getAttributeMappingConverterLists()); - } - - protected Iterable<Iterable<EclipseLinkConverter>> getAttributeMappingConverterLists() { - return new TransformationIterable<AttributeMapping, Iterable<EclipseLinkConverter>>( - this.getAttributeMappings(), - ATTRIBUTE_MAPPING_CONVERTER_TRANSFORMER - ); - } - - - // ********** change tracking ********** - - public EclipseLinkChangeTracking getChangeTracking() { - return this.changeTracking; - } - - protected JavaEclipseLinkChangeTracking buildChangeTracking() { - return new JavaEclipseLinkChangeTracking(this); - } - - - // ********** customizer ********** - - public EclipseLinkCustomizer getCustomizer() { - return this.customizer; - } - - protected JavaEclipseLinkCustomizer buildCustomizer() { - return new JavaEclipseLinkCustomizer(this); - } - - - // ********** misc ********** - - public boolean usesPrimaryKeyColumns() { - return false; - } - - public boolean usesPrimaryKeyTenantDiscriminatorColumns() { - return false; - } - - // ********** converter container parent adapter ********** - - public JavaJpaContextNode getConverterContainerParent() { - return this; // no adapter - } - - public JavaResourceAnnotatedElement getJavaResourceAnnotatedElement() { - return this.getJavaResourceType(); - } - - public boolean parentSupportsConverters() { - return true; - } - - // ********** validation ********** - - @Override - public void validate(List<IMessage> messages, IReporter reporter, CompilationUnit astRoot) { - super.validate(messages, reporter, astRoot); - this.converterContainer.validate(messages, reporter, astRoot); - this.changeTracking.validate(messages, reporter, astRoot); - this.customizer.validate(messages, reporter, astRoot); - } - - @Override - protected JptValidator buildTypeMappingValidator(CompilationUnit astRoot) { - return new EclipseLinkTypeMappingValidator(this, this.getJavaResourceType(), this.buildTextRangeResolver(astRoot)); - } -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/java/JavaEclipseLinkEmbeddedIdMapping.java b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/java/JavaEclipseLinkEmbeddedIdMapping.java deleted file mode 100644 index e10d1b5823..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/java/JavaEclipseLinkEmbeddedIdMapping.java +++ /dev/null @@ -1,74 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2011, 2012 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.eclipselink.core.internal.context.java; - -import org.eclipse.jpt.common.core.resource.java.JavaResourceAnnotatedElement; -import org.eclipse.jpt.jpa.core.context.java.JavaJpaContextNode; -import org.eclipse.jpt.jpa.core.context.java.JavaPersistentAttribute; -import org.eclipse.jpt.jpa.core.internal.context.java.AbstractJavaEmbeddedIdMapping; -import org.eclipse.jpt.jpa.eclipselink.core.context.java.EclipseLinkJavaConvertibleMapping; -import org.eclipse.jpt.jpa.eclipselink.core.context.java.JavaEclipseLinkConverterContainer; - -/** - * Java embedded ID mapping - */ -public class JavaEclipseLinkEmbeddedIdMapping - extends AbstractJavaEmbeddedIdMapping - implements EclipseLinkJavaConvertibleMapping -{ - - protected final JavaEclipseLinkConverterContainer converterContainer; - - public JavaEclipseLinkEmbeddedIdMapping(JavaPersistentAttribute parent) { - super(parent); - this.converterContainer = this.buildConverterContainer(); - } - - - // ********** synchronize/update ********** - - @Override - public void synchronizeWithResourceModel() { - super.synchronizeWithResourceModel(); - this.converterContainer.synchronizeWithResourceModel(); - } - - @Override - public void update() { - super.update(); - this.converterContainer.update(); - } - - - // ********** converters ********** - - public JavaEclipseLinkConverterContainer getConverterContainer() { - return this.converterContainer; - } - - protected JavaEclipseLinkConverterContainer buildConverterContainer() { - return new JavaEclipseLinkConverterContainerImpl(this); - } - - // ********** converter container parent adapter ********** - - public JavaJpaContextNode getConverterContainerParent() { - return this; // no adapter - } - - public JavaResourceAnnotatedElement getJavaResourceAnnotatedElement() { - return this.getResourceAttribute(); - } - - public boolean parentSupportsConverters() { - return ! this.getPersistentAttribute().isVirtual(); - } -} - diff --git a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/java/JavaEclipseLinkEmbeddedMapping.java b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/java/JavaEclipseLinkEmbeddedMapping.java deleted file mode 100644 index 017f7c0f92..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/java/JavaEclipseLinkEmbeddedMapping.java +++ /dev/null @@ -1,70 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2011, 2012 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.eclipselink.core.internal.context.java; - -import org.eclipse.jpt.common.core.resource.java.JavaResourceAnnotatedElement; -import org.eclipse.jpt.jpa.core.context.java.JavaJpaContextNode; -import org.eclipse.jpt.jpa.core.context.java.JavaPersistentAttribute; -import org.eclipse.jpt.jpa.core.internal.context.java.AbstractJavaEmbeddedMapping; -import org.eclipse.jpt.jpa.eclipselink.core.context.java.EclipseLinkJavaConvertibleMapping; -import org.eclipse.jpt.jpa.eclipselink.core.context.java.JavaEclipseLinkConverterContainer; - -public class JavaEclipseLinkEmbeddedMapping - extends AbstractJavaEmbeddedMapping - implements EclipseLinkJavaConvertibleMapping -{ - - protected final JavaEclipseLinkConverterContainer converterContainer; - - public JavaEclipseLinkEmbeddedMapping(JavaPersistentAttribute parent) { - super(parent); - this.converterContainer = this.buildConverterContainer(); - } - - - // ********** synchronize/update ********** - - @Override - public void synchronizeWithResourceModel() { - super.synchronizeWithResourceModel(); - this.converterContainer.synchronizeWithResourceModel(); - } - - @Override - public void update() { - super.update(); - this.converterContainer.update(); - } - - - // ********** converters ********** - - public JavaEclipseLinkConverterContainer getConverterContainer() { - return this.converterContainer; - } - - protected JavaEclipseLinkConverterContainer buildConverterContainer() { - return new JavaEclipseLinkConverterContainerImpl(this); - } - - // ********** converter container parent adapter ********** - - public JavaJpaContextNode getConverterContainerParent() { - return this; // no adapter - } - - public JavaResourceAnnotatedElement getJavaResourceAnnotatedElement() { - return this.getResourceAttribute(); - } - - public boolean parentSupportsConverters() { - return ! this.getPersistentAttribute().isVirtual(); - } -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/java/JavaEclipseLinkEntityImpl.java b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/java/JavaEclipseLinkEntityImpl.java deleted file mode 100644 index bf03953941..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/java/JavaEclipseLinkEntityImpl.java +++ /dev/null @@ -1,290 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2008, 2012 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.eclipselink.core.internal.context.java; - -import java.util.List; -import org.eclipse.jdt.core.dom.CompilationUnit; -import org.eclipse.jpt.common.core.resource.java.JavaResourceAnnotatedElement; -import org.eclipse.jpt.common.utility.Filter; -import org.eclipse.jpt.common.utility.internal.NotNullFilter; -import org.eclipse.jpt.common.utility.internal.iterables.CompositeIterable; -import org.eclipse.jpt.common.utility.internal.iterables.FilteringIterable; -import org.eclipse.jpt.common.utility.internal.iterables.TransformationIterable; -import org.eclipse.jpt.jpa.core.context.AttributeMapping; -import org.eclipse.jpt.jpa.core.context.InheritanceType; -import org.eclipse.jpt.jpa.core.context.java.JavaJpaContextNode; -import org.eclipse.jpt.jpa.core.context.java.JavaPersistentType; -import org.eclipse.jpt.jpa.core.internal.context.JptValidator; -import org.eclipse.jpt.jpa.core.internal.context.java.AbstractJavaEntity; -import org.eclipse.jpt.jpa.core.jpa2.context.java.JavaCacheable2_0; -import org.eclipse.jpt.jpa.core.jpa2.context.java.JavaCacheableHolder2_0; -import org.eclipse.jpt.jpa.core.resource.java.EntityAnnotation; -import org.eclipse.jpt.jpa.eclipselink.core.JptJpaEclipseLinkCorePlugin; -import org.eclipse.jpt.jpa.eclipselink.core.context.EclipseLinkChangeTracking; -import org.eclipse.jpt.jpa.eclipselink.core.context.EclipseLinkConverter; -import org.eclipse.jpt.jpa.eclipselink.core.context.EclipseLinkCustomizer; -import org.eclipse.jpt.jpa.eclipselink.core.context.EclipseLinkReadOnly; -import org.eclipse.jpt.jpa.eclipselink.core.context.java.JavaEclipseLinkCaching; -import org.eclipse.jpt.jpa.eclipselink.core.context.java.JavaEclipseLinkConverterContainer; -import org.eclipse.jpt.jpa.eclipselink.core.context.java.JavaEclipseLinkEntity; -import org.eclipse.jpt.jpa.eclipselink.core.context.java.JavaEclipseLinkMultitenancy2_3; -import org.eclipse.jpt.jpa.eclipselink.core.internal.context.EclipseLinkEntityPrimaryKeyValidator; -import org.eclipse.jpt.jpa.eclipselink.core.internal.context.EclipseLinkTypeMappingValidator; -import org.eclipse.jpt.jpa.eclipselink.core.resource.java.EclipseLink; -import org.eclipse.jpt.jpa.eclipselink.core.resource.java.EclipseLinkClassExtractorAnnotation2_1; -import org.eclipse.wst.validation.internal.provisional.core.IMessage; -import org.eclipse.wst.validation.internal.provisional.core.IReporter; - -/** - * EclipseLink - * Java entity - */ -public class JavaEclipseLinkEntityImpl - extends AbstractJavaEntity - implements JavaEclipseLinkEntity, JavaEclipseLinkConverterContainer.ParentAdapter -{ - protected final JavaEclipseLinkCaching caching; - - protected final JavaEclipseLinkReadOnly readOnly; - - protected final JavaEclipseLinkConverterContainer converterContainer; - - protected final JavaEclipseLinkChangeTracking changeTracking; - - protected final JavaEclipseLinkCustomizer customizer; - - protected final JavaEclipseLinkMultitenancy2_3 multitenancy; - - public JavaEclipseLinkEntityImpl(JavaPersistentType parent, EntityAnnotation mappingAnnotation) { - super(parent, mappingAnnotation); - this.caching = this.buildCaching(); - this.readOnly = this.buildReadOnly(); - this.converterContainer = this.buildConverterContainer(); - this.changeTracking = this.buildChangeTracking(); - this.customizer = this.buildCustomizer(); - this.multitenancy = this.buildMultitenancy(); - } - - - // ********** synchronize/update ********** - - @Override - public void synchronizeWithResourceModel() { - super.synchronizeWithResourceModel(); - this.caching.synchronizeWithResourceModel(); - this.readOnly.synchronizeWithResourceModel(); - this.converterContainer.synchronizeWithResourceModel(); - this.changeTracking.synchronizeWithResourceModel(); - this.customizer.synchronizeWithResourceModel(); - this.multitenancy.synchronizeWithResourceModel(); - } - - @Override - public void update() { - super.update(); - this.caching.update(); - this.readOnly.update(); - this.converterContainer.update(); - this.changeTracking.update(); - this.customizer.update(); - this.multitenancy.update(); - } - - - // ********** caching ********** - - public JavaEclipseLinkCaching getCaching() { - return this.caching; - } - - protected JavaEclipseLinkCaching buildCaching() { - return new JavaEclipseLinkCachingImpl(this); - } - - - // ********** read-only ********** - - public EclipseLinkReadOnly getReadOnly() { - return this.readOnly; - } - - protected JavaEclipseLinkReadOnly buildReadOnly() { - return new JavaEclipseLinkReadOnly(this); - } - - - // ********** converter container ********** - - public JavaEclipseLinkConverterContainer getConverterContainer() { - return this.converterContainer; - } - - protected JavaEclipseLinkConverterContainer buildConverterContainer() { - return new JavaEclipseLinkConverterContainerImpl(this); - } - - @SuppressWarnings("unchecked") - public Iterable<EclipseLinkConverter> getConverters() { - return new CompositeIterable<EclipseLinkConverter>( - this.converterContainer.getConverters(), - this.getAttributeMappingConverters() - ); - } - - protected Iterable<EclipseLinkConverter> getAttributeMappingConverters() { - return new FilteringIterable<EclipseLinkConverter>(this.getAttributeMappingConverters_(), NotNullFilter.<EclipseLinkConverter>instance()); - } - - protected Iterable<EclipseLinkConverter> getAttributeMappingConverters_() { - return new CompositeIterable<EclipseLinkConverter>(this.getAttributeMappingConverterLists()); - } - - protected Iterable<Iterable<EclipseLinkConverter>> getAttributeMappingConverterLists() { - return new TransformationIterable<AttributeMapping, Iterable<EclipseLinkConverter>>( - this.getAttributeMappings(), - ATTRIBUTE_MAPPING_CONVERTER_TRANSFORMER - ); - } - - - // ********** change tracking ********** - - public EclipseLinkChangeTracking getChangeTracking() { - return this.changeTracking; - } - - protected JavaEclipseLinkChangeTracking buildChangeTracking() { - return new JavaEclipseLinkChangeTracking(this); - } - - - // ********** customizer ********** - - public EclipseLinkCustomizer getCustomizer() { - return this.customizer; - } - - protected JavaEclipseLinkCustomizer buildCustomizer() { - return new JavaEclipseLinkCustomizer(this); - } - - - // ********** multitenancy ********** - - public JavaEclipseLinkMultitenancy2_3 getMultitenancy() { - return this.multitenancy; - } - - protected JavaEclipseLinkMultitenancy2_3 buildMultitenancy() { - return this.isEclipseLink2_3Compatible() ? - new JavaEclipseLinkMultitenancyImpl2_3(this) : - new NullJavaEclipseLinkMultitenancy2_3(this); - } - - protected boolean isEclipseLink2_3Compatible() { - return JptJpaEclipseLinkCorePlugin.nodeIsEclipseLink2_3Compatible(this); - } - - public boolean isMultitenantMetadataAllowed() { - return this.isRootEntity() || this.isInheritanceStrategyTablePerClass(); - } - - protected boolean isInheritanceStrategyTablePerClass() { - return this.getInheritanceStrategy() == InheritanceType.TABLE_PER_CLASS; - } - - - // ********** discriminator column ********** - - @Override - protected boolean buildSpecifiedDiscriminatorColumnIsAllowed() { - return super.buildSpecifiedDiscriminatorColumnIsAllowed() && ! this.classExtractorIsSpecified(); - } - - protected boolean classExtractorIsSpecified() { - return this.getClassExtractorAnnotation() != null; - } - - protected EclipseLinkClassExtractorAnnotation2_1 getClassExtractorAnnotation() { - return (EclipseLinkClassExtractorAnnotation2_1) this.getJavaResourceType().getAnnotation(EclipseLinkClassExtractorAnnotation2_1.ANNOTATION_NAME); - } - - - // ********** misc ********** - - public boolean usesPrimaryKeyColumns() { - return this.getJavaResourceType().getAnnotation(EclipseLink.PRIMARY_KEY) != null; - } - - public boolean usesPrimaryKeyTenantDiscriminatorColumns() { - return getMultitenancy().usesPrimaryKeyTenantDiscriminatorColumns(); - } - - public JavaCacheable2_0 getCacheable() { - return ((JavaCacheableHolder2_0) this.getCaching()).getCacheable(); - } - - public boolean calculateDefaultCacheable() { - return ((JavaCacheableHolder2_0) this.getCaching()).calculateDefaultCacheable(); - } - - // ********** converter container parent adapter ********** - - public JavaJpaContextNode getConverterContainerParent() { - return this; // no adapter - } - - public JavaResourceAnnotatedElement getJavaResourceAnnotatedElement() { - return this.getJavaResourceType(); - } - - public boolean parentSupportsConverters() { - return true; - } - - // ********** Java completion proposals ********** - - @Override - public Iterable<String> getJavaCompletionProposals(int pos, Filter<String> filter, CompilationUnit astRoot) { - Iterable<String> result = super.getJavaCompletionProposals(pos, filter, astRoot); - if (result != null) { - return result; - } - result = this.multitenancy.getJavaCompletionProposals(pos, filter, astRoot); - if (result != null) { - return result; - } - return null; - } - - - // ********** validation ********** - - @Override - public void validate(List<IMessage> messages, IReporter reporter, CompilationUnit astRoot) { - super.validate(messages, reporter, astRoot); - this.caching.validate(messages, reporter, astRoot); - this.readOnly.validate(messages, reporter, astRoot); - this.converterContainer.validate(messages, reporter, astRoot); - this.changeTracking.validate(messages, reporter, astRoot); - this.customizer.validate(messages, reporter, astRoot); - this.multitenancy.validate(messages, reporter, astRoot); - } - - @Override - protected JptValidator buildPrimaryKeyValidator(CompilationUnit astRoot) { - return new EclipseLinkEntityPrimaryKeyValidator(this, this.buildTextRangeResolver(astRoot)); - } - - @Override - protected JptValidator buildTypeMappingValidator(CompilationUnit astRoot) { - return new EclipseLinkTypeMappingValidator(this, this.getJavaResourceType(), buildTextRangeResolver(astRoot)); - } -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/java/JavaEclipseLinkIdMapping.java b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/java/JavaEclipseLinkIdMapping.java deleted file mode 100644 index 584749bc0d..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/java/JavaEclipseLinkIdMapping.java +++ /dev/null @@ -1,109 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2008, 2012 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.eclipselink.core.internal.context.java; - -import java.util.List; -import org.eclipse.jdt.core.dom.CompilationUnit; -import org.eclipse.jpt.common.core.resource.java.JavaResourceAnnotatedElement; -import org.eclipse.jpt.common.utility.internal.iterables.CompositeIterable; -import org.eclipse.jpt.jpa.core.context.java.JavaConverter; -import org.eclipse.jpt.jpa.core.context.java.JavaJpaContextNode; -import org.eclipse.jpt.jpa.core.context.java.JavaPersistentAttribute; -import org.eclipse.jpt.jpa.core.internal.context.java.AbstractJavaIdMapping; -import org.eclipse.jpt.jpa.eclipselink.core.context.EclipseLinkIdMapping; -import org.eclipse.jpt.jpa.eclipselink.core.context.EclipseLinkMutable; -import org.eclipse.jpt.jpa.eclipselink.core.context.java.EclipseLinkJavaConvertibleMapping; -import org.eclipse.jpt.jpa.eclipselink.core.context.java.JavaEclipseLinkConverterContainer; -import org.eclipse.wst.validation.internal.provisional.core.IMessage; -import org.eclipse.wst.validation.internal.provisional.core.IReporter; - -public class JavaEclipseLinkIdMapping - extends AbstractJavaIdMapping - implements EclipseLinkIdMapping, EclipseLinkJavaConvertibleMapping -{ - protected final JavaEclipseLinkMutable mutable; - - protected final JavaEclipseLinkConverterContainer converterContainer; - - - public JavaEclipseLinkIdMapping(JavaPersistentAttribute parent) { - super(parent); - this.mutable = new JavaEclipseLinkMutable(this); - this.converterContainer = this.buildConverterContainer(); - } - - - // ********** synchronize/update ********** - - @Override - public void synchronizeWithResourceModel() { - super.synchronizeWithResourceModel(); - this.mutable.synchronizeWithResourceModel(); - this.converterContainer.synchronizeWithResourceModel(); - } - - @Override - public void update() { - super.update(); - this.mutable.update(); - this.converterContainer.update(); - } - - - // ********** mutable ********** - - public EclipseLinkMutable getMutable() { - return this.mutable; - } - - - // ********** converters ********** - - public JavaEclipseLinkConverterContainer getConverterContainer() { - return this.converterContainer; - } - - protected JavaEclipseLinkConverterContainer buildConverterContainer() { - return new JavaEclipseLinkConverterContainerImpl(this); - } - - // ********** converter container parent adapter ********** - - public JavaJpaContextNode getConverterContainerParent() { - return this; // no adapter - } - - public JavaResourceAnnotatedElement getJavaResourceAnnotatedElement() { - return this.getResourceAttribute(); - } - - public boolean parentSupportsConverters() { - return ! this.getPersistentAttribute().isVirtual(); - } - - // ********** converter adapters ********** - - /** - * put the EclipseLink convert adapter first - this is the order EclipseLink searches - */ - @Override - protected Iterable<JavaConverter.Adapter> getConverterAdapters() { - return new CompositeIterable<JavaConverter.Adapter>(JavaEclipseLinkConvert.Adapter.instance(), super.getConverterAdapters()); - } - - - // ********** validation ********** - - @Override - public void validate(List<IMessage> messages, IReporter reporter, CompilationUnit astRoot) { - super.validate(messages, reporter, astRoot); - this.mutable.validate(messages, reporter, astRoot); - } -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/java/JavaEclipseLinkJoinFetch.java b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/java/JavaEclipseLinkJoinFetch.java deleted file mode 100644 index fcb9dd1148..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/java/JavaEclipseLinkJoinFetch.java +++ /dev/null @@ -1,136 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2008, 2011 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.eclipselink.core.internal.context.java; - -import org.eclipse.jdt.core.dom.CompilationUnit; -import org.eclipse.jpt.common.core.resource.java.JavaResourceAttribute; -import org.eclipse.jpt.common.core.utility.TextRange; -import org.eclipse.jpt.jpa.core.context.java.JavaAttributeMapping; -import org.eclipse.jpt.jpa.core.internal.context.java.AbstractJavaJpaContextNode; -import org.eclipse.jpt.jpa.eclipselink.core.context.EclipseLinkJoinFetch; -import org.eclipse.jpt.jpa.eclipselink.core.context.EclipseLinkJoinFetchType; -import org.eclipse.jpt.jpa.eclipselink.core.resource.java.EclipseLinkJoinFetchAnnotation; -import org.eclipse.jpt.jpa.eclipselink.core.resource.java.JoinFetchType; - -public class JavaEclipseLinkJoinFetch - extends AbstractJavaJpaContextNode - implements EclipseLinkJoinFetch -{ - protected EclipseLinkJoinFetchType value; - - - public JavaEclipseLinkJoinFetch(JavaAttributeMapping parent) { - super(parent); - this.value = this.buildValue(); - } - - - // ********** synchronize/update ********** - - @Override - public void synchronizeWithResourceModel() { - super.synchronizeWithResourceModel(); - this.setValue_(this.buildValue()); - } - - - // ********** value ********** - - public EclipseLinkJoinFetchType getValue() { - return this.value; - } - - public void setValue(EclipseLinkJoinFetchType value) { - if (this.valuesAreDifferent(value, this.value)) { - EclipseLinkJoinFetchAnnotation annotation = this.getJoinFetchAnnotation(); - if (value == null) { - if (annotation != null) { - this.removeJoinFetchAnnotation(); - } - } else { - if (annotation == null) { - annotation = this.addJoinFetchAnnotation(); - } - annotation.setValue(EclipseLinkJoinFetchType.toJavaResourceModel(value)); - } - - this.setValue_(value); - } - } - - protected void setValue_(EclipseLinkJoinFetchType value) { - EclipseLinkJoinFetchType old = this.value; - this.value = value; - this.firePropertyChanged(VALUE_PROPERTY, old, value); - } - - private EclipseLinkJoinFetchType buildValue() { - EclipseLinkJoinFetchAnnotation annotation = this.getJoinFetchAnnotation(); - if (annotation == null) { - return null; - } - JoinFetchType annotationValue = annotation.getValue(); - return (annotationValue != null) ? - EclipseLinkJoinFetchType.fromJavaResourceModel(annotationValue) : - this.getDefaultValue(); // @JoinFetch is equivalent to @JoinFetch(JoinFetch.INNER) - } - - protected EclipseLinkJoinFetchType getDefaultValue() { - return DEFAULT_VALUE; - } - - - // ********** join fetch annotation ********** - - protected EclipseLinkJoinFetchAnnotation getJoinFetchAnnotation() { - return (EclipseLinkJoinFetchAnnotation) this.getResourceAttribute().getAnnotation(this.getJoinFetchAnnotationName()); - } - - protected EclipseLinkJoinFetchAnnotation addJoinFetchAnnotation() { - return (EclipseLinkJoinFetchAnnotation) this.getResourceAttribute().addAnnotation(this.getJoinFetchAnnotationName()); - } - - protected void removeJoinFetchAnnotation() { - this.getResourceAttribute().removeAnnotation(this.getJoinFetchAnnotationName()); - } - - protected String getJoinFetchAnnotationName() { - return EclipseLinkJoinFetchAnnotation.ANNOTATION_NAME; - } - - - // ********** misc ********** - - @Override - public JavaAttributeMapping getParent() { - return (JavaAttributeMapping) super.getParent(); - } - - protected JavaAttributeMapping getAttributeMapping() { - return this.getParent(); - } - - protected JavaResourceAttribute getResourceAttribute() { - return this.getAttributeMapping().getResourceAttribute(); - } - - - // ********** validation ********** - - public TextRange getValidationTextRange(CompilationUnit astRoot) { - TextRange textRange = this.getAnnotationTextRange(astRoot); - return (textRange != null) ? textRange : this.getAttributeMapping().getValidationTextRange(astRoot); - } - - protected TextRange getAnnotationTextRange(CompilationUnit astRoot) { - EclipseLinkJoinFetchAnnotation annotation = this.getJoinFetchAnnotation(); - return (annotation == null) ? null : annotation.getTextRange(astRoot); - } -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/java/JavaEclipseLinkManyToManyMapping.java b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/java/JavaEclipseLinkManyToManyMapping.java deleted file mode 100644 index b169bd9e87..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/java/JavaEclipseLinkManyToManyMapping.java +++ /dev/null @@ -1,97 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2008, 2012 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.eclipselink.core.internal.context.java; - -import java.util.List; -import org.eclipse.jdt.core.dom.CompilationUnit; -import org.eclipse.jpt.common.core.resource.java.JavaResourceAnnotatedElement; -import org.eclipse.jpt.jpa.core.context.java.JavaJpaContextNode; -import org.eclipse.jpt.jpa.core.context.java.JavaPersistentAttribute; -import org.eclipse.jpt.jpa.core.internal.context.java.AbstractJavaManyToManyMapping; -import org.eclipse.jpt.jpa.eclipselink.core.context.EclipseLinkJoinFetch; -import org.eclipse.jpt.jpa.eclipselink.core.context.EclipseLinkManyToManyMapping; -import org.eclipse.jpt.jpa.eclipselink.core.context.java.EclipseLinkJavaConvertibleMapping; -import org.eclipse.jpt.jpa.eclipselink.core.context.java.JavaEclipseLinkConverterContainer; -import org.eclipse.wst.validation.internal.provisional.core.IMessage; -import org.eclipse.wst.validation.internal.provisional.core.IReporter; - -public class JavaEclipseLinkManyToManyMapping - extends AbstractJavaManyToManyMapping - implements EclipseLinkManyToManyMapping, EclipseLinkJavaConvertibleMapping -{ - protected final JavaEclipseLinkJoinFetch joinFetch; - - protected final JavaEclipseLinkConverterContainer converterContainer; - - - public JavaEclipseLinkManyToManyMapping(JavaPersistentAttribute parent) { - super(parent); - this.joinFetch = new JavaEclipseLinkJoinFetch(this); - this.converterContainer = this.buildConverterContainer(); - } - - - // ********** synchronize/update ********** - - @Override - public void synchronizeWithResourceModel() { - super.synchronizeWithResourceModel(); - this.joinFetch.synchronizeWithResourceModel(); - this.converterContainer.synchronizeWithResourceModel(); - } - - @Override - public void update() { - super.update(); - this.joinFetch.update(); - this.converterContainer.update(); - } - - - // ********** join fetch ********** - - public EclipseLinkJoinFetch getJoinFetch() { - return this.joinFetch; - } - - - // ********** converters ********** - - public JavaEclipseLinkConverterContainer getConverterContainer() { - return this.converterContainer; - } - - protected JavaEclipseLinkConverterContainer buildConverterContainer() { - return new JavaEclipseLinkConverterContainerImpl(this); - } - - // ********** converter container parent adapter ********** - - public JavaJpaContextNode getConverterContainerParent() { - return this; // no adapter - } - - public JavaResourceAnnotatedElement getJavaResourceAnnotatedElement() { - return this.getResourceAttribute(); - } - - public boolean parentSupportsConverters() { - return ! this.getPersistentAttribute().isVirtual(); - } - - - // ********** validation ********** - - @Override - public void validate(List<IMessage> messages, IReporter reporter, CompilationUnit astRoot) { - super.validate(messages, reporter, astRoot); - this.joinFetch.validate(messages, reporter, astRoot); - } -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/java/JavaEclipseLinkManyToOneMapping.java b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/java/JavaEclipseLinkManyToOneMapping.java deleted file mode 100644 index 2c1a52650a..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/java/JavaEclipseLinkManyToOneMapping.java +++ /dev/null @@ -1,96 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2008, 2012 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.eclipselink.core.internal.context.java; - -import java.util.List; -import org.eclipse.jdt.core.dom.CompilationUnit; -import org.eclipse.jpt.common.core.resource.java.JavaResourceAnnotatedElement; -import org.eclipse.jpt.jpa.core.context.java.JavaJpaContextNode; -import org.eclipse.jpt.jpa.core.context.java.JavaPersistentAttribute; -import org.eclipse.jpt.jpa.core.internal.context.java.AbstractJavaManyToOneMapping; -import org.eclipse.jpt.jpa.eclipselink.core.context.EclipseLinkJoinFetch; -import org.eclipse.jpt.jpa.eclipselink.core.context.EclipseLinkRelationshipMapping; -import org.eclipse.jpt.jpa.eclipselink.core.context.java.EclipseLinkJavaConvertibleMapping; -import org.eclipse.jpt.jpa.eclipselink.core.context.java.JavaEclipseLinkConverterContainer; -import org.eclipse.wst.validation.internal.provisional.core.IMessage; -import org.eclipse.wst.validation.internal.provisional.core.IReporter; - -public class JavaEclipseLinkManyToOneMapping - extends AbstractJavaManyToOneMapping - implements EclipseLinkRelationshipMapping, EclipseLinkJavaConvertibleMapping -{ - protected final JavaEclipseLinkJoinFetch joinFetch; - - protected final JavaEclipseLinkConverterContainer converterContainer; - - - public JavaEclipseLinkManyToOneMapping(JavaPersistentAttribute parent) { - super(parent); - this.joinFetch = new JavaEclipseLinkJoinFetch(this); - this.converterContainer = this.buildConverterContainer(); - } - - - // ********** synchronize/update ********** - - @Override - public void synchronizeWithResourceModel() { - super.synchronizeWithResourceModel(); - this.joinFetch.synchronizeWithResourceModel(); - this.converterContainer.synchronizeWithResourceModel(); - } - - @Override - public void update() { - super.update(); - this.joinFetch.update(); - this.converterContainer.update(); - } - - - // ********** join fetch ********** - - public EclipseLinkJoinFetch getJoinFetch() { - return this.joinFetch; - } - - - // ********** converters ********** - - public JavaEclipseLinkConverterContainer getConverterContainer() { - return this.converterContainer; - } - - protected JavaEclipseLinkConverterContainer buildConverterContainer() { - return new JavaEclipseLinkConverterContainerImpl(this); - } - - // ********** converter container parent adapter ********** - - public JavaJpaContextNode getConverterContainerParent() { - return this; // no adapter - } - - public JavaResourceAnnotatedElement getJavaResourceAnnotatedElement() { - return this.getResourceAttribute(); - } - - public boolean parentSupportsConverters() { - return ! this.getPersistentAttribute().isVirtual(); - } - - // ********** validation ********** - - @Override - public void validate(List<IMessage> messages, IReporter reporter, CompilationUnit astRoot) { - super.validate(messages, reporter, astRoot); - this.joinFetch.validate(messages, reporter, astRoot); - } -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/java/JavaEclipseLinkMappedSuperclassImpl.java b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/java/JavaEclipseLinkMappedSuperclassImpl.java deleted file mode 100644 index d35595468c..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/java/JavaEclipseLinkMappedSuperclassImpl.java +++ /dev/null @@ -1,268 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2008, 2012 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.eclipselink.core.internal.context.java; - -import java.util.List; -import org.eclipse.jdt.core.dom.CompilationUnit; -import org.eclipse.jpt.common.core.resource.java.JavaResourceAnnotatedElement; -import org.eclipse.jpt.common.utility.Filter; -import org.eclipse.jpt.common.utility.internal.NotNullFilter; -import org.eclipse.jpt.common.utility.internal.iterables.CompositeIterable; -import org.eclipse.jpt.common.utility.internal.iterables.FilteringIterable; -import org.eclipse.jpt.common.utility.internal.iterables.TransformationIterable; -import org.eclipse.jpt.jpa.core.context.AttributeMapping; -import org.eclipse.jpt.jpa.core.context.java.JavaJpaContextNode; -import org.eclipse.jpt.jpa.core.context.java.JavaPersistentType; -import org.eclipse.jpt.jpa.core.internal.context.JptValidator; -import org.eclipse.jpt.jpa.core.internal.context.java.AbstractJavaMappedSuperclass; -import org.eclipse.jpt.jpa.core.jpa2.context.CacheableHolder2_0; -import org.eclipse.jpt.jpa.core.jpa2.context.java.JavaCacheable2_0; -import org.eclipse.jpt.jpa.core.jpa2.context.java.JavaCacheableHolder2_0; -import org.eclipse.jpt.jpa.core.resource.java.MappedSuperclassAnnotation; -import org.eclipse.jpt.jpa.eclipselink.core.JptJpaEclipseLinkCorePlugin; -import org.eclipse.jpt.jpa.eclipselink.core.context.EclipseLinkChangeTracking; -import org.eclipse.jpt.jpa.eclipselink.core.context.EclipseLinkConverter; -import org.eclipse.jpt.jpa.eclipselink.core.context.EclipseLinkCustomizer; -import org.eclipse.jpt.jpa.eclipselink.core.context.EclipseLinkReadOnly; -import org.eclipse.jpt.jpa.eclipselink.core.context.java.JavaEclipseLinkCaching; -import org.eclipse.jpt.jpa.eclipselink.core.context.java.JavaEclipseLinkConverterContainer; -import org.eclipse.jpt.jpa.eclipselink.core.context.java.JavaEclipseLinkMappedSuperclass; -import org.eclipse.jpt.jpa.eclipselink.core.context.java.JavaEclipseLinkMultitenancy2_3; -import org.eclipse.jpt.jpa.eclipselink.core.internal.context.EclipseLinkMappedSuperclassPrimaryKeyValidator; -import org.eclipse.jpt.jpa.eclipselink.core.internal.context.EclipseLinkMappedSuperclassValidator; -import org.eclipse.jpt.jpa.eclipselink.core.resource.java.EclipseLink; -import org.eclipse.wst.validation.internal.provisional.core.IMessage; -import org.eclipse.wst.validation.internal.provisional.core.IReporter; - -/** - * EclipseLink - * Java mapped superclass - */ -public class JavaEclipseLinkMappedSuperclassImpl - extends AbstractJavaMappedSuperclass - implements JavaEclipseLinkMappedSuperclass, JavaCacheableHolder2_0, JavaEclipseLinkConverterContainer.ParentAdapter -{ - protected final JavaEclipseLinkCaching caching; - - protected final JavaEclipseLinkReadOnly readOnly; - - protected final JavaEclipseLinkConverterContainer converterContainer; - - protected final JavaEclipseLinkChangeTracking changeTracking; - - protected final JavaEclipseLinkCustomizer customizer; - - protected final JavaEclipseLinkMultitenancy2_3 multitenancy; - - public JavaEclipseLinkMappedSuperclassImpl(JavaPersistentType parent, MappedSuperclassAnnotation mappingAnnotation) { - super(parent, mappingAnnotation); - this.caching = this.buildCaching(); - this.readOnly = this.buildReadOnly(); - this.converterContainer = this.buildConverterContainer(); - this.changeTracking = this.buildChangeTracking(); - this.customizer = this.buildCustomizer(); - this.multitenancy = this.buildMultitenancy(); - } - - - // ********** synchronize/update ********** - - @Override - public void synchronizeWithResourceModel() { - super.synchronizeWithResourceModel(); - this.caching.synchronizeWithResourceModel(); - this.readOnly.synchronizeWithResourceModel(); - this.converterContainer.synchronizeWithResourceModel(); - this.changeTracking.synchronizeWithResourceModel(); - this.customizer.synchronizeWithResourceModel(); - this.multitenancy.synchronizeWithResourceModel(); - } - - @Override - public void update() { - super.update(); - this.caching.update(); - this.readOnly.update(); - this.converterContainer.update(); - this.changeTracking.update(); - this.customizer.update(); - this.multitenancy.update(); - } - - - // ********** caching ********** - - public JavaEclipseLinkCaching getCaching() { - return this.caching; - } - - protected JavaEclipseLinkCaching buildCaching() { - return new JavaEclipseLinkCachingImpl(this); - } - - - // ********** read-only ********** - - public EclipseLinkReadOnly getReadOnly() { - return this.readOnly; - } - - protected JavaEclipseLinkReadOnly buildReadOnly() { - return new JavaEclipseLinkReadOnly(this); - } - - - // ********** converter container ********** - - public JavaEclipseLinkConverterContainer getConverterContainer() { - return this.converterContainer; - } - - protected JavaEclipseLinkConverterContainer buildConverterContainer() { - return new JavaEclipseLinkConverterContainerImpl(this); - } - - @SuppressWarnings("unchecked") - public Iterable<EclipseLinkConverter> getConverters() { - return new CompositeIterable<EclipseLinkConverter>( - this.converterContainer.getConverters(), - this.getAttributeMappingConverters() - ); - } - - protected Iterable<EclipseLinkConverter> getAttributeMappingConverters() { - return new FilteringIterable<EclipseLinkConverter>(this.getAttributeMappingConverters_(), NotNullFilter.<EclipseLinkConverter>instance()); - } - - protected Iterable<EclipseLinkConverter> getAttributeMappingConverters_() { - return new CompositeIterable<EclipseLinkConverter>(this.getAttributeMappingConverterLists()); - } - - protected Iterable<Iterable<EclipseLinkConverter>> getAttributeMappingConverterLists() { - return new TransformationIterable<AttributeMapping, Iterable<EclipseLinkConverter>>( - this.getAttributeMappings(), - ATTRIBUTE_MAPPING_CONVERTER_TRANSFORMER - ); - } - - - // ********** change tracking ********** - - public EclipseLinkChangeTracking getChangeTracking() { - return this.changeTracking; - } - - protected JavaEclipseLinkChangeTracking buildChangeTracking() { - return new JavaEclipseLinkChangeTracking(this); - } - - - // ********** customizer ********** - - public EclipseLinkCustomizer getCustomizer() { - return this.customizer; - } - - protected JavaEclipseLinkCustomizer buildCustomizer() { - return new JavaEclipseLinkCustomizer(this); - } - - - // ********** multitenancy ********** - - public JavaEclipseLinkMultitenancy2_3 getMultitenancy() { - return this.multitenancy; - } - - - protected JavaEclipseLinkMultitenancy2_3 buildMultitenancy() { - return this.isEclipseLink2_3Compatible() ? - new JavaEclipseLinkMultitenancyImpl2_3(this) : - new NullJavaEclipseLinkMultitenancy2_3(this); - } - - protected boolean isEclipseLink2_3Compatible() { - return JptJpaEclipseLinkCorePlugin.nodeIsEclipseLink2_3Compatible(this); - } - - public boolean isMultitenantMetadataAllowed() { - return true; - } - - // ********** misc ********** - - public boolean usesPrimaryKeyColumns() { - return this.getJavaResourceType().getAnnotation(EclipseLink.PRIMARY_KEY) != null; - } - - public boolean usesPrimaryKeyTenantDiscriminatorColumns() { - return getMultitenancy().usesPrimaryKeyTenantDiscriminatorColumns(); - } - - public JavaCacheable2_0 getCacheable() { - return ((JavaCacheableHolder2_0) this.getCaching()).getCacheable(); - } - - public boolean calculateDefaultCacheable() { - return ((CacheableHolder2_0) this.getCaching()).calculateDefaultCacheable(); - } - - // ********** converter container parent adapter ********** - - public JavaJpaContextNode getConverterContainerParent() { - return this; // no adapter - } - - public JavaResourceAnnotatedElement getJavaResourceAnnotatedElement() { - return this.getJavaResourceType(); - } - - public boolean parentSupportsConverters() { - return true; - } - - // ********** Java completion proposals ********** - - @Override - public Iterable<String> getJavaCompletionProposals(int pos, Filter<String> filter, CompilationUnit astRoot) { - Iterable<String> result = super.getJavaCompletionProposals(pos, filter, astRoot); - if (result != null) { - return result; - } - result = this.multitenancy.getJavaCompletionProposals(pos, filter, astRoot); - if (result != null) { - return result; - } - return null; - } - - // ********** validation ********** - - @Override - public void validate(List<IMessage> messages, IReporter reporter, CompilationUnit astRoot) { - super.validate(messages, reporter, astRoot); - this.caching.validate(messages, reporter, astRoot); - this.readOnly.validate(messages, reporter, astRoot); - this.converterContainer.validate(messages, reporter, astRoot); - this.changeTracking.validate(messages, reporter, astRoot); - this.customizer.validate(messages, reporter, astRoot); - this.multitenancy.validate(messages, reporter, astRoot); - } - - @Override - protected JptValidator buildPrimaryKeyValidator(CompilationUnit astRoot) { - return new EclipseLinkMappedSuperclassPrimaryKeyValidator(this, this.buildTextRangeResolver(astRoot)); - } - - @Override - protected JptValidator buildTypeMappingValidator(CompilationUnit astRoot) { - return new EclipseLinkMappedSuperclassValidator(this, this.getJavaResourceType(), this.buildTextRangeResolver(astRoot)); - } -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/java/JavaEclipseLinkMultitenancyImpl2_3.java b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/java/JavaEclipseLinkMultitenancyImpl2_3.java deleted file mode 100644 index adc71a7b7d..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/java/JavaEclipseLinkMultitenancyImpl2_3.java +++ /dev/null @@ -1,764 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2011, 2012 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.eclipselink.core.internal.context.java; - -import java.util.List; -import org.eclipse.jdt.core.dom.CompilationUnit; -import org.eclipse.jpt.common.core.resource.java.JavaResourceType; -import org.eclipse.jpt.common.core.resource.java.NestableAnnotation; -import org.eclipse.jpt.common.core.utility.TextRange; -import org.eclipse.jpt.common.utility.Filter; -import org.eclipse.jpt.common.utility.internal.CollectionTools; -import org.eclipse.jpt.common.utility.internal.iterables.EmptyListIterable; -import org.eclipse.jpt.common.utility.internal.iterables.ListIterable; -import org.eclipse.jpt.common.utility.internal.iterables.SingleElementListIterable; -import org.eclipse.jpt.common.utility.internal.iterables.SubListIterableWrapper; -import org.eclipse.jpt.common.utility.internal.iterables.SuperListIterableWrapper; -import org.eclipse.jpt.jpa.core.context.DiscriminatorType; -import org.eclipse.jpt.jpa.core.context.Entity; -import org.eclipse.jpt.jpa.core.context.InheritanceType; -import org.eclipse.jpt.jpa.core.context.MappingFileRoot; -import org.eclipse.jpt.jpa.core.context.ReadOnlyNamedColumn; -import org.eclipse.jpt.jpa.core.context.ReadOnlyNamedDiscriminatorColumn; -import org.eclipse.jpt.jpa.core.context.TypeMapping; -import org.eclipse.jpt.jpa.core.context.java.JavaPersistentType; -import org.eclipse.jpt.jpa.core.internal.context.JptValidator; -import org.eclipse.jpt.jpa.core.internal.context.NamedColumnTextRangeResolver; -import org.eclipse.jpt.jpa.core.internal.context.java.AbstractJavaJpaContextNode; -import org.eclipse.jpt.jpa.db.Table; -import org.eclipse.jpt.jpa.eclipselink.core.context.EclipseLinkEntity; -import org.eclipse.jpt.jpa.eclipselink.core.context.EclipseLinkMappedSuperclass; -import org.eclipse.jpt.jpa.eclipselink.core.context.EclipseLinkMultitenantType2_3; -import org.eclipse.jpt.jpa.eclipselink.core.context.ReadOnlyTenantDiscriminatorColumn2_3; -import org.eclipse.jpt.jpa.eclipselink.core.context.TenantDiscriminatorColumn2_3; -import org.eclipse.jpt.jpa.eclipselink.core.context.java.JavaEclipseLinkMultitenancy2_3; -import org.eclipse.jpt.jpa.eclipselink.core.context.java.JavaEclipseLinkNonEmbeddableTypeMapping; -import org.eclipse.jpt.jpa.eclipselink.core.context.java.JavaReadOnlyTenantDiscriminatorColumn2_3; -import org.eclipse.jpt.jpa.eclipselink.core.context.java.JavaTenantDiscriminatorColumn2_3; -import org.eclipse.jpt.jpa.eclipselink.core.context.java.JavaVirtualTenantDiscriminatorColumn2_3; -import org.eclipse.jpt.jpa.eclipselink.core.context.orm.EclipseLinkEntityMappings; -import org.eclipse.jpt.jpa.eclipselink.core.context.persistence.EclipseLinkPersistenceUnit; -import org.eclipse.jpt.jpa.eclipselink.core.context.persistence.TargetDatabase; -import org.eclipse.jpt.jpa.eclipselink.core.internal.DefaultEclipseLinkJpaValidationMessages; -import org.eclipse.jpt.jpa.eclipselink.core.internal.EclipseLinkJpaValidationMessages; -import org.eclipse.jpt.jpa.eclipselink.core.internal.context.TenantDiscriminatorColumnValidator2_3; -import org.eclipse.jpt.jpa.eclipselink.core.internal.resource.java.NullEclipseLinkTenantDiscriminatorColumnAnnotation2_3; -import org.eclipse.jpt.jpa.eclipselink.core.resource.java.EclipseLinkMultitenantAnnotation2_3; -import org.eclipse.jpt.jpa.eclipselink.core.resource.java.EclipseLinkTenantDiscriminatorColumnAnnotation2_3; -import org.eclipse.wst.validation.internal.provisional.core.IMessage; -import org.eclipse.wst.validation.internal.provisional.core.IReporter; - -public class JavaEclipseLinkMultitenancyImpl2_3 - extends AbstractJavaJpaContextNode - implements JavaEclipseLinkMultitenancy2_3 -{ - protected boolean defaultMultitenant; - protected boolean specifiedMultitenant; - - protected EclipseLinkMultitenantType2_3 specifiedType; - protected EclipseLinkMultitenantType2_3 defaultType; - - protected Boolean specifiedIncludeCriteria; - protected boolean defaultIncludeCriteria = DEFAULT_INCLUDE_CRITERIA; - - protected final JavaReadOnlyTenantDiscriminatorColumn2_3.Owner tenantDiscriminatorColumnOwner; - protected final ContextListContainer<JavaTenantDiscriminatorColumn2_3, EclipseLinkTenantDiscriminatorColumnAnnotation2_3> specifiedTenantDiscriminatorColumnContainer; - protected final ContextListContainer<JavaVirtualTenantDiscriminatorColumn2_3, ReadOnlyTenantDiscriminatorColumn2_3> defaultTenantDiscriminatorColumnContainer; - - protected final JavaReadOnlyTenantDiscriminatorColumn2_3 defaultTenantDiscriminatorColumn; - - protected boolean specifiedTenantDiscriminatorColumnsAllowed; - - public JavaEclipseLinkMultitenancyImpl2_3(JavaEclipseLinkNonEmbeddableTypeMapping parent) { - super(parent); - - EclipseLinkMultitenantAnnotation2_3 multitenantAnnotation = this.getMultitenantAnnotation(); - this.specifiedMultitenant = multitenantAnnotation.isSpecified(); - this.specifiedType = EclipseLinkMultitenantType2_3.fromJavaResourceModel(multitenantAnnotation.getValue()); - this.specifiedIncludeCriteria = multitenantAnnotation.getIncludeCriteria(); - this.tenantDiscriminatorColumnOwner = this.buildTenantDiscriminatorColumnOwner(); - this.specifiedTenantDiscriminatorColumnContainer = this.buildSpecifiedTenantDiscriminatorColumnContainer(); - this.defaultTenantDiscriminatorColumn = this.buildTenantDiscriminatorColumn(this.buildNullTenantDiscriminatorColumnAnnotation()); - this.defaultTenantDiscriminatorColumnContainer = this.buildDefaultTenantDiscriminatorColumnContainer(); - } - - - // ********** synchronize/update ********** - - @Override - public void synchronizeWithResourceModel() { - super.synchronizeWithResourceModel(); - - EclipseLinkMultitenantAnnotation2_3 multitenantAnnotation = this.getMultitenantAnnotation(); - this.setSpecifiedType_(EclipseLinkMultitenantType2_3.fromJavaResourceModel(multitenantAnnotation.getValue())); - this.setSpecifiedIncludeCriteria_(multitenantAnnotation.getIncludeCriteria()); - this.syncSpecifiedTenantDiscriminatorColumns(); - } - - @Override - public void update() { - super.update(); - this.updateNodes(this.getSpecifiedTenantDiscriminatorColumns()); - this.setSpecifiedMultitenant_(this.isMultitenantAnnotationSpecified()); - this.setDefaultMultitenant(this.buildDefaultMultitenant()); - this.setDefaultType(this.buildDefaultType()); - this.setDefaultIncludeCriteria(this.buildDefaultIncludeCriteria()); - this.setSpecifiedTenantDiscriminatorColumnsAllowed(this.buildSpecifiedTenantDiscriminatorColumnsAllowed()); - this.updateDefaultTenantDiscriminatorColumns(); - } - - - // ********** multitenant ********** - - public boolean isMultitenant() { - return this.isSpecifiedMultitenant() || this.isDefaultMultitenant(); - } - - public boolean isDefaultMultitenant() { - return this.defaultMultitenant; - } - - public void setDefaultMultitenant(boolean defaultMultitenant) { - boolean old = this.defaultMultitenant; - this.defaultMultitenant = defaultMultitenant; - this.firePropertyChanged(DEFAULT_MULTITENANT_PROPERTY, old, defaultMultitenant); - } - - protected boolean buildDefaultMultitenant() { - return this.isMultitenantInheritanceHierarchy() || this.isSuperMappedSuperclassMultitenant(); - } - - public boolean isSpecifiedMultitenant() { - return this.specifiedMultitenant; - } - - public void setSpecifiedMultitenant(boolean isMultitenant) { - if (isMultitenant) { - if (getMultitenantAnnotation().isSpecified()) { - throw new IllegalStateException("Multitenant annotation already specified"); //$NON-NLS-1$ - } - this.addMultitenantAnnotation(); - } - else { - if (!getMultitenantAnnotation().isSpecified()) { - throw new IllegalStateException("Multitenant annotation does not exist"); //$NON-NLS-1$ - } - this.removeMultitenantAnnotation(); - this.setSpecifiedType(null); - for (int i = this.getSpecifiedTenantDiscriminatorColumnsSize(); i-- > 0; ) { - this.removeSpecifiedTenantDiscriminatorColumn(i); - } - } - this.setSpecifiedMultitenant_(isMultitenant); - } - - protected void setSpecifiedMultitenant_(boolean isMultitenant) { - boolean old = this.specifiedMultitenant; - this.specifiedMultitenant = isMultitenant; - this.firePropertyChanged(SPECIFIED_MULTITENANT_PROPERTY, old, isMultitenant); - } - - - // ********** type ********** - - public EclipseLinkMultitenantType2_3 getType() { - return (this.specifiedType != null) ? this.specifiedType : this.getDefaultType(); - } - - public EclipseLinkMultitenantType2_3 getSpecifiedType() { - return this.specifiedType; - } - - public void setSpecifiedType(EclipseLinkMultitenantType2_3 type) { - this.getMultitenantAnnotation().setValue(EclipseLinkMultitenantType2_3.toJavaResourceModel(type)); - this.setSpecifiedType_(type); - } - - protected void setSpecifiedType_(EclipseLinkMultitenantType2_3 type) { - EclipseLinkMultitenantType2_3 old = this.specifiedType; - this.specifiedType = type; - this.firePropertyChanged(SPECIFIED_TYPE_PROPERTY, old, type); - } - - public EclipseLinkMultitenantType2_3 getDefaultType() { - return this.defaultType; - } - - protected void setDefaultType(EclipseLinkMultitenantType2_3 type) { - EclipseLinkMultitenantType2_3 old = this.defaultType; - this.defaultType = type; - this.firePropertyChanged(DEFAULT_TYPE_PROPERTY, old, type); - } - - protected EclipseLinkMultitenantType2_3 buildDefaultType() { - if (!isMultitenant()) { - return null; - } - if (isSpecifiedMultitenant()) { - return DEFAULT_TYPE; - } - if (this.isMultitenantInheritanceHierarchy()) { - return getRootEntity().getMultitenancy().getType(); - } - EclipseLinkMappedSuperclass superMappedSuperclass = getSuperMappedSuperclass(); - return superMappedSuperclass != null ? superMappedSuperclass.getMultitenancy().getType() : DEFAULT_TYPE; - } - - - // ********** include criteria ********** - - public boolean isIncludeCriteria() { - return (this.specifiedIncludeCriteria != null) ? this.specifiedIncludeCriteria.booleanValue() : this.isDefaultIncludeCriteria(); - } - - public Boolean getSpecifiedIncludeCriteria() { - return this.specifiedIncludeCriteria; - } - - public void setSpecifiedIncludeCriteria(Boolean includeCriteria) { - this.getMultitenantAnnotation().setIncludeCriteria(includeCriteria); - this.setSpecifiedIncludeCriteria_(includeCriteria); - } - - protected void setSpecifiedIncludeCriteria_(Boolean includeCriteria) { - Boolean old = this.specifiedIncludeCriteria; - this.specifiedIncludeCriteria = includeCriteria; - this.firePropertyChanged(SPECIFIED_INCLUDE_CRITERIA_PROPERTY, old, includeCriteria); - } - - public boolean isDefaultIncludeCriteria() { - return this.defaultIncludeCriteria; - } - - protected void setDefaultIncludeCriteria(boolean includeCriteria) { - boolean old = this.defaultIncludeCriteria; - this.defaultIncludeCriteria = includeCriteria; - this.firePropertyChanged(DEFAULT_INCLUDE_CRITERIA_PROPERTY, old, includeCriteria); - } - - protected boolean buildDefaultIncludeCriteria() { - if (getType() == EclipseLinkMultitenantType2_3.VPD) { - return false; - } - return DEFAULT_INCLUDE_CRITERIA; - } - - - // ********** tenant discriminator columns ********** - - public ListIterable<JavaReadOnlyTenantDiscriminatorColumn2_3> getTenantDiscriminatorColumns() { - return this.hasSpecifiedTenantDiscriminatorColumns() ? - this.getReadOnlySpecifiedTenantDiscriminatorColumns() : - this.getReadOnlyDefaultTenantDiscriminatorColumns(); - } - - public int getTenantDiscriminatorColumnsSize() { - return this.hasSpecifiedTenantDiscriminatorColumns() ? - this.getSpecifiedTenantDiscriminatorColumnsSize() : - this.getDefaultTenantDiscriminatorColumnsSize(); - } - - - // ********** specified tenant discriminator columns ********** - - public ListIterable<JavaTenantDiscriminatorColumn2_3> getSpecifiedTenantDiscriminatorColumns() { - return this.specifiedTenantDiscriminatorColumnContainer.getContextElements(); - } - - protected ListIterable<JavaReadOnlyTenantDiscriminatorColumn2_3> getReadOnlySpecifiedTenantDiscriminatorColumns() { - return new SuperListIterableWrapper<JavaReadOnlyTenantDiscriminatorColumn2_3>(this.getSpecifiedTenantDiscriminatorColumns()); - } - - public int getSpecifiedTenantDiscriminatorColumnsSize() { - return this.specifiedTenantDiscriminatorColumnContainer.getContextElementsSize(); - } - - public boolean hasSpecifiedTenantDiscriminatorColumns() { - return this.getSpecifiedTenantDiscriminatorColumnsSize() != 0; - } - - public JavaTenantDiscriminatorColumn2_3 addSpecifiedTenantDiscriminatorColumn() { - return this.addSpecifiedTenantDiscriminatorColumn(this.getSpecifiedTenantDiscriminatorColumnsSize()); - } - - public JavaTenantDiscriminatorColumn2_3 addSpecifiedTenantDiscriminatorColumn(int index) { - EclipseLinkTenantDiscriminatorColumnAnnotation2_3 annotation = this.addTenantDiscriminatorColumnAnnotation(index); - return this.specifiedTenantDiscriminatorColumnContainer.addContextElement(index, annotation); - } - - public void removeSpecifiedTenantDiscriminatorColumn(TenantDiscriminatorColumn2_3 tenantDiscriminatorColumn) { - this.removeSpecifiedTenantDiscriminatorColumn(this.specifiedTenantDiscriminatorColumnContainer.indexOfContextElement((JavaTenantDiscriminatorColumn2_3) tenantDiscriminatorColumn)); - } - - public void removeSpecifiedTenantDiscriminatorColumn(int index) { - this.removeTenantDiscriminatorColumnAnnotation(index); - this.specifiedTenantDiscriminatorColumnContainer.removeContextElement(index); - } - - public void moveSpecifiedTenantDiscriminatorColumn(int targetIndex, int sourceIndex) { - this.moveTenantDiscriminatorColumnAnnotation(targetIndex, sourceIndex); - this.specifiedTenantDiscriminatorColumnContainer.moveContextElement(targetIndex, sourceIndex); - } - - protected JavaTenantDiscriminatorColumn2_3 buildTenantDiscriminatorColumn(EclipseLinkTenantDiscriminatorColumnAnnotation2_3 discriminatorColumnAnnotation) { - return new EclipseLinkJavaTenantDiscriminatorColumn2_3(this, this.tenantDiscriminatorColumnOwner, discriminatorColumnAnnotation); - } - - protected EclipseLinkTenantDiscriminatorColumnAnnotation2_3 buildNullTenantDiscriminatorColumnAnnotation() { - return new NullEclipseLinkTenantDiscriminatorColumnAnnotation2_3(this.getJavaResourceType()); - } - - protected void syncSpecifiedTenantDiscriminatorColumns() { - this.specifiedTenantDiscriminatorColumnContainer.synchronizeWithResourceModel(); - } - - protected ContextListContainer<JavaTenantDiscriminatorColumn2_3, EclipseLinkTenantDiscriminatorColumnAnnotation2_3> buildSpecifiedTenantDiscriminatorColumnContainer() { - SpecifiedTenantDiscriminatorColumnContainer container = new SpecifiedTenantDiscriminatorColumnContainer(); - container.initialize(); - return container; - } - - protected JavaReadOnlyTenantDiscriminatorColumn2_3.Owner buildTenantDiscriminatorColumnOwner() { - return new TenantDiscriminatorColumnOwner(); - } - - /** - * specified tenant discriminator column container - */ - protected class SpecifiedTenantDiscriminatorColumnContainer - extends ContextListContainer<JavaTenantDiscriminatorColumn2_3, EclipseLinkTenantDiscriminatorColumnAnnotation2_3> - { - @Override - protected String getContextElementsPropertyName() { - return SPECIFIED_TENANT_DISCRIMINATOR_COLUMNS_LIST; - } - @Override - protected JavaTenantDiscriminatorColumn2_3 buildContextElement(EclipseLinkTenantDiscriminatorColumnAnnotation2_3 resourceElement) { - return JavaEclipseLinkMultitenancyImpl2_3.this.buildTenantDiscriminatorColumn(resourceElement); - } - @Override - protected ListIterable<EclipseLinkTenantDiscriminatorColumnAnnotation2_3> getResourceElements() { - return JavaEclipseLinkMultitenancyImpl2_3.this.getTenantDiscriminatorColumnAnnotations(); - } - @Override - protected EclipseLinkTenantDiscriminatorColumnAnnotation2_3 getResourceElement(JavaTenantDiscriminatorColumn2_3 contextElement) { - return contextElement.getColumnAnnotation(); - } - } - - - // ********** default tenant discriminator columns ********** - - public ListIterable<JavaVirtualTenantDiscriminatorColumn2_3> getDefaultTenantDiscriminatorColumns() { - return this.defaultTenantDiscriminatorColumnContainer.getContextElements(); - } - - protected ListIterable<JavaReadOnlyTenantDiscriminatorColumn2_3> getReadOnlyDefaultTenantDiscriminatorColumns() { - return new SuperListIterableWrapper<JavaReadOnlyTenantDiscriminatorColumn2_3>(this.getDefaultTenantDiscriminatorColumns()); - } - - public int getDefaultTenantDiscriminatorColumnsSize() { - return this.defaultTenantDiscriminatorColumnContainer.getContextElementsSize(); - } - - protected void clearDefaultTenantDiscriminatorColumns() { - this.defaultTenantDiscriminatorColumnContainer.clearContextList(); - } - - /** - * If there are any specified tenant discriminator columns, then there are no default - * tenant discriminator columns. - * @see #getTenantDiscriminatorColumnsForDefaults() - */ - protected void updateDefaultTenantDiscriminatorColumns() { - this.defaultTenantDiscriminatorColumnContainer.update(); - } - - protected ContextListContainer<JavaVirtualTenantDiscriminatorColumn2_3, ReadOnlyTenantDiscriminatorColumn2_3> buildDefaultTenantDiscriminatorColumnContainer() { - return new DefaultTenantDiscriminatorColumnContainer(); - } - - protected JavaVirtualTenantDiscriminatorColumn2_3 buildVirtualTenantDiscriminatorColumn(ReadOnlyTenantDiscriminatorColumn2_3 tenantDiscriminatorColumn) { - return new EclipseLinkJavaVirtualTenantDiscriminatorColumn2_3(this, this.tenantDiscriminatorColumnOwner, tenantDiscriminatorColumn); - } - - protected ListIterable<ReadOnlyTenantDiscriminatorColumn2_3> getTenantDiscriminatorColumnsForDefaults() { - if (this.getType() == null || this.getType() == EclipseLinkMultitenantType2_3.TABLE_PER_TENANT) { - return EmptyListIterable.instance(); - } - if (this.isMultitenantInheritanceHierarchy()) { - return new SuperListIterableWrapper<ReadOnlyTenantDiscriminatorColumn2_3>(this.getRootEntity().getMultitenancy().getTenantDiscriminatorColumns()); - } - if (!this.isSpecifiedMultitenant()) { - EclipseLinkMappedSuperclass superMappedSuperclass = this.getSuperMappedSuperclass(); - if (superMappedSuperclass != null && superMappedSuperclass.getMultitenancy().isMultitenant()) { - return new SuperListIterableWrapper<ReadOnlyTenantDiscriminatorColumn2_3>(superMappedSuperclass.getMultitenancy().getTenantDiscriminatorColumns()); - } - } - if (this.getSpecifiedTenantDiscriminatorColumnsSize() == 0) { - ListIterable<ReadOnlyTenantDiscriminatorColumn2_3> contextColumns = this.getContextDefaultTenantDiscriminatorColumns(); - if (CollectionTools.isEmpty(contextColumns)) { - return new SingleElementListIterable<ReadOnlyTenantDiscriminatorColumn2_3>(this.defaultTenantDiscriminatorColumn); - } - return contextColumns; - } - return EmptyListIterable.instance(); - } - - protected ListIterable<ReadOnlyTenantDiscriminatorColumn2_3> getContextDefaultTenantDiscriminatorColumns() { - EclipseLinkEntityMappings entityMappings = this.getEclipseLinkEntityMappings(); - return (entityMappings != null) ? entityMappings.getTenantDiscriminatorColumns() : this.getPersistenceUnit().getDefaultTenantDiscriminatorColumns(); - } - - public boolean specifiedTenantDiscriminatorColumnsAllowed() { - return this.specifiedTenantDiscriminatorColumnsAllowed; - } - - public void setSpecifiedTenantDiscriminatorColumnsAllowed(boolean allowed) { - boolean old = this.specifiedTenantDiscriminatorColumnsAllowed; - this.specifiedTenantDiscriminatorColumnsAllowed = allowed; - this.firePropertyChanged(SPECIFIED_TENANT_DISCRIMINATOR_COLUMNS_ALLOWED_PROPERTY, old, allowed); - } - - protected boolean buildSpecifiedTenantDiscriminatorColumnsAllowed() { - return this.getParent().isMultitenantMetadataAllowed(); - } - - - /** - * default tenant discriminator column container - */ - protected class DefaultTenantDiscriminatorColumnContainer - extends ContextListContainer<JavaVirtualTenantDiscriminatorColumn2_3, ReadOnlyTenantDiscriminatorColumn2_3> - { - @Override - protected String getContextElementsPropertyName() { - return DEFAULT_TENANT_DISCRIMINATOR_COLUMNS_LIST; - } - @Override - protected JavaVirtualTenantDiscriminatorColumn2_3 buildContextElement(ReadOnlyTenantDiscriminatorColumn2_3 resourceElement) { - return JavaEclipseLinkMultitenancyImpl2_3.this.buildVirtualTenantDiscriminatorColumn(resourceElement); - } - @Override - protected ListIterable<ReadOnlyTenantDiscriminatorColumn2_3> getResourceElements() { - return JavaEclipseLinkMultitenancyImpl2_3.this.getTenantDiscriminatorColumnsForDefaults(); - } - @Override - protected ReadOnlyTenantDiscriminatorColumn2_3 getResourceElement(JavaVirtualTenantDiscriminatorColumn2_3 contextElement) { - return contextElement.getOverriddenColumn(); - } - } - - - - // ********** JavaReadOnlyTenantDiscriminatorColumn.Owner implementation ********** - - protected class TenantDiscriminatorColumnOwner - implements JavaReadOnlyTenantDiscriminatorColumn2_3.Owner - { - - public String getDefaultContextPropertyName() { - return ReadOnlyTenantDiscriminatorColumn2_3.DEFAULT_CONTEXT_PROPERTY; - } - - public boolean getDefaultPrimaryKey() { - return ReadOnlyTenantDiscriminatorColumn2_3.DEFAULT_PRIMARY_KEY; - } - - public int getDefaultLength() { - return ReadOnlyNamedDiscriminatorColumn.DEFAULT_LENGTH; - } - - public DiscriminatorType getDefaultDiscriminatorType() { - return ReadOnlyNamedDiscriminatorColumn.DEFAULT_DISCRIMINATOR_TYPE; - } - - public String getDefaultTableName() { - return getTypeMapping().getPrimaryTableName(); - } - - public String getDefaultColumnName(ReadOnlyNamedColumn column) { - return ReadOnlyTenantDiscriminatorColumn2_3.DEFAULT_NAME; - } - - public Table resolveDbTable(String tableName) { - return getTypeMapping().resolveDbTable(tableName); - } - - public Iterable<String> getCandidateTableNames() { - return getTypeMapping().getAllAssociatedTableNames(); - } - - public boolean tableNameIsInvalid(String tableName) { - return getTypeMapping().tableNameIsInvalid(tableName); - } - - public JptValidator buildColumnValidator(ReadOnlyNamedColumn column, NamedColumnTextRangeResolver textRangeResolver) { - return new TenantDiscriminatorColumnValidator2_3((ReadOnlyTenantDiscriminatorColumn2_3) column, textRangeResolver); - } - - public TextRange getValidationTextRange(CompilationUnit astRoot) { - return JavaEclipseLinkMultitenancyImpl2_3.this.getValidationTextRange(astRoot); - } - } - - - // ********** multitenant annotation ********** - - protected EclipseLinkMultitenantAnnotation2_3 addMultitenantAnnotation() { - return (EclipseLinkMultitenantAnnotation2_3) this.getJavaResourceType().addAnnotation(this.getMultitenantAnnotationName()); - } - - protected void removeMultitenantAnnotation() { - this.getJavaResourceType().removeAnnotation(this.getMultitenantAnnotationName()); - } - - protected EclipseLinkMultitenantAnnotation2_3 getMultitenantAnnotation() { - return (EclipseLinkMultitenantAnnotation2_3) this.getJavaResourceType().getNonNullAnnotation(this.getMultitenantAnnotationName()); - } - - protected TextRange getMultitenantAnnotationTextRange(CompilationUnit astRoot) { - return this.getMultitenantAnnotation().getTextRange(astRoot); - } - - public boolean isMultitenantAnnotationSpecified() { - return this.getMultitenantAnnotation().isSpecified(); - } - - protected String getMultitenantAnnotationName() { - return EclipseLinkMultitenantAnnotation2_3.ANNOTATION_NAME; - } - - - // ********** tenant discriminator column annotations ********** - - protected ListIterable<EclipseLinkTenantDiscriminatorColumnAnnotation2_3> getTenantDiscriminatorColumnAnnotations() { - return this.getTenantDiscriminatorColumnAnnotations_(); - } - - protected ListIterable<EclipseLinkTenantDiscriminatorColumnAnnotation2_3> getTenantDiscriminatorColumnAnnotations_() { - return new SubListIterableWrapper<NestableAnnotation, EclipseLinkTenantDiscriminatorColumnAnnotation2_3>(this.getNestableTenantDiscriminatorColumnAnnotations_()); - } - - protected ListIterable<NestableAnnotation> getNestableTenantDiscriminatorColumnAnnotations_() { - return this.getJavaResourceType().getAnnotations(EclipseLinkTenantDiscriminatorColumnAnnotation2_3.ANNOTATION_NAME); - } - - protected EclipseLinkTenantDiscriminatorColumnAnnotation2_3 addTenantDiscriminatorColumnAnnotation(int index) { - return (EclipseLinkTenantDiscriminatorColumnAnnotation2_3) this.getJavaResourceType().addAnnotation(index, EclipseLinkTenantDiscriminatorColumnAnnotation2_3.ANNOTATION_NAME); - } - - protected void removeTenantDiscriminatorColumnAnnotation(int index) { - this.getJavaResourceType().removeAnnotation(index, EclipseLinkTenantDiscriminatorColumnAnnotation2_3.ANNOTATION_NAME); - } - - protected void moveTenantDiscriminatorColumnAnnotation(int targetIndex, int sourceIndex) { - this.getJavaResourceType().moveAnnotation(targetIndex, sourceIndex, EclipseLinkTenantDiscriminatorColumnAnnotation2_3.ANNOTATION_NAME); - } - - - // ********** misc ********** - - @Override - public JavaEclipseLinkNonEmbeddableTypeMapping getParent() { - return (JavaEclipseLinkNonEmbeddableTypeMapping) super.getParent(); - } - - protected JavaEclipseLinkNonEmbeddableTypeMapping getTypeMapping() { - return this.getParent(); - } - - protected JavaPersistentType getPersistentType() { - return this.getTypeMapping().getPersistentType(); - } - - public JavaResourceType getJavaResourceType() { - return this.getTypeMapping().getJavaResourceType(); - } - - public EclipseLinkEntityMappings getEclipseLinkEntityMappings() { - MappingFileRoot mfRoot = super.getMappingFileRoot(); - if (mfRoot instanceof EclipseLinkEntityMappings) { - return (EclipseLinkEntityMappings) mfRoot; - } - return null; - } - - @Override - public EclipseLinkPersistenceUnit getPersistenceUnit() { - return (EclipseLinkPersistenceUnit) super.getPersistenceUnit(); - } - - protected boolean isMultitenantInheritanceHierarchy() { - if (this.isInheritanceStrategyTablePerClass()) { - return false; - } - return this.isRootEntityMultitenant(); - } - - protected boolean isInheritanceStrategyTablePerClass() { - return this.getParent().getInheritanceStrategy() == InheritanceType.TABLE_PER_CLASS; - } - - protected boolean isRootEntityMultitenant() { - EclipseLinkEntity rootEntity = this.getRootEntity(); - return rootEntity != null && rootEntity != getParent() && rootEntity.getMultitenancy().isMultitenant(); - } - - protected EclipseLinkEntity getRootEntity() { - //instanceof check in case the rootEntity is in an orm.xml instead of an eclipselinkorm.xml file. - Entity entity = getParent().getRootEntity(); - return entity instanceof EclipseLinkEntity ? (EclipseLinkEntity) entity : null; - } - - - protected boolean isSuperMappedSuperclassMultitenant() { - EclipseLinkMappedSuperclass mappedSuperclass = this.getSuperMappedSuperclass(getParent()); - return mappedSuperclass != null && mappedSuperclass.getMultitenancy().isMultitenant(); - } - - protected EclipseLinkMappedSuperclass getSuperMappedSuperclass() { - return this.getSuperMappedSuperclass(this.getParent()); - } - - protected EclipseLinkMappedSuperclass getSuperMappedSuperclass(TypeMapping typeMapping) { - TypeMapping superTypeMapping = typeMapping.getSuperTypeMapping(); - if (superTypeMapping == null) { - return null; - } - //instanceof check in case the mapped superclass is in an orm.xml instead of an eclipselinkorm.xml file. - if (superTypeMapping instanceof EclipseLinkMappedSuperclass) { - return (EclipseLinkMappedSuperclass) superTypeMapping; - } - return this.getSuperMappedSuperclass(superTypeMapping); - } - - public boolean usesPrimaryKeyTenantDiscriminatorColumns() { - for (ReadOnlyTenantDiscriminatorColumn2_3 column : getTenantDiscriminatorColumns()) { - if (column.isPrimaryKey()) { - return true; - } - } - return false; - } - - // ********** Java completion proposals ********** - - @Override - public Iterable<String> getJavaCompletionProposals(int pos, Filter<String> filter, CompilationUnit astRoot) { - Iterable<String> result = super.getJavaCompletionProposals(pos, filter, astRoot); - if (result != null) { - return result; - } - for (JavaTenantDiscriminatorColumn2_3 tenantDiscriminatorColumn : this.getSpecifiedTenantDiscriminatorColumns()) { - result = tenantDiscriminatorColumn.getJavaCompletionProposals(pos, filter, astRoot); - if (result != null) { - return result; - } - } - - return null; - } - - - // ********** validation ********** - - @Override - public void validate(List<IMessage> messages, IReporter reporter, CompilationUnit astRoot) { - super.validate(messages, reporter, astRoot); - if (getSpecifiedType() == EclipseLinkMultitenantType2_3.TABLE_PER_TENANT) { - messages.add( - DefaultEclipseLinkJpaValidationMessages.buildMessage( - IMessage.NORMAL_SEVERITY, - EclipseLinkJpaValidationMessages.MULTITENANT_TABLE_PER_TENANT_NOT_SUPPORTED, - EMPTY_STRING_ARRAY, - this, - this.getMultitenantAnnotationTextRange(astRoot) - ) - ); - } - if (getSpecifiedType() == EclipseLinkMultitenantType2_3.VPD) { - String targetDatabase = getPersistenceUnit().getOptions().getTargetDatabase(); - if (targetDatabase == null) { - messages.add( - DefaultEclipseLinkJpaValidationMessages.buildMessage( - IMessage.LOW_SEVERITY, - EclipseLinkJpaValidationMessages.MULTITENANT_VPD_MIGHT_NOT_BE_NOT_SUPPORTED, - EMPTY_STRING_ARRAY, - this, - this.getMultitenantAnnotationTextRange(astRoot) - ) - ); - } - else if (!TargetDatabase.isOracleDatabase(targetDatabase)) { - messages.add( - DefaultEclipseLinkJpaValidationMessages.buildMessage( - IMessage.NORMAL_SEVERITY, - EclipseLinkJpaValidationMessages.MULTITENANT_VPD_NOT_SUPPORTED_ON_NON_ORACLE_DATABASE_PLATFORM, - new String[] {targetDatabase}, - this, - this.getMultitenantAnnotationTextRange(astRoot) - ) - ); - } - } - if (this.getSpecifiedTenantDiscriminatorColumnsSize() > 0) { - if (!this.specifiedTenantDiscriminatorColumnsAllowed()) { - messages.add( - DefaultEclipseLinkJpaValidationMessages.buildMessage( - IMessage.NORMAL_SEVERITY, - EclipseLinkJpaValidationMessages.MULTITENANT_METADATA_CANNOT_BE_SPECIFIED_ON_NON_ROOT_ENTITY, - EMPTY_STRING_ARRAY, - this, - this.getJavaResourceType().getTextRange(EclipseLinkTenantDiscriminatorColumnAnnotation2_3.ANNOTATION_NAME, astRoot) - ) - ); - } - else if (this.isMultitenantAnnotationSpecified()) { - for (JavaTenantDiscriminatorColumn2_3 column : this.getSpecifiedTenantDiscriminatorColumns()) { - column.validate(messages, reporter, astRoot); - } - } - else { - messages.add( - DefaultEclipseLinkJpaValidationMessages.buildMessage( - IMessage.NORMAL_SEVERITY, - EclipseLinkJpaValidationMessages.MULTITENANT_NOT_SPECIFIED_WITH_TENANT_DISCRIMINATOR_COLUMNS, - EMPTY_STRING_ARRAY, - this, - this.getJavaResourceType().getTextRange(EclipseLinkTenantDiscriminatorColumnAnnotation2_3.ANNOTATION_NAME, astRoot) - ) - ); - } - } - if (this.specifiedTenantDiscriminatorColumnsAllowed()) { - //bug 360731 no need to validate, they will be validated where they are specified - for (JavaVirtualTenantDiscriminatorColumn2_3 column : this.getDefaultTenantDiscriminatorColumns()) { - column.validate(messages, reporter, astRoot); - } - } - if (this.getSpecifiedIncludeCriteria() == Boolean.TRUE && getType() == EclipseLinkMultitenantType2_3.VPD) { - messages.add( - DefaultEclipseLinkJpaValidationMessages.buildMessage( - IMessage.NORMAL_SEVERITY, - EclipseLinkJpaValidationMessages.MULTITENANT_VPD_INCLUDE_CRITERIA_WILL_BE_IGNORED, - EMPTY_STRING_ARRAY, - this, - this.getMultitenantAnnotation().getIncludeCriteriaTextRange(astRoot) - ) - ); - } - } - - public TextRange getValidationTextRange(CompilationUnit astRoot) { - TextRange textRange = this.getMultitenantAnnotation().getTextRange(astRoot); - return (textRange != null) ? textRange : this.getTypeMapping().getValidationTextRange(astRoot); - } -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/java/JavaEclipseLinkMutable.java b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/java/JavaEclipseLinkMutable.java deleted file mode 100644 index 9892b02742..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/java/JavaEclipseLinkMutable.java +++ /dev/null @@ -1,175 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2008, 2012 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.eclipselink.core.internal.context.java; - -import org.eclipse.jdt.core.dom.CompilationUnit; -import org.eclipse.jpt.common.core.resource.java.JavaResourceAttribute; -import org.eclipse.jpt.common.core.utility.TextRange; -import org.eclipse.jpt.jpa.core.context.java.JavaAttributeMapping; -import org.eclipse.jpt.jpa.core.internal.context.java.AbstractJavaJpaContextNode; -import org.eclipse.jpt.jpa.eclipselink.core.context.EclipseLinkMutable; -import org.eclipse.jpt.jpa.eclipselink.core.context.java.JavaEclipseLinkPersistentAttribute; -import org.eclipse.jpt.jpa.eclipselink.core.context.persistence.EclipseLinkPersistenceUnit; -import org.eclipse.jpt.jpa.eclipselink.core.resource.java.EclipseLinkMutableAnnotation; - -public class JavaEclipseLinkMutable - extends AbstractJavaJpaContextNode - implements EclipseLinkMutable -{ - protected Boolean specifiedMutable; - protected boolean defaultMutable; - - - public JavaEclipseLinkMutable(JavaAttributeMapping parent) { - super(parent); - this.specifiedMutable = this.buildSpecifiedMutable(); - } - - - // ********** synchronize/update ********** - - @Override - public void synchronizeWithResourceModel() { - super.synchronizeWithResourceModel(); - this.setSpecifiedMutable_(this.buildSpecifiedMutable()); - } - - @Override - public void update() { - super.update(); - this.setDefaultMutable(this.buildDefaultMutable()); - } - - - // ********** mutable ********** - - public boolean isMutable() { - return (this.specifiedMutable != null) ? this.specifiedMutable.booleanValue() : this.defaultMutable; - } - - public Boolean getSpecifiedMutable() { - return this.specifiedMutable; - } - - public void setSpecifiedMutable(Boolean mutable) { - if (this.valuesAreDifferent(mutable, this.specifiedMutable)) { - EclipseLinkMutableAnnotation annotation = this.getMutableAnnotation(); - if (mutable == null) { - if (annotation != null) { - this.removeMutableAnnotation(); - } - } else { - if (annotation == null) { - annotation = this.addMutableAnnotation(); - } - Boolean annotationValue = annotation.getValue(); - boolean annotationBooleanValue = (annotationValue == null) ? true : annotationValue.booleanValue(); - if (annotationBooleanValue != mutable.booleanValue()) { - annotation.setValue(mutable); - } - } - - this.setSpecifiedMutable_(mutable); - } - } - - protected void setSpecifiedMutable_(Boolean mutable) { - Boolean old = this.specifiedMutable; - this.specifiedMutable = mutable; - this.firePropertyChanged(SPECIFIED_MUTABLE_PROPERTY, old, mutable); - } - - protected Boolean buildSpecifiedMutable() { - EclipseLinkMutableAnnotation annotation = this.getMutableAnnotation(); - if (annotation == null) { - return null; - } - - // @Mutable is equivalent to @Mutable(true) - Boolean annotationValue = annotation.getValue(); - return (annotationValue == null) ? Boolean.TRUE : annotationValue; - } - - public boolean isDefaultMutable() { - return this.defaultMutable; - } - - protected void setDefaultMutable(boolean mutable) { - boolean old = this.defaultMutable; - this.defaultMutable = mutable; - this.firePropertyChanged(DEFAULT_MUTABLE_PROPERTY, old, mutable); - } - - protected boolean buildDefaultMutable() { - JavaEclipseLinkPersistentAttribute javaAttribute = this.getPersistentAttribute(); - if (javaAttribute.typeIsDateOrCalendar()) { - Boolean puTemporalMutable = this.getPersistenceUnit().getOptions().getTemporalMutable(); - return (puTemporalMutable == null) ? false : puTemporalMutable.booleanValue(); - } - return javaAttribute.typeIsSerializable(); - } - - - // ********** mutable annotation ********** - - protected EclipseLinkMutableAnnotation getMutableAnnotation() { - return (EclipseLinkMutableAnnotation) this.getResourceAttribute().getAnnotation(this.getMutableAnnotationName()); - } - - protected EclipseLinkMutableAnnotation addMutableAnnotation() { - return (EclipseLinkMutableAnnotation) this.getResourceAttribute().addAnnotation(this.getMutableAnnotationName()); - } - - protected void removeMutableAnnotation() { - this.getResourceAttribute().removeAnnotation(this.getMutableAnnotationName()); - } - - protected String getMutableAnnotationName() { - return EclipseLinkMutableAnnotation.ANNOTATION_NAME; - } - - - // ********** misc ********** - - @Override - public JavaAttributeMapping getParent() { - return (JavaAttributeMapping) super.getParent(); - } - - protected JavaAttributeMapping getAttributeMapping() { - return this.getParent(); - } - - protected JavaResourceAttribute getResourceAttribute() { - return this.getAttributeMapping().getResourceAttribute(); - } - - protected JavaEclipseLinkPersistentAttribute getPersistentAttribute() { - return (JavaEclipseLinkPersistentAttribute) this.getAttributeMapping().getPersistentAttribute(); - } - - @Override - public EclipseLinkPersistenceUnit getPersistenceUnit() { - return (EclipseLinkPersistenceUnit) super.getPersistenceUnit(); - } - - - // ********** validation ********** - - public TextRange getValidationTextRange(CompilationUnit astRoot) { - TextRange textRange = this.getAnnotationTextRange(astRoot); - return (textRange != null) ? textRange : this.getAttributeMapping().getValidationTextRange(astRoot); - } - - protected TextRange getAnnotationTextRange(CompilationUnit astRoot) { - EclipseLinkMutableAnnotation annotation = this.getMutableAnnotation(); - return (annotation == null) ? null : annotation.getTextRange(astRoot); - } -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/java/JavaEclipseLinkObjectTypeConverter.java b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/java/JavaEclipseLinkObjectTypeConverter.java deleted file mode 100644 index 085884302f..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/java/JavaEclipseLinkObjectTypeConverter.java +++ /dev/null @@ -1,345 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2008, 2012 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.eclipselink.core.internal.context.java; - -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import org.eclipse.jdt.core.dom.CompilationUnit; -import org.eclipse.jpt.common.utility.internal.Tools; -import org.eclipse.jpt.common.utility.internal.iterables.ListIterable; -import org.eclipse.jpt.common.utility.internal.iterables.TransformationIterable; -import org.eclipse.jpt.jpa.core.context.JpaNamedContextNode; -import org.eclipse.jpt.jpa.eclipselink.core.context.EclipseLinkConversionValue; -import org.eclipse.jpt.jpa.eclipselink.core.context.EclipseLinkObjectTypeConverter; -import org.eclipse.jpt.jpa.eclipselink.core.context.java.JavaEclipseLinkConverterContainer; -import org.eclipse.jpt.jpa.eclipselink.core.context.orm.OrmEclipseLinkConverterContainer; -import org.eclipse.jpt.jpa.eclipselink.core.internal.DefaultEclipseLinkJpaValidationMessages; -import org.eclipse.jpt.jpa.eclipselink.core.internal.EclipseLinkJpaValidationMessages; -import org.eclipse.jpt.jpa.eclipselink.core.resource.java.EclipseLinkConversionValueAnnotation; -import org.eclipse.jpt.jpa.eclipselink.core.resource.java.EclipseLinkObjectTypeConverterAnnotation; -import org.eclipse.wst.validation.internal.provisional.core.IMessage; -import org.eclipse.wst.validation.internal.provisional.core.IReporter; - -/** - * <code>org.eclipse.persistence.annotations.ObjectTypeConverter</code> - */ -public class JavaEclipseLinkObjectTypeConverter - extends JavaEclipseLinkConverter<EclipseLinkObjectTypeConverterAnnotation> - implements EclipseLinkObjectTypeConverter -{ - private String dataType; - private String fullyQualifiedDataType; - - private String objectType; - private String fullyQualifiedObjectType; - - protected final ContextListContainer<JavaEclipseLinkConversionValue, EclipseLinkConversionValueAnnotation> conversionValueContainer; - - private String defaultObjectValue; - - - public JavaEclipseLinkObjectTypeConverter(JavaEclipseLinkConverterContainer parent, EclipseLinkObjectTypeConverterAnnotation converterAnnotation) { - super(parent, converterAnnotation); - this.dataType = converterAnnotation.getDataType(); - this.objectType = converterAnnotation.getObjectType(); - this.conversionValueContainer = this.buildConversionValueContainer(); - this.defaultObjectValue = converterAnnotation.getDefaultObjectValue(); - } - - - // ********** synchronize/update ********** - - @Override - public void synchronizeWithResourceModel() { - super.synchronizeWithResourceModel(); - this.setDataType_(this.converterAnnotation.getDataType()); - this.setObjectType_(this.converterAnnotation.getObjectType()); - this.syncConversionValues(); - this.setDefaultObjectValue_(this.converterAnnotation.getDefaultObjectValue()); - } - - @Override - public void update() { - super.update(); - this.setFullyQualifiedDataType(this.converterAnnotation.getFullyQualifiedDataType()); - this.setFullyQualifiedObjectType(this.converterAnnotation.getFullyQualifiedObjectType()); - this.updateNodes(this.getConversionValues()); - } - - - // ********** data type ********** - - public String getDataType() { - return this.dataType; - } - - public void setDataType(String dataType) { - this.converterAnnotation.setDataType(dataType); - this.setDataType_(dataType); - } - - protected void setDataType_(String dataType) { - String old = this.dataType; - this.dataType = dataType; - this.firePropertyChanged(DATA_TYPE_PROPERTY, old, dataType); - } - - - // ********** fully qualified data type ********** - - public String getFullyQualifiedDataType() { - return this.fullyQualifiedDataType; - } - - protected void setFullyQualifiedDataType(String dataType) { - String old = this.fullyQualifiedDataType; - this.fullyQualifiedDataType = dataType; - this.firePropertyChanged(FULLY_QUALIFIED_DATA_TYPE_PROPERTY, old, dataType); - } - - - // ********** object type ********** - - public String getObjectType() { - return this.objectType; - } - - public void setObjectType(String objectType) { - this.converterAnnotation.setObjectType(objectType); - this.setObjectType_(objectType); - } - - protected void setObjectType_(String objectType) { - String old = this.objectType; - this.objectType = objectType; - this.firePropertyChanged(OBJECT_TYPE_PROPERTY, old, objectType); - } - - - // ********** fully qualified object type ********** - - public String getFullyQualifiedObjectType() { - return this.fullyQualifiedObjectType; - } - - protected void setFullyQualifiedObjectType(String objectType) { - String old = this.fullyQualifiedObjectType; - this.fullyQualifiedObjectType = objectType; - this.firePropertyChanged(FULLY_QUALIFIED_OBJECT_TYPE_PROPERTY, old, objectType); - } - - - // ********** conversion values ********** - - public ListIterable<JavaEclipseLinkConversionValue> getConversionValues() { - return this.conversionValueContainer.getContextElements(); - } - - public int getConversionValuesSize() { - return this.conversionValueContainer.getContextElementsSize(); - } - - public EclipseLinkConversionValue getConversionValue(int index) { - return this.conversionValueContainer.get(index); - } - - public JavaEclipseLinkConversionValue addConversionValue() { - return this.addConversionValue(this.getConversionValuesSize()); - } - - public JavaEclipseLinkConversionValue addConversionValue(int index) { - EclipseLinkConversionValueAnnotation annotation = this.converterAnnotation.addConversionValue(index); - return this.conversionValueContainer.addContextElement(index, annotation); - } - - public void removeConversionValue(EclipseLinkConversionValue conversionValue) { - this.removeConversionValue(this.conversionValueContainer.indexOfContextElement((JavaEclipseLinkConversionValue) conversionValue)); - } - - public void removeConversionValue(int index) { - this.converterAnnotation.removeConversionValue(index); - this.conversionValueContainer.removeContextElement(index); - } - - public void moveConversionValue(int targetIndex, int sourceIndex) { - this.converterAnnotation.moveConversionValue(targetIndex, sourceIndex); - this.conversionValueContainer.moveContextElement(targetIndex, sourceIndex); - } - - protected JavaEclipseLinkConversionValue buildConversionValue(EclipseLinkConversionValueAnnotation conversionValueAnnotation) { - return new JavaEclipseLinkConversionValue(this, conversionValueAnnotation); - } - - protected void syncConversionValues() { - this.conversionValueContainer.synchronizeWithResourceModel(); - } - - protected ListIterable<EclipseLinkConversionValueAnnotation> getConversionValueAnnotations() { - return this.converterAnnotation.getConversionValues(); - } - - protected ContextListContainer<JavaEclipseLinkConversionValue, EclipseLinkConversionValueAnnotation> buildConversionValueContainer() { - ConversionValueContainer container = new ConversionValueContainer(); - container.initialize(); - return container; - } - - /** - * conversion value container - */ - protected class ConversionValueContainer - extends ContextListContainer<JavaEclipseLinkConversionValue, EclipseLinkConversionValueAnnotation> { - - @Override - protected String getContextElementsPropertyName() { - return CONVERSION_VALUES_LIST; - } - - @Override - protected JavaEclipseLinkConversionValue buildContextElement(EclipseLinkConversionValueAnnotation resourceElement) { - return JavaEclipseLinkObjectTypeConverter.this.buildConversionValue(resourceElement); - } - - @Override - protected ListIterable<EclipseLinkConversionValueAnnotation> getResourceElements() { - return JavaEclipseLinkObjectTypeConverter.this.getConversionValueAnnotations(); - } - - @Override - protected EclipseLinkConversionValueAnnotation getResourceElement(JavaEclipseLinkConversionValue contextElement) { - return contextElement.getConversionValueAnnotation(); - } - } - - - // ********** data values ********** - - public Iterable<String> getDataValues() { - return new TransformationIterable<JavaEclipseLinkConversionValue, String>(this.getConversionValues()) { - @Override - protected String transform(JavaEclipseLinkConversionValue conversionValue) { - return conversionValue.getDataValue(); - } - }; - } - - public int getDataValuesSize() { - return this.getConversionValuesSize(); - } - - - // ********** default object value ********** - - public String getDefaultObjectValue() { - return this.defaultObjectValue; - } - - public void setDefaultObjectValue(String value) { - this.converterAnnotation.setDefaultObjectValue(value); - this.setDefaultObjectValue_(value); - } - - protected void setDefaultObjectValue_(String value) { - String old = this.defaultObjectValue; - this.defaultObjectValue = value; - this.firePropertyChanged(DEFAULT_OBJECT_VALUE_PROPERTY, old, value); - } - - - // ********** misc ********** - - public Class<EclipseLinkObjectTypeConverter> getType() { - return EclipseLinkObjectTypeConverter.class; - } - - - // ********** validation ********** - - @Override - public void validate(List<IMessage> messages, IReporter reporter, CompilationUnit astRoot) { - super.validate(messages, reporter, astRoot); - this.checkForDuplicateDataValues(messages, astRoot); - for (JavaEclipseLinkConversionValue conversionValue : this.getConversionValues()) { - conversionValue.validate(messages, reporter, astRoot); - } - } - - protected void checkForDuplicateDataValues(List<IMessage> messages, CompilationUnit astRoot) { - for (ArrayList<JavaEclipseLinkConversionValue> dups : this.mapConversionValuesByDataValue().values()) { - if (dups.size() > 1) { - for (JavaEclipseLinkConversionValue dup : dups) { - messages.add( - DefaultEclipseLinkJpaValidationMessages.buildMessage( - IMessage.HIGH_SEVERITY, - EclipseLinkJpaValidationMessages.MULTIPLE_OBJECT_VALUES_FOR_DATA_VALUE, - new String[] {dup.getDataValue()}, - this, - dup.getDataValueTextRange(astRoot) - ) - ); - } - } - } - } - - protected HashMap<String, ArrayList<JavaEclipseLinkConversionValue>> mapConversionValuesByDataValue() { - HashMap<String, ArrayList<JavaEclipseLinkConversionValue>> map = new HashMap<String, ArrayList<JavaEclipseLinkConversionValue>>(this.getConversionValuesSize()); - for (JavaEclipseLinkConversionValue conversionValue : this.getConversionValues()) { - String dataValue = conversionValue.getDataValue(); - ArrayList<JavaEclipseLinkConversionValue> list = map.get(dataValue); - if (list == null) { - list = new ArrayList<JavaEclipseLinkConversionValue>(); - map.put(dataValue, list); - } - list.add(conversionValue); - } - return map; - } - - @Override - public boolean isEquivalentTo(JpaNamedContextNode node) { - return super.isEquivalentTo(node) - && this.isEquivalentTo((EclipseLinkObjectTypeConverter) node); - } - - protected boolean isEquivalentTo(EclipseLinkObjectTypeConverter converter) { - return Tools.valuesAreEqual(this.fullyQualifiedObjectType, converter.getFullyQualifiedObjectType()) && - Tools.valuesAreEqual(this.fullyQualifiedDataType, converter.getFullyQualifiedDataType()) && - Tools.valuesAreEqual(this.defaultObjectValue, converter.getDefaultObjectValue()) && - this.conversionValuesAreEquivalentTo(converter); - } - - protected boolean conversionValuesAreEquivalentTo(EclipseLinkObjectTypeConverter converter) { - if (this.getConversionValuesSize() != converter.getConversionValuesSize()) { - return false; - } - - for (int i=0; i<this.getConversionValuesSize(); i++) { - if ( ! this.conversionValueContainer.get(i).isEquivalentTo(converter.getConversionValue(i))) { - return false; - } - } - return true; - } - - - // ********** metadata conversion ********** - - @Override - public void convertTo(OrmEclipseLinkConverterContainer ormConverterContainer) { - ormConverterContainer.addObjectTypeConverter().convertFrom(this); - } - - @Override - public void delete() { - this.getParent().removeObjectTypeConverter(this); - } -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/java/JavaEclipseLinkOneToManyMapping.java b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/java/JavaEclipseLinkOneToManyMapping.java deleted file mode 100644 index 8dfc2c5ea7..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/java/JavaEclipseLinkOneToManyMapping.java +++ /dev/null @@ -1,125 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2008, 2012 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.eclipselink.core.internal.context.java; - -import java.util.List; -import org.eclipse.jdt.core.dom.CompilationUnit; -import org.eclipse.jpt.common.core.resource.java.JavaResourceAnnotatedElement; -import org.eclipse.jpt.jpa.core.context.java.JavaJpaContextNode; -import org.eclipse.jpt.jpa.core.context.java.JavaMappingRelationship; -import org.eclipse.jpt.jpa.core.context.java.JavaPersistentAttribute; -import org.eclipse.jpt.jpa.core.internal.context.java.AbstractJavaOneToManyMapping; -import org.eclipse.jpt.jpa.eclipselink.core.context.EclipseLinkJoinFetch; -import org.eclipse.jpt.jpa.eclipselink.core.context.EclipseLinkOneToManyMapping2_0; -import org.eclipse.jpt.jpa.eclipselink.core.context.EclipseLinkPrivateOwned; -import org.eclipse.jpt.jpa.eclipselink.core.context.java.EclipseLinkJavaConvertibleMapping; -import org.eclipse.jpt.jpa.eclipselink.core.context.java.EclipseLinkJavaOneToManyRelationship2_0; -import org.eclipse.jpt.jpa.eclipselink.core.context.java.JavaEclipseLinkConverterContainer; -import org.eclipse.wst.validation.internal.provisional.core.IMessage; -import org.eclipse.wst.validation.internal.provisional.core.IReporter; - -public class JavaEclipseLinkOneToManyMapping - extends AbstractJavaOneToManyMapping - implements EclipseLinkOneToManyMapping2_0, EclipseLinkJavaConvertibleMapping -{ - protected final JavaEclipseLinkJoinFetch joinFetch; - - protected final JavaEclipseLinkPrivateOwned privateOwned; - - protected final JavaEclipseLinkConverterContainer converterContainer; - - - public JavaEclipseLinkOneToManyMapping(JavaPersistentAttribute parent) { - super(parent); - this.joinFetch = new JavaEclipseLinkJoinFetch(this); - this.privateOwned = new JavaEclipseLinkPrivateOwned(this); - this.converterContainer = this.buildConverterContainer(); - } - - - // ********** synchronize/update ********** - - @Override - public void synchronizeWithResourceModel() { - super.synchronizeWithResourceModel(); - this.privateOwned.synchronizeWithResourceModel(); - this.joinFetch.synchronizeWithResourceModel(); - this.converterContainer.synchronizeWithResourceModel(); - } - - @Override - public void update() { - super.update(); - this.privateOwned.update(); - this.joinFetch.update(); - this.converterContainer.update(); - } - - - // ********** private owned ********** - - public EclipseLinkPrivateOwned getPrivateOwned() { - return this.privateOwned; - } - - - // ********** join fetch ********** - - public EclipseLinkJoinFetch getJoinFetch() { - return this.joinFetch; - } - - - // ********** converters ********** - - public JavaEclipseLinkConverterContainer getConverterContainer() { - return this.converterContainer; - } - - protected JavaEclipseLinkConverterContainer buildConverterContainer() { - return new JavaEclipseLinkConverterContainerImpl(this); - } - - // ********** converter container parent adapter ********** - - public JavaJpaContextNode getConverterContainerParent() { - return this; // no adapter - } - - public JavaResourceAnnotatedElement getJavaResourceAnnotatedElement() { - return this.getResourceAttribute(); - } - - public boolean parentSupportsConverters() { - return ! this.getPersistentAttribute().isVirtual(); - } - - // ********** relationship ********** - - @Override - public EclipseLinkJavaOneToManyRelationship2_0 getRelationship() { - return (EclipseLinkJavaOneToManyRelationship) super.getRelationship(); - } - - @Override - protected JavaMappingRelationship buildRelationship() { - return new EclipseLinkJavaOneToManyRelationship(this); - } - - - // ********** validation ********** - - @Override - public void validate(List<IMessage> messages, IReporter reporter, CompilationUnit astRoot) { - super.validate(messages, reporter, astRoot); - this.joinFetch.validate(messages, reporter, astRoot); - this.privateOwned.validate(messages, reporter, astRoot); - } -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/java/JavaEclipseLinkOneToOneMapping.java b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/java/JavaEclipseLinkOneToOneMapping.java deleted file mode 100644 index ae6866d9d2..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/java/JavaEclipseLinkOneToOneMapping.java +++ /dev/null @@ -1,109 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2008, 2012 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.eclipselink.core.internal.context.java; - -import java.util.List; -import org.eclipse.jdt.core.dom.CompilationUnit; -import org.eclipse.jpt.common.core.resource.java.JavaResourceAnnotatedElement; -import org.eclipse.jpt.jpa.core.context.java.JavaJpaContextNode; -import org.eclipse.jpt.jpa.core.context.java.JavaPersistentAttribute; -import org.eclipse.jpt.jpa.core.internal.context.java.AbstractJavaOneToOneMapping; -import org.eclipse.jpt.jpa.eclipselink.core.context.EclipseLinkJoinFetch; -import org.eclipse.jpt.jpa.eclipselink.core.context.EclipseLinkOneToOneMapping2_0; -import org.eclipse.jpt.jpa.eclipselink.core.context.EclipseLinkPrivateOwned; -import org.eclipse.jpt.jpa.eclipselink.core.context.java.EclipseLinkJavaConvertibleMapping; -import org.eclipse.jpt.jpa.eclipselink.core.context.java.JavaEclipseLinkConverterContainer; -import org.eclipse.wst.validation.internal.provisional.core.IMessage; -import org.eclipse.wst.validation.internal.provisional.core.IReporter; - -public class JavaEclipseLinkOneToOneMapping - extends AbstractJavaOneToOneMapping - implements EclipseLinkOneToOneMapping2_0, EclipseLinkJavaConvertibleMapping -{ - protected final JavaEclipseLinkJoinFetch joinFetch; - - protected final JavaEclipseLinkPrivateOwned privateOwned; - - protected final JavaEclipseLinkConverterContainer converterContainer; - - - public JavaEclipseLinkOneToOneMapping(JavaPersistentAttribute parent) { - super(parent); - this.joinFetch = new JavaEclipseLinkJoinFetch(this); - this.privateOwned = new JavaEclipseLinkPrivateOwned(this); - this.converterContainer = this.buildConverterContainer(); - } - - // ********** synchronize/update ********** - - @Override - public void synchronizeWithResourceModel() { - super.synchronizeWithResourceModel(); - this.privateOwned.synchronizeWithResourceModel(); - this.joinFetch.synchronizeWithResourceModel(); - this.converterContainer.synchronizeWithResourceModel(); - } - - @Override - public void update() { - super.update(); - this.privateOwned.update(); - this.joinFetch.update(); - this.converterContainer.update(); - } - - - // ********** private owned ********** - - public EclipseLinkPrivateOwned getPrivateOwned() { - return this.privateOwned; - } - - - // ********** join fetch ********** - - public EclipseLinkJoinFetch getJoinFetch() { - return this.joinFetch; - } - - - // ********** converters ********** - - public JavaEclipseLinkConverterContainer getConverterContainer() { - return this.converterContainer; - } - - protected JavaEclipseLinkConverterContainer buildConverterContainer() { - return new JavaEclipseLinkConverterContainerImpl(this); - } - - // ********** converter container parent adapter ********** - - public JavaJpaContextNode getConverterContainerParent() { - return this; // no adapter - } - - public JavaResourceAnnotatedElement getJavaResourceAnnotatedElement() { - return this.getResourceAttribute(); - } - - public boolean parentSupportsConverters() { - return ! this.getPersistentAttribute().isVirtual(); - } - - // ********** validation ********** - - @Override - public void validate(List<IMessage> messages, IReporter reporter, CompilationUnit astRoot) { - super.validate(messages, reporter, astRoot); - this.joinFetch.validate(messages, reporter, astRoot); - this.privateOwned.validate(messages, reporter, astRoot); - } -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/java/JavaEclipseLinkPrivateOwned.java b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/java/JavaEclipseLinkPrivateOwned.java deleted file mode 100644 index 01b6e9238b..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/java/JavaEclipseLinkPrivateOwned.java +++ /dev/null @@ -1,122 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2008, 2011 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.eclipselink.core.internal.context.java; - -import org.eclipse.jdt.core.dom.CompilationUnit; -import org.eclipse.jpt.common.core.resource.java.JavaResourceAttribute; -import org.eclipse.jpt.common.core.utility.TextRange; -import org.eclipse.jpt.jpa.core.context.java.JavaAttributeMapping; -import org.eclipse.jpt.jpa.core.internal.context.java.AbstractJavaJpaContextNode; -import org.eclipse.jpt.jpa.eclipselink.core.context.EclipseLinkPrivateOwned; -import org.eclipse.jpt.jpa.eclipselink.core.resource.java.EclipseLinkPrivateOwnedAnnotation; - -public class JavaEclipseLinkPrivateOwned - extends AbstractJavaJpaContextNode - implements EclipseLinkPrivateOwned -{ - protected boolean privateOwned; - - - public JavaEclipseLinkPrivateOwned(JavaAttributeMapping parent) { - super(parent); - this.privateOwned = this.buildPrivateOwned(); - } - - - // ********** synchronize/update ********** - - @Override - public void synchronizeWithResourceModel() { - super.synchronizeWithResourceModel(); - this.setPrivateOwned_(this.buildPrivateOwned()); - } - - - // ********** private owned ********** - - public boolean isPrivateOwned() { - return this.privateOwned; - } - - public void setPrivateOwned(boolean privateOwned) { - if (privateOwned != this.privateOwned) { - EclipseLinkPrivateOwnedAnnotation annotation = this.getPrivateOwnedAnnotation(); - if (privateOwned) { - if (annotation == null) { - this.addPrivateOwnedAnnotation(); - } - } else { - if (annotation != null) { - this.removePrivateOwnedAnnotation(); - } - } - - this.setPrivateOwned_(privateOwned); - } - } - - protected void setPrivateOwned_(boolean privateOwned) { - boolean old = this.privateOwned; - this.privateOwned = privateOwned; - this.firePropertyChanged(PRIVATE_OWNED_PROPERTY, old, privateOwned); - } - - protected boolean buildPrivateOwned() { - return this.getPrivateOwnedAnnotation() != null; - } - - - // ********** private owned annotation ********** - - protected EclipseLinkPrivateOwnedAnnotation getPrivateOwnedAnnotation() { - return (EclipseLinkPrivateOwnedAnnotation) this.getResourceAttribute().getAnnotation(this.getPrivateOwnedAnnotationName()); - } - - protected EclipseLinkPrivateOwnedAnnotation addPrivateOwnedAnnotation() { - return (EclipseLinkPrivateOwnedAnnotation) this.getResourceAttribute().addAnnotation(this.getPrivateOwnedAnnotationName()); - } - - protected void removePrivateOwnedAnnotation() { - this.getResourceAttribute().removeAnnotation(this.getPrivateOwnedAnnotationName()); - } - - protected String getPrivateOwnedAnnotationName() { - return EclipseLinkPrivateOwnedAnnotation.ANNOTATION_NAME; - } - - - // ********** misc ********** - - @Override - public JavaAttributeMapping getParent() { - return (JavaAttributeMapping) super.getParent(); - } - - protected JavaAttributeMapping getAttributeMapping() { - return this.getParent(); - } - - protected JavaResourceAttribute getResourceAttribute() { - return this.getAttributeMapping().getResourceAttribute(); - } - - - // ********** validation ********** - - public TextRange getValidationTextRange(CompilationUnit astRoot) { - TextRange textRange = this.getAnnotationTextRange(astRoot); - return (textRange != null) ? textRange : this.getAttributeMapping().getValidationTextRange(astRoot); - } - - protected TextRange getAnnotationTextRange(CompilationUnit astRoot) { - EclipseLinkPrivateOwnedAnnotation annotation = this.getPrivateOwnedAnnotation(); - return (annotation == null) ? null : annotation.getTextRange(astRoot); - } -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/java/JavaEclipseLinkReadOnly.java b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/java/JavaEclipseLinkReadOnly.java deleted file mode 100644 index 0cc0da0052..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/java/JavaEclipseLinkReadOnly.java +++ /dev/null @@ -1,136 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2008, 2011 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.eclipselink.core.internal.context.java; - -import org.eclipse.jdt.core.dom.CompilationUnit; -import org.eclipse.jpt.common.core.resource.java.JavaResourceType; -import org.eclipse.jpt.common.core.utility.TextRange; -import org.eclipse.jpt.jpa.core.context.java.JavaPersistentType; -import org.eclipse.jpt.jpa.core.internal.context.java.AbstractJavaJpaContextNode; -import org.eclipse.jpt.jpa.eclipselink.core.context.EclipseLinkReadOnly; -import org.eclipse.jpt.jpa.eclipselink.core.context.java.JavaEclipseLinkNonEmbeddableTypeMapping; -import org.eclipse.jpt.jpa.eclipselink.core.resource.java.EclipseLinkReadOnlyAnnotation; - -public class JavaEclipseLinkReadOnly - extends AbstractJavaJpaContextNode - implements EclipseLinkReadOnly -{ - protected Boolean specifiedReadOnly; // TRUE or null - - - public JavaEclipseLinkReadOnly(JavaEclipseLinkNonEmbeddableTypeMapping parent) { - super(parent); - this.specifiedReadOnly = this.buildSpecifiedReadOnly(); - } - - - // ********** synchronize/update ********** - - @Override - public void synchronizeWithResourceModel() { - super.synchronizeWithResourceModel(); - this.setSpecifiedReadOnly_(this.buildSpecifiedReadOnly()); - } - - - // ********** read-only ********** - - public boolean isReadOnly() { - return (this.specifiedReadOnly != null) ? this.specifiedReadOnly.booleanValue() : this.isDefaultReadOnly(); - } - - public Boolean getSpecifiedReadOnly() { - return this.specifiedReadOnly; - } - - public void setSpecifiedReadOnly(Boolean readOnly) { - readOnly = (readOnly == null) ? null : readOnly.booleanValue() ? readOnly : null; - if (this.valuesAreDifferent(readOnly, this.specifiedReadOnly)) { - EclipseLinkReadOnlyAnnotation annotation = this.getReadOnlyAnnotation(); - if (readOnly != null) { - if (annotation == null) { - this.addReadOnlyAnnotation(); - } - } else { - if (annotation != null) { - this.removeReadOnlyAnnotation(); - } - } - - this.setSpecifiedReadOnly_(readOnly); - } - } - - protected void setSpecifiedReadOnly_(Boolean readOnly) { - Boolean old = this.specifiedReadOnly; - this.specifiedReadOnly = readOnly; - this.firePropertyChanged(SPECIFIED_READ_ONLY_PROPERTY, old, readOnly); - } - - private Boolean buildSpecifiedReadOnly() { - return (this.getReadOnlyAnnotation() == null) ? null : Boolean.TRUE; - } - - public boolean isDefaultReadOnly() { - return DEFAULT_READ_ONLY; - } - - - // ********** read-only annotation ********** - - protected EclipseLinkReadOnlyAnnotation getReadOnlyAnnotation() { - return (EclipseLinkReadOnlyAnnotation) this.getJavaResourceType().getAnnotation(this.getReadOnlyAnnotationName()); - } - - protected void addReadOnlyAnnotation() { - this.getJavaResourceType().addAnnotation(this.getReadOnlyAnnotationName()); - } - - protected void removeReadOnlyAnnotation() { - this.getJavaResourceType().removeAnnotation(this.getReadOnlyAnnotationName()); - } - - protected String getReadOnlyAnnotationName() { - return EclipseLinkReadOnlyAnnotation.ANNOTATION_NAME; - } - - - // ********** misc ********** - - @Override - public JavaEclipseLinkNonEmbeddableTypeMapping getParent() { - return (JavaEclipseLinkNonEmbeddableTypeMapping) super.getParent(); - } - - protected JavaEclipseLinkNonEmbeddableTypeMapping getTypeMapping() { - return this.getParent(); - } - - protected JavaPersistentType getPersistentType() { - return this.getTypeMapping().getPersistentType(); - } - - protected JavaResourceType getJavaResourceType() { - return this.getTypeMapping().getJavaResourceType(); - } - - - // ********** validation ********** - - public TextRange getValidationTextRange(CompilationUnit astRoot) { - TextRange textRange = this.getAnnotationTextRange(astRoot); - return (textRange != null) ? textRange : this.getTypeMapping().getValidationTextRange(astRoot); - } - - protected TextRange getAnnotationTextRange(CompilationUnit astRoot) { - EclipseLinkReadOnlyAnnotation annotation = this.getReadOnlyAnnotation(); - return (annotation == null) ? null : annotation.getTextRange(astRoot); - } -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/java/JavaEclipseLinkStructConverter.java b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/java/JavaEclipseLinkStructConverter.java deleted file mode 100644 index c368e7c247..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/java/JavaEclipseLinkStructConverter.java +++ /dev/null @@ -1,86 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2008, 2012 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.eclipselink.core.internal.context.java; - -import org.eclipse.jpt.common.core.utility.TextRange; -import org.eclipse.jpt.jpa.eclipselink.core.context.EclipseLinkStructConverter; -import org.eclipse.jpt.jpa.eclipselink.core.context.java.JavaEclipseLinkConverterContainer; -import org.eclipse.jpt.jpa.eclipselink.core.context.orm.OrmEclipseLinkConverterContainer; -import org.eclipse.jpt.jpa.eclipselink.core.internal.EclipseLinkJpaValidationMessages; -import org.eclipse.jpt.jpa.eclipselink.core.resource.java.EclipseLinkStructConverterAnnotation; - -/** - * <code>org.eclipse.persistence.annotations.StructConverter</code> - */ -public class JavaEclipseLinkStructConverter - extends JavaEclipseLinkConverterClassConverter<EclipseLinkStructConverterAnnotation> - implements EclipseLinkStructConverter -{ - public JavaEclipseLinkStructConverter(JavaEclipseLinkConverterContainer parent, EclipseLinkStructConverterAnnotation converterAnnotation) { - super(parent, converterAnnotation, converterAnnotation.getConverter()); - } - - - // ********** converter class ********** - - @Override - protected String getAnnotationConverterClass() { - return this.converterAnnotation.getConverter(); - } - - @Override - protected void setAnnotationConverterClass(String converterClass) { - this.converterAnnotation.setConverter(converterClass); - } - - - // ********** misc ********** - - public Class<EclipseLinkStructConverter> getType() { - return EclipseLinkStructConverter.class; - } - - - // ********** validation ********** - - @Override - protected String getEclipseLinkConverterInterface() { - return ECLIPSELINK_STRUCT_CONVERTER_CLASS_NAME; - } - - @Override - protected String getEclipseLinkConverterInterfaceErrorMessage() { - return EclipseLinkJpaValidationMessages.STRUCT_CONVERTER_CLASS_IMPLEMENTS_STRUCT_CONVERTER; - } - - @Override - protected TextRange getAnnotationConverterClassTextRange() { - return this.converterAnnotation.getConverterTextRange(); - } - - /** - * Since the converter class is a string, it must be fully-qualified. - */ - public String getFullyQualifiedConverterClass() { - return this.getConverterClass(); - } - - // ********** metadata conversion ********** - - @Override - public void convertTo(OrmEclipseLinkConverterContainer ormConverterContainer) { - ormConverterContainer.addStructConverter().convertFrom(this); - } - - @Override - public void delete() { - this.getParent().removeStructConverter(this); - } -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/java/JavaEclipseLinkStructureMapping2_3.java b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/java/JavaEclipseLinkStructureMapping2_3.java deleted file mode 100644 index f1a6915182..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/java/JavaEclipseLinkStructureMapping2_3.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, 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.eclipselink.core.internal.context.java; - -import org.eclipse.jpt.jpa.core.context.java.JavaPersistentAttribute; -import org.eclipse.jpt.jpa.core.internal.context.java.AbstractJavaAttributeMapping; -import org.eclipse.jpt.jpa.eclipselink.core.EclipseLinkMappingKeys; -import org.eclipse.jpt.jpa.eclipselink.core.context.EclipseLinkStructureMapping2_3; -import org.eclipse.jpt.jpa.eclipselink.core.resource.java.EclipseLinkStructureAnnotation2_3; - -public class JavaEclipseLinkStructureMapping2_3 - extends AbstractJavaAttributeMapping<EclipseLinkStructureAnnotation2_3> - implements EclipseLinkStructureMapping2_3 -{ - - public JavaEclipseLinkStructureMapping2_3(JavaPersistentAttribute parent) { - super(parent); - } - - - // ********** misc ********** - - public String getKey() { - return EclipseLinkMappingKeys.STRUCTURE_ATTRIBUTE_MAPPING_KEY; - } - - @Override - protected String getAnnotationName() { - return EclipseLinkStructureAnnotation2_3.ANNOTATION_NAME; - } -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/java/JavaEclipseLinkTransformationMapping.java b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/java/JavaEclipseLinkTransformationMapping.java deleted file mode 100644 index b6ea98a647..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/java/JavaEclipseLinkTransformationMapping.java +++ /dev/null @@ -1,84 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2008, 2012 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.eclipselink.core.internal.context.java; - -import org.eclipse.jpt.common.core.resource.java.JavaResourceAnnotatedElement; -import org.eclipse.jpt.jpa.core.context.java.JavaJpaContextNode; -import org.eclipse.jpt.jpa.core.context.java.JavaPersistentAttribute; -import org.eclipse.jpt.jpa.core.internal.context.java.AbstractJavaAttributeMapping; -import org.eclipse.jpt.jpa.eclipselink.core.EclipseLinkMappingKeys; -import org.eclipse.jpt.jpa.eclipselink.core.context.EclipseLinkTransformationMapping; -import org.eclipse.jpt.jpa.eclipselink.core.context.java.EclipseLinkJavaConvertibleMapping; -import org.eclipse.jpt.jpa.eclipselink.core.context.java.JavaEclipseLinkConverterContainer; -import org.eclipse.jpt.jpa.eclipselink.core.resource.java.EclipseLinkTransformationAnnotation; - -public class JavaEclipseLinkTransformationMapping - extends AbstractJavaAttributeMapping<EclipseLinkTransformationAnnotation> - implements EclipseLinkTransformationMapping, EclipseLinkJavaConvertibleMapping -{ - - protected final JavaEclipseLinkConverterContainer converterContainer; - - public JavaEclipseLinkTransformationMapping(JavaPersistentAttribute parent) { - super(parent); - this.converterContainer = this.buildConverterContainer(); - } - - - // ********** synchronize/update ********** - - @Override - public void synchronizeWithResourceModel() { - super.synchronizeWithResourceModel(); - this.converterContainer.synchronizeWithResourceModel(); - } - - @Override - public void update() { - super.update(); - this.converterContainer.update(); - } - - - // ********** converters ********** - - public JavaEclipseLinkConverterContainer getConverterContainer() { - return this.converterContainer; - } - - protected JavaEclipseLinkConverterContainer buildConverterContainer() { - return new JavaEclipseLinkConverterContainerImpl(this); - } - - // ********** converter container parent adapter ********** - - public JavaJpaContextNode getConverterContainerParent() { - return this; // no adapter - } - - public JavaResourceAnnotatedElement getJavaResourceAnnotatedElement() { - return this.getResourceAttribute(); - } - - public boolean parentSupportsConverters() { - return ! this.getPersistentAttribute().isVirtual(); - } - - // ********** misc ********** - - public String getKey() { - return EclipseLinkMappingKeys.TRANSFORMATION_ATTRIBUTE_MAPPING_KEY; - } - - @Override - protected String getAnnotationName() { - return EclipseLinkTransformationAnnotation.ANNOTATION_NAME; - } -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/java/JavaEclipseLinkTypeConverter.java b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/java/JavaEclipseLinkTypeConverter.java deleted file mode 100644 index ec658aa847..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/java/JavaEclipseLinkTypeConverter.java +++ /dev/null @@ -1,151 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2008, 2011 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.eclipselink.core.internal.context.java; - -import org.eclipse.jpt.common.utility.internal.Tools; -import org.eclipse.jpt.jpa.core.context.JpaNamedContextNode; -import org.eclipse.jpt.jpa.eclipselink.core.context.EclipseLinkTypeConverter; -import org.eclipse.jpt.jpa.eclipselink.core.context.java.JavaEclipseLinkConverterContainer; -import org.eclipse.jpt.jpa.eclipselink.core.context.orm.OrmEclipseLinkConverterContainer; -import org.eclipse.jpt.jpa.eclipselink.core.resource.java.EclipseLinkTypeConverterAnnotation; - -/** - * <code>org.eclipse.persistence.annotations.TypeConverter</code> - */ -public class JavaEclipseLinkTypeConverter - extends JavaEclipseLinkConverter<EclipseLinkTypeConverterAnnotation> - implements EclipseLinkTypeConverter -{ - private String dataType; - private String fullyQualifiedDataType; - - private String objectType; - private String fullyQualifiedObjectType; - - - public JavaEclipseLinkTypeConverter(JavaEclipseLinkConverterContainer parent, EclipseLinkTypeConverterAnnotation converterAnnotation) { - super(parent, converterAnnotation); - this.dataType = this.converterAnnotation.getDataType(); - this.objectType = this.converterAnnotation.getObjectType(); - } - - - // ********** synchronize/update ********** - - @Override - public void synchronizeWithResourceModel() { - super.synchronizeWithResourceModel(); - this.setDataType_(this.converterAnnotation.getDataType()); - this.setObjectType_(this.converterAnnotation.getObjectType()); - } - - @Override - public void update() { - super.update(); - this.setFullyQualifiedDataType(this.converterAnnotation.getFullyQualifiedDataType()); - this.setFullyQualifiedObjectType(this.converterAnnotation.getFullyQualifiedObjectType()); - } - - - // ********** data type ********** - - public String getDataType() { - return this.dataType; - } - - public void setDataType(String dataType) { - this.converterAnnotation.setDataType(dataType); - this.setDataType_(dataType); - } - - protected void setDataType_(String dataType) { - String old = this.dataType; - this.dataType = dataType; - this.firePropertyChanged(DATA_TYPE_PROPERTY, old, dataType); - } - - - // ********** fully qualified data type ********** - - public String getFullyQualifiedDataType() { - return this.fullyQualifiedDataType; - } - - protected void setFullyQualifiedDataType(String dataType) { - String old = this.fullyQualifiedDataType; - this.fullyQualifiedDataType = dataType; - this.firePropertyChanged(FULLY_QUALIFIED_DATA_TYPE_PROPERTY, old, dataType); - } - - - // ********** object type ********** - - public String getObjectType() { - return this.objectType; - } - - public void setObjectType(String objectType) { - this.converterAnnotation.setObjectType(objectType); - this.setObjectType_(objectType); - } - - protected void setObjectType_(String objectType) { - String old = this.objectType; - this.objectType = objectType; - this.firePropertyChanged(OBJECT_TYPE_PROPERTY, old, objectType); - } - - - // ********** fully qualified object type ********** - - public String getFullyQualifiedObjectType() { - return this.fullyQualifiedObjectType; - } - - protected void setFullyQualifiedObjectType(String objectType) { - String old = this.fullyQualifiedObjectType; - this.fullyQualifiedObjectType = objectType; - this.firePropertyChanged(FULLY_QUALIFIED_OBJECT_TYPE_PROPERTY, old, objectType); - } - - - // ********** misc ********** - - public Class<EclipseLinkTypeConverter> getType() { - return EclipseLinkTypeConverter.class; - } - - - // ********** validation ********* - - @Override - public boolean isEquivalentTo(JpaNamedContextNode node) { - return super.isEquivalentTo(node) - && this.isEquivalentTo((EclipseLinkTypeConverter) node); - } - - protected boolean isEquivalentTo(EclipseLinkTypeConverter converter) { - return Tools.valuesAreEqual(this.fullyQualifiedDataType, converter.getFullyQualifiedDataType()) && - Tools.valuesAreEqual(this.fullyQualifiedObjectType, converter.getFullyQualifiedObjectType()); - } - - - // ********** metadata conversion ********** - - @Override - public void convertTo(OrmEclipseLinkConverterContainer ormConverterContainer) { - ormConverterContainer.addTypeConverter().convertFrom(this); - } - - @Override - public void delete() { - this.getParent().removeTypeConverter(this); - } -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/java/JavaEclipseLinkVariableOneToOneMapping.java b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/java/JavaEclipseLinkVariableOneToOneMapping.java deleted file mode 100644 index 4aca27cee5..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/java/JavaEclipseLinkVariableOneToOneMapping.java +++ /dev/null @@ -1,84 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2009, 2012 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.eclipselink.core.internal.context.java; - -import org.eclipse.jpt.common.core.resource.java.JavaResourceAnnotatedElement; -import org.eclipse.jpt.jpa.core.context.java.JavaJpaContextNode; -import org.eclipse.jpt.jpa.core.context.java.JavaPersistentAttribute; -import org.eclipse.jpt.jpa.core.internal.context.java.AbstractJavaAttributeMapping; -import org.eclipse.jpt.jpa.eclipselink.core.EclipseLinkMappingKeys; -import org.eclipse.jpt.jpa.eclipselink.core.context.EclipseLinkVariableOneToOneMapping; -import org.eclipse.jpt.jpa.eclipselink.core.context.java.EclipseLinkJavaConvertibleMapping; -import org.eclipse.jpt.jpa.eclipselink.core.context.java.JavaEclipseLinkConverterContainer; -import org.eclipse.jpt.jpa.eclipselink.core.resource.java.EclipseLinkVariableOneToOneAnnotation; - -public class JavaEclipseLinkVariableOneToOneMapping - extends AbstractJavaAttributeMapping<EclipseLinkVariableOneToOneAnnotation> - implements EclipseLinkVariableOneToOneMapping, EclipseLinkJavaConvertibleMapping -{ - - protected final JavaEclipseLinkConverterContainer converterContainer; - - public JavaEclipseLinkVariableOneToOneMapping(JavaPersistentAttribute parent) { - super(parent); - this.converterContainer = this.buildConverterContainer(); - } - - - // ********** synchronize/update ********** - - @Override - public void synchronizeWithResourceModel() { - super.synchronizeWithResourceModel(); - this.converterContainer.synchronizeWithResourceModel(); - } - - @Override - public void update() { - super.update(); - this.converterContainer.update(); - } - - - // ********** converters ********** - - public JavaEclipseLinkConverterContainer getConverterContainer() { - return this.converterContainer; - } - - protected JavaEclipseLinkConverterContainer buildConverterContainer() { - return new JavaEclipseLinkConverterContainerImpl(this); - } - - // ********** converter container parent adapter ********** - - public JavaJpaContextNode getConverterContainerParent() { - return this; // no adapter - } - - public JavaResourceAnnotatedElement getJavaResourceAnnotatedElement() { - return this.getResourceAttribute(); - } - - public boolean parentSupportsConverters() { - return ! this.getPersistentAttribute().isVirtual(); - } - - // ********** misc ********** - - public String getKey() { - return EclipseLinkMappingKeys.VARIABLE_ONE_TO_ONE_ATTRIBUTE_MAPPING_KEY; - } - - @Override - protected String getAnnotationName() { - return EclipseLinkVariableOneToOneAnnotation.ANNOTATION_NAME; - } -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/java/JavaEclipseLinkVersionMapping.java b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/java/JavaEclipseLinkVersionMapping.java deleted file mode 100644 index 92b1f9bfcf..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/java/JavaEclipseLinkVersionMapping.java +++ /dev/null @@ -1,127 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2008, 2012 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.eclipselink.core.internal.context.java; - -import java.util.List; -import org.eclipse.jdt.core.dom.CompilationUnit; -import org.eclipse.jpt.common.core.resource.java.JavaResourceAnnotatedElement; -import org.eclipse.jpt.common.utility.internal.ArrayTools; -import org.eclipse.jpt.common.utility.internal.iterables.CompositeIterable; -import org.eclipse.jpt.jpa.core.context.java.JavaConverter; -import org.eclipse.jpt.jpa.core.context.java.JavaJpaContextNode; -import org.eclipse.jpt.jpa.core.context.java.JavaPersistentAttribute; -import org.eclipse.jpt.jpa.core.internal.context.java.AbstractJavaVersionMapping; -import org.eclipse.jpt.jpa.eclipselink.core.context.EclipseLinkMutable; -import org.eclipse.jpt.jpa.eclipselink.core.context.EclipseLinkVersionMapping; -import org.eclipse.jpt.jpa.eclipselink.core.context.java.EclipseLinkJavaConvertibleMapping; -import org.eclipse.jpt.jpa.eclipselink.core.context.java.JavaEclipseLinkConverterContainer; -import org.eclipse.jpt.jpa.eclipselink.core.internal.DefaultEclipseLinkJpaValidationMessages; -import org.eclipse.jpt.jpa.eclipselink.core.internal.EclipseLinkJpaValidationMessages; -import org.eclipse.wst.validation.internal.provisional.core.IMessage; -import org.eclipse.wst.validation.internal.provisional.core.IReporter; - -public class JavaEclipseLinkVersionMapping - extends AbstractJavaVersionMapping - implements EclipseLinkVersionMapping, EclipseLinkJavaConvertibleMapping -{ - protected final JavaEclipseLinkMutable mutable; - - protected final JavaEclipseLinkConverterContainer converterContainer; - - - public JavaEclipseLinkVersionMapping(JavaPersistentAttribute parent) { - super(parent); - this.mutable = new JavaEclipseLinkMutable(this); - this.converterContainer = this.buildConverterContainer(); - } - - - // ********** synchronize/update ********** - - @Override - public void synchronizeWithResourceModel() { - super.synchronizeWithResourceModel(); - this.mutable.synchronizeWithResourceModel(); - this.converterContainer.synchronizeWithResourceModel(); - } - - @Override - public void update() { - super.update(); - this.mutable.update(); - this.converterContainer.update(); - } - - - // ********** mutable ********** - - public EclipseLinkMutable getMutable() { - return this.mutable; - } - - - // ********** converters ********** - - public JavaEclipseLinkConverterContainer getConverterContainer() { - return this.converterContainer; - } - - protected JavaEclipseLinkConverterContainer buildConverterContainer() { - return new JavaEclipseLinkConverterContainerImpl(this); - } - - // ********** converter container parent adapter ********** - - public JavaJpaContextNode getConverterContainerParent() { - return this; // no adapter - } - - public JavaResourceAnnotatedElement getJavaResourceAnnotatedElement() { - return this.getResourceAttribute(); - } - - public boolean parentSupportsConverters() { - return ! this.getPersistentAttribute().isVirtual(); - } - - // ********** converter adapters ********** - - /** - * put the EclipseLink convert adapter first - this is the order EclipseLink searches - */ - @Override - protected Iterable<JavaConverter.Adapter> getConverterAdapters() { - return new CompositeIterable<JavaConverter.Adapter>(JavaEclipseLinkConvert.Adapter.instance(), super.getConverterAdapters()); - } - - - // ********** validation ********** - - @Override - public void validate(List<IMessage> messages, IReporter reporter, CompilationUnit astRoot) { - super.validate(messages, reporter, astRoot); - this.mutable.validate(messages, reporter, astRoot); - } - - @Override - protected void validateAttributeType(List<IMessage> messages, CompilationUnit astRoot) { - if (!ArrayTools.contains(SUPPORTED_TYPE_NAMES, this.getPersistentAttribute().getTypeName())) { - messages.add( - DefaultEclipseLinkJpaValidationMessages.buildMessage( - IMessage.HIGH_SEVERITY, - EclipseLinkJpaValidationMessages.PERSISTENT_ATTRIBUTE_INVALID_VERSION_MAPPING_TYPE, - new String[] {this.getName()}, - this, - this.getValidationTextRange(astRoot) - ) - ); - } - } -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/java/NullJavaEclipseLinkMultitenancy2_3.java b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/java/NullJavaEclipseLinkMultitenancy2_3.java deleted file mode 100644 index 47b1b00a4a..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/java/NullJavaEclipseLinkMultitenancy2_3.java +++ /dev/null @@ -1,146 +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, 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.eclipselink.core.internal.context.java; - -import org.eclipse.jdt.core.dom.CompilationUnit; -import org.eclipse.jpt.common.core.utility.TextRange; -import org.eclipse.jpt.common.utility.internal.iterables.EmptyListIterable; -import org.eclipse.jpt.common.utility.internal.iterables.ListIterable; -import org.eclipse.jpt.jpa.core.internal.context.java.AbstractJavaJpaContextNode; -import org.eclipse.jpt.jpa.eclipselink.core.context.EclipseLinkMultitenantType2_3; -import org.eclipse.jpt.jpa.eclipselink.core.context.TenantDiscriminatorColumn2_3; -import org.eclipse.jpt.jpa.eclipselink.core.context.java.JavaEclipseLinkMultitenancy2_3; -import org.eclipse.jpt.jpa.eclipselink.core.context.java.JavaEclipseLinkNonEmbeddableTypeMapping; -import org.eclipse.jpt.jpa.eclipselink.core.context.java.JavaReadOnlyTenantDiscriminatorColumn2_3; -import org.eclipse.jpt.jpa.eclipselink.core.context.java.JavaTenantDiscriminatorColumn2_3; -import org.eclipse.jpt.jpa.eclipselink.core.context.java.JavaVirtualTenantDiscriminatorColumn2_3; - -public class NullJavaEclipseLinkMultitenancy2_3 - extends AbstractJavaJpaContextNode - implements JavaEclipseLinkMultitenancy2_3 -{ - - public NullJavaEclipseLinkMultitenancy2_3(JavaEclipseLinkNonEmbeddableTypeMapping parent) { - super(parent); - } - - // ********** multitenant ********** - - public boolean isMultitenant() { - return false; - } - - public boolean isDefaultMultitenant() { - return false; - } - - public boolean isSpecifiedMultitenant() { - return false; - } - - public void setSpecifiedMultitenant(boolean isMultitenant) { - throw new UnsupportedOperationException("Multitenancy is only supported in EclipseLink version 2.3 and higher"); //$NON-NLS-1$ - } - - - // ********** type ********** - - public EclipseLinkMultitenantType2_3 getType() { - return null; - } - - public EclipseLinkMultitenantType2_3 getSpecifiedType() { - return null; - } - - public void setSpecifiedType(EclipseLinkMultitenantType2_3 type) { - throw new UnsupportedOperationException("Multitenancy is only supported in EclipseLink version 2.3 and higher"); //$NON-NLS-1$ - } - - public EclipseLinkMultitenantType2_3 getDefaultType() { - return null; - } - - public boolean isIncludeCriteria() { - return false; - } - - public Boolean getSpecifiedIncludeCriteria() { - return null; - } - - public void setSpecifiedIncludeCriteria(Boolean includeCriteria) { - throw new UnsupportedOperationException("Multitenancy is only supported in EclipseLink version 2.3 and higher"); //$NON-NLS-1$ - } - - public boolean isDefaultIncludeCriteria() { - return false; - } - - public ListIterable<JavaReadOnlyTenantDiscriminatorColumn2_3> getTenantDiscriminatorColumns() { - return EmptyListIterable.instance(); - } - - public int getTenantDiscriminatorColumnsSize() { - return 0; - } - - public ListIterable<JavaTenantDiscriminatorColumn2_3> getSpecifiedTenantDiscriminatorColumns() { - return EmptyListIterable.instance(); - } - - public int getSpecifiedTenantDiscriminatorColumnsSize() { - return 0; - } - - public boolean hasSpecifiedTenantDiscriminatorColumns() { - return false; - } - - public JavaTenantDiscriminatorColumn2_3 addSpecifiedTenantDiscriminatorColumn() { - throw new UnsupportedOperationException("Multitenancy is only supported in EclipseLink version 2.3 and higher"); //$NON-NLS-1$ - } - - public JavaTenantDiscriminatorColumn2_3 addSpecifiedTenantDiscriminatorColumn(int index) { - throw new UnsupportedOperationException("Multitenancy is only supported in EclipseLink version 2.3 and higher"); //$NON-NLS-1$ - } - - public void removeSpecifiedTenantDiscriminatorColumn(TenantDiscriminatorColumn2_3 tenantDiscriminatorColumn) { - throw new UnsupportedOperationException("Multitenancy is only supported in EclipseLink version 2.3 and higher"); //$NON-NLS-1$ - } - - public void removeSpecifiedTenantDiscriminatorColumn(int index) { - throw new UnsupportedOperationException("Multitenancy is only supported in EclipseLink version 2.3 and higher"); //$NON-NLS-1$ - } - - public void moveSpecifiedTenantDiscriminatorColumn(int targetIndex, int sourceIndex) { - throw new UnsupportedOperationException("Multitenancy is only supported in EclipseLink version 2.3 and higher"); //$NON-NLS-1$ - } - - public ListIterable<JavaVirtualTenantDiscriminatorColumn2_3> getDefaultTenantDiscriminatorColumns() { - return EmptyListIterable.instance(); - } - - public int getDefaultTenantDiscriminatorColumnsSize() { - return 0; - } - - public TextRange getValidationTextRange(CompilationUnit astRoot) { - throw new UnsupportedOperationException("Multitenancy is only supported in EclipseLink version 2.3 and higher"); //$NON-NLS-1$ - } - - public boolean specifiedTenantDiscriminatorColumnsAllowed() { - return false; - } - - public boolean usesPrimaryKeyTenantDiscriminatorColumns() { - return false; - } -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/java/SpecifiedJavaEclipseLinkPersistentAttribute.java b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/java/SpecifiedJavaEclipseLinkPersistentAttribute.java deleted file mode 100644 index 0549444725..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/java/SpecifiedJavaEclipseLinkPersistentAttribute.java +++ /dev/null @@ -1,107 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2009, 2012 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.eclipselink.core.internal.context.java; - -import org.eclipse.jdt.core.dom.CompilationUnit; -import org.eclipse.jpt.common.core.internal.utility.JDTTools; -import org.eclipse.jpt.common.core.resource.java.JavaResourceField; -import org.eclipse.jpt.common.core.resource.java.JavaResourceMethod; -import org.eclipse.jpt.common.utility.internal.Tools; -import org.eclipse.jpt.jpa.core.MappingKeys; -import org.eclipse.jpt.jpa.core.context.PersistentType; -import org.eclipse.jpt.jpa.core.context.java.Accessor; -import org.eclipse.jpt.jpa.core.context.java.JavaAttributeMappingDefinition; -import org.eclipse.jpt.jpa.core.internal.context.JptValidator; -import org.eclipse.jpt.jpa.core.internal.context.java.AbstractJavaPersistentAttribute; -import org.eclipse.jpt.jpa.eclipselink.core.context.java.JavaEclipseLinkPersistentAttribute; -import org.eclipse.jpt.jpa.eclipselink.core.internal.context.EclipseLinkPersistentAttributeValidator; - -/** - * EclipseLink Java persistent attribute - */ -public class SpecifiedJavaEclipseLinkPersistentAttribute - extends AbstractJavaPersistentAttribute - implements JavaEclipseLinkPersistentAttribute -{ - - public SpecifiedJavaEclipseLinkPersistentAttribute(PersistentType parent, JavaResourceField resourceField) { - super(parent,resourceField); - } - - public SpecifiedJavaEclipseLinkPersistentAttribute(PersistentType parent, JavaResourceMethod resourceGetter, JavaResourceMethod resourceSetter) { - super(parent, resourceGetter, resourceSetter); - } - - public SpecifiedJavaEclipseLinkPersistentAttribute(PersistentType parent, Accessor accessor) { - super(parent, accessor); - } - - // ********** mapping ********** - - @Override - protected JavaAttributeMappingDefinition getSpecifiedMappingDefinition(String key) { - if (this.specifiedKeyIsInvalid(key)) { - throw new IllegalArgumentException("invalid mapping: " + key); //$NON-NLS-1$ - } - return super.getSpecifiedMappingDefinition(key); - } - - /** - * EclipseLink does not support setting an attribute with a default 1:1 - * mapping to a specified mapping of ID; because the resulting ID annotation - * indicates a primary key derived from the 1:1 mapping, <em>not</em> an ID - * mapping. - */ - protected boolean specifiedKeyIsInvalid(String key) { - return Tools.valuesAreEqual(key, MappingKeys.ID_ATTRIBUTE_MAPPING_KEY) && - Tools.valuesAreEqual(this.getDefaultMappingKey(), MappingKeys.ONE_TO_ONE_ATTRIBUTE_MAPPING_KEY); - } - - - // ********** type ********** - - /** - * Return whether the attribute's type is a subclass of - * <code>java.util.Date</code> or <code>java.util.Calendar</code>. - */ - public boolean typeIsDateOrCalendar() { - return this.getResourceAttribute().typeIsSubTypeOf(DATE_TYPE_NAME) - || this.getResourceAttribute().typeIsSubTypeOf(CALENDAR_TYPE_NAME); - } - - public boolean typeIsSerializable() { - return this.getResourceAttribute().typeIsVariablePrimitive() - || this.getResourceAttribute().typeIsSubTypeOf(JDTTools.SERIALIZABLE_CLASS_NAME); - } - - public boolean typeIsValidForVariableOneToOne() { - return this.getResourceAttribute().typeIsInterface() - && this.interfaceIsValidForVariableOneToOne(getTypeName()); - } - - protected boolean interfaceIsValidForVariableOneToOne(String interfaceName) { - return ! this.interfaceIsInvalidForVariableOneToOne(interfaceName); - } - - // TODO we could probably add more interfaces to this list... - protected boolean interfaceIsInvalidForVariableOneToOne(String interfaceName) { - return (interfaceName == null) || - this.typeIsContainer(interfaceName) || - interfaceName.equals("org.eclipse.persistence.indirection.ValueHolderInterface"); //$NON-NLS-1$ - } - - - // ********** validation ********** - - @Override - protected JptValidator buildAttributeValidator(CompilationUnit astRoot) { - return new EclipseLinkPersistentAttributeValidator(this, buildTextRangeResolver(astRoot)); - } -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/orm/AbstractEclipseLinkOrmXmlDefinition.java b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/orm/AbstractEclipseLinkOrmXmlDefinition.java deleted file mode 100644 index cb76b92120..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/orm/AbstractEclipseLinkOrmXmlDefinition.java +++ /dev/null @@ -1,27 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2008, 2011 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.eclipselink.core.internal.context.orm; - -import org.eclipse.emf.ecore.EFactory; -import org.eclipse.jpt.jpa.core.internal.context.orm.AbstractOrmXmlDefinition; -import org.eclipse.jpt.jpa.eclipselink.core.resource.orm.EclipseLinkOrmFactory; - -public abstract class AbstractEclipseLinkOrmXmlDefinition - extends AbstractOrmXmlDefinition -{ - protected AbstractEclipseLinkOrmXmlDefinition() { - super(); - } - - public EFactory getResourceNodeFactory() { - return EclipseLinkOrmFactory.eINSTANCE; - } - -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/orm/AbstractOrmEclipseLinkBasicCollectionMapping.java b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/orm/AbstractOrmEclipseLinkBasicCollectionMapping.java deleted file mode 100644 index 962339cc9f..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/orm/AbstractOrmEclipseLinkBasicCollectionMapping.java +++ /dev/null @@ -1,67 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2008, 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.eclipselink.core.internal.context.orm; - -import org.eclipse.jpt.jpa.core.context.java.JavaPersistentAttribute; -import org.eclipse.jpt.jpa.core.context.orm.OrmAttributeMapping; -import org.eclipse.jpt.jpa.core.context.orm.OrmPersistentAttribute; -import org.eclipse.jpt.jpa.core.internal.context.orm.AbstractOrmAttributeMapping; -import org.eclipse.jpt.jpa.core.jpa2.context.MetamodelField; -import org.eclipse.jpt.jpa.core.jpa2.context.PersistentAttribute2_0; -import org.eclipse.jpt.jpa.eclipselink.core.EclipseLinkMappingKeys; -import org.eclipse.jpt.jpa.eclipselink.core.context.EclipseLinkBasicCollectionMapping; -import org.eclipse.jpt.jpa.eclipselink.core.resource.orm.Attributes; -import org.eclipse.jpt.jpa.eclipselink.core.resource.orm.XmlBasicCollection; - -public abstract class AbstractOrmEclipseLinkBasicCollectionMapping - extends AbstractOrmAttributeMapping<XmlBasicCollection> - implements EclipseLinkBasicCollectionMapping -{ - protected AbstractOrmEclipseLinkBasicCollectionMapping(OrmPersistentAttribute parent, XmlBasicCollection xmlMapping) { - super(parent, xmlMapping); - } - - public void initializeOn(OrmAttributeMapping newMapping) { - newMapping.initializeFromOrmAttributeMapping(this); - } - - public String getKey() { - return EclipseLinkMappingKeys.BASIC_COLLECTION_ATTRIBUTE_MAPPING_KEY; - } - - public void addXmlAttributeMappingTo(org.eclipse.jpt.jpa.core.resource.orm.Attributes resourceAttributes) { - ((Attributes) resourceAttributes).getBasicCollections().add(this.xmlAttributeMapping); - } - - public void removeXmlAttributeMappingFrom(org.eclipse.jpt.jpa.core.resource.orm.Attributes resourceAttributes) { - ((Attributes) resourceAttributes).getBasicCollections().remove(this.xmlAttributeMapping); - } - - public int getXmlSequence() { - return 23; - } - - - // ********** metamodel ********** - @Override - protected String getMetamodelFieldTypeName() { - return ((PersistentAttribute2_0) getPersistentAttribute()).getMetamodelContainerFieldTypeName(); - } - - @Override - public String getMetamodelTypeName() { - String targetTypeName = null; - JavaPersistentAttribute javaPersistentAttribute = getJavaPersistentAttribute(); - if (javaPersistentAttribute != null) { - targetTypeName = javaPersistentAttribute.getMultiReferenceTargetTypeName(); - } - return (targetTypeName != null) ? targetTypeName : MetamodelField.DEFAULT_TYPE_NAME; - } -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/orm/AbstractOrmEclipseLinkBasicMapMapping.java b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/orm/AbstractOrmEclipseLinkBasicMapMapping.java deleted file mode 100644 index 2a7bf337c8..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/orm/AbstractOrmEclipseLinkBasicMapMapping.java +++ /dev/null @@ -1,85 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2008, 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.eclipselink.core.internal.context.orm; - -import java.util.ArrayList; -import org.eclipse.jpt.jpa.core.context.java.JavaPersistentAttribute; -import org.eclipse.jpt.jpa.core.context.orm.OrmAttributeMapping; -import org.eclipse.jpt.jpa.core.context.orm.OrmPersistentAttribute; -import org.eclipse.jpt.jpa.core.internal.context.orm.AbstractOrmAttributeMapping; -import org.eclipse.jpt.jpa.core.jpa2.context.MetamodelField; -import org.eclipse.jpt.jpa.core.jpa2.context.PersistentAttribute2_0; -import org.eclipse.jpt.jpa.eclipselink.core.EclipseLinkMappingKeys; -import org.eclipse.jpt.jpa.eclipselink.core.context.EclipseLinkBasicMapMapping; -import org.eclipse.jpt.jpa.eclipselink.core.resource.orm.Attributes; -import org.eclipse.jpt.jpa.eclipselink.core.resource.orm.XmlBasicMap; - -public abstract class AbstractOrmEclipseLinkBasicMapMapping - extends AbstractOrmAttributeMapping<XmlBasicMap> - implements EclipseLinkBasicMapMapping -{ - protected AbstractOrmEclipseLinkBasicMapMapping(OrmPersistentAttribute parent, XmlBasicMap xmlMapping) { - super(parent, xmlMapping); - } - - public void initializeOn(OrmAttributeMapping newMapping) { - newMapping.initializeFromOrmAttributeMapping(this); - } - - public String getKey() { - return EclipseLinkMappingKeys.BASIC_MAP_ATTRIBUTE_MAPPING_KEY; - } - - public void addXmlAttributeMappingTo(org.eclipse.jpt.jpa.core.resource.orm.Attributes resourceAttributes) { - ((Attributes) resourceAttributes).getBasicMaps().add(this.xmlAttributeMapping); - } - - public void removeXmlAttributeMappingFrom(org.eclipse.jpt.jpa.core.resource.orm.Attributes resourceAttributes) { - ((Attributes) resourceAttributes).getBasicMaps().remove(this.xmlAttributeMapping); - } - - - public int getXmlSequence() { - return 27; - } - - - // ********** metamodel ********** - @Override - protected String getMetamodelFieldTypeName() { - return ((PersistentAttribute2_0) getPersistentAttribute()).getMetamodelContainerFieldTypeName(); - } - - @Override - public String getMetamodelTypeName() { - String targetTypeName = null; - JavaPersistentAttribute javaPersistentAttribute = getJavaPersistentAttribute(); - if (javaPersistentAttribute != null) { - targetTypeName = javaPersistentAttribute.getMultiReferenceTargetTypeName(); - } - return (targetTypeName != null) ? targetTypeName : MetamodelField.DEFAULT_TYPE_NAME; - } - - @Override - protected void addMetamodelFieldTypeArgumentNamesTo(ArrayList<String> typeArgumentNames) { - this.addMetamodelFieldMapKeyTypeArgumentNameTo(typeArgumentNames); - super.addMetamodelFieldTypeArgumentNamesTo(typeArgumentNames); - } - - protected void addMetamodelFieldMapKeyTypeArgumentNameTo(ArrayList<String> typeArgumentNames) { - String mapKeyTypeName = null; - JavaPersistentAttribute javaPersistentAttribute = getJavaPersistentAttribute(); - if (javaPersistentAttribute != null) { - mapKeyTypeName = javaPersistentAttribute.getMultiReferenceMapKeyTypeName(); - } - mapKeyTypeName = mapKeyTypeName != null ? mapKeyTypeName : MetamodelField.DEFAULT_TYPE_NAME; - typeArgumentNames.add(mapKeyTypeName); - } -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/orm/EclipseLinkEntityMappingsImpl.java b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/orm/EclipseLinkEntityMappingsImpl.java deleted file mode 100644 index 3222b02607..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/orm/EclipseLinkEntityMappingsImpl.java +++ /dev/null @@ -1,609 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2008, 2012 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.eclipselink.core.internal.context.orm; - -import java.util.List; -import org.eclipse.core.runtime.content.IContentType; -import org.eclipse.jdt.core.IPackageFragment; -import org.eclipse.jdt.core.IType; -import org.eclipse.jpt.common.core.utility.TextRange; -import org.eclipse.jpt.common.utility.internal.iterables.CompositeIterable; -import org.eclipse.jpt.common.utility.internal.iterables.EmptyIterable; -import org.eclipse.jpt.common.utility.internal.iterables.EmptyListIterable; -import org.eclipse.jpt.common.utility.internal.iterables.ListIterable; -import org.eclipse.jpt.common.utility.internal.iterables.LiveCloneListIterable; -import org.eclipse.jpt.common.utility.internal.iterables.SuperListIterableWrapper; -import org.eclipse.jpt.common.utility.internal.iterables.TransformationIterable; -import org.eclipse.jpt.jpa.core.context.DiscriminatorType; -import org.eclipse.jpt.jpa.core.context.ReadOnlyNamedDiscriminatorColumn; -import org.eclipse.jpt.jpa.core.context.ReadOnlyNamedColumn; -import org.eclipse.jpt.jpa.core.context.orm.OrmTypeMapping; -import org.eclipse.jpt.jpa.core.context.orm.OrmXml; -import org.eclipse.jpt.jpa.core.internal.context.JptValidator; -import org.eclipse.jpt.jpa.core.internal.context.NamedColumnTextRangeResolver; -import org.eclipse.jpt.jpa.core.internal.context.orm.AbstractEntityMappings; -import org.eclipse.jpt.jpa.db.Table; -import org.eclipse.jpt.jpa.eclipselink.core.JptJpaEclipseLinkCorePlugin; -import org.eclipse.jpt.jpa.eclipselink.core.context.EclipseLinkConverter; -import org.eclipse.jpt.jpa.eclipselink.core.context.EclipseLinkTypeMapping; -import org.eclipse.jpt.jpa.eclipselink.core.context.ReadOnlyTenantDiscriminatorColumn2_3; -import org.eclipse.jpt.jpa.eclipselink.core.context.orm.EclipseLinkEntityMappings; -import org.eclipse.jpt.jpa.eclipselink.core.context.orm.OrmEclipseLinkConverterContainer; -import org.eclipse.jpt.jpa.eclipselink.core.context.orm.OrmReadOnlyTenantDiscriminatorColumn2_3; -import org.eclipse.jpt.jpa.eclipselink.core.context.orm.OrmTenantDiscriminatorColumn2_3; -import org.eclipse.jpt.jpa.eclipselink.core.context.orm.OrmVirtualTenantDiscriminatorColumn2_3; -import org.eclipse.jpt.jpa.eclipselink.core.context.persistence.EclipseLinkPersistenceUnit; -import org.eclipse.jpt.jpa.eclipselink.core.resource.orm.EclipseLinkOrmFactory; -import org.eclipse.jpt.jpa.eclipselink.core.resource.orm.XmlAccessMethods; -import org.eclipse.jpt.jpa.eclipselink.core.resource.orm.XmlEntityMappings; -import org.eclipse.jpt.jpa.eclipselink.core.resource.orm.XmlTenantDiscriminatorColumn; -import org.eclipse.jpt.jpa.eclipselink.core.resource.orm.v2_3.XmlTenantDiscriminatorColumn_2_3; -import org.eclipse.text.edits.ReplaceEdit; -import org.eclipse.wst.validation.internal.provisional.core.IMessage; -import org.eclipse.wst.validation.internal.provisional.core.IReporter; - -public class EclipseLinkEntityMappingsImpl - extends AbstractEntityMappings - implements - EclipseLinkEntityMappings, - OrmEclipseLinkConverterContainer.Owner -{ - protected final OrmEclipseLinkConverterContainer converterContainer; - - protected final ContextListContainer<OrmTenantDiscriminatorColumn2_3, XmlTenantDiscriminatorColumn_2_3> specifiedTenantDiscriminatorColumnContainer; - protected final OrmReadOnlyTenantDiscriminatorColumn2_3.Owner tenantDiscriminatorColumnOwner; - - protected final ContextListContainer<OrmVirtualTenantDiscriminatorColumn2_3, ReadOnlyTenantDiscriminatorColumn2_3> defaultTenantDiscriminatorColumnContainer; - - - protected String specifiedGetMethod; - protected String defaultGetMethod; - - protected String specifiedSetMethod; - protected String defaultSetMethod; - - - public EclipseLinkEntityMappingsImpl(OrmXml parent, XmlEntityMappings resource) { - super(parent, resource); - this.converterContainer = this.buildConverterContainer(); - this.tenantDiscriminatorColumnOwner = this.buildTenantDiscriminatorColumnOwner(); - this.specifiedTenantDiscriminatorColumnContainer = this.buildSpecifiedTenantDiscriminatorColumnContainer(); - this.defaultTenantDiscriminatorColumnContainer = this.buildDefaultTenantDiscriminatorColumnContainer(); - this.specifiedGetMethod = this.buildSpecifiedGetMethod(); - this.specifiedSetMethod = this.buildSpecifiedSetMethod(); - } - - - // ********** synchronize/update ********** - - @Override - public void synchronizeWithResourceModel() { - super.synchronizeWithResourceModel(); - this.converterContainer.synchronizeWithResourceModel(); - this.syncSpecifiedTenantDiscriminatorColumns(); - this.setSpecifiedGetMethod_(this.buildSpecifiedGetMethod()); - this.setSpecifiedSetMethod_(this.buildSpecifiedSetMethod()); - } - - @Override - public void update() { - super.update(); - this.converterContainer.update(); - this.updateNodes(this.getSpecifiedTenantDiscriminatorColumns()); - this.updateDefaultTenantDiscriminatorColumns(); - this.setDefaultGetMethod(this.buildDefaultGetMethod()); - this.setDefaultSetMethod(this.buildDefaultSetMethod()); - } - - @Override - public XmlEntityMappings getXmlEntityMappings() { - return (XmlEntityMappings) super.getXmlEntityMappings(); - } - - - // ********** types ********** - - /** - * preconditions: - * getPackage() is not null - * unqualifiedClassName is not qualified (contains no '.') - */ - @Override - protected String prependGlobalPackage(String unqualifiedClassName) { - // Format of global package is "foo.bar." - if (this.getPackage().endsWith(".")) { //$NON-NLS-1$ - return this.getPackage() + unqualifiedClassName; - } - // Format of global package is "foo.bar" - return super.prependGlobalPackage(unqualifiedClassName); - } - - - // ********** converter container ********** - - public OrmEclipseLinkConverterContainer getConverterContainer() { - return this.converterContainer; - } - - protected OrmEclipseLinkConverterContainer buildConverterContainer() { - return new OrmEclipseLinkConverterContainerImpl(this, this, (XmlEntityMappings) this.xmlEntityMappings); - } - - public int getNumberSupportedConverters() { - return Integer.MAX_VALUE; - } - - @SuppressWarnings("unchecked") - public Iterable<EclipseLinkConverter> getMappingFileConverters() { - return new CompositeIterable<EclipseLinkConverter>( - this.converterContainer.getConverters(), - this.getTypeMappingConverters() - ); - } - - protected Iterable<EclipseLinkConverter> getTypeMappingConverters() { - return new CompositeIterable<EclipseLinkConverter>(this.getTypeMappingConverterLists()); - } - - protected Iterable<Iterable<EclipseLinkConverter>> getTypeMappingConverterLists() { - return new TransformationIterable<OrmTypeMapping, Iterable<EclipseLinkConverter>>(this.getTypeMappings()) { - @Override - protected Iterable<EclipseLinkConverter> transform(OrmTypeMapping typeMapping) { - return ((EclipseLinkTypeMapping) typeMapping).getConverters(); - } - }; - } - - - // ********** tenant discriminator columns ********** - - public ListIterable<ReadOnlyTenantDiscriminatorColumn2_3> getTenantDiscriminatorColumns() { - return this.hasSpecifiedTenantDiscriminatorColumns() ? - this.getReadOnlySpecifiedTenantDiscriminatorColumns() : - this.getReadOnlyDefaultTenantDiscriminatorColumns(); - } - - public int getTenantDiscriminatorColumnsSize() { - return this.hasSpecifiedTenantDiscriminatorColumns() ? - this.getSpecifiedTenantDiscriminatorColumnsSize() : - this.getDefaultTenantDiscriminatorColumnsSize(); - } - - // ********** specified tenant discriminator columns ********** - - public ListIterable<OrmTenantDiscriminatorColumn2_3> getSpecifiedTenantDiscriminatorColumns() { - return this.specifiedTenantDiscriminatorColumnContainer.getContextElements(); - } - - protected ListIterable<ReadOnlyTenantDiscriminatorColumn2_3> getReadOnlySpecifiedTenantDiscriminatorColumns() { - return new SuperListIterableWrapper<ReadOnlyTenantDiscriminatorColumn2_3>(this.getSpecifiedTenantDiscriminatorColumns()); - } - - public int getSpecifiedTenantDiscriminatorColumnsSize() { - return this.specifiedTenantDiscriminatorColumnContainer.getContextElementsSize(); - } - - public boolean hasSpecifiedTenantDiscriminatorColumns() { - return this.getSpecifiedTenantDiscriminatorColumnsSize() != 0; - } - - public OrmTenantDiscriminatorColumn2_3 getSpecifiedTenantDiscriminatorColumn(int index) { - return this.specifiedTenantDiscriminatorColumnContainer.getContextElement(index); - } - - public OrmTenantDiscriminatorColumn2_3 addSpecifiedTenantDiscriminatorColumn() { - return this.addSpecifiedTenantDiscriminatorColumn(this.getSpecifiedTenantDiscriminatorColumnsSize()); - } - - public OrmTenantDiscriminatorColumn2_3 addSpecifiedTenantDiscriminatorColumn(int index) { - XmlTenantDiscriminatorColumn xmlJoinColumn = this.buildXmlTenantDiscriminatorColumn(); - OrmTenantDiscriminatorColumn2_3 joinColumn = this.specifiedTenantDiscriminatorColumnContainer.addContextElement(index, xmlJoinColumn); - this.getXmlEntityMappings().getTenantDiscriminatorColumns().add(index, xmlJoinColumn); - return joinColumn; - } - - protected XmlTenantDiscriminatorColumn buildXmlTenantDiscriminatorColumn() { - return EclipseLinkOrmFactory.eINSTANCE.createXmlTenantDiscriminatorColumn(); - } - - public void removeSpecifiedTenantDiscriminatorColumn(OrmTenantDiscriminatorColumn2_3 tenantDiscriminatorColumn) { - this.removeSpecifiedTenantDiscriminatorColumn(this.specifiedTenantDiscriminatorColumnContainer.indexOfContextElement(tenantDiscriminatorColumn)); - } - - public void removeSpecifiedTenantDiscriminatorColumn(int index) { - this.specifiedTenantDiscriminatorColumnContainer.removeContextElement(index); - this.getXmlEntityMappings().getTenantDiscriminatorColumns().remove(index); - } - - public void moveSpecifiedTenantDiscriminatorColumn(int targetIndex, int sourceIndex) { - this.specifiedTenantDiscriminatorColumnContainer.moveContextElement(targetIndex, sourceIndex); - this.getXmlEntityMappings().getTenantDiscriminatorColumns().move(targetIndex, sourceIndex); - } - - protected void syncSpecifiedTenantDiscriminatorColumns() { - this.specifiedTenantDiscriminatorColumnContainer.synchronizeWithResourceModel(); - } - - protected ListIterable<XmlTenantDiscriminatorColumn_2_3> getXmlTenantDiscriminatorColumns() { - if (getXmlEntityMappings() == null) { - return EmptyListIterable.instance(); - } - // clone to reduce chance of concurrency problems - return new LiveCloneListIterable<XmlTenantDiscriminatorColumn_2_3>(this.getXmlEntityMappings().getTenantDiscriminatorColumns()); - } - - /** - * specified tenant discriminator column container - */ - protected class SpecifiedTenantDiscriminatorColumnContainer - extends ContextListContainer<OrmTenantDiscriminatorColumn2_3, XmlTenantDiscriminatorColumn_2_3> - { - @Override - protected String getContextElementsPropertyName() { - return SPECIFIED_TENANT_DISCRIMINATOR_COLUMNS_LIST; - } - @Override - protected OrmTenantDiscriminatorColumn2_3 buildContextElement(XmlTenantDiscriminatorColumn_2_3 resourceElement) { - return EclipseLinkEntityMappingsImpl.this.buildTenantDiscriminatorColumn(resourceElement); - } - @Override - protected ListIterable<XmlTenantDiscriminatorColumn_2_3> getResourceElements() { - return EclipseLinkEntityMappingsImpl.this.getXmlTenantDiscriminatorColumns(); - } - @Override - protected XmlTenantDiscriminatorColumn_2_3 getResourceElement(OrmTenantDiscriminatorColumn2_3 contextElement) { - return contextElement.getXmlColumn(); - } - } - - protected OrmReadOnlyTenantDiscriminatorColumn2_3.Owner buildTenantDiscriminatorColumnOwner() { - return new TenantDiscriminatorColumnOwner(); - } - - protected SpecifiedTenantDiscriminatorColumnContainer buildSpecifiedTenantDiscriminatorColumnContainer() { - SpecifiedTenantDiscriminatorColumnContainer container = new SpecifiedTenantDiscriminatorColumnContainer(); - container.initialize(); - return container; - } - - protected OrmTenantDiscriminatorColumn2_3 buildTenantDiscriminatorColumn(XmlTenantDiscriminatorColumn_2_3 xmlTenantDiscriminatorColumn) { - return new EclipseLinkOrmTenantDiscriminatorColumn2_3(this, this.tenantDiscriminatorColumnOwner, xmlTenantDiscriminatorColumn); - } - - - // ********** default tenant discriminator columns ********** - - public ListIterable<OrmVirtualTenantDiscriminatorColumn2_3> getDefaultTenantDiscriminatorColumns() { - return this.defaultTenantDiscriminatorColumnContainer.getContextElements(); - } - - protected ListIterable<ReadOnlyTenantDiscriminatorColumn2_3> getReadOnlyDefaultTenantDiscriminatorColumns() { - return new SuperListIterableWrapper<ReadOnlyTenantDiscriminatorColumn2_3>(this.getDefaultTenantDiscriminatorColumns()); - } - - public int getDefaultTenantDiscriminatorColumnsSize() { - return this.defaultTenantDiscriminatorColumnContainer.getContextElementsSize(); - } - - protected void clearDefaultTenantDiscriminatorColumns() { - this.defaultTenantDiscriminatorColumnContainer.clearContextList(); - } - - /** - * If there are any specified tenant discriminator columns, then there are no default - * tenant discriminator columns. - * @see #getTenantDiscriminatorColumnsForDefaults() - */ - protected void updateDefaultTenantDiscriminatorColumns() { - this.defaultTenantDiscriminatorColumnContainer.update(); - } - - protected ListIterable<ReadOnlyTenantDiscriminatorColumn2_3> getTenantDiscriminatorColumnsForDefaults() { - if (this.getSpecifiedTenantDiscriminatorColumnsSize() > 0) { - return EmptyListIterable.instance(); - } - return getContextDefaultTenantDiscriminatorColumns(); - } - - protected ListIterable<ReadOnlyTenantDiscriminatorColumn2_3> getContextDefaultTenantDiscriminatorColumns() { - return this.getPersistenceUnit().getDefaultTenantDiscriminatorColumns(); - } - - protected void moveDefaultTenantDiscriminatorColumn(int index, OrmVirtualTenantDiscriminatorColumn2_3 tenantDiscriminatorColumn) { - this.defaultTenantDiscriminatorColumnContainer.moveContextElement(index, tenantDiscriminatorColumn); - } - - protected OrmVirtualTenantDiscriminatorColumn2_3 addDefaultTenantDiscriminatorColumn(int index, OrmTenantDiscriminatorColumn2_3 ormTenantDiscriminatorColumn) { - return this.defaultTenantDiscriminatorColumnContainer.addContextElement(index, ormTenantDiscriminatorColumn); - } - - protected OrmVirtualTenantDiscriminatorColumn2_3 buildVirtualTenantDiscriminatorColumn(ReadOnlyTenantDiscriminatorColumn2_3 tenantDiscriminatorColumn) { - return new GenericOrmVirtualTenantDiscriminatorColumn2_3(this, this.tenantDiscriminatorColumnOwner, tenantDiscriminatorColumn); - } - - protected void removeDefaultTenantDiscriminatorColumn(OrmVirtualTenantDiscriminatorColumn2_3 tenantDiscriminatorColumn) { - this.defaultTenantDiscriminatorColumnContainer.removeContextElement(tenantDiscriminatorColumn); - } - - protected DefaultTenantDiscriminatorColumnContainer buildDefaultTenantDiscriminatorColumnContainer() { - return new DefaultTenantDiscriminatorColumnContainer(); - } - - - /** - * default tenant discriminator column container - */ - protected class DefaultTenantDiscriminatorColumnContainer - extends ContextListContainer<OrmVirtualTenantDiscriminatorColumn2_3, ReadOnlyTenantDiscriminatorColumn2_3> - { - @Override - protected String getContextElementsPropertyName() { - return DEFAULT_TENANT_DISCRIMINATOR_COLUMNS_LIST; - } - @Override - protected OrmVirtualTenantDiscriminatorColumn2_3 buildContextElement(ReadOnlyTenantDiscriminatorColumn2_3 resourceElement) { - return EclipseLinkEntityMappingsImpl.this.buildVirtualTenantDiscriminatorColumn(resourceElement); - } - @Override - protected ListIterable<ReadOnlyTenantDiscriminatorColumn2_3> getResourceElements() { - return EclipseLinkEntityMappingsImpl.this.getTenantDiscriminatorColumnsForDefaults(); - } - @Override - protected ReadOnlyTenantDiscriminatorColumn2_3 getResourceElement(OrmVirtualTenantDiscriminatorColumn2_3 contextElement) { - return contextElement.getOverriddenColumn(); - } - } - - - // ********** OrmReadOnlyTenantDiscriminatorColumn.Owner implementation ********** - - protected class TenantDiscriminatorColumnOwner - implements OrmReadOnlyTenantDiscriminatorColumn2_3.Owner - { - - public String getDefaultContextPropertyName() { - return ReadOnlyTenantDiscriminatorColumn2_3.DEFAULT_CONTEXT_PROPERTY; - } - - public boolean getDefaultPrimaryKey() { - return ReadOnlyTenantDiscriminatorColumn2_3.DEFAULT_PRIMARY_KEY; - } - - public int getDefaultLength() { - return ReadOnlyNamedDiscriminatorColumn.DEFAULT_LENGTH; - } - - public DiscriminatorType getDefaultDiscriminatorType() { - return ReadOnlyNamedDiscriminatorColumn.DEFAULT_DISCRIMINATOR_TYPE; - } - - /** - * No default table name in the context of entity mappings - */ - public String getDefaultTableName() { - return null; - } - - public String getDefaultColumnName(ReadOnlyNamedColumn column) { - return ReadOnlyTenantDiscriminatorColumn2_3.DEFAULT_NAME; - } - - /** - * No table in the context of entity mappings - */ - public Table resolveDbTable(String tableName) { - return null; - } - - public Iterable<String> getCandidateTableNames() { - return EmptyIterable.instance(); - } - - public boolean tableNameIsInvalid(String tableName) { - return false; - } - - /** - * no column validation can be done in the context of the persistence unit defaults - */ - public JptValidator buildColumnValidator(ReadOnlyNamedColumn column, NamedColumnTextRangeResolver textRangeResolver) { - return JptValidator.Null.instance(); - } - - public TextRange getValidationTextRange() { - return EclipseLinkEntityMappingsImpl.this.getValidationTextRange(); - } - } - - - //*************** get method ***************** - - public String getGetMethod() { - String specifiedGetMethod = this.getSpecifiedGetMethod(); - return (specifiedGetMethod != null) ? specifiedGetMethod : this.defaultGetMethod; - } - - public String getDefaultGetMethod() { - return this.defaultGetMethod; - } - - protected String buildDefaultGetMethod() { - return this.getPersistenceUnit().getDefaultGetMethod(); - } - - protected void setDefaultGetMethod(String getMethod) { - String old = this.defaultGetMethod; - this.defaultGetMethod = getMethod; - this.firePropertyChanged(DEFAULT_GET_METHOD_PROPERTY, old, getMethod); - } - - public String getSpecifiedGetMethod() { - return this.specifiedGetMethod; - } - - public void setSpecifiedGetMethod(String getMethod) { - if (this.valuesAreDifferent(this.specifiedGetMethod, getMethod)) { - XmlAccessMethods xmlAccessMethods = this.getXmlAccessMethodsForUpdate(); - this.setSpecifiedGetMethod_(getMethod); - xmlAccessMethods.setGetMethod(getMethod); - this.removeXmlAccessMethodsIfUnset(); - } - } - - protected void setSpecifiedGetMethod_(String getMethod) { - String old = this.specifiedGetMethod; - this.specifiedGetMethod = getMethod; - this.firePropertyChanged(SPECIFIED_GET_METHOD_PROPERTY, old, getMethod); - } - - protected String buildSpecifiedGetMethod() { - XmlAccessMethods xmlAccessMethods = getXmlAccessMethods(); - return xmlAccessMethods != null ? xmlAccessMethods.getGetMethod() : null; - } - - - //*************** set method ***************** - - public String getSetMethod() { - String specifiedSetMethod = this.getSpecifiedSetMethod(); - return (specifiedSetMethod != null) ? specifiedSetMethod : this.defaultSetMethod; - } - - public String getDefaultSetMethod() { - return this.defaultSetMethod; - } - - protected void setDefaultSetMethod(String setMethod) { - String old = this.defaultSetMethod; - this.defaultSetMethod = setMethod; - this.firePropertyChanged(DEFAULT_SET_METHOD_PROPERTY, old, setMethod); - } - - protected String buildDefaultSetMethod() { - return this.getPersistenceUnit().getDefaultSetMethod(); - } - - public String getSpecifiedSetMethod() { - return this.specifiedSetMethod; - } - - public void setSpecifiedSetMethod(String setMethod) { - if (this.valuesAreDifferent(this.specifiedSetMethod, setMethod)) { - XmlAccessMethods xmlAccessMethods = this.getXmlAccessMethodsForUpdate(); - this.setSpecifiedSetMethod_(setMethod); - xmlAccessMethods.setSetMethod(setMethod); - this.removeXmlAccessMethodsIfUnset(); - } - } - - protected void setSpecifiedSetMethod_(String setMethod) { - String old = this.specifiedSetMethod; - this.specifiedSetMethod = setMethod; - this.firePropertyChanged(SPECIFIED_SET_METHOD_PROPERTY, old, setMethod); - } - - protected String buildSpecifiedSetMethod() { - XmlAccessMethods xmlAccessMethods = getXmlAccessMethods(); - return xmlAccessMethods != null ? xmlAccessMethods.getSetMethod() : null; - } - - //*************** XML access methods ***************** - protected XmlAccessMethods getXmlAccessMethods() { - return getXmlEntityMappings().getAccessMethods(); - } - - /** - * Build the XML access methods (and XML defaults and XML metadata if necessary) if it does not exist. - */ - protected XmlAccessMethods getXmlAccessMethodsForUpdate() { - XmlAccessMethods xmlAccessMethods = getXmlAccessMethods(); - return (xmlAccessMethods != null) ? xmlAccessMethods : this.buildXmlAccessMethods(); - } - - protected XmlAccessMethods buildXmlAccessMethods() { - XmlAccessMethods xmlAccessMethods = this.buildXmlAccessMethods_(); - this.getXmlEntityMappings().setAccessMethods(xmlAccessMethods); - return xmlAccessMethods; - } - - protected XmlAccessMethods buildXmlAccessMethods_() { - return EclipseLinkOrmFactory.eINSTANCE.createXmlAccessMethods(); - } - - /** - * clear the XML access methods if appropriate - */ - protected void removeXmlAccessMethodsIfUnset() { - if (this.getXmlAccessMethods().isUnset()) { - this.getXmlEntityMappings().setAccessMethods(null); - } - } - - - // ********** misc ********** - - @Override - public EclipseLinkPersistenceUnit getPersistenceUnit() { - return (EclipseLinkPersistenceUnit) super.getPersistenceUnit(); - } - - @Override - protected IContentType getContentType() { - return JptJpaEclipseLinkCorePlugin.ECLIPSELINK_ORM_XML_CONTENT_TYPE; - } - - - // ********** refactoring ********** - - @SuppressWarnings("unchecked") - @Override - public Iterable<ReplaceEdit> createRenameTypeEdits(IType originalType, String newName) { - return new CompositeIterable<ReplaceEdit>( - super.createRenameTypeEdits(originalType, newName), - this.createConverterRenameTypeEdits(originalType, newName)); - } - - protected Iterable<ReplaceEdit> createConverterRenameTypeEdits(IType originalType, String newName) { - return this.converterContainer.createRenameTypeEdits(originalType, newName); - } - - @SuppressWarnings("unchecked") - @Override - public Iterable<ReplaceEdit> createMoveTypeEdits(IType originalType, IPackageFragment newPackage) { - return new CompositeIterable<ReplaceEdit>( - super.createMoveTypeEdits(originalType, newPackage), - this.createConverterMoveTypeEdits(originalType, newPackage)); - } - - protected Iterable<ReplaceEdit> createConverterMoveTypeEdits(IType originalType, IPackageFragment newPackage) { - return this.converterContainer.createMoveTypeEdits(originalType, newPackage); - } - - @SuppressWarnings("unchecked") - @Override - public Iterable<ReplaceEdit> createRenamePackageEdits(IPackageFragment originalPackage, String newName) { - return new CompositeIterable<ReplaceEdit>( - super.createRenamePackageEdits(originalPackage, newName), - this.createConverterRenamePackageEdits(originalPackage, newName)); - } - - protected Iterable<ReplaceEdit> createConverterRenamePackageEdits(IPackageFragment originalPackage, String newName) { - return this.converterContainer.createRenamePackageEdits(originalPackage, newName); - } - - - // ********** validation ********** - - @Override - public void validate(List<IMessage> messages, IReporter reporter) { - super.validate(messages, reporter); - this.converterContainer.validate(messages, reporter); - } -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/orm/EclipseLinkOrmElementCollectionMapping2_0.java b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/orm/EclipseLinkOrmElementCollectionMapping2_0.java deleted file mode 100644 index 184167e1c2..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/orm/EclipseLinkOrmElementCollectionMapping2_0.java +++ /dev/null @@ -1,203 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010, 2012 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.eclipselink.core.internal.context.orm; - -import java.util.List; -import org.eclipse.jdt.core.IPackageFragment; -import org.eclipse.jdt.core.IType; -import org.eclipse.jpt.common.core.internal.utility.JDTTools; -import org.eclipse.jpt.common.core.utility.TextRange; -import org.eclipse.jpt.common.utility.internal.StringTools; -import org.eclipse.jpt.common.utility.internal.iterables.CompositeIterable; -import org.eclipse.jpt.jpa.core.context.orm.OrmConverter; -import org.eclipse.jpt.jpa.core.context.orm.OrmPersistentAttribute; -import org.eclipse.jpt.jpa.core.internal.jpa2.context.orm.AbstractOrmElementCollectionMapping2_0; -import org.eclipse.jpt.jpa.eclipselink.core.JptJpaEclipseLinkCorePlugin; -import org.eclipse.jpt.jpa.eclipselink.core.context.EclipseLinkAccessType; -import org.eclipse.jpt.jpa.eclipselink.core.context.EclipseLinkElementCollectionMapping2_0; -import org.eclipse.jpt.jpa.eclipselink.core.context.EclipseLinkJoinFetch; -import org.eclipse.jpt.jpa.eclipselink.core.context.orm.EclipseLinkOrmConvertibleMapping; -import org.eclipse.jpt.jpa.eclipselink.core.context.orm.OrmEclipseLinkConverterContainer; -import org.eclipse.jpt.jpa.eclipselink.core.internal.DefaultEclipseLinkJpaValidationMessages; -import org.eclipse.jpt.jpa.eclipselink.core.internal.EclipseLinkJpaValidationMessages; -import org.eclipse.jpt.jpa.eclipselink.core.resource.orm.XmlElementCollection; -import org.eclipse.text.edits.ReplaceEdit; -import org.eclipse.wst.validation.internal.provisional.core.IMessage; -import org.eclipse.wst.validation.internal.provisional.core.IReporter; - -public class EclipseLinkOrmElementCollectionMapping2_0 - extends AbstractOrmElementCollectionMapping2_0<XmlElementCollection> - implements - EclipseLinkElementCollectionMapping2_0, - EclipseLinkOrmConvertibleMapping, - OrmEclipseLinkConverterContainer.Owner -{ - protected final OrmEclipseLinkJoinFetch joinFetch; - - protected final OrmEclipseLinkConverterContainer converterContainer; - - - public EclipseLinkOrmElementCollectionMapping2_0(OrmPersistentAttribute parent, XmlElementCollection resourceMapping) { - super(parent, resourceMapping); - this.joinFetch = new OrmEclipseLinkJoinFetch(this); - this.converterContainer = this.buildConverterContainer(); - } - - - // ********** synchronize/update ********** - - @Override - public void synchronizeWithResourceModel() { - super.synchronizeWithResourceModel(); - this.joinFetch.synchronizeWithResourceModel(); - this.converterContainer.synchronizeWithResourceModel(); - } - - @Override - public void update() { - super.update(); - this.joinFetch.update(); - this.converterContainer.update(); - } - - - // ********** attribute type ********** - - @Override - protected String buildSpecifiedAttributeType() { - return this.xmlAttributeMapping.getAttributeType(); - } - - @Override - protected void setSpecifiedAttributeTypeInXml(String attributeType) { - this.xmlAttributeMapping.setAttributeType(attributeType); - } - - - // ********** join fetch ********** - - public EclipseLinkJoinFetch getJoinFetch() { - if (getJpaPlatformVersion().getVersion().equals(JptJpaEclipseLinkCorePlugin.ECLIPSELINK_PLATFORM_VERSION_2_0)) { - throw new UnsupportedOperationException("join-fetch not supported in EclipseLink 2.0 platform"); //$NON-NLS-1$ - } - return this.joinFetch; - } - - - // ********** converters ********** - - public OrmEclipseLinkConverterContainer getConverterContainer() { - return this.converterContainer; - } - - protected OrmEclipseLinkConverterContainer buildConverterContainer() { - return new OrmEclipseLinkConverterContainerImpl(this, this, this.xmlAttributeMapping); - } - - public int getNumberSupportedConverters() { - return 2; - } - - // ********** converter adapters ********** - - /** - * put the EclipseLink convert adapter first - this is the order EclipseLink searches - */ - @Override - protected Iterable<OrmConverter.Adapter> getConverterAdapters() { - return new CompositeIterable<OrmConverter.Adapter>( - OrmEclipseLinkConvert.Adapter.instance(), - super.getConverterAdapters() - ); - } - - - //************ refactoring ************ - - @Override - @SuppressWarnings("unchecked") - public Iterable<ReplaceEdit> createMoveTypeEdits(IType originalType, IPackageFragment newPackage) { - return new CompositeIterable<ReplaceEdit>( - super.createMoveTypeEdits(originalType, newPackage), - this.converterContainer.createMoveTypeEdits(originalType, newPackage) - ); - } - - @Override - @SuppressWarnings("unchecked") - public Iterable<ReplaceEdit> createRenamePackageEdits(IPackageFragment originalPackage, String newName) { - return new CompositeIterable<ReplaceEdit>( - super.createRenamePackageEdits(originalPackage, newName), - this.converterContainer.createRenamePackageEdits(originalPackage, newName) - ); - } - - @Override - @SuppressWarnings("unchecked") - public Iterable<ReplaceEdit> createRenameTypeEdits(IType originalType, String newName) { - return new CompositeIterable<ReplaceEdit>( - super.createRenameTypeEdits(originalType, newName), - this.converterContainer.createRenameTypeEdits(originalType, newName) - ); - } - - - // ********** validation ********** - - @Override - public void validate(List<IMessage> messages, IReporter reporter) { - super.validate(messages, reporter); - // TODO join fetch validation - } - - @Override - protected void validateAttributeType(List<IMessage> messages, IReporter reporter) { - if (this.isVirtualAccess()) { - if (StringTools.stringIsEmpty(this.getAttributeType())) { - messages.add( - DefaultEclipseLinkJpaValidationMessages.buildMessage( - IMessage.HIGH_SEVERITY, - EclipseLinkJpaValidationMessages.VIRTUAL_ATTRIBUTE_NO_ATTRIBUTE_TYPE_SPECIFIED, - new String[] {this.getName()}, - this, - this.getAttributeTypeTextRange() - ) - ); - return; - } - if (this.getResolvedAttributeType() == null) { - IType jdtType = JDTTools.findType(this.getJavaProject(), this.getFullyQualifiedAttributeType()); - if (jdtType == null) { - messages.add( - DefaultEclipseLinkJpaValidationMessages.buildMessage( - IMessage.HIGH_SEVERITY, - EclipseLinkJpaValidationMessages.VIRTUAL_ATTRIBUTE_ATTRIBUTE_TYPE_DOES_NOT_EXIST, - new String[] {this.getFullyQualifiedAttributeType()}, - this, - this.getAttributeTypeTextRange() - ) - ); - return; - } - } - } - super.validateAttributeType(messages, reporter); - } - - - protected boolean isVirtualAccess() { - return getPersistentAttribute().getAccess() == EclipseLinkAccessType.VIRTUAL; - } - - @Override - protected TextRange getAttributeTypeTextRange() { - return this.getValidationTextRange(this.xmlAttributeMapping.getAttributeTypeTextRange()); - } -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/orm/EclipseLinkOrmOneToManyRelationship.java b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/orm/EclipseLinkOrmOneToManyRelationship.java deleted file mode 100644 index 8c9def1627..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/orm/EclipseLinkOrmOneToManyRelationship.java +++ /dev/null @@ -1,28 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010, 2011 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.eclipselink.core.internal.context.orm; - -import org.eclipse.jpt.jpa.core.context.orm.OrmOneToManyMapping; -import org.eclipse.jpt.jpa.core.internal.context.orm.GenericOrmOneToManyRelationship; -import org.eclipse.jpt.jpa.eclipselink.core.context.orm.EclipseLinkOrmOneToManyRelationship2_0; - -/** - * We need this class because the EclipseLink 1.0 1:m mapping supports a join - * column strategy while JPA did not until JPA 2.0. As a result, we need a class - * that implements EclipseLink 1.0. - */ -public class EclipseLinkOrmOneToManyRelationship - extends GenericOrmOneToManyRelationship - implements EclipseLinkOrmOneToManyRelationship2_0 -{ - public EclipseLinkOrmOneToManyRelationship(OrmOneToManyMapping parent) { - super(parent, true); // true=supports join column strategy - } -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/orm/EclipseLinkOrmPersistentTypeImpl.java b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/orm/EclipseLinkOrmPersistentTypeImpl.java deleted file mode 100644 index 5f762ba74e..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/orm/EclipseLinkOrmPersistentTypeImpl.java +++ /dev/null @@ -1,324 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2012 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.eclipselink.core.internal.context.orm; - -import java.util.List; -import org.eclipse.jpt.jpa.core.context.PersistentType; -import org.eclipse.jpt.jpa.core.context.java.JavaPersistentType; -import org.eclipse.jpt.jpa.core.context.orm.EntityMappings; -import org.eclipse.jpt.jpa.core.context.orm.OrmAttributeMappingDefinition; -import org.eclipse.jpt.jpa.core.context.orm.OrmPersistentAttribute; -import org.eclipse.jpt.jpa.core.internal.context.orm.SpecifiedOrmPersistentType; -import org.eclipse.jpt.jpa.core.internal.validation.DefaultJpaValidationMessages; -import org.eclipse.jpt.jpa.core.internal.validation.JpaValidationMessages; -import org.eclipse.jpt.jpa.core.resource.orm.Attributes; -import org.eclipse.jpt.jpa.eclipselink.core.JptJpaEclipseLinkCorePlugin; -import org.eclipse.jpt.jpa.eclipselink.core.context.EclipseLinkAccessType; -import org.eclipse.jpt.jpa.eclipselink.core.context.orm.EclipseLinkEntityMappings; -import org.eclipse.jpt.jpa.eclipselink.core.context.orm.EclipseLinkOrmTypeMapping; -import org.eclipse.jpt.jpa.eclipselink.core.context.orm.EclipseLinkOrmPersistentType; -import org.eclipse.jpt.jpa.eclipselink.core.resource.orm.EclipseLinkOrmFactory; -import org.eclipse.jpt.jpa.eclipselink.core.resource.orm.XmlAccessMethods; -import org.eclipse.jpt.jpa.eclipselink.core.resource.orm.XmlAccessMethodsHolder; -import org.eclipse.jpt.jpa.eclipselink.core.resource.orm.XmlAttributeMapping; -import org.eclipse.jpt.jpa.eclipselink.core.resource.orm.XmlTypeMapping; -import org.eclipse.wst.validation.internal.provisional.core.IMessage; - -/** - * <code>eclipselink-orm.xml</code> persistent type:<ul> - * <li>mapping - * <li>access - * <li>access-methods - * <li>attributes - * <li>super persistent type - * <li>Java persistent type - * </ul> - */ -public class EclipseLinkOrmPersistentTypeImpl - extends SpecifiedOrmPersistentType - implements EclipseLinkOrmPersistentType -{ - - protected String specifiedGetMethod; - protected String defaultGetMethod; - - protected String specifiedSetMethod; - protected String defaultSetMethod; - - protected boolean dynamic; - - public EclipseLinkOrmPersistentTypeImpl(EntityMappings parent, XmlTypeMapping xmlTypeMapping) { - super(parent, xmlTypeMapping); - this.specifiedGetMethod = this.buildSpecifiedGetMethod(); - this.specifiedSetMethod = this.buildSpecifiedSetMethod(); - } - - @Override - protected XmlTypeMapping getXmlTypeMapping() { - return (XmlTypeMapping) super.getXmlTypeMapping(); - } - - @Override - public EclipseLinkOrmTypeMapping getMapping() { - return (EclipseLinkOrmTypeMapping) super.getMapping(); - } - - // ********** synchronize/update ********** - - @Override - public void synchronizeWithResourceModel() { - super.synchronizeWithResourceModel(); - this.setSpecifiedGetMethod_(this.buildSpecifiedGetMethod()); - this.setSpecifiedSetMethod_(this.buildSpecifiedSetMethod()); - } - - @Override - public void update() { - super.update(); - this.setDefaultGetMethod(this.buildDefaultGetMethod()); - this.setDefaultSetMethod(this.buildDefaultSetMethod()); - this.setDynamic(this.buildDynamic()); - } - - - //*************** dynamic ***************** - - public boolean isDynamic() { - return this.dynamic; - } - - protected void setDynamic(boolean dynamic) { - boolean old = this.dynamic; - this.dynamic = dynamic; - if (this.firePropertyChanged(DYNAMIC_PROPERTY, old, this.dynamic)) { - // clear out the Java persistent type here, it will be rebuilt during "update" - if (this.javaPersistentType != null) { - this.javaPersistentType.dispose(); - this.setJavaPersistentType(null); - } - } - } - - //Base the dynamic state only on the JavaResourceType being null. - //Otherwise, the access type affects the hierarchy - //and then the hierarchy affects the access type and we get stuck in an update. - //Validation will check that virtual access is set if it is dynamic. - protected boolean buildDynamic() { - return JptJpaEclipseLinkCorePlugin.nodeIsEclipseLinkVersionCompatible(this, JptJpaEclipseLinkCorePlugin.ECLIPSELINK_PLATFORM_VERSION_2_1) - && this.resolveJavaResourceType() == null; - } - - protected boolean isVirtualAccess() { - return this.getAccess() == EclipseLinkAccessType.VIRTUAL; - } - - @Override - protected JavaPersistentType buildJavaPersistentType() { - if (this.isDynamic()) { - return this.buildVirtualJavaPersistentType(); - } - return super.buildJavaPersistentType(); - } - - protected JavaPersistentType buildVirtualJavaPersistentType() { - return new VirtualJavaPersistentType(this, this.getXmlTypeMapping()); - } - - - @Override - public PersistentType getOverriddenPersistentType() { - if (this.isDynamic()) { - return null; - } - return super.getOverriddenPersistentType(); - } - - public OrmPersistentAttribute addVirtualAttribute(String attributeName, String mappingKey, String attributeType) { - // force the creation of an empty xml attribute container beforehand or it will trigger - // a sync and, if we do this after adding the attribute, clear out our context attributes - Attributes xmlAttributes = this.getXmlAttributesForUpdate(); - this.getXmlTypeMapping().setAttributes(xmlAttributes); // possibly a NOP - - OrmAttributeMappingDefinition md = this.getMappingFileDefinition().getAttributeMappingDefinition(mappingKey); - XmlAttributeMapping xmlMapping = (XmlAttributeMapping) md.buildResourceMapping(this.getResourceNodeFactory()); - xmlMapping.setName(attributeName); - xmlMapping.setAttributeType(attributeType); - if (this.getAccess() != EclipseLinkAccessType.VIRTUAL) { - xmlMapping.setAccess(EclipseLinkAccessType.VIRTUAL.getOrmAccessType()); - } - - OrmPersistentAttribute specifiedAttribute = this.buildSpecifiedAttribute(xmlMapping); - // we need to add the attribute to the right spot in the list - stupid spec... - int specifiedIndex = this.getSpecifiedAttributeInsertionIndex(specifiedAttribute); - this.addItemToList(specifiedIndex, specifiedAttribute, this.specifiedAttributes, SPECIFIED_ATTRIBUTES_LIST); - specifiedAttribute.getMapping().addXmlAttributeMappingTo(xmlAttributes); - - return specifiedAttribute; - } - - //*************** get method ***************** - - public String getGetMethod() { - String specifiedGetMethod = this.getSpecifiedGetMethod(); - return (specifiedGetMethod != null) ? specifiedGetMethod : this.defaultGetMethod; - } - - public String getDefaultGetMethod() { - return this.defaultGetMethod; - } - - //TODO get the default get method from the java VirtualAccessMethods annotation and from the super type - protected String buildDefaultGetMethod() { - if (getAccess() == EclipseLinkAccessType.VIRTUAL) { - String defaultGetMethod = getEntityMappings().getDefaultGetMethod(); - return defaultGetMethod != null ? defaultGetMethod : DEFAULT_GET_METHOD; - } - return null; - } - - protected void setDefaultGetMethod(String getMethod) { - String old = this.defaultGetMethod; - this.defaultGetMethod = getMethod; - this.firePropertyChanged(DEFAULT_GET_METHOD_PROPERTY, old, getMethod); - } - - public String getSpecifiedGetMethod() { - return this.specifiedGetMethod; - } - - public void setSpecifiedGetMethod(String getMethod) { - if (this.valuesAreDifferent(this.specifiedGetMethod, getMethod)) { - XmlAccessMethods xmlAccessMethods = this.getXmlAccessMethodsForUpdate(); - this.setSpecifiedGetMethod_(getMethod); - xmlAccessMethods.setGetMethod(getMethod); - this.removeXmlAccessMethodsIfUnset(); - } - } - - protected void setSpecifiedGetMethod_(String getMethod) { - String old = this.specifiedGetMethod; - this.specifiedGetMethod = getMethod; - this.firePropertyChanged(SPECIFIED_GET_METHOD_PROPERTY, old, getMethod); - } - - protected String buildSpecifiedGetMethod() { - XmlAccessMethods accessMethods = this.getXmlAccessMethods(); - return accessMethods != null ? accessMethods.getGetMethod() : null; - } - - - //*************** set method ***************** - - public String getSetMethod() { - String specifiedSetMethod = this.getSpecifiedSetMethod(); - return (specifiedSetMethod != null) ? specifiedSetMethod : this.defaultSetMethod; - } - - public String getDefaultSetMethod() { - return this.defaultSetMethod; - } - - protected void setDefaultSetMethod(String setMethod) { - String old = this.defaultSetMethod; - this.defaultSetMethod = setMethod; - this.firePropertyChanged(DEFAULT_SET_METHOD_PROPERTY, old, setMethod); - } - - protected String buildDefaultSetMethod() { - if (getAccess() == EclipseLinkAccessType.VIRTUAL) { - //TODO get the default set method from the java VirtualAccessMethods annotation/super persistent type, embedded parent, etc - String defaultSetMethod = getEntityMappings().getDefaultSetMethod(); - return defaultSetMethod != null ? defaultSetMethod : DEFAULT_SET_METHOD; - } - return null; - } - - public String getSpecifiedSetMethod() { - return this.specifiedSetMethod; - } - - public void setSpecifiedSetMethod(String setMethod) { - if (this.valuesAreDifferent(this.specifiedSetMethod, setMethod)) { - XmlAccessMethods xmlAccessMethods = this.getXmlAccessMethodsForUpdate(); - this.setSpecifiedSetMethod_(setMethod); - xmlAccessMethods.setSetMethod(setMethod); - this.removeXmlAccessMethodsIfUnset(); - } - } - - protected void setSpecifiedSetMethod_(String setMethod) { - String old = this.specifiedSetMethod; - this.specifiedSetMethod = setMethod; - this.firePropertyChanged(SPECIFIED_SET_METHOD_PROPERTY, old, setMethod); - } - - protected String buildSpecifiedSetMethod() { - XmlAccessMethods accessMethods = this.getXmlAccessMethods(); - return accessMethods != null ? accessMethods.getSetMethod() : null; - } - - //*************** XML access methods ***************** - - protected XmlAccessMethodsHolder getXmlAccessMethodsHolder() { - return this.getXmlTypeMapping(); - } - - protected XmlAccessMethods getXmlAccessMethods() { - return getXmlAccessMethodsHolder().getAccessMethods(); - } - - /** - * Build the XML access methods (and XML defaults and XML metadata if necessary) if it does not exist. - */ - protected XmlAccessMethods getXmlAccessMethodsForUpdate() { - XmlAccessMethods xmlAccessMethods = this.getXmlAccessMethodsHolder().getAccessMethods(); - return (xmlAccessMethods != null) ? xmlAccessMethods : this.buildXmlAccessMethods(); - } - - protected XmlAccessMethods buildXmlAccessMethods() { - XmlAccessMethods xmlAccessMethods = this.buildXmlAccessMethods_(); - this.getXmlAccessMethodsHolder().setAccessMethods(xmlAccessMethods); - return xmlAccessMethods; - } - - protected XmlAccessMethods buildXmlAccessMethods_() { - return EclipseLinkOrmFactory.eINSTANCE.createXmlAccessMethods(); - } - - /** - * clear the XML access methods if appropriate - */ - protected void removeXmlAccessMethodsIfUnset() { - if (this.getXmlAccessMethods().isUnset()) { - this.getXmlAccessMethodsHolder().setAccessMethods(null); - } - } - - @Override - protected EclipseLinkEntityMappings getEntityMappings() { - return (EclipseLinkEntityMappings) super.getEntityMappings(); - } - - @Override - protected void validateClass(List<IMessage> messages) { - if (this.isDynamic() && !this.isVirtualAccess()) { - messages.add( - DefaultJpaValidationMessages.buildMessage( - IMessage.HIGH_SEVERITY, - JpaValidationMessages.PERSISTENT_TYPE_UNRESOLVED_CLASS, - new String[] {this.getName()}, - this, - this.mapping.getClassTextRange() - ) - ); - } - } - -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/orm/EclipseLinkOrmTenantDiscriminatorColumn2_3.java b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/orm/EclipseLinkOrmTenantDiscriminatorColumn2_3.java deleted file mode 100644 index 463756227a..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/orm/EclipseLinkOrmTenantDiscriminatorColumn2_3.java +++ /dev/null @@ -1,270 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2012 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the terms of - * the Eclipse Public License v1.0, which accompanies this distribution and is available at - * http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.eclipselink.core.internal.context.orm; - -import org.eclipse.jpt.common.core.utility.TextRange; -import org.eclipse.jpt.jpa.core.context.XmlContextNode; -import org.eclipse.jpt.jpa.core.internal.context.NamedColumnTextRangeResolver; -import org.eclipse.jpt.jpa.core.internal.context.orm.OrmTableColumnTextRangeResolver; -import org.eclipse.jpt.jpa.core.internal.jpa1.context.orm.AbstractOrmNamedDiscriminatorColumn; -import org.eclipse.jpt.jpa.eclipselink.core.context.orm.OrmReadOnlyTenantDiscriminatorColumn2_3; -import org.eclipse.jpt.jpa.eclipselink.core.context.orm.OrmTenantDiscriminatorColumn2_3; -import org.eclipse.jpt.jpa.eclipselink.core.resource.orm.XmlTenantDiscriminatorColumn; -import org.eclipse.jpt.jpa.eclipselink.core.resource.orm.v2_3.XmlTenantDiscriminatorColumn_2_3; - -/** - * <code>orm.xml</code> tenant discriminator column - */ -public class EclipseLinkOrmTenantDiscriminatorColumn2_3 - extends AbstractOrmNamedDiscriminatorColumn<XmlTenantDiscriminatorColumn_2_3, OrmReadOnlyTenantDiscriminatorColumn2_3.Owner> - implements OrmTenantDiscriminatorColumn2_3 -{ - protected XmlTenantDiscriminatorColumn_2_3 xmlTenantDiscriminatorColumn; - - protected String specifiedTable; - protected String defaultTable; - - protected String specifiedContextProperty; - protected String defaultContextProperty; - - protected Boolean specifiedPrimaryKey; - protected boolean defaultPrimaryKey = DEFAULT_PRIMARY_KEY; - - public EclipseLinkOrmTenantDiscriminatorColumn2_3(XmlContextNode parent, OrmReadOnlyTenantDiscriminatorColumn2_3.Owner owner, XmlTenantDiscriminatorColumn_2_3 column) { - super(parent, owner, column); - this.specifiedTable = this.buildSpecifiedTable(); - this.specifiedContextProperty = this.buildSpecifiedContextProperty(); - this.specifiedPrimaryKey = this.buildSpecifiedPrimaryKey(); - } - - - // ********** synchronize/update ********** - - @Override - public void synchronizeWithResourceModel() { - super.synchronizeWithResourceModel(); - this.setSpecifiedTable_(this.buildSpecifiedTable()); - this.setSpecifiedContextProperty_(this.buildSpecifiedContextProperty()); - this.setSpecifiedPrimaryKey_(this.buildSpecifiedPrimaryKey()); - } - - @Override - public void update() { - super.update(); - this.setDefaultTable(this.buildDefaultTable()); - this.setDefaultContextProperty(this.buildDefaultContextProperty()); - this.setDefaultPrimaryKey(this.buildDefaultPrimaryKey()); - } - - - - // ********** XML column ********** - - @Override - public XmlTenantDiscriminatorColumn_2_3 getXmlColumn() { - return this.xmlTenantDiscriminatorColumn; - } - - @Override - protected void setXmlColumn(XmlTenantDiscriminatorColumn_2_3 xmlColumn) { - this.xmlTenantDiscriminatorColumn = xmlColumn; - } - - /** - * tenant discriminator columns are part of a collection; - * the 'tenant-discriminator-column' element will be removed/added - * when the XML tenant discriminator column is removed from/added to - * the owner's collection - */ - @Override - protected XmlTenantDiscriminatorColumn buildXmlColumn() { - throw new IllegalStateException("XML tenant discriminator column is missing"); //$NON-NLS-1$ - } - - /** - * @see #buildXmlColumn() - */ - @Override - protected void removeXmlColumn() { - // do nothing - } - - - // ********** table ********** - - @Override - public String getTable() { - return (this.specifiedTable != null) ? this.specifiedTable : this.defaultTable; - } - - public String getSpecifiedTable() { - return this.specifiedTable; - } - - public void setSpecifiedTable(String table) { - if (this.valuesAreDifferent(this.specifiedTable, table)) { - this.setSpecifiedTable_(table); - this.xmlTenantDiscriminatorColumn.setTable(table); - } - } - - protected void setSpecifiedTable_(String table) { - String old = this.specifiedTable; - this.specifiedTable = table; - this.firePropertyChanged(SPECIFIED_TABLE_PROPERTY, old, table); - } - - protected String buildSpecifiedTable() { - return (this.xmlTenantDiscriminatorColumn == null) ? null : this.xmlTenantDiscriminatorColumn.getTable(); - } - - public String getDefaultTable() { - return this.defaultTable; - } - - protected void setDefaultTable(String table) { - String old = this.defaultTable; - this.defaultTable = table; - this.firePropertyChanged(DEFAULT_TABLE_PROPERTY, old, table); - } - - protected String buildDefaultTable() { - return this.owner.getDefaultTableName(); - } - - // ********** contextProperty ********** - - public String getContextProperty() { - return (this.specifiedContextProperty != null) ? this.specifiedContextProperty : this.defaultContextProperty; - } - - public String getSpecifiedContextProperty() { - return this.specifiedContextProperty; - } - - public void setSpecifiedContextProperty(String contextProperty) { - if (this.valuesAreDifferent(this.specifiedContextProperty, contextProperty)) { - this.setSpecifiedContextProperty_(contextProperty); - this.xmlTenantDiscriminatorColumn.setContextProperty(contextProperty); - } - } - - protected void setSpecifiedContextProperty_(String contextProperty) { - String old = this.specifiedContextProperty; - this.specifiedContextProperty = contextProperty; - this.firePropertyChanged(SPECIFIED_CONTEXT_PROPERTY_PROPERTY, old, contextProperty); - } - - protected String buildSpecifiedContextProperty() { - return (this.xmlTenantDiscriminatorColumn == null) ? null : this.xmlTenantDiscriminatorColumn.getContextProperty(); - } - - public String getDefaultContextProperty() { - return this.defaultContextProperty; - } - - protected void setDefaultContextProperty(String contextProperty) { - String old = this.defaultContextProperty; - this.defaultContextProperty = contextProperty; - this.firePropertyChanged(DEFAULT_CONTEXT_PROPERTY_PROPERTY, old, contextProperty); - } - - protected String buildDefaultContextProperty() { - return this.owner.getDefaultContextPropertyName(); - } - - - // ********** primaryKey ********** - - public boolean isPrimaryKey() { - return (this.specifiedPrimaryKey != null) ? this.specifiedPrimaryKey.booleanValue() : this.isDefaultPrimaryKey(); - } - - public Boolean getSpecifiedPrimaryKey() { - return this.specifiedPrimaryKey; - } - - public void setSpecifiedPrimaryKey(Boolean primaryKey) { - if (this.valuesAreDifferent(this.specifiedPrimaryKey, primaryKey)) { - this.setSpecifiedPrimaryKey_(primaryKey); - this.xmlTenantDiscriminatorColumn.setPrimaryKey(primaryKey); - } - } - - protected void setSpecifiedPrimaryKey_(Boolean primaryKey) { - Boolean old = this.specifiedPrimaryKey; - this.specifiedPrimaryKey = primaryKey; - this.firePropertyChanged(SPECIFIED_PRIMARY_KEY_PROPERTY, old, primaryKey); - } - - protected Boolean buildSpecifiedPrimaryKey() { - return (this.xmlTenantDiscriminatorColumn == null) ? null : this.xmlTenantDiscriminatorColumn.getPrimaryKey(); - } - - public boolean isDefaultPrimaryKey() { - return this.defaultPrimaryKey; - } - - protected void setDefaultPrimaryKey(boolean defaultPrimaryKey) { - boolean old = this.defaultPrimaryKey; - this.defaultPrimaryKey = defaultPrimaryKey; - this.firePropertyChanged(DEFAULT_PRIMARY_KEY_PROPERTY, old, defaultPrimaryKey); - } - - protected boolean buildDefaultPrimaryKey() { - return this.owner.getDefaultPrimaryKey(); - } - - - // ********** misc ********** - - public Iterable<String> getCandidateTableNames() { - return this.owner.getCandidateTableNames(); - } - - - // ********** validation ********** - - public boolean tableNameIsInvalid() { - return this.owner.tableNameIsInvalid(this.getTable()); - } - - public TextRange getTableTextRange() { - return this.getValidationTextRange(this.getXmlColumnTableTextRange()); - } - - protected TextRange getXmlColumnTableTextRange() { - XmlTenantDiscriminatorColumn_2_3 xmlColumn = this.getXmlColumn(); - return (xmlColumn == null) ? null : xmlColumn.getTableTextRange(); - } - - @Override - protected NamedColumnTextRangeResolver buildTextRangeResolver() { - return new OrmTableColumnTextRangeResolver(this); - } - - // ********** completion proposals ********** - - @Override - public Iterable<String> getXmlCompletionProposals(int pos) { - Iterable<String> result = super.getXmlCompletionProposals(pos); - if (result != null) { - return result; - } - if (this.tableTouches(pos)) { - return this.getCandidateTableNames(); - } - return null; - } - - protected boolean tableTouches(int pos) { - return this.xmlTenantDiscriminatorColumn.tableTouches(pos); - } -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/orm/EclipseLinkOrmTimeOfDay.java b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/orm/EclipseLinkOrmTimeOfDay.java deleted file mode 100644 index 046fd56243..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/orm/EclipseLinkOrmTimeOfDay.java +++ /dev/null @@ -1,146 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2008, 2011 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.eclipselink.core.internal.context.orm; - -import org.eclipse.jpt.common.core.utility.TextRange; -import org.eclipse.jpt.jpa.core.internal.context.orm.AbstractOrmXmlContextNode; -import org.eclipse.jpt.jpa.eclipselink.core.context.EclipseLinkTimeOfDay; -import org.eclipse.jpt.jpa.eclipselink.core.context.orm.OrmEclipseLinkCaching; -import org.eclipse.jpt.jpa.eclipselink.core.resource.orm.XmlTimeOfDay; - -public class EclipseLinkOrmTimeOfDay - extends AbstractOrmXmlContextNode - implements EclipseLinkTimeOfDay -{ - protected final XmlTimeOfDay xmlTimeOfDay; - - protected Integer hour; - protected Integer minute; - protected Integer second; - protected Integer millisecond; - - - public EclipseLinkOrmTimeOfDay(OrmEclipseLinkCaching parent, XmlTimeOfDay xmlTimeOfDay) { - super(parent); - this.xmlTimeOfDay = xmlTimeOfDay; - this.hour = xmlTimeOfDay.getHour(); - this.minute = xmlTimeOfDay.getMinute(); - this.second = xmlTimeOfDay.getSecond(); - this.millisecond = xmlTimeOfDay.getMillisecond(); - } - - - // ********** synchronize/update ********** - - @Override - public void synchronizeWithResourceModel() { - super.synchronizeWithResourceModel(); - this.setHour_(this.xmlTimeOfDay.getHour()); - this.setMinute_(this.xmlTimeOfDay.getMinute()); - this.setSecond_(this.xmlTimeOfDay.getSecond()); - this.setMillisecond_(this.xmlTimeOfDay.getMillisecond()); - } - - - // ********** hour ********** - - public Integer getHour() { - return this.hour; - } - - public void setHour(Integer hour) { - this.setHour_(hour); - this.xmlTimeOfDay.setHour(hour); - } - - protected void setHour_(Integer hour) { - Integer old = this.hour; - this.hour = hour; - this.firePropertyChanged(HOUR_PROPERTY, old, hour); - } - - - // ********** minute ********** - - public Integer getMinute() { - return this.minute; - } - - public void setMinute(Integer minute) { - this.setMinute_(minute); - this.xmlTimeOfDay.setMinute(minute); - } - - protected void setMinute_(Integer minute) { - Integer old = this.minute; - this.minute = minute; - this.firePropertyChanged(MINUTE_PROPERTY, old, minute); - } - - - // ********** second ********** - - public Integer getSecond() { - return this.second; - } - - public void setSecond(Integer second) { - this.setSecond_(second); - this.xmlTimeOfDay.setSecond(second); - } - - protected void setSecond_(Integer second) { - Integer old = this.second; - this.second = second; - this.firePropertyChanged(SECOND_PROPERTY, old, second); - } - - - // ********** millisecond ********** - - public Integer getMillisecond() { - return this.millisecond; - } - - public void setMillisecond(Integer millisecond) { - this.setMillisecond_(millisecond); - this.xmlTimeOfDay.setMillisecond(millisecond); - } - - protected void setMillisecond_(Integer millisecond) { - Integer old = this.millisecond; - this.millisecond = millisecond; - this.firePropertyChanged(MILLISECOND_PROPERTY, old, millisecond); - } - - - // ********** misc ********** - - @Override - public OrmEclipseLinkCaching getParent() { - return (OrmEclipseLinkCaching) super.getParent(); - } - - protected OrmEclipseLinkCaching getCaching() { - return this.getParent(); - } - - public XmlTimeOfDay getXmlTimeOfDay() { - return this.xmlTimeOfDay; - } - - - // ********** validation ********** - - public TextRange getValidationTextRange() { - TextRange textRange = this.xmlTimeOfDay.getValidationTextRange(); - return (textRange != null) ? textRange : this.getCaching().getValidationTextRange(); - } -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/orm/EclipseLinkOrmXml1_1Definition.java b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/orm/EclipseLinkOrmXml1_1Definition.java deleted file mode 100644 index ba636b0de6..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/orm/EclipseLinkOrmXml1_1Definition.java +++ /dev/null @@ -1,54 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2009, 2011 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.eclipselink.core.internal.context.orm; - -import java.util.ArrayList; -import org.eclipse.jpt.common.core.JptResourceType; -import org.eclipse.jpt.common.utility.internal.CollectionTools; -import org.eclipse.jpt.jpa.core.context.orm.OrmAttributeMappingDefinition; -import org.eclipse.jpt.jpa.core.context.orm.OrmXmlContextNodeFactory; -import org.eclipse.jpt.jpa.core.context.orm.OrmXmlDefinition; -import org.eclipse.jpt.jpa.eclipselink.core.JptJpaEclipseLinkCorePlugin; - -public class EclipseLinkOrmXml1_1Definition - extends AbstractEclipseLinkOrmXmlDefinition -{ - // singleton - private static final OrmXmlDefinition INSTANCE = new EclipseLinkOrmXml1_1Definition(); - - /** - * Return the singleton. - */ - public static OrmXmlDefinition instance() { - return INSTANCE; - } - - - /** - * Enforce singleton usage - */ - private EclipseLinkOrmXml1_1Definition() { - super(); - } - public JptResourceType getResourceType() { - return JptJpaEclipseLinkCorePlugin.ECLIPSELINK_ORM_XML_1_1_RESOURCE_TYPE; - } - - @Override - protected OrmXmlContextNodeFactory buildContextNodeFactory() { - return EclipseLinkOrmXmlDefinition.instance().getContextNodeFactory(); - } - - @Override - protected void addAttributeMappingDefinitionsTo(ArrayList<OrmAttributeMappingDefinition> definitions) { - CollectionTools.addAll(definitions, EclipseLinkOrmXmlDefinition.ECLIPSELINK_ATTRIBUTE_MAPPING_DEFINITIONS); - } - -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/orm/EclipseLinkOrmXml1_2Definition.java b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/orm/EclipseLinkOrmXml1_2Definition.java deleted file mode 100644 index 77527bef2b..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/orm/EclipseLinkOrmXml1_2Definition.java +++ /dev/null @@ -1,55 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2009, 2011 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.eclipselink.core.internal.context.orm; - -import java.util.ArrayList; -import org.eclipse.jpt.common.core.JptResourceType; -import org.eclipse.jpt.common.utility.internal.CollectionTools; -import org.eclipse.jpt.jpa.core.context.orm.OrmAttributeMappingDefinition; -import org.eclipse.jpt.jpa.core.context.orm.OrmXmlContextNodeFactory; -import org.eclipse.jpt.jpa.core.context.orm.OrmXmlDefinition; -import org.eclipse.jpt.jpa.eclipselink.core.JptJpaEclipseLinkCorePlugin; - -public class EclipseLinkOrmXml1_2Definition - extends AbstractEclipseLinkOrmXmlDefinition -{ - // singleton - private static final OrmXmlDefinition INSTANCE = new EclipseLinkOrmXml1_2Definition(); - - /** - * Return the singleton. - */ - public static OrmXmlDefinition instance() { - return INSTANCE; - } - - - /** - * Enforce singleton usage - */ - private EclipseLinkOrmXml1_2Definition() { - super(); - } - - public JptResourceType getResourceType() { - return JptJpaEclipseLinkCorePlugin.ECLIPSELINK_ORM_XML_1_2_RESOURCE_TYPE; - } - - @Override - protected OrmXmlContextNodeFactory buildContextNodeFactory() { - return EclipseLinkOrmXmlDefinition.instance().getContextNodeFactory(); - } - - @Override - protected void addAttributeMappingDefinitionsTo(ArrayList<OrmAttributeMappingDefinition> definitions) { - CollectionTools.addAll(definitions, EclipseLinkOrmXmlDefinition.ECLIPSELINK_ATTRIBUTE_MAPPING_DEFINITIONS); - } - -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/orm/EclipseLinkOrmXml2_0ContextNodeFactory.java b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/orm/EclipseLinkOrmXml2_0ContextNodeFactory.java deleted file mode 100644 index 8d4e85e5d3..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/orm/EclipseLinkOrmXml2_0ContextNodeFactory.java +++ /dev/null @@ -1,97 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2009, 2011 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.eclipselink.core.internal.context.orm; - -import org.eclipse.jpt.jpa.core.context.Table; -import org.eclipse.jpt.jpa.core.context.XmlContextNode; -import org.eclipse.jpt.jpa.core.context.orm.OrmAssociationOverrideContainer; -import org.eclipse.jpt.jpa.core.context.orm.OrmAttributeMapping; -import org.eclipse.jpt.jpa.core.context.orm.OrmNamedQuery; -import org.eclipse.jpt.jpa.core.context.orm.OrmOrderable; -import org.eclipse.jpt.jpa.core.context.orm.OrmPersistentAttribute; -import org.eclipse.jpt.jpa.core.context.orm.OrmSequenceGenerator; -import org.eclipse.jpt.jpa.core.internal.jpa1.context.orm.GenericOrmAssociationOverrideContainer; -import org.eclipse.jpt.jpa.core.internal.jpa1.context.orm.GenericOrmOrderable; -import org.eclipse.jpt.jpa.core.internal.jpa2.context.orm.GenericOrmCacheable2_0; -import org.eclipse.jpt.jpa.core.internal.jpa2.context.orm.GenericOrmCollectionTable2_0; -import org.eclipse.jpt.jpa.core.internal.jpa2.context.orm.GenericOrmDerivedIdentity2_0; -import org.eclipse.jpt.jpa.core.internal.jpa2.context.orm.GenericOrmNamedQuery2_0; -import org.eclipse.jpt.jpa.core.internal.jpa2.context.orm.GenericOrmOrderColumn2_0; -import org.eclipse.jpt.jpa.core.internal.jpa2.context.orm.GenericOrmOrphanRemoval2_0; -import org.eclipse.jpt.jpa.core.internal.jpa2.context.orm.GenericOrmSequenceGenerator2_0; -import org.eclipse.jpt.jpa.core.jpa2.context.Orderable2_0; -import org.eclipse.jpt.jpa.core.jpa2.context.orm.OrmAssociationOverrideContainer2_0; -import org.eclipse.jpt.jpa.core.jpa2.context.orm.OrmCacheable2_0; -import org.eclipse.jpt.jpa.core.jpa2.context.orm.OrmCacheableHolder2_0; -import org.eclipse.jpt.jpa.core.jpa2.context.orm.OrmCollectionTable2_0; -import org.eclipse.jpt.jpa.core.jpa2.context.orm.OrmDerivedIdentity2_0; -import org.eclipse.jpt.jpa.core.jpa2.context.orm.OrmElementCollectionMapping2_0; -import org.eclipse.jpt.jpa.core.jpa2.context.orm.OrmEmbeddedMapping2_0; -import org.eclipse.jpt.jpa.core.jpa2.context.orm.OrmOrderColumn2_0; -import org.eclipse.jpt.jpa.core.jpa2.context.orm.OrmOrderable2_0; -import org.eclipse.jpt.jpa.core.jpa2.context.orm.OrmOrphanRemovable2_0; -import org.eclipse.jpt.jpa.core.jpa2.context.orm.OrmOrphanRemovalHolder2_0; -import org.eclipse.jpt.jpa.core.jpa2.context.orm.OrmSingleRelationshipMapping2_0; -import org.eclipse.jpt.jpa.core.jpa2.context.orm.OrmXml2_0ContextNodeFactory; -import org.eclipse.jpt.jpa.core.resource.orm.XmlNamedQuery; -import org.eclipse.jpt.jpa.eclipselink.core.resource.orm.XmlElementCollection; - -public class EclipseLinkOrmXml2_0ContextNodeFactory - extends EclipseLinkOrmXmlContextNodeFactory - implements OrmXml2_0ContextNodeFactory -{ - - public OrmAssociationOverrideContainer buildOrmAssociationOverrideContainer(OrmEmbeddedMapping2_0 parent, OrmAssociationOverrideContainer2_0.Owner owner) { - return new GenericOrmAssociationOverrideContainer(parent, owner); - } - - @Override - public OrmSequenceGenerator buildOrmSequenceGenerator(XmlContextNode parent, org.eclipse.jpt.jpa.core.resource.orm.XmlSequenceGenerator resourceSequenceGenerator) { - return new GenericOrmSequenceGenerator2_0(parent, resourceSequenceGenerator); - } - - public OrmDerivedIdentity2_0 buildOrmDerivedIdentity(OrmSingleRelationshipMapping2_0 parent) { - return new GenericOrmDerivedIdentity2_0(parent); - } - - public OrmElementCollectionMapping2_0 buildOrmElementCollectionMapping2_0(OrmPersistentAttribute parent, org.eclipse.jpt.jpa.core.resource.orm.XmlElementCollection resourceMapping) { - return new EclipseLinkOrmElementCollectionMapping2_0(parent, (XmlElementCollection) resourceMapping); - } - - public OrmCacheable2_0 buildOrmCacheable(OrmCacheableHolder2_0 parent) { - return new GenericOrmCacheable2_0(parent); - } - - public OrmOrphanRemovable2_0 buildOrmOrphanRemoval(OrmOrphanRemovalHolder2_0 parent) { - return new GenericOrmOrphanRemoval2_0(parent); - } - - @Override - public OrmNamedQuery buildOrmNamedQuery(XmlContextNode parent, XmlNamedQuery resourceNamedQuery) { - return new GenericOrmNamedQuery2_0(parent, resourceNamedQuery); - } - - public OrmCollectionTable2_0 buildOrmCollectionTable(OrmElementCollectionMapping2_0 parent, Table.Owner owner) { - return new GenericOrmCollectionTable2_0(parent, owner); - } - - @Override - public OrmOrderable buildOrmOrderable(OrmAttributeMapping parent) { - throw new UnsupportedOperationException("use #buildOrmOrderable(OrmAttributeMapping parent, Orderable2_0.Owner owner)"); //$NON-NLS-1$ - } - - public OrmOrderable2_0 buildOrmOrderable(OrmAttributeMapping parent, Orderable2_0.Owner owner) { - return new GenericOrmOrderable(parent, owner); - } - - public OrmOrderColumn2_0 buildOrmOrderColumn(OrmOrderable2_0 parent, OrmOrderColumn2_0.Owner owner) { - return new GenericOrmOrderColumn2_0(parent, owner); - } -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/orm/EclipseLinkOrmXml2_0Definition.java b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/orm/EclipseLinkOrmXml2_0Definition.java deleted file mode 100644 index 2cd76ef0e9..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/orm/EclipseLinkOrmXml2_0Definition.java +++ /dev/null @@ -1,90 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2009, 2011 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.eclipselink.core.internal.context.orm; - -import java.util.ArrayList; -import org.eclipse.jpt.common.core.JptResourceType; -import org.eclipse.jpt.common.utility.internal.CollectionTools; -import org.eclipse.jpt.jpa.core.context.orm.NullOrmAttributeMappingDefinition; -import org.eclipse.jpt.jpa.core.context.orm.OrmAttributeMappingDefinition; -import org.eclipse.jpt.jpa.core.context.orm.OrmXmlContextNodeFactory; -import org.eclipse.jpt.jpa.core.context.orm.OrmXmlDefinition; -import org.eclipse.jpt.jpa.core.internal.context.orm.OrmBasicMappingDefinition; -import org.eclipse.jpt.jpa.core.internal.context.orm.OrmEmbeddedIdMappingDefinition; -import org.eclipse.jpt.jpa.core.internal.context.orm.OrmEmbeddedMappingDefinition; -import org.eclipse.jpt.jpa.core.internal.context.orm.OrmIdMappingDefinition; -import org.eclipse.jpt.jpa.core.internal.context.orm.OrmManyToManyMappingDefinition; -import org.eclipse.jpt.jpa.core.internal.context.orm.OrmManyToOneMappingDefinition; -import org.eclipse.jpt.jpa.core.internal.context.orm.OrmOneToManyMappingDefinition; -import org.eclipse.jpt.jpa.core.internal.context.orm.OrmOneToOneMappingDefinition; -import org.eclipse.jpt.jpa.core.internal.context.orm.OrmTransientMappingDefinition; -import org.eclipse.jpt.jpa.core.internal.context.orm.OrmVersionMappingDefinition; -import org.eclipse.jpt.jpa.core.internal.jpa2.context.orm.OrmElementCollectionMapping2_0Definition; -import org.eclipse.jpt.jpa.eclipselink.core.JptJpaEclipseLinkCorePlugin; -import org.eclipse.jpt.jpa.eclipselink.core.internal.EclipseLink2_0JpaPlatformProvider; - -public class EclipseLinkOrmXml2_0Definition - extends AbstractEclipseLinkOrmXmlDefinition -{ - // singleton - private static final OrmXmlDefinition INSTANCE = new EclipseLinkOrmXml2_0Definition(); - - /** - * Return the singleton. - */ - public static OrmXmlDefinition instance() { - return INSTANCE; - } - - - /** - * Enforce singleton usage - */ - private EclipseLinkOrmXml2_0Definition() { - super(); - } - - public JptResourceType getResourceType() { - return JptJpaEclipseLinkCorePlugin.ECLIPSELINK_ORM_XML_2_0_RESOURCE_TYPE; - } - - @Override - protected OrmXmlContextNodeFactory buildContextNodeFactory() { - return new EclipseLinkOrmXml2_0ContextNodeFactory(); - } - - @Override - protected void addAttributeMappingDefinitionsTo(ArrayList<OrmAttributeMappingDefinition> definitions) { - CollectionTools.addAll(definitions, ECLIPSELINK_2_0_ATTRIBUTE_MAPPING_DEFINITIONS); - } - - /** - * Order should not matter here; but we'll use the same order as for Java. - * @see EclipseLink2_0JpaPlatformProvider - */ - protected static final OrmAttributeMappingDefinition[] ECLIPSELINK_2_0_ATTRIBUTE_MAPPING_DEFINITIONS = new OrmAttributeMappingDefinition[] { - OrmTransientMappingDefinition.instance(), - OrmEclipseLinkBasicCollectionMappingDefinition.instance(), - OrmEclipseLinkBasicMapMappingDefinition.instance(), - OrmElementCollectionMapping2_0Definition.instance(), - OrmIdMappingDefinition.instance(), - OrmVersionMappingDefinition.instance(), - OrmBasicMappingDefinition.instance(), - OrmEmbeddedMappingDefinition.instance(), - OrmEmbeddedIdMappingDefinition.instance(), - OrmEclipseLinkTransformationMappingDefinition.instance(), - OrmManyToManyMappingDefinition.instance(), - OrmManyToOneMappingDefinition.instance(), - OrmOneToManyMappingDefinition.instance(), - OrmOneToOneMappingDefinition.instance(), - OrmEclipseLinkVariableOneToOneMappingDefinition.instance(), - NullOrmAttributeMappingDefinition.instance() - }; -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/orm/EclipseLinkOrmXml2_1ContextNodeFactory.java b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/orm/EclipseLinkOrmXml2_1ContextNodeFactory.java deleted file mode 100644 index 95ac734624..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/orm/EclipseLinkOrmXml2_1ContextNodeFactory.java +++ /dev/null @@ -1,29 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010, 2011 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.eclipselink.core.internal.context.orm; - -import org.eclipse.jpt.jpa.core.context.orm.OrmPersistentAttribute; -import org.eclipse.jpt.jpa.eclipselink.core.resource.orm.XmlBasicCollection; -import org.eclipse.jpt.jpa.eclipselink.core.resource.orm.XmlBasicMap; - -public class EclipseLinkOrmXml2_1ContextNodeFactory - extends EclipseLinkOrmXml2_0ContextNodeFactory -{ - - @Override - public AbstractOrmEclipseLinkBasicCollectionMapping buildOrmEclipseLinkBasicCollectionMapping(OrmPersistentAttribute parent, XmlBasicCollection resourceMapping) { - return new OrmEclipseLinkBasicCollectionMapping2_1(parent, resourceMapping); - } - - @Override - public AbstractOrmEclipseLinkBasicMapMapping buildOrmEclipseLinkBasicMapMapping(OrmPersistentAttribute parent, XmlBasicMap resourceMapping) { - return new OrmEclipseLinkBasicMapMapping2_1(parent, resourceMapping); - } -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/orm/EclipseLinkOrmXml2_1Definition.java b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/orm/EclipseLinkOrmXml2_1Definition.java deleted file mode 100644 index bb5f160db9..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/orm/EclipseLinkOrmXml2_1Definition.java +++ /dev/null @@ -1,54 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010, 2011 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.eclipselink.core.internal.context.orm; - -import java.util.ArrayList; -import org.eclipse.jpt.common.core.JptResourceType; -import org.eclipse.jpt.common.utility.internal.CollectionTools; -import org.eclipse.jpt.jpa.core.context.orm.OrmAttributeMappingDefinition; -import org.eclipse.jpt.jpa.core.context.orm.OrmXmlContextNodeFactory; -import org.eclipse.jpt.jpa.core.context.orm.OrmXmlDefinition; -import org.eclipse.jpt.jpa.eclipselink.core.JptJpaEclipseLinkCorePlugin; - -public class EclipseLinkOrmXml2_1Definition - extends AbstractEclipseLinkOrmXmlDefinition -{ - // singleton - private static final OrmXmlDefinition INSTANCE = new EclipseLinkOrmXml2_1Definition(); - - /** - * Return the singleton. - */ - public static OrmXmlDefinition instance() { - return INSTANCE; - } - - - /** - * Enforce singleton usage - */ - private EclipseLinkOrmXml2_1Definition() { - super(); - } - - public JptResourceType getResourceType() { - return JptJpaEclipseLinkCorePlugin.ECLIPSELINK_ORM_XML_2_1_RESOURCE_TYPE; - } - - @Override - protected OrmXmlContextNodeFactory buildContextNodeFactory() { - return new EclipseLinkOrmXml2_1ContextNodeFactory(); - } - - @Override - protected void addAttributeMappingDefinitionsTo(ArrayList<OrmAttributeMappingDefinition> definitions) { - CollectionTools.addAll(definitions, EclipseLinkOrmXml2_0Definition.ECLIPSELINK_2_0_ATTRIBUTE_MAPPING_DEFINITIONS); - } -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/orm/EclipseLinkOrmXml2_2Definition.java b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/orm/EclipseLinkOrmXml2_2Definition.java deleted file mode 100644 index 0b9a42b08c..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/orm/EclipseLinkOrmXml2_2Definition.java +++ /dev/null @@ -1,58 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010, 2011 Oracle. - * All rights reserved. This program and the accompanying materials are - * made available under the terms of the Eclipse Public License v1.0 which - * accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Oracle - initial API and implementation - *******************************************************************************/ -package org.eclipse.jpt.jpa.eclipselink.core.internal.context.orm; - -import java.util.ArrayList; -import org.eclipse.jpt.common.core.JptResourceType; -import org.eclipse.jpt.common.utility.internal.CollectionTools; -import org.eclipse.jpt.jpa.core.context.orm.OrmAttributeMappingDefinition; -import org.eclipse.jpt.jpa.core.context.orm.OrmXmlContextNodeFactory; -import org.eclipse.jpt.jpa.core.context.orm.OrmXmlDefinition; -import org.eclipse.jpt.jpa.eclipselink.core.JptJpaEclipseLinkCorePlugin; - -public class EclipseLinkOrmXml2_2Definition - extends AbstractEclipseLinkOrmXmlDefinition -{ - // singleton - private static final OrmXmlDefinition INSTANCE = - new EclipseLinkOrmXml2_2Definition(); - - - /** - * Return the singleton. - */ - public static OrmXmlDefinition instance() { - return INSTANCE; - } - - - /** - * Enforce singleton usage - */ - private EclipseLinkOrmXml2_2Definition() { - super(); - } - - - @Override - protected OrmXmlContextNodeFactory buildContextNodeFactory() { - return EclipseLinkOrmXml2_1Definition.instance().getContextNodeFactory(); - } - - public JptResourceType getResourceType() { - return JptJpaEclipseLinkCorePlugin.ECLIPSELINK_ORM_XML_2_2_RESOURCE_TYPE; - } - - @Override - protected void addAttributeMappingDefinitionsTo(ArrayList<OrmAttributeMappingDefinition> definitions) { - CollectionTools.addAll(definitions, EclipseLinkOrmXml2_0Definition.ECLIPSELINK_2_0_ATTRIBUTE_MAPPING_DEFINITIONS); - } -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/orm/EclipseLinkOrmXml2_3ContextNodeFactory.java b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/orm/EclipseLinkOrmXml2_3ContextNodeFactory.java deleted file mode 100644 index 85bbeb4b4e..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/orm/EclipseLinkOrmXml2_3ContextNodeFactory.java +++ /dev/null @@ -1,28 +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, 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.eclipselink.core.internal.context.orm; - -import org.eclipse.jpt.jpa.core.context.orm.OrmPersistentAttribute; -import org.eclipse.jpt.jpa.eclipselink.core.resource.orm.XmlArray; -import org.eclipse.jpt.jpa.eclipselink.core.resource.orm.XmlStructure; - -public class EclipseLinkOrmXml2_3ContextNodeFactory - extends EclipseLinkOrmXml2_0ContextNodeFactory -{ - - public OrmEclipseLinkArrayMapping2_3 buildOrmEclipseLinkArrayMapping(OrmPersistentAttribute parent, XmlArray resourceMapping) { - return new OrmEclipseLinkArrayMapping2_3(parent, resourceMapping); - } - - public OrmEclipseLinkStructureMapping2_3 buildOrmEclipseLinkStructureMapping(OrmPersistentAttribute parent, XmlStructure resourceMapping) { - return new OrmEclipseLinkStructureMapping2_3(parent, resourceMapping); - } - -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/orm/EclipseLinkOrmXml2_3Definition.java b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/orm/EclipseLinkOrmXml2_3Definition.java deleted file mode 100644 index 1b86429d5a..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/orm/EclipseLinkOrmXml2_3Definition.java +++ /dev/null @@ -1,94 +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, 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.eclipselink.core.internal.context.orm; - -import java.util.ArrayList; -import org.eclipse.jpt.common.core.JptResourceType; -import org.eclipse.jpt.common.utility.internal.CollectionTools; -import org.eclipse.jpt.jpa.core.context.orm.NullOrmAttributeMappingDefinition; -import org.eclipse.jpt.jpa.core.context.orm.OrmAttributeMappingDefinition; -import org.eclipse.jpt.jpa.core.context.orm.OrmXmlContextNodeFactory; -import org.eclipse.jpt.jpa.core.context.orm.OrmXmlDefinition; -import org.eclipse.jpt.jpa.core.internal.context.orm.OrmBasicMappingDefinition; -import org.eclipse.jpt.jpa.core.internal.context.orm.OrmEmbeddedIdMappingDefinition; -import org.eclipse.jpt.jpa.core.internal.context.orm.OrmEmbeddedMappingDefinition; -import org.eclipse.jpt.jpa.core.internal.context.orm.OrmIdMappingDefinition; -import org.eclipse.jpt.jpa.core.internal.context.orm.OrmManyToManyMappingDefinition; -import org.eclipse.jpt.jpa.core.internal.context.orm.OrmManyToOneMappingDefinition; -import org.eclipse.jpt.jpa.core.internal.context.orm.OrmOneToManyMappingDefinition; -import org.eclipse.jpt.jpa.core.internal.context.orm.OrmOneToOneMappingDefinition; -import org.eclipse.jpt.jpa.core.internal.context.orm.OrmTransientMappingDefinition; -import org.eclipse.jpt.jpa.core.internal.context.orm.OrmVersionMappingDefinition; -import org.eclipse.jpt.jpa.core.internal.jpa2.context.orm.OrmElementCollectionMapping2_0Definition; -import org.eclipse.jpt.jpa.eclipselink.core.JptJpaEclipseLinkCorePlugin; - - -public class EclipseLinkOrmXml2_3Definition - extends AbstractEclipseLinkOrmXmlDefinition { - - // singleton - private static final OrmXmlDefinition INSTANCE = new EclipseLinkOrmXml2_3Definition(); - - - /** - * Return the singleton. - */ - public static OrmXmlDefinition instance() { - return INSTANCE; - } - - - /** - * Enforce singleton usage - */ - private EclipseLinkOrmXml2_3Definition() { - super(); - } - - - public JptResourceType getResourceType() { - return JptJpaEclipseLinkCorePlugin.ECLIPSELINK_ORM_XML_2_3_RESOURCE_TYPE; - } - - @Override - protected OrmXmlContextNodeFactory buildContextNodeFactory() { - return new EclipseLinkOrmXml2_3ContextNodeFactory(); - } - - @Override - protected void addAttributeMappingDefinitionsTo(ArrayList<OrmAttributeMappingDefinition> definitions) { - CollectionTools.addAll(definitions, ECLIPSELINK_2_3_ATTRIBUTE_MAPPING_DEFINITIONS); - } - - /** - * Order should not matter here; but we'll use the same order as for Java. - * @see EclipseLink2_3JpaPlatformProvider - */ - protected static final OrmAttributeMappingDefinition[] ECLIPSELINK_2_3_ATTRIBUTE_MAPPING_DEFINITIONS = new OrmAttributeMappingDefinition[] { - OrmTransientMappingDefinition.instance(), - OrmEclipseLinkBasicCollectionMappingDefinition.instance(), - OrmEclipseLinkBasicMapMappingDefinition.instance(), - OrmEclipseLinkArrayMapping2_3Definition.instance(), - OrmElementCollectionMapping2_0Definition.instance(), - OrmIdMappingDefinition.instance(), - OrmVersionMappingDefinition.instance(), - OrmBasicMappingDefinition.instance(), - OrmEclipseLinkStructureMapping2_3Definition.instance(), - OrmEmbeddedMappingDefinition.instance(), - OrmEmbeddedIdMappingDefinition.instance(), - OrmEclipseLinkTransformationMappingDefinition.instance(), - OrmManyToManyMappingDefinition.instance(), - OrmManyToOneMappingDefinition.instance(), - OrmOneToManyMappingDefinition.instance(), - OrmOneToOneMappingDefinition.instance(), - OrmEclipseLinkVariableOneToOneMappingDefinition.instance(), - NullOrmAttributeMappingDefinition.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/context/orm/EclipseLinkOrmXml2_4Definition.java b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/orm/EclipseLinkOrmXml2_4Definition.java deleted file mode 100644 index c686fb0b55..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/orm/EclipseLinkOrmXml2_4Definition.java +++ /dev/null @@ -1,58 +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, 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.eclipselink.core.internal.context.orm; - -import java.util.ArrayList; -import org.eclipse.jpt.common.core.JptResourceType; -import org.eclipse.jpt.common.utility.internal.CollectionTools; -import org.eclipse.jpt.jpa.core.context.orm.OrmAttributeMappingDefinition; -import org.eclipse.jpt.jpa.core.context.orm.OrmXmlContextNodeFactory; -import org.eclipse.jpt.jpa.core.context.orm.OrmXmlDefinition; -import org.eclipse.jpt.jpa.eclipselink.core.JptJpaEclipseLinkCorePlugin; - - -public class EclipseLinkOrmXml2_4Definition - extends AbstractEclipseLinkOrmXmlDefinition { - - // singleton - private static final OrmXmlDefinition INSTANCE = new EclipseLinkOrmXml2_4Definition(); - - - /** - * Return the singleton. - */ - public static OrmXmlDefinition instance() { - return INSTANCE; - } - - - /** - * Enforce singleton usage - */ - private EclipseLinkOrmXml2_4Definition() { - super(); - } - - - public JptResourceType getResourceType() { - return JptJpaEclipseLinkCorePlugin.ECLIPSELINK_ORM_XML_2_4_RESOURCE_TYPE; - } - - @Override - protected OrmXmlContextNodeFactory buildContextNodeFactory() { - return EclipseLinkOrmXml2_3Definition.instance().getContextNodeFactory(); - } - - @Override - protected void addAttributeMappingDefinitionsTo(ArrayList<OrmAttributeMappingDefinition> definitions) { - CollectionTools.addAll(definitions, EclipseLinkOrmXml2_3Definition.ECLIPSELINK_2_3_ATTRIBUTE_MAPPING_DEFINITIONS); - } - -}
\ 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/context/orm/EclipseLinkOrmXmlContextNodeFactory.java b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/orm/EclipseLinkOrmXmlContextNodeFactory.java deleted file mode 100644 index 745ef833a8..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/orm/EclipseLinkOrmXmlContextNodeFactory.java +++ /dev/null @@ -1,157 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2009, 2012 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.eclipselink.core.internal.context.orm; - -import org.eclipse.jpt.jpa.core.context.orm.EntityMappings; -import org.eclipse.jpt.jpa.core.context.orm.OrmBasicMapping; -import org.eclipse.jpt.jpa.core.context.orm.OrmEmbeddable; -import org.eclipse.jpt.jpa.core.context.orm.OrmEmbeddedIdMapping; -import org.eclipse.jpt.jpa.core.context.orm.OrmEmbeddedMapping; -import org.eclipse.jpt.jpa.core.context.orm.OrmEntity; -import org.eclipse.jpt.jpa.core.context.orm.OrmIdMapping; -import org.eclipse.jpt.jpa.core.context.orm.OrmManyToManyMapping; -import org.eclipse.jpt.jpa.core.context.orm.OrmManyToOneMapping; -import org.eclipse.jpt.jpa.core.context.orm.OrmMappedSuperclass; -import org.eclipse.jpt.jpa.core.context.orm.OrmOneToManyMapping; -import org.eclipse.jpt.jpa.core.context.orm.OrmOneToOneMapping; -import org.eclipse.jpt.jpa.core.context.orm.OrmPersistenceUnitDefaults; -import org.eclipse.jpt.jpa.core.context.orm.OrmPersistenceUnitMetadata; -import org.eclipse.jpt.jpa.core.context.orm.OrmPersistentAttribute; -import org.eclipse.jpt.jpa.core.context.orm.OrmPersistentType; -import org.eclipse.jpt.jpa.core.context.orm.OrmVersionMapping; -import org.eclipse.jpt.jpa.core.context.orm.OrmXml; -import org.eclipse.jpt.jpa.core.internal.context.orm.AbstractOrmXmlContextNodeFactory; -import org.eclipse.jpt.jpa.eclipselink.core.resource.orm.XmlAttributeMapping; -import org.eclipse.jpt.jpa.eclipselink.core.resource.orm.XmlBasic; -import org.eclipse.jpt.jpa.eclipselink.core.resource.orm.XmlBasicCollection; -import org.eclipse.jpt.jpa.eclipselink.core.resource.orm.XmlBasicMap; -import org.eclipse.jpt.jpa.eclipselink.core.resource.orm.XmlEmbeddable; -import org.eclipse.jpt.jpa.eclipselink.core.resource.orm.XmlEmbedded; -import org.eclipse.jpt.jpa.eclipselink.core.resource.orm.XmlEmbeddedId; -import org.eclipse.jpt.jpa.eclipselink.core.resource.orm.XmlEntity; -import org.eclipse.jpt.jpa.eclipselink.core.resource.orm.XmlEntityMappings; -import org.eclipse.jpt.jpa.eclipselink.core.resource.orm.XmlId; -import org.eclipse.jpt.jpa.eclipselink.core.resource.orm.XmlManyToMany; -import org.eclipse.jpt.jpa.eclipselink.core.resource.orm.XmlManyToOne; -import org.eclipse.jpt.jpa.eclipselink.core.resource.orm.XmlMappedSuperclass; -import org.eclipse.jpt.jpa.eclipselink.core.resource.orm.XmlOneToMany; -import org.eclipse.jpt.jpa.eclipselink.core.resource.orm.XmlOneToOne; -import org.eclipse.jpt.jpa.eclipselink.core.resource.orm.XmlTransformation; -import org.eclipse.jpt.jpa.eclipselink.core.resource.orm.XmlTypeMapping; -import org.eclipse.jpt.jpa.eclipselink.core.resource.orm.XmlVariableOneToOne; -import org.eclipse.jpt.jpa.eclipselink.core.resource.orm.XmlVersion; - -public class EclipseLinkOrmXmlContextNodeFactory - extends AbstractOrmXmlContextNodeFactory -{ - - // ********** EclipseLink-specific ORM Context Model ********** - - @Override - public EntityMappings buildEntityMappings(OrmXml parent, org.eclipse.jpt.jpa.core.resource.orm.XmlEntityMappings xmlEntityMappings) { - return new EclipseLinkEntityMappingsImpl(parent, (XmlEntityMappings) xmlEntityMappings); - } - - @Override - public OrmPersistentAttribute buildOrmPersistentAttribute(OrmPersistentType parent, org.eclipse.jpt.jpa.core.resource.orm.XmlAttributeMapping resourceMapping) { - return new OrmEclipseLinkPersistentAttribute(parent, (XmlAttributeMapping) resourceMapping); - } - - @Override - public OrmPersistentType buildOrmPersistentType(EntityMappings parent, org.eclipse.jpt.jpa.core.resource.orm.XmlTypeMapping resourceMapping) { - return new EclipseLinkOrmPersistentTypeImpl(parent, (XmlTypeMapping) resourceMapping); - } - - @Override - public OrmEmbeddable buildOrmEmbeddable(OrmPersistentType type, org.eclipse.jpt.jpa.core.resource.orm.XmlEmbeddable resourceMapping) { - return new OrmEclipseLinkEmbeddableImpl(type, (XmlEmbeddable) resourceMapping); - } - - @Override - public OrmEntity buildOrmEntity(OrmPersistentType type, org.eclipse.jpt.jpa.core.resource.orm.XmlEntity resourceMapping) { - return new OrmEclipseLinkEntityImpl(type, (XmlEntity) resourceMapping); - } - - @Override - public OrmMappedSuperclass buildOrmMappedSuperclass(OrmPersistentType type, org.eclipse.jpt.jpa.core.resource.orm.XmlMappedSuperclass resourceMapping) { - return new OrmEclipseLinkMappedSuperclassImpl(type, (XmlMappedSuperclass) resourceMapping); - } - - @Override - public OrmBasicMapping buildOrmBasicMapping(OrmPersistentAttribute parent, org.eclipse.jpt.jpa.core.resource.orm.XmlBasic resourceMapping) { - return new OrmEclipseLinkBasicMapping(parent, (XmlBasic) resourceMapping); - } - - @Override - public OrmIdMapping buildOrmIdMapping(OrmPersistentAttribute parent, org.eclipse.jpt.jpa.core.resource.orm.XmlId resourceMapping) { - return new OrmEclipseLinkIdMapping(parent, (XmlId) resourceMapping); - } - - @Override - public OrmEmbeddedMapping buildOrmEmbeddedMapping(OrmPersistentAttribute parent, org.eclipse.jpt.jpa.core.resource.orm.XmlEmbedded resourceMapping) { - return new OrmEclipseLinkEmbeddedMapping(parent, (XmlEmbedded) resourceMapping); - } - - @Override - public OrmEmbeddedIdMapping buildOrmEmbeddedIdMapping(OrmPersistentAttribute parent, org.eclipse.jpt.jpa.core.resource.orm.XmlEmbeddedId resourceMapping) { - return new OrmEclipseLinkEmbeddedIdMapping(parent, (XmlEmbeddedId) resourceMapping); - } - - @Override - public OrmManyToManyMapping buildOrmManyToManyMapping(OrmPersistentAttribute parent, org.eclipse.jpt.jpa.core.resource.orm.XmlManyToMany resourceMapping) { - return new OrmEclipseLinkManyToManyMapping(parent, (XmlManyToMany) resourceMapping); - } - - @Override - public OrmManyToOneMapping buildOrmManyToOneMapping(OrmPersistentAttribute parent, org.eclipse.jpt.jpa.core.resource.orm.XmlManyToOne resourceMapping) { - return new OrmEclipseLinkManyToOneMapping(parent, (XmlManyToOne) resourceMapping); - } - - @Override - public OrmOneToManyMapping buildOrmOneToManyMapping(OrmPersistentAttribute parent, org.eclipse.jpt.jpa.core.resource.orm.XmlOneToMany resourceMapping) { - return new OrmEclipseLinkOneToManyMapping(parent, (XmlOneToMany) resourceMapping); - } - - @Override - public OrmOneToOneMapping buildOrmOneToOneMapping(OrmPersistentAttribute parent, org.eclipse.jpt.jpa.core.resource.orm.XmlOneToOne resourceMapping) { - return new OrmEclipseLinkOneToOneMapping(parent, (XmlOneToOne) resourceMapping); - } - - @Override - public OrmVersionMapping buildOrmVersionMapping(OrmPersistentAttribute parent, org.eclipse.jpt.jpa.core.resource.orm.XmlVersion resourceMapping) { - return new OrmEclipseLinkVersionMapping(parent, (XmlVersion) resourceMapping); - } - - public AbstractOrmEclipseLinkBasicCollectionMapping buildOrmEclipseLinkBasicCollectionMapping(OrmPersistentAttribute parent, XmlBasicCollection resourceMapping) { - return new OrmEclipseLinkBasicCollectionMapping(parent, resourceMapping); - } - - public AbstractOrmEclipseLinkBasicMapMapping buildOrmEclipseLinkBasicMapMapping(OrmPersistentAttribute parent, XmlBasicMap resourceMapping) { - return new OrmEclipseLinkBasicMapMapping(parent, resourceMapping); - } - - public OrmEclipseLinkTransformationMapping buildOrmEclipseLinkTransformationMapping(OrmPersistentAttribute parent, XmlTransformation resourceMapping) { - return new OrmEclipseLinkTransformationMapping(parent, resourceMapping); - } - - public OrmEclipseLinkVariableOneToOneMapping buildOrmEclipseLinkVariableOneToOneMapping(OrmPersistentAttribute parent, XmlVariableOneToOne resourceMapping) { - return new OrmEclipseLinkVariableOneToOneMapping(parent, resourceMapping); - } - - @Override - public OrmPersistenceUnitDefaults buildOrmPersistenceUnitDefaults(OrmPersistenceUnitMetadata parent) { - return new OrmEclipseLinkPersistenceUnitDefaults(parent); - } - - @Override - public OrmPersistenceUnitMetadata buildOrmPersistenceUnitMetadata(EntityMappings parent) { - return new OrmEclipseLinkPersistenceUnitMetadata(parent); - } -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/orm/EclipseLinkOrmXmlDefinition.java b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/orm/EclipseLinkOrmXmlDefinition.java deleted file mode 100644 index 751e36ce08..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/orm/EclipseLinkOrmXmlDefinition.java +++ /dev/null @@ -1,88 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2008, 2011 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.eclipselink.core.internal.context.orm; - -import java.util.ArrayList; -import org.eclipse.jpt.common.core.JptResourceType; -import org.eclipse.jpt.common.utility.internal.CollectionTools; -import org.eclipse.jpt.jpa.core.context.orm.NullOrmAttributeMappingDefinition; -import org.eclipse.jpt.jpa.core.context.orm.OrmAttributeMappingDefinition; -import org.eclipse.jpt.jpa.core.context.orm.OrmXmlContextNodeFactory; -import org.eclipse.jpt.jpa.core.context.orm.OrmXmlDefinition; -import org.eclipse.jpt.jpa.core.internal.context.orm.OrmBasicMappingDefinition; -import org.eclipse.jpt.jpa.core.internal.context.orm.OrmEmbeddedIdMappingDefinition; -import org.eclipse.jpt.jpa.core.internal.context.orm.OrmEmbeddedMappingDefinition; -import org.eclipse.jpt.jpa.core.internal.context.orm.OrmIdMappingDefinition; -import org.eclipse.jpt.jpa.core.internal.context.orm.OrmManyToManyMappingDefinition; -import org.eclipse.jpt.jpa.core.internal.context.orm.OrmManyToOneMappingDefinition; -import org.eclipse.jpt.jpa.core.internal.context.orm.OrmOneToManyMappingDefinition; -import org.eclipse.jpt.jpa.core.internal.context.orm.OrmOneToOneMappingDefinition; -import org.eclipse.jpt.jpa.core.internal.context.orm.OrmTransientMappingDefinition; -import org.eclipse.jpt.jpa.core.internal.context.orm.OrmVersionMappingDefinition; -import org.eclipse.jpt.jpa.eclipselink.core.JptJpaEclipseLinkCorePlugin; -import org.eclipse.jpt.jpa.eclipselink.core.internal.EclipseLinkJpaPlatformProvider; - -public class EclipseLinkOrmXmlDefinition - extends AbstractEclipseLinkOrmXmlDefinition -{ - // singleton - private static final OrmXmlDefinition INSTANCE = new EclipseLinkOrmXmlDefinition(); - - /** - * Return the singleton. - */ - public static OrmXmlDefinition instance() { - return INSTANCE; - } - - - /** - * Ensure single instance. - */ - private EclipseLinkOrmXmlDefinition() { - super(); - } - - public JptResourceType getResourceType() { - return JptJpaEclipseLinkCorePlugin.ECLIPSELINK_ORM_XML_1_0_RESOURCE_TYPE; - } - - @Override - protected OrmXmlContextNodeFactory buildContextNodeFactory() { - return new EclipseLinkOrmXmlContextNodeFactory(); - } - - @Override - protected void addAttributeMappingDefinitionsTo(ArrayList<OrmAttributeMappingDefinition> definitions) { - CollectionTools.addAll(definitions, ECLIPSELINK_ATTRIBUTE_MAPPING_DEFINITIONS); - } - - /** - * Order should not matter here; but we'll use the same order as for Java. - * @see EclipseLinkJpaPlatformProvider - */ - protected static final OrmAttributeMappingDefinition[] ECLIPSELINK_ATTRIBUTE_MAPPING_DEFINITIONS = new OrmAttributeMappingDefinition[] { - OrmTransientMappingDefinition.instance(), - OrmEclipseLinkBasicCollectionMappingDefinition.instance(), - OrmEclipseLinkBasicMapMappingDefinition.instance(), - OrmIdMappingDefinition.instance(), - OrmVersionMappingDefinition.instance(), - OrmBasicMappingDefinition.instance(), - OrmEmbeddedMappingDefinition.instance(), - OrmEmbeddedIdMappingDefinition.instance(), - OrmEclipseLinkTransformationMappingDefinition.instance(), - OrmManyToManyMappingDefinition.instance(), - OrmManyToOneMappingDefinition.instance(), - OrmOneToManyMappingDefinition.instance(), - OrmOneToOneMappingDefinition.instance(), - OrmEclipseLinkVariableOneToOneMappingDefinition.instance(), - NullOrmAttributeMappingDefinition.instance() - }; -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/orm/GenericOrmVirtualTenantDiscriminatorColumn2_3.java b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/orm/GenericOrmVirtualTenantDiscriminatorColumn2_3.java deleted file mode 100644 index aceef294b9..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/orm/GenericOrmVirtualTenantDiscriminatorColumn2_3.java +++ /dev/null @@ -1,196 +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, 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.eclipselink.core.internal.context.orm; - -import org.eclipse.jpt.common.core.utility.TextRange; -import org.eclipse.jpt.jpa.core.context.XmlContextNode; -import org.eclipse.jpt.jpa.core.internal.context.NamedColumnTextRangeResolver; -import org.eclipse.jpt.jpa.core.internal.context.orm.AbstractOrmVirtualNamedDiscriminatorColumn; -import org.eclipse.jpt.jpa.core.internal.context.orm.OrmTableColumnTextRangeResolver; -import org.eclipse.jpt.jpa.eclipselink.core.context.ReadOnlyTenantDiscriminatorColumn2_3; -import org.eclipse.jpt.jpa.eclipselink.core.context.orm.OrmReadOnlyTenantDiscriminatorColumn2_3; -import org.eclipse.jpt.jpa.eclipselink.core.context.orm.OrmVirtualTenantDiscriminatorColumn2_3; - -/** - * <code>orm.xml</code> virtual tenant discriminator column - */ -public class GenericOrmVirtualTenantDiscriminatorColumn2_3 - extends AbstractOrmVirtualNamedDiscriminatorColumn<OrmReadOnlyTenantDiscriminatorColumn2_3.Owner, ReadOnlyTenantDiscriminatorColumn2_3> - implements OrmVirtualTenantDiscriminatorColumn2_3 -{ - protected final ReadOnlyTenantDiscriminatorColumn2_3 overriddenColumn; - - protected String specifiedTable; - protected String defaultTable; - - protected String specifiedContextProperty; - protected String defaultContextProperty; - - protected Boolean specifiedPrimaryKey; - protected boolean defaultPrimaryKey; - - - public GenericOrmVirtualTenantDiscriminatorColumn2_3(XmlContextNode parent, OrmReadOnlyTenantDiscriminatorColumn2_3.Owner owner, ReadOnlyTenantDiscriminatorColumn2_3 overridenColumn) { - super(parent, owner); - this.overriddenColumn = overridenColumn; - } - - - // ********** synchronize/update ********** - - @Override - public void update() { - super.update(); - - this.setSpecifiedTable(this.buildSpecifiedTable()); - this.setDefaultTable(this.buildDefaultTable()); - - this.setSpecifiedContextProperty(this.buildSpecifiedContextProperty()); - this.setDefaultContextProperty(this.buildDefaultContextProperty()); - - this.setSpecifiedPrimaryKey(this.buildSpecifiedPrimaryKey()); - this.setDefaultPrimaryKey(this.buildDefaultPrimaryKey()); - } - - - // ********** column ********** - - @Override - public ReadOnlyTenantDiscriminatorColumn2_3 getOverriddenColumn() { - return this.overriddenColumn; - } - - - // ********** table ********** - - public String getTable() { - return (this.specifiedTable != null) ? this.specifiedTable : this.defaultTable; - } - - public String getSpecifiedTable() { - return this.specifiedTable; - } - - protected void setSpecifiedTable(String table) { - String old = this.specifiedTable; - this.specifiedTable = table; - this.firePropertyChanged(SPECIFIED_TABLE_PROPERTY, old, table); - } - - protected String buildSpecifiedTable() { - return this.getOverriddenColumn().getSpecifiedTable(); - } - - public String getDefaultTable() { - return this.defaultTable; - } - - protected void setDefaultTable(String table) { - String old = this.defaultTable; - this.defaultTable = table; - this.firePropertyChanged(DEFAULT_TABLE_PROPERTY, old, table); - } - - protected String buildDefaultTable() { - return this.owner.getDefaultTableName(); - } - - // ********** context property ********** - - public String getContextProperty() { - return (this.specifiedContextProperty != null) ? this.specifiedContextProperty : this.defaultContextProperty; - } - - public String getSpecifiedContextProperty() { - return this.specifiedContextProperty; - } - - protected void setSpecifiedContextProperty(String contextProperty) { - String old = this.specifiedContextProperty; - this.specifiedContextProperty = contextProperty; - this.firePropertyChanged(SPECIFIED_CONTEXT_PROPERTY_PROPERTY, old, contextProperty); - } - - protected String buildSpecifiedContextProperty() { - return this.getOverriddenColumn().getSpecifiedContextProperty(); - } - - public String getDefaultContextProperty() { - return this.defaultContextProperty; - } - - protected void setDefaultContextProperty(String contextProperty) { - String old = this.defaultContextProperty; - this.defaultContextProperty = contextProperty; - this.firePropertyChanged(DEFAULT_CONTEXT_PROPERTY_PROPERTY, old, contextProperty); - } - - protected String buildDefaultContextProperty() { - return this.owner.getDefaultContextPropertyName(); - } - - - // ********** primary key ********** - - public boolean isPrimaryKey() { - return (this.specifiedPrimaryKey != null) ? this.specifiedPrimaryKey.booleanValue() : this.defaultPrimaryKey; - } - - public Boolean getSpecifiedPrimaryKey() { - return this.specifiedPrimaryKey; - } - - protected void setSpecifiedPrimaryKey(Boolean primaryKey) { - Boolean old = this.specifiedPrimaryKey; - this.specifiedPrimaryKey = primaryKey; - this.firePropertyChanged(SPECIFIED_PRIMARY_KEY_PROPERTY, old, primaryKey); - } - - protected Boolean buildSpecifiedPrimaryKey() { - return this.getOverriddenColumn().getSpecifiedPrimaryKey(); - } - - public boolean isDefaultPrimaryKey() { - return this.defaultPrimaryKey; - } - - protected void setDefaultPrimaryKey(boolean primaryKey) { - boolean old = this.defaultPrimaryKey; - this.defaultPrimaryKey = primaryKey; - this.firePropertyChanged(DEFAULT_PRIMARY_KEY_PROPERTY, old, primaryKey); - } - - protected boolean buildDefaultPrimaryKey() { - return this.owner.getDefaultPrimaryKey(); - } - - - // ********** misc ********** - - public boolean tableNameIsInvalid() { - return this.owner.tableNameIsInvalid(this.getTable()); - } - - public Iterable<String> getCandidateTableNames() { - return this.owner.getCandidateTableNames(); - } - - - // ********** validation ********** - - public TextRange getTableTextRange() { - return this.getValidationTextRange(); - } - - @Override - protected NamedColumnTextRangeResolver buildTextRangeResolver() { - return new OrmTableColumnTextRangeResolver(this); - } -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/orm/NullOrmEclipseLinkMultitenancy2_3.java b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/orm/NullOrmEclipseLinkMultitenancy2_3.java deleted file mode 100644 index c4aeb14826..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/orm/NullOrmEclipseLinkMultitenancy2_3.java +++ /dev/null @@ -1,153 +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, 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.eclipselink.core.internal.context.orm; - -import org.eclipse.jpt.common.core.utility.TextRange; -import org.eclipse.jpt.common.utility.internal.iterables.EmptyListIterable; -import org.eclipse.jpt.common.utility.internal.iterables.ListIterable; -import org.eclipse.jpt.jpa.core.internal.context.orm.AbstractOrmXmlContextNode; -import org.eclipse.jpt.jpa.eclipselink.core.context.EclipseLinkMultitenantType2_3; -import org.eclipse.jpt.jpa.eclipselink.core.context.TenantDiscriminatorColumn2_3; -import org.eclipse.jpt.jpa.eclipselink.core.context.orm.OrmEclipseLinkMultitenancy2_3; -import org.eclipse.jpt.jpa.eclipselink.core.context.orm.OrmEclipseLinkNonEmbeddableTypeMapping; -import org.eclipse.jpt.jpa.eclipselink.core.context.orm.OrmReadOnlyTenantDiscriminatorColumn2_3; -import org.eclipse.jpt.jpa.eclipselink.core.context.orm.OrmTenantDiscriminatorColumn2_3; -import org.eclipse.jpt.jpa.eclipselink.core.context.orm.OrmVirtualTenantDiscriminatorColumn2_3; - -public class NullOrmEclipseLinkMultitenancy2_3 - extends AbstractOrmXmlContextNode - implements OrmEclipseLinkMultitenancy2_3 -{ - - public NullOrmEclipseLinkMultitenancy2_3(OrmEclipseLinkNonEmbeddableTypeMapping parent) { - super(parent); - } - - - // ********** multitenant ********** - - public boolean isMultitenant() { - return false; - } - - public boolean isDefaultMultitenant() { - return false; - } - - public boolean isSpecifiedMultitenant() { - return false; - } - - public void setSpecifiedMultitenant(boolean isMultitenant) { - throw new UnsupportedOperationException("Multitenancy is only supported in EclipseLink version 2.3 and higher"); //$NON-NLS-1$ - } - - - // ********** type ********** - - public EclipseLinkMultitenantType2_3 getType() { - return null; - } - - public EclipseLinkMultitenantType2_3 getSpecifiedType() { - return null; - } - - public void setSpecifiedType(EclipseLinkMultitenantType2_3 type) { - throw new UnsupportedOperationException("Multitenancy is only supported in EclipseLink version 2.3 and higher"); //$NON-NLS-1$ - } - - public EclipseLinkMultitenantType2_3 getDefaultType() { - return null; - } - - - // ********** include criteria ********** - - public boolean isIncludeCriteria() { - return false; - } - - public Boolean getSpecifiedIncludeCriteria() { - return null; - } - - public void setSpecifiedIncludeCriteria(Boolean includeCriteria) { - throw new UnsupportedOperationException("Multitenancy is only supported in EclipseLink version 2.3 and higher"); //$NON-NLS-1$ - } - - public boolean isDefaultIncludeCriteria() { - return false; - } - - - - // ********** tenant discriminator columns ********** - - public ListIterable<OrmReadOnlyTenantDiscriminatorColumn2_3> getTenantDiscriminatorColumns() { - return EmptyListIterable.instance(); - } - - public int getTenantDiscriminatorColumnsSize() { - return 0; - } - - public ListIterable<OrmTenantDiscriminatorColumn2_3> getSpecifiedTenantDiscriminatorColumns() { - return EmptyListIterable.instance(); - } - - public int getSpecifiedTenantDiscriminatorColumnsSize() { - return 0; - } - - public boolean hasSpecifiedTenantDiscriminatorColumns() { - return false; - } - - public OrmTenantDiscriminatorColumn2_3 addSpecifiedTenantDiscriminatorColumn() { - throw new UnsupportedOperationException("Multitenancy is only supported in EclipseLink version 2.3 and higher"); //$NON-NLS-1$ - } - - public OrmTenantDiscriminatorColumn2_3 addSpecifiedTenantDiscriminatorColumn(int index) { - throw new UnsupportedOperationException("Multitenancy is only supported in EclipseLink version 2.3 and higher"); //$NON-NLS-1$ - } - - public void removeSpecifiedTenantDiscriminatorColumn(TenantDiscriminatorColumn2_3 tenantDiscriminatorColumn) { - throw new UnsupportedOperationException("Multitenancy is only supported in EclipseLink version 2.3 and higher"); //$NON-NLS-1$ - } - - public void removeSpecifiedTenantDiscriminatorColumn(int index) { - throw new UnsupportedOperationException("Multitenancy is only supported in EclipseLink version 2.3 and higher"); //$NON-NLS-1$ - } - - public void moveSpecifiedTenantDiscriminatorColumn(int targetIndex, int sourceIndex) { - throw new UnsupportedOperationException("Multitenancy is only supported in EclipseLink version 2.3 and higher"); //$NON-NLS-1$ - } - - public TextRange getValidationTextRange() { - throw new UnsupportedOperationException("Multitenancy is only supported in EclipseLink version 2.3 and higher"); //$NON-NLS-1$ - } - - public ListIterable<OrmVirtualTenantDiscriminatorColumn2_3> getDefaultTenantDiscriminatorColumns() { - return EmptyListIterable.instance(); - } - - public int getDefaultTenantDiscriminatorColumnsSize() { - return 0; - } - - public boolean specifiedTenantDiscriminatorColumnsAllowed() { - return false; - } - - public boolean usesPrimaryKeyTenantDiscriminatorColumns() { - return false; - } -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/orm/OrmEclipseLinkArrayMapping2_3.java b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/orm/OrmEclipseLinkArrayMapping2_3.java deleted file mode 100644 index fcfe9537db..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/orm/OrmEclipseLinkArrayMapping2_3.java +++ /dev/null @@ -1,369 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2011, 2012 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.eclipselink.core.internal.context.orm; - -import java.util.List; -import org.eclipse.jdt.core.IPackageFragment; -import org.eclipse.jdt.core.IType; -import org.eclipse.jpt.common.utility.internal.iterables.ArrayIterable; -import org.eclipse.jpt.common.utility.internal.iterables.CompositeIterable; -import org.eclipse.jpt.jpa.core.context.Converter; -import org.eclipse.jpt.jpa.core.context.ReadOnlyBaseColumn; -import org.eclipse.jpt.jpa.core.context.ReadOnlyNamedColumn; -import org.eclipse.jpt.jpa.core.context.orm.OrmAttributeMapping; -import org.eclipse.jpt.jpa.core.context.orm.OrmColumn; -import org.eclipse.jpt.jpa.core.context.orm.OrmColumnMapping; -import org.eclipse.jpt.jpa.core.context.orm.OrmConverter; -import org.eclipse.jpt.jpa.core.context.orm.OrmEnumeratedConverter; -import org.eclipse.jpt.jpa.core.context.orm.OrmLobConverter; -import org.eclipse.jpt.jpa.core.context.orm.OrmPersistentAttribute; -import org.eclipse.jpt.jpa.core.context.orm.OrmTemporalConverter; -import org.eclipse.jpt.jpa.core.context.orm.OrmXmlContextNodeFactory; -import org.eclipse.jpt.jpa.core.internal.context.JptValidator; -import org.eclipse.jpt.jpa.core.internal.context.NamedColumnTextRangeResolver; -import org.eclipse.jpt.jpa.core.internal.context.TableColumnTextRangeResolver; -import org.eclipse.jpt.jpa.core.internal.context.orm.AbstractOrmAttributeMapping; -import org.eclipse.jpt.jpa.core.internal.jpa1.context.EntityTableDescriptionProvider; -import org.eclipse.jpt.jpa.core.internal.jpa1.context.NamedColumnValidator; -import org.eclipse.jpt.jpa.core.internal.jpa1.context.orm.NullOrmConverter; -import org.eclipse.jpt.jpa.core.resource.orm.Attributes; -import org.eclipse.jpt.jpa.core.resource.orm.OrmFactory; -import org.eclipse.jpt.jpa.core.resource.orm.XmlColumn; -import org.eclipse.jpt.jpa.db.Table; -import org.eclipse.jpt.jpa.eclipselink.core.EclipseLinkMappingKeys; -import org.eclipse.jpt.jpa.eclipselink.core.context.EclipseLinkArrayMapping2_3; -import org.eclipse.jpt.jpa.eclipselink.core.context.orm.EclipseLinkOrmConvertibleMapping; -import org.eclipse.jpt.jpa.eclipselink.core.context.orm.OrmEclipseLinkConverterContainer; -import org.eclipse.jpt.jpa.eclipselink.core.resource.orm.XmlArray; -import org.eclipse.jpt.jpa.eclipselink.core.resource.orm.v2_3.XmlAttributes_2_3; -import org.eclipse.text.edits.ReplaceEdit; -import org.eclipse.wst.validation.internal.provisional.core.IMessage; -import org.eclipse.wst.validation.internal.provisional.core.IReporter; - -//TODO canonical metamodel generation, need to override getMetamodelTypeName() and use the target-class element -public class OrmEclipseLinkArrayMapping2_3 - extends AbstractOrmAttributeMapping<XmlArray> - implements - EclipseLinkArrayMapping2_3, - EclipseLinkOrmConvertibleMapping, - OrmEclipseLinkConverterContainer.Owner, - OrmColumnMapping -{ - protected final OrmColumn column; - - protected OrmConverter converter; // never null - - protected static final OrmConverter.Adapter[] CONVERTER_ADAPTER_ARRAY = new OrmConverter.Adapter[] { - OrmEnumeratedConverter.Adapter.instance(), - OrmTemporalConverter.BasicAdapter.instance(), - OrmLobConverter.Adapter.instance(), - OrmEclipseLinkConvert.Adapter.instance() - }; - protected static final Iterable<OrmConverter.Adapter> CONVERTER_ADAPTERS = new ArrayIterable<OrmConverter.Adapter>(CONVERTER_ADAPTER_ARRAY); - - protected final OrmEclipseLinkConverterContainer converterContainer; - - - public OrmEclipseLinkArrayMapping2_3(OrmPersistentAttribute parent, XmlArray xmlMapping) { - super(parent, xmlMapping); - this.column = this.buildColumn(); - this.converterContainer = this.buildConverterContainer(); - this.converter = this.buildConverter(); - } - - - // ********** synchronize/update ********** - - @Override - public void synchronizeWithResourceModel() { - super.synchronizeWithResourceModel(); - this.column.synchronizeWithResourceModel(); - this.converterContainer.synchronizeWithResourceModel(); - this.syncConverter(); - } - - @Override - public void update() { - super.update(); - this.column.update(); - this.converterContainer.update(); - this.converter.update(); - } - - - // ********** attribute type ********** - - @Override - protected String buildSpecifiedAttributeType() { - return this.xmlAttributeMapping.getAttributeType(); - } - - @Override - protected void setSpecifiedAttributeTypeInXml(String attributeType) { - this.xmlAttributeMapping.setAttributeType(attributeType); - } - - - // ********** column ********** - - public OrmColumn getColumn() { - return this.column; - } - - protected OrmColumn buildColumn() { - return this.getContextNodeFactory().buildOrmColumn(this, this); - } - - - // ********** converter ********** - - public OrmConverter getConverter() { - return this.converter; - } - - public void setConverter(Class<? extends Converter> converterType) { - if (this.converter.getType() != converterType) { - // note: we may also clear the XML value we want; - // but if we leave it, the resulting sync will screw things up... - this.clearXmlConverterValues(); - OrmConverter.Adapter converterAdapter = this.getConverterAdapter(converterType); - this.setConverter_(this.buildConverter(converterAdapter)); - this.converter.initialize(); - } - } - - protected OrmConverter buildConverter(OrmConverter.Adapter converterAdapter) { - return (converterAdapter != null) ? - converterAdapter.buildNewConverter(this, this.getContextNodeFactory()) : - this.buildNullConverter(); - } - - protected void setConverter_(OrmConverter converter) { - Converter old = this.converter; - this.converter = converter; - this.firePropertyChanged(CONVERTER_PROPERTY, old, converter); - } - - protected void clearXmlConverterValues() { - for (OrmConverter.Adapter adapter : this.getConverterAdapters()) { - adapter.clearXmlValue(this.xmlAttributeMapping); - } - } - - protected OrmConverter buildConverter() { - OrmXmlContextNodeFactory factory = this.getContextNodeFactory(); - for (OrmConverter.Adapter adapter : this.getConverterAdapters()) { - OrmConverter ormConverter = adapter.buildConverter(this, factory); - if (ormConverter != null) { - return ormConverter; - } - } - return this.buildNullConverter(); - } - - protected void syncConverter() { - OrmConverter.Adapter adapter = this.getXmlConverterAdapter(); - if (adapter == null) { - if (this.converter.getType() != null) { - this.setConverter_(this.buildNullConverter()); - } - } else { - if (this.converter.getType() == adapter.getConverterType()) { - this.converter.synchronizeWithResourceModel(); - } else { - this.setConverter_(adapter.buildNewConverter(this, this.getContextNodeFactory())); - } - } - } - - /** - * Return the first adapter whose converter value is set in the XML mapping. - * Return <code>null</code> if there are no converter values in the XML. - */ - protected OrmConverter.Adapter getXmlConverterAdapter() { - for (OrmConverter.Adapter adapter : this.getConverterAdapters()) { - if (adapter.isActive(this.xmlAttributeMapping)) { - return adapter; - } - } - return null; - } - - protected OrmConverter buildNullConverter() { - return new NullOrmConverter(this); - } - - - // ********** converter adapters ********** - - /** - * Return the converter adapter for the specified converter type. - */ - protected OrmConverter.Adapter getConverterAdapter(Class<? extends Converter> converterType) { - for (OrmConverter.Adapter adapter : this.getConverterAdapters()) { - if (adapter.getConverterType() == converterType) { - return adapter; - } - } - return null; - } - - protected Iterable<OrmConverter.Adapter> getConverterAdapters() { - return CONVERTER_ADAPTERS; - } - - // ********** converters ********** - - public OrmEclipseLinkConverterContainer getConverterContainer() { - return this.converterContainer; - } - - protected OrmEclipseLinkConverterContainer buildConverterContainer() { - return new OrmEclipseLinkConverterContainerImpl(this, this, this.xmlAttributeMapping); - } - - public int getNumberSupportedConverters() { - return 2; //TODO EclipseLink supports 2, but really should be just 1, see bug 365114 - } - - - // ********** misc ********** - - public String getKey() { - return EclipseLinkMappingKeys.ARRAY_ATTRIBUTE_MAPPING_KEY; - } - - public int getXmlSequence() { - return 110; - } - - @Override - public boolean isOverridableAttributeMapping() { - return true; - } - - public void initializeOn(OrmAttributeMapping newMapping) { - newMapping.initializeFromOrmAttributeMapping(this); - } - - @Override - protected void initializeFromOrmColumnMapping(OrmColumnMapping oldMapping) { - super.initializeFromOrmColumnMapping(oldMapping); - this.column.initializeFrom(oldMapping.getColumn()); - } - - public void addXmlAttributeMappingTo(Attributes xmlAttributes) { - ((XmlAttributes_2_3) xmlAttributes).getArrays().add(this.xmlAttributeMapping); - } - - public void removeXmlAttributeMappingFrom(Attributes xmlAttributes) { - ((XmlAttributes_2_3) xmlAttributes).getArrays().remove(this.xmlAttributeMapping); - } - - - // ********** OrmColumn.Owner implementation ********** - - public String getDefaultColumnName(ReadOnlyNamedColumn column) { - return this.name; - } - - public String getDefaultTableName() { - return this.getTypeMapping().getPrimaryTableName(); - } - - public Table resolveDbTable(String tableName) { - return this.getTypeMapping().resolveDbTable(tableName); - } - - public boolean tableNameIsInvalid(String tableName) { - return this.getTypeMapping().tableNameIsInvalid(tableName); - } - - public Iterable<String> getCandidateTableNames() { - return this.getTypeMapping().getAllAssociatedTableNames(); - } - - public XmlColumn getXmlColumn() { - return this.xmlAttributeMapping.getColumn(); - } - - public XmlColumn buildXmlColumn() { - XmlColumn xmlColumn = OrmFactory.eINSTANCE.createXmlColumn(); - this.xmlAttributeMapping.setColumn(xmlColumn); - return xmlColumn; - } - - public void removeXmlColumn() { - this.xmlAttributeMapping.setColumn(null); - } - - - //************ refactoring ************ - - @Override - @SuppressWarnings("unchecked") - public Iterable<ReplaceEdit> createMoveTypeEdits(IType originalType, IPackageFragment newPackage) { - return new CompositeIterable<ReplaceEdit>( - super.createMoveTypeEdits(originalType, newPackage), - this.converterContainer.createMoveTypeEdits(originalType, newPackage) - ); - } - - @Override - @SuppressWarnings("unchecked") - public Iterable<ReplaceEdit> createRenamePackageEdits(IPackageFragment originalPackage, String newName) { - return new CompositeIterable<ReplaceEdit>( - super.createRenamePackageEdits(originalPackage, newName), - this.converterContainer.createRenamePackageEdits(originalPackage, newName) - ); - } - - @Override - @SuppressWarnings("unchecked") - public Iterable<ReplaceEdit> createRenameTypeEdits(IType originalType, String newName) { - return new CompositeIterable<ReplaceEdit>( - super.createRenameTypeEdits(originalType, newName), - this.converterContainer.createRenameTypeEdits(originalType, newName) - ); - } - - - // ********** validation ********** - - @Override - public void validate(List<IMessage> messages, IReporter reporter) { - super.validate(messages, reporter); - this.column.validate(messages, reporter); - this.converter.validate(messages, reporter); - } - - public JptValidator buildColumnValidator(ReadOnlyNamedColumn col, NamedColumnTextRangeResolver textRangeResolver) { - return new NamedColumnValidator(this.getPersistentAttribute(), (ReadOnlyBaseColumn) col, (TableColumnTextRangeResolver) textRangeResolver, new EntityTableDescriptionProvider()); - } - - // ********** completion proposals ********** - - @Override - public Iterable<String> getXmlCompletionProposals(int pos) { - Iterable<String> result = super.getXmlCompletionProposals(pos); - if (result != null) { - return result; - } - result = this.column.getXmlCompletionProposals(pos); - if (result != null) { - return result; - } - result = this.converter.getXmlCompletionProposals(pos); - if (result != null) { - return result; - } - return null; - } -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/orm/OrmEclipseLinkArrayMapping2_3Definition.java b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/orm/OrmEclipseLinkArrayMapping2_3Definition.java deleted file mode 100644 index bdf36eddc2..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/orm/OrmEclipseLinkArrayMapping2_3Definition.java +++ /dev/null @@ -1,64 +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, 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.eclipselink.core.internal.context.orm; - -import org.eclipse.emf.ecore.EFactory; -import org.eclipse.jpt.jpa.core.context.orm.OrmAttributeMapping; -import org.eclipse.jpt.jpa.core.context.orm.OrmAttributeMappingDefinition; -import org.eclipse.jpt.jpa.core.context.orm.OrmPersistentAttribute; -import org.eclipse.jpt.jpa.core.context.orm.OrmXmlContextNodeFactory; -import org.eclipse.jpt.jpa.core.resource.orm.XmlAttributeMapping; -import org.eclipse.jpt.jpa.core.resource.xml.EmfTools; -import org.eclipse.jpt.jpa.eclipselink.core.EclipseLinkMappingKeys; -import org.eclipse.jpt.jpa.eclipselink.core.resource.orm.EclipseLinkOrmPackage; -import org.eclipse.jpt.jpa.eclipselink.core.resource.orm.XmlArray; - -public class OrmEclipseLinkArrayMapping2_3Definition - implements OrmAttributeMappingDefinition -{ - // singleton - private static final OrmEclipseLinkArrayMapping2_3Definition INSTANCE = - new OrmEclipseLinkArrayMapping2_3Definition(); - - - /** - * Return the singleton - */ - public static OrmAttributeMappingDefinition instance() { - return INSTANCE; - } - - - /** - * Enforce singleton usage - */ - private OrmEclipseLinkArrayMapping2_3Definition() { - super(); - } - - - public String getKey() { - return EclipseLinkMappingKeys.ARRAY_ATTRIBUTE_MAPPING_KEY; - } - - public XmlAttributeMapping buildResourceMapping(EFactory factory) { - return EmfTools.create( - factory, - EclipseLinkOrmPackage.eINSTANCE.getXmlArray(), - XmlArray.class); - } - - public OrmAttributeMapping buildContextMapping( - OrmPersistentAttribute parent, - XmlAttributeMapping resourceMapping, - OrmXmlContextNodeFactory factory) { - return new OrmEclipseLinkArrayMapping2_3(parent, (XmlArray) resourceMapping); - } -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/orm/OrmEclipseLinkBasicCollectionMapping.java b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/orm/OrmEclipseLinkBasicCollectionMapping.java deleted file mode 100644 index c12804c92d..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/orm/OrmEclipseLinkBasicCollectionMapping.java +++ /dev/null @@ -1,21 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2008, 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.eclipselink.core.internal.context.orm; - -import org.eclipse.jpt.jpa.core.context.orm.OrmPersistentAttribute; -import org.eclipse.jpt.jpa.eclipselink.core.resource.orm.XmlBasicCollection; - -public class OrmEclipseLinkBasicCollectionMapping - extends AbstractOrmEclipseLinkBasicCollectionMapping -{ - public OrmEclipseLinkBasicCollectionMapping(OrmPersistentAttribute parent, XmlBasicCollection xmlMapping) { - super(parent, xmlMapping); - } -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/orm/OrmEclipseLinkBasicCollectionMapping2_1.java b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/orm/OrmEclipseLinkBasicCollectionMapping2_1.java deleted file mode 100644 index cc74413dc1..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/orm/OrmEclipseLinkBasicCollectionMapping2_1.java +++ /dev/null @@ -1,40 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010, 2011 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.eclipselink.core.internal.context.orm; - -import java.util.List; -import org.eclipse.jpt.jpa.core.context.orm.OrmPersistentAttribute; -import org.eclipse.jpt.jpa.eclipselink.core.internal.DefaultEclipseLinkJpaValidationMessages; -import org.eclipse.jpt.jpa.eclipselink.core.internal.EclipseLinkJpaValidationMessages; -import org.eclipse.jpt.jpa.eclipselink.core.resource.orm.XmlBasicCollection; -import org.eclipse.wst.validation.internal.provisional.core.IMessage; -import org.eclipse.wst.validation.internal.provisional.core.IReporter; - -public class OrmEclipseLinkBasicCollectionMapping2_1 - extends AbstractOrmEclipseLinkBasicCollectionMapping -{ - public OrmEclipseLinkBasicCollectionMapping2_1(OrmPersistentAttribute parent, XmlBasicCollection xmlMapping) { - super(parent, xmlMapping); - } - - @Override - public void validate(List<IMessage> messages, IReporter reporter) { - super.validate(messages, reporter); - messages.add( - DefaultEclipseLinkJpaValidationMessages.buildMessage( - IMessage.NORMAL_SEVERITY, - EclipseLinkJpaValidationMessages.BASIC_COLLECTION_MAPPING_DEPRECATED, - new String[] {this.getName()}, - this, - this.getValidationTextRange() - ) - ); - } -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/orm/OrmEclipseLinkBasicCollectionMappingDefinition.java b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/orm/OrmEclipseLinkBasicCollectionMappingDefinition.java deleted file mode 100644 index 25b2416257..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/orm/OrmEclipseLinkBasicCollectionMappingDefinition.java +++ /dev/null @@ -1,65 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2008, 2009 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.eclipselink.core.internal.context.orm; - -import org.eclipse.emf.ecore.EFactory; -import org.eclipse.jpt.jpa.core.context.orm.OrmAttributeMapping; -import org.eclipse.jpt.jpa.core.context.orm.OrmAttributeMappingDefinition; -import org.eclipse.jpt.jpa.core.context.orm.OrmPersistentAttribute; -import org.eclipse.jpt.jpa.core.context.orm.OrmXmlContextNodeFactory; -import org.eclipse.jpt.jpa.core.resource.orm.XmlAttributeMapping; -import org.eclipse.jpt.jpa.core.resource.xml.EmfTools; -import org.eclipse.jpt.jpa.eclipselink.core.EclipseLinkMappingKeys; -import org.eclipse.jpt.jpa.eclipselink.core.resource.orm.EclipseLinkOrmPackage; -import org.eclipse.jpt.jpa.eclipselink.core.resource.orm.XmlBasicCollection; - -public class OrmEclipseLinkBasicCollectionMappingDefinition - implements OrmAttributeMappingDefinition -{ - // singleton - private static final OrmEclipseLinkBasicCollectionMappingDefinition INSTANCE = - new OrmEclipseLinkBasicCollectionMappingDefinition(); - - - /** - * Return the singleton. - */ - public static OrmAttributeMappingDefinition instance() { - return INSTANCE; - } - - - /** - * Enforce singleton usage - */ - private OrmEclipseLinkBasicCollectionMappingDefinition() { - super(); - } - - - public String getKey() { - return EclipseLinkMappingKeys.BASIC_COLLECTION_ATTRIBUTE_MAPPING_KEY; - } - - public XmlAttributeMapping buildResourceMapping(EFactory factory) { - return EmfTools.create( - factory, - EclipseLinkOrmPackage.eINSTANCE.getXmlBasicCollection(), - XmlBasicCollection.class); - } - - public OrmAttributeMapping buildContextMapping( - OrmPersistentAttribute parent, - XmlAttributeMapping resourceMapping, - OrmXmlContextNodeFactory factory) { - return ((EclipseLinkOrmXmlContextNodeFactory) factory). - buildOrmEclipseLinkBasicCollectionMapping(parent, (XmlBasicCollection) resourceMapping); - } -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/orm/OrmEclipseLinkBasicMapMapping.java b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/orm/OrmEclipseLinkBasicMapMapping.java deleted file mode 100644 index b968528b6c..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/orm/OrmEclipseLinkBasicMapMapping.java +++ /dev/null @@ -1,21 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2008, 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.eclipselink.core.internal.context.orm; - -import org.eclipse.jpt.jpa.core.context.orm.OrmPersistentAttribute; -import org.eclipse.jpt.jpa.eclipselink.core.resource.orm.XmlBasicMap; - -public class OrmEclipseLinkBasicMapMapping - extends AbstractOrmEclipseLinkBasicMapMapping -{ - public OrmEclipseLinkBasicMapMapping(OrmPersistentAttribute parent, XmlBasicMap xmlMapping) { - super(parent, xmlMapping); - } -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/orm/OrmEclipseLinkBasicMapMapping2_1.java b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/orm/OrmEclipseLinkBasicMapMapping2_1.java deleted file mode 100644 index df70780bff..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/orm/OrmEclipseLinkBasicMapMapping2_1.java +++ /dev/null @@ -1,40 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010, 2011 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.eclipselink.core.internal.context.orm; - -import java.util.List; -import org.eclipse.jpt.jpa.core.context.orm.OrmPersistentAttribute; -import org.eclipse.jpt.jpa.eclipselink.core.internal.DefaultEclipseLinkJpaValidationMessages; -import org.eclipse.jpt.jpa.eclipselink.core.internal.EclipseLinkJpaValidationMessages; -import org.eclipse.jpt.jpa.eclipselink.core.resource.orm.XmlBasicMap; -import org.eclipse.wst.validation.internal.provisional.core.IMessage; -import org.eclipse.wst.validation.internal.provisional.core.IReporter; - -public class OrmEclipseLinkBasicMapMapping2_1 - extends AbstractOrmEclipseLinkBasicMapMapping -{ - public OrmEclipseLinkBasicMapMapping2_1(OrmPersistentAttribute parent, XmlBasicMap xmlMapping) { - super(parent, xmlMapping); - } - - @Override - public void validate(List<IMessage> messages, IReporter reporter) { - super.validate(messages, reporter); - messages.add( - DefaultEclipseLinkJpaValidationMessages.buildMessage( - IMessage.NORMAL_SEVERITY, - EclipseLinkJpaValidationMessages.BASIC_MAP_MAPPING_DEPRECATED, - new String[] {this.getName()}, - this, - this.getValidationTextRange() - ) - ); - } -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/orm/OrmEclipseLinkBasicMapMappingDefinition.java b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/orm/OrmEclipseLinkBasicMapMappingDefinition.java deleted file mode 100644 index 5130e023ea..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/orm/OrmEclipseLinkBasicMapMappingDefinition.java +++ /dev/null @@ -1,65 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2008, 2009 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.eclipselink.core.internal.context.orm; - -import org.eclipse.emf.ecore.EFactory; -import org.eclipse.jpt.jpa.core.context.orm.OrmAttributeMapping; -import org.eclipse.jpt.jpa.core.context.orm.OrmAttributeMappingDefinition; -import org.eclipse.jpt.jpa.core.context.orm.OrmPersistentAttribute; -import org.eclipse.jpt.jpa.core.context.orm.OrmXmlContextNodeFactory; -import org.eclipse.jpt.jpa.core.resource.orm.XmlAttributeMapping; -import org.eclipse.jpt.jpa.core.resource.xml.EmfTools; -import org.eclipse.jpt.jpa.eclipselink.core.EclipseLinkMappingKeys; -import org.eclipse.jpt.jpa.eclipselink.core.resource.orm.EclipseLinkOrmPackage; -import org.eclipse.jpt.jpa.eclipselink.core.resource.orm.XmlBasicMap; - -public class OrmEclipseLinkBasicMapMappingDefinition - implements OrmAttributeMappingDefinition -{ - // singleton - private static final OrmEclipseLinkBasicMapMappingDefinition INSTANCE = - new OrmEclipseLinkBasicMapMappingDefinition(); - - - /** - * Return the singleton - */ - public static OrmAttributeMappingDefinition instance() { - return INSTANCE; - } - - - /** - * Ensforce singleton usage - */ - private OrmEclipseLinkBasicMapMappingDefinition() { - super(); - } - - - public String getKey() { - return EclipseLinkMappingKeys.BASIC_MAP_ATTRIBUTE_MAPPING_KEY; - } - - public XmlAttributeMapping buildResourceMapping(EFactory factory) { - return EmfTools.create( - factory, - EclipseLinkOrmPackage.eINSTANCE.getXmlBasicMap(), - XmlBasicMap.class); - } - - public OrmAttributeMapping buildContextMapping( - OrmPersistentAttribute parent, - XmlAttributeMapping resourceMapping, - OrmXmlContextNodeFactory factory) { - return ((EclipseLinkOrmXmlContextNodeFactory) factory). - buildOrmEclipseLinkBasicMapMapping(parent, (XmlBasicMap) resourceMapping); - } -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/orm/OrmEclipseLinkBasicMapping.java b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/orm/OrmEclipseLinkBasicMapping.java deleted file mode 100644 index 7bb026f2d1..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/orm/OrmEclipseLinkBasicMapping.java +++ /dev/null @@ -1,201 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2008, 2012 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.eclipselink.core.internal.context.orm; - -import java.util.List; -import org.eclipse.jdt.core.IPackageFragment; -import org.eclipse.jdt.core.IType; -import org.eclipse.jpt.common.core.internal.utility.JDTTools; -import org.eclipse.jpt.common.core.utility.TextRange; -import org.eclipse.jpt.common.utility.internal.StringTools; -import org.eclipse.jpt.common.utility.internal.iterables.CompositeIterable; -import org.eclipse.jpt.jpa.core.context.orm.OrmConverter; -import org.eclipse.jpt.jpa.core.context.orm.OrmPersistentAttribute; -import org.eclipse.jpt.jpa.core.internal.context.MappingTools; -import org.eclipse.jpt.jpa.core.internal.context.orm.AbstractOrmBasicMapping; -import org.eclipse.jpt.jpa.eclipselink.core.context.EclipseLinkAccessType; -import org.eclipse.jpt.jpa.eclipselink.core.context.EclipseLinkBasicMapping; -import org.eclipse.jpt.jpa.eclipselink.core.context.EclipseLinkMutable; -import org.eclipse.jpt.jpa.eclipselink.core.context.orm.EclipseLinkOrmConvertibleMapping; -import org.eclipse.jpt.jpa.eclipselink.core.context.orm.OrmEclipseLinkConverterContainer; -import org.eclipse.jpt.jpa.eclipselink.core.internal.DefaultEclipseLinkJpaValidationMessages; -import org.eclipse.jpt.jpa.eclipselink.core.internal.EclipseLinkJpaValidationMessages; -import org.eclipse.jpt.jpa.eclipselink.core.resource.orm.XmlBasic; -import org.eclipse.text.edits.ReplaceEdit; -import org.eclipse.wst.validation.internal.provisional.core.IMessage; -import org.eclipse.wst.validation.internal.provisional.core.IReporter; - -public class OrmEclipseLinkBasicMapping - extends AbstractOrmBasicMapping<XmlBasic> - implements - EclipseLinkBasicMapping, - EclipseLinkOrmConvertibleMapping, - OrmEclipseLinkConverterContainer.Owner -{ - protected final OrmEclipseLinkMutable mutable; - - protected final OrmEclipseLinkConverterContainer converterContainer; - - - public OrmEclipseLinkBasicMapping(OrmPersistentAttribute parent, XmlBasic xmlMapping) { - super(parent, xmlMapping); - this.mutable = new OrmEclipseLinkMutable(this); - this.converterContainer = this.buildConverterContainer(); - } - - - // ********** synchronize/update ********** - - @Override - public void synchronizeWithResourceModel() { - super.synchronizeWithResourceModel(); - this.mutable.synchronizeWithResourceModel(); - this.converterContainer.synchronizeWithResourceModel(); - } - - @Override - public void update() { - super.update(); - this.mutable.update(); - this.converterContainer.update(); - } - - - // ********** attribute type ********** - - @Override - protected String buildSpecifiedAttributeType() { - return this.xmlAttributeMapping.getAttributeType(); - } - - @Override - protected void setSpecifiedAttributeTypeInXml(String attributeType) { - this.xmlAttributeMapping.setAttributeType(attributeType); - } - - - // ********** mutable ********** - - public EclipseLinkMutable getMutable() { - return this.mutable; - } - - - // ********** converters ********** - - public OrmEclipseLinkConverterContainer getConverterContainer() { - return this.converterContainer; - } - - protected OrmEclipseLinkConverterContainer buildConverterContainer() { - return new OrmEclipseLinkConverterContainerImpl(this, this, this.xmlAttributeMapping); - } - - public int getNumberSupportedConverters() { - return 1; - } - - - // ********** converter adapters ********** - - /** - * put the EclipseLink convert adapter first - this is the order EclipseLink searches - */ - @Override - protected Iterable<OrmConverter.Adapter> getConverterAdapters() { - return new CompositeIterable<OrmConverter.Adapter>( - OrmEclipseLinkConvert.Adapter.instance(), - super.getConverterAdapters() - ); - } - - - //************ refactoring ************ - - @Override - @SuppressWarnings("unchecked") - public Iterable<ReplaceEdit> createMoveTypeEdits(IType originalType, IPackageFragment newPackage) { - return new CompositeIterable<ReplaceEdit>( - super.createMoveTypeEdits(originalType, newPackage), - this.converterContainer.createMoveTypeEdits(originalType, newPackage) - ); - } - - @Override - @SuppressWarnings("unchecked") - public Iterable<ReplaceEdit> createRenamePackageEdits(IPackageFragment originalPackage, String newName) { - return new CompositeIterable<ReplaceEdit>( - super.createRenamePackageEdits(originalPackage, newName), - this.converterContainer.createRenamePackageEdits(originalPackage, newName) - ); - } - - @Override - @SuppressWarnings("unchecked") - public Iterable<ReplaceEdit> createRenameTypeEdits(IType originalType, String newName) { - return new CompositeIterable<ReplaceEdit>( - super.createRenameTypeEdits(originalType, newName), - this.converterContainer.createRenameTypeEdits(originalType, newName) - ); - } - - - // ********** validation ********** - - @Override - public void validate(List<IMessage> messages, IReporter reporter) { - super.validate(messages, reporter); - this.validateAttributeType(messages); - // TODO mutable validation - } - - protected void validateAttributeType(List<IMessage> messages) { - if (this.isVirtualAccess()) { - if (StringTools.stringIsEmpty(this.getAttributeType())) { - messages.add( - DefaultEclipseLinkJpaValidationMessages.buildMessage( - IMessage.HIGH_SEVERITY, - EclipseLinkJpaValidationMessages.VIRTUAL_ATTRIBUTE_NO_ATTRIBUTE_TYPE_SPECIFIED, - new String[] {this.getName()}, - this, - this.getAttributeTypeTextRange() - ) - ); - return; - } - if (MappingTools.typeIsBasic(this.getJavaProject(), this.getFullyQualifiedAttributeType())) { - return; - } - if (this.getResolvedAttributeType() == null) { - IType jdtType = JDTTools.findType(this.getJavaProject(), this.getFullyQualifiedAttributeType()); - if (jdtType == null) { - messages.add( - DefaultEclipseLinkJpaValidationMessages.buildMessage( - IMessage.HIGH_SEVERITY, - EclipseLinkJpaValidationMessages.VIRTUAL_ATTRIBUTE_ATTRIBUTE_TYPE_DOES_NOT_EXIST, - new String[] {this.getFullyQualifiedAttributeType()}, - this, - this.getAttributeTypeTextRange() - ) - ); - } - return; - } - } - } - - protected boolean isVirtualAccess() { - return getPersistentAttribute().getAccess() == EclipseLinkAccessType.VIRTUAL; - } - - protected TextRange getAttributeTypeTextRange() { - return this.getValidationTextRange(this.xmlAttributeMapping.getAttributeTypeTextRange()); - } -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/orm/OrmEclipseLinkCachingImpl.java b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/orm/OrmEclipseLinkCachingImpl.java deleted file mode 100644 index cc7e2b852b..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/orm/OrmEclipseLinkCachingImpl.java +++ /dev/null @@ -1,805 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2008, 2012 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.eclipselink.core.internal.context.orm; - -import org.eclipse.jpt.common.core.utility.TextRange; -import org.eclipse.jpt.common.utility.internal.StringTools; -import org.eclipse.jpt.jpa.core.context.PersistentType; -import org.eclipse.jpt.jpa.core.context.TypeMapping; -import org.eclipse.jpt.jpa.core.context.java.JavaPersistentType; -import org.eclipse.jpt.jpa.core.internal.context.orm.AbstractOrmXmlContextNode; -import org.eclipse.jpt.jpa.core.internal.jpa2.context.orm.NullOrmCacheable2_0; -import org.eclipse.jpt.jpa.core.jpa2.context.CacheableHolder2_0; -import org.eclipse.jpt.jpa.core.jpa2.context.orm.OrmCacheable2_0; -import org.eclipse.jpt.jpa.core.jpa2.context.orm.OrmCacheableHolder2_0; -import org.eclipse.jpt.jpa.core.jpa2.context.persistence.PersistenceUnit2_0; -import org.eclipse.jpt.jpa.core.resource.orm.XmlTypeMapping; -import org.eclipse.jpt.jpa.core.resource.orm.v2_0.XmlCacheable_2_0; -import org.eclipse.jpt.jpa.eclipselink.core.context.EclipseLinkCacheCoordinationType; -import org.eclipse.jpt.jpa.eclipselink.core.context.EclipseLinkCacheIsolationType2_2; -import org.eclipse.jpt.jpa.eclipselink.core.context.EclipseLinkCacheType; -import org.eclipse.jpt.jpa.eclipselink.core.context.EclipseLinkExistenceType; -import org.eclipse.jpt.jpa.eclipselink.core.context.EclipseLinkTimeOfDay; -import org.eclipse.jpt.jpa.eclipselink.core.context.java.JavaEclipseLinkCaching; -import org.eclipse.jpt.jpa.eclipselink.core.context.java.JavaEclipseLinkNonEmbeddableTypeMapping; -import org.eclipse.jpt.jpa.eclipselink.core.context.orm.OrmEclipseLinkCaching; -import org.eclipse.jpt.jpa.eclipselink.core.context.orm.OrmEclipseLinkNonEmbeddableTypeMapping; -import org.eclipse.jpt.jpa.eclipselink.core.context.persistence.EclipseLinkPersistenceUnit; -import org.eclipse.jpt.jpa.eclipselink.core.resource.orm.EclipseLinkOrmFactory; -import org.eclipse.jpt.jpa.eclipselink.core.resource.orm.XmlCache; -import org.eclipse.jpt.jpa.eclipselink.core.resource.orm.XmlCacheHolder; -import org.eclipse.jpt.jpa.eclipselink.core.resource.orm.XmlTimeOfDay; - -public class OrmEclipseLinkCachingImpl - extends AbstractOrmXmlContextNode - implements OrmEclipseLinkCaching, OrmCacheableHolder2_0 -{ - protected EclipseLinkCacheType specifiedType; - protected EclipseLinkCacheType defaultType = DEFAULT_TYPE; - - protected Integer specifiedSize; - protected int defaultSize = DEFAULT_SIZE; - - protected Boolean specifiedShared; - protected boolean defaultShared = DEFAULT_SHARED; - - protected Boolean specifiedAlwaysRefresh; - protected boolean defaultAlwaysRefresh = DEFAULT_ALWAYS_REFRESH; - - protected Boolean specifiedRefreshOnlyIfNewer; - protected boolean defaultRefreshOnlyIfNewer = DEFAULT_REFRESH_ONLY_IF_NEWER; - - protected Boolean specifiedDisableHits; - protected boolean defaultDisableHits = DEFAULT_DISABLE_HITS; - - protected EclipseLinkCacheCoordinationType specifiedCoordinationType; - protected EclipseLinkCacheCoordinationType defaultCoordinationType = DEFAULT_COORDINATION_TYPE; - - protected Integer expiry; - protected EclipseLinkOrmTimeOfDay expiryTimeOfDay; - - protected EclipseLinkExistenceType specifiedExistenceType; - protected EclipseLinkExistenceType defaultExistenceType = DEFAULT_EXISTENCE_TYPE; - - protected final OrmCacheable2_0 cacheable; - - protected EclipseLinkCacheIsolationType2_2 specifiedIsolation; - protected EclipseLinkCacheIsolationType2_2 defaultIsolation = DEFAULT_ISOLATION; - - - public OrmEclipseLinkCachingImpl(OrmEclipseLinkNonEmbeddableTypeMapping parent) { - super(parent); - - this.specifiedType = this.buildSpecifiedType(); - this.specifiedSize = this.buildSpecifiedSize(); - this.specifiedShared = this.buildSpecifiedShared(); - this.specifiedAlwaysRefresh = this.buildSpecifiedAlwaysRefresh(); - this.specifiedRefreshOnlyIfNewer = this.buildSpecifiedRefreshOnlyIfNewer(); - this.specifiedDisableHits = this.buildSpecifiedDisableHits(); - - this.specifiedCoordinationType = this.buildSpecifiedCoordinationType(); - - this.expiry = this.buildExpiry(); - this.expiryTimeOfDay = this.buildExpiryTimeOfDay(); - - this.specifiedExistenceType = this.buildSpecifiedExistenceType(); - - this.cacheable = this.buildCacheable(); - - this.specifiedIsolation = this.buildSpecifiedIsolation(); - } - - - // ********** synchronize/update ********** - - @Override - public void synchronizeWithResourceModel() { - super.synchronizeWithResourceModel(); - - this.setSpecifiedType_(this.buildSpecifiedType()); - this.setSpecifiedSize_(this.buildSpecifiedSize()); - this.setSpecifiedShared_(this.buildSpecifiedShared()); - this.setSpecifiedAlwaysRefresh_(this.buildSpecifiedAlwaysRefresh()); - this.setSpecifiedRefreshOnlyIfNewer_(this.buildSpecifiedRefreshOnlyIfNewer()); - this.setSpecifiedDisableHits_(this.buildSpecifiedDisableHits()); - - this.setSpecifiedCoordinationType_(this.buildSpecifiedCoordinationType()); - - this.setExpiry_(this.buildExpiry()); - this.syncExpiryTimeOfDay(); - - this.setSpecifiedExistenceType_(this.buildSpecifiedExistenceType()); - - this.cacheable.synchronizeWithResourceModel(); - - this.setSpecifiedIsolation_(this.buildSpecifiedIsolation()); - } - - @Override - public void update() { - super.update(); - - boolean xmlCacheNotSpecified = (this.getXmlCache() == null); - JavaEclipseLinkCaching javaCaching = this.getJavaCachingForDefaults(); - boolean javaCacheSpecified = (javaCaching != null); - boolean useJavaValue = (xmlCacheNotSpecified && javaCacheSpecified); - - this.setDefaultType(useJavaValue ? javaCaching.getType() : DEFAULT_TYPE); - this.setDefaultSize(useJavaValue ? javaCaching.getSize() : DEFAULT_SIZE); - this.setDefaultShared(useJavaValue ? javaCaching.isShared() : DEFAULT_SHARED); - this.setDefaultAlwaysRefresh(useJavaValue ? javaCaching.isAlwaysRefresh() : DEFAULT_ALWAYS_REFRESH); - this.setDefaultRefreshOnlyIfNewer(useJavaValue ? javaCaching.isRefreshOnlyIfNewer() : DEFAULT_REFRESH_ONLY_IF_NEWER); - this.setDefaultDisableHits(useJavaValue ? javaCaching.isDisableHits() : DEFAULT_DISABLE_HITS); - - this.setDefaultCoordinationType(useJavaValue ? javaCaching.getCoordinationType() : DEFAULT_COORDINATION_TYPE); - - if (this.expiryTimeOfDay != null) { - this.expiryTimeOfDay.update(); - } - - // existence checking is its own xml attribute, it is not part of the cache xml element - this.setDefaultExistenceType(javaCacheSpecified ? javaCaching.getExistenceType() : DEFAULT_EXISTENCE_TYPE); - - this.cacheable.update(); - - this.setDefaultIsolation(useJavaValue ? javaCaching.getIsolation() : DEFAULT_ISOLATION); - } - - - // ********** type ********** - - public EclipseLinkCacheType getType() { - return (this.specifiedType != null) ? this.specifiedType : this.defaultType; - } - - public EclipseLinkCacheType getSpecifiedType() { - return this.specifiedType; - } - - public void setSpecifiedType(EclipseLinkCacheType type) { - if (this.valuesAreDifferent(this.specifiedType, type)) { - XmlCache xmlCache = this.getXmlCacheForUpdate(); - this.setSpecifiedType_(type); - xmlCache.setType(EclipseLinkCacheType.toOrmResourceModel(type)); - this.removeXmlCacheIfUnset(); - } - - if (type != null) { - this.setSpecifiedShared(null); - } - } - - protected void setSpecifiedType_(EclipseLinkCacheType type) { - EclipseLinkCacheType old = this.specifiedType; - this.specifiedType = type; - this.firePropertyChanged(SPECIFIED_TYPE_PROPERTY, old, type); - } - - protected EclipseLinkCacheType buildSpecifiedType() { - XmlCache xmlCache = this.getXmlCache(); - return (xmlCache == null) ? null : EclipseLinkCacheType.fromOrmResourceModel(xmlCache.getType()); - } - - public EclipseLinkCacheType getDefaultType() { - String puDefaultCacheTypeName = ((EclipseLinkPersistenceUnit)getPersistenceUnit()).getDefaultCacheTypePropertyValue(); - if (!StringTools.stringIsEmpty(puDefaultCacheTypeName)) { - try { - return EclipseLinkCacheType.valueOf(StringTools.convertCamelCaseToAllCaps(puDefaultCacheTypeName)); - } catch (IllegalArgumentException exception) { - //no match, return default - } - } - return this.defaultType; - } - - protected void setDefaultType(EclipseLinkCacheType type) { - EclipseLinkCacheType old = this.defaultType; - this.defaultType = type; - this.firePropertyChanged(DEFAULT_TYPE_PROPERTY, old, type); - } - - - // ********** size ********** - - public int getSize() { - return (this.specifiedSize != null) ? this.specifiedSize.intValue() : this.defaultSize; - } - - public Integer getSpecifiedSize() { - return this.specifiedSize; - } - - public void setSpecifiedSize(Integer size) { - if (this.valuesAreDifferent(this.specifiedSize, size)) { - XmlCache xmlCache = this.getXmlCacheForUpdate(); - this.setSpecifiedSize_(size); - xmlCache.setSize(size); - this.removeXmlCacheIfUnset(); - } - - if (size != null) { - this.setSpecifiedShared(null); - } - } - - protected void setSpecifiedSize_(Integer size) { - Integer old = this.specifiedSize; - this.specifiedSize = size; - this.firePropertyChanged(SPECIFIED_SIZE_PROPERTY, old, size); - } - - protected Integer buildSpecifiedSize() { - XmlCache xmlCache = this.getXmlCache(); - return (xmlCache == null) ? null : xmlCache.getSize(); - } - - public int getDefaultSize() { - String puDefaultCacheSize = ((EclipseLinkPersistenceUnit)getPersistenceUnit()).getDefaultCacheSizePropertyValue(); - if (!StringTools.stringIsEmpty(puDefaultCacheSize)) { - try { - return Integer.valueOf(puDefaultCacheSize).intValue(); - } catch (NumberFormatException exception) { - //couldn't parse, return default - } - } - return this.defaultSize; - } - - protected void setDefaultSize(int size) { - int old = this.defaultSize; - this.defaultSize = size; - this.firePropertyChanged(DEFAULT_SIZE_PROPERTY, old, size); - } - - - // ********** shared ********** - - public boolean isShared() { - return (this.specifiedShared != null) ? this.specifiedShared.booleanValue() : this.defaultShared; - } - - public Boolean getSpecifiedShared() { - return this.specifiedShared; - } - - public void setSpecifiedShared(Boolean shared) { - if (this.valuesAreDifferent(this.specifiedShared, shared)) { - XmlCache xmlCache = this.getXmlCacheForUpdate(); - this.setSpecifiedShared_(shared); - xmlCache.setShared(shared); - this.removeXmlCacheIfUnset(); - } - - if ((shared != null) && ! shared.booleanValue()) { // Boolean.FALSE - this.setSpecifiedType(null); - this.setSpecifiedSize(null); - this.setSpecifiedAlwaysRefresh(null); - this.setSpecifiedRefreshOnlyIfNewer(null); - this.setSpecifiedDisableHits(null); - this.setSpecifiedCoordinationType(null); - this.setExpiry(null); - this.removeExpiryTimeOfDayIfNecessary(); - } - } - - protected void setSpecifiedShared_(Boolean shared) { - Boolean old = this.specifiedShared; - this.specifiedShared = shared; - this.firePropertyChanged(SPECIFIED_SHARED_PROPERTY, old, shared); - } - - protected Boolean buildSpecifiedShared() { - XmlCache xmlCache = this.getXmlCache(); - return (xmlCache == null) ? null : xmlCache.getShared(); - } - - public boolean isDefaultShared() { - String puDefaultSharedCache = ((EclipseLinkPersistenceUnit)getPersistenceUnit()).getDefaultCacheSharedPropertyValue(); - return !StringTools.stringIsEmpty(puDefaultSharedCache) ? Boolean.valueOf(puDefaultSharedCache) : this.defaultShared; - } - - protected void setDefaultShared(boolean shared) { - boolean old = this.defaultShared; - this.defaultShared = shared; - this.firePropertyChanged(DEFAULT_SHARED_PROPERTY, old, shared); - } - - - // ********** always refresh ********** - - public boolean isAlwaysRefresh() { - return (this.specifiedAlwaysRefresh != null) ? this.specifiedAlwaysRefresh.booleanValue() : this.defaultAlwaysRefresh; - } - - public Boolean getSpecifiedAlwaysRefresh() { - return this.specifiedAlwaysRefresh; - } - - public void setSpecifiedAlwaysRefresh(Boolean alwaysRefresh) { - if (this.valuesAreDifferent(this.specifiedAlwaysRefresh, alwaysRefresh)) { - XmlCache xmlCache = this.getXmlCacheForUpdate(); - this.setSpecifiedAlwaysRefresh_(alwaysRefresh); - xmlCache.setAlwaysRefresh(alwaysRefresh); - this.removeXmlCacheIfUnset(); - } - - if (alwaysRefresh != null) { - this.setSpecifiedShared(null); - } - } - - protected void setSpecifiedAlwaysRefresh_(Boolean alwaysRefresh) { - Boolean old = this.specifiedAlwaysRefresh; - this.specifiedAlwaysRefresh = alwaysRefresh; - this.firePropertyChanged(SPECIFIED_ALWAYS_REFRESH_PROPERTY, old, alwaysRefresh); - } - - protected Boolean buildSpecifiedAlwaysRefresh() { - XmlCache xmlCache = this.getXmlCache(); - return (xmlCache == null) ? null : xmlCache.getAlwaysRefresh(); - } - - public boolean isDefaultAlwaysRefresh() { - return this.defaultAlwaysRefresh; - } - - protected void setDefaultAlwaysRefresh(boolean alwaysRefresh) { - boolean old = this.defaultAlwaysRefresh; - this.defaultAlwaysRefresh = alwaysRefresh; - this.firePropertyChanged(DEFAULT_ALWAYS_REFRESH_PROPERTY, old, alwaysRefresh); - } - - - // ********** refresh only if newer ********** - - public boolean isRefreshOnlyIfNewer() { - return (this.specifiedRefreshOnlyIfNewer != null) ? this.specifiedRefreshOnlyIfNewer.booleanValue() : this.defaultRefreshOnlyIfNewer; - } - - public Boolean getSpecifiedRefreshOnlyIfNewer() { - return this.specifiedRefreshOnlyIfNewer; - } - - public void setSpecifiedRefreshOnlyIfNewer(Boolean refreshOnlyIfNewer) { - if (this.valuesAreDifferent(this.specifiedRefreshOnlyIfNewer, refreshOnlyIfNewer)) { - XmlCache xmlCache = this.getXmlCacheForUpdate(); - this.setSpecifiedRefreshOnlyIfNewer_(refreshOnlyIfNewer); - xmlCache.setRefreshOnlyIfNewer(refreshOnlyIfNewer); - this.removeXmlCacheIfUnset(); - } - - if (refreshOnlyIfNewer != null) { - this.setSpecifiedShared(null); - } - } - - protected void setSpecifiedRefreshOnlyIfNewer_(Boolean refreshOnlyIfNewer) { - Boolean old = this.specifiedRefreshOnlyIfNewer; - this.specifiedRefreshOnlyIfNewer = refreshOnlyIfNewer; - this.firePropertyChanged(SPECIFIED_REFRESH_ONLY_IF_NEWER_PROPERTY, old, refreshOnlyIfNewer); - } - - protected Boolean buildSpecifiedRefreshOnlyIfNewer() { - XmlCache xmlCache = this.getXmlCache(); - return (xmlCache == null) ? null : xmlCache.getRefreshOnlyIfNewer(); - } - - public boolean isDefaultRefreshOnlyIfNewer() { - return this.defaultRefreshOnlyIfNewer; - } - - protected void setDefaultRefreshOnlyIfNewer(boolean refreshOnlyIfNewer) { - boolean old = this.defaultRefreshOnlyIfNewer; - this.defaultRefreshOnlyIfNewer = refreshOnlyIfNewer; - this.firePropertyChanged(DEFAULT_REFRESH_ONLY_IF_NEWER_PROPERTY, old, refreshOnlyIfNewer); - } - - - // ********** disable hits ********** - - public boolean isDisableHits() { - return (this.specifiedDisableHits != null) ? this.specifiedDisableHits.booleanValue() : this.defaultDisableHits; - } - - public Boolean getSpecifiedDisableHits() { - return this.specifiedDisableHits; - } - - public void setSpecifiedDisableHits(Boolean disableHits) { - if (this.valuesAreDifferent(this.specifiedDisableHits, disableHits)) { - XmlCache xmlCache = this.getXmlCacheForUpdate(); - this.setSpecifiedDisableHits_(disableHits); - xmlCache.setDisableHits(disableHits); - this.removeXmlCacheIfUnset(); - } - - if (disableHits != null) { - this.setSpecifiedShared(null); - } - } - - protected void setSpecifiedDisableHits_(Boolean disableHits) { - Boolean old = this.specifiedDisableHits; - this.specifiedDisableHits = disableHits; - this.firePropertyChanged(SPECIFIED_DISABLE_HITS_PROPERTY, old, disableHits); - } - - protected Boolean buildSpecifiedDisableHits() { - XmlCache xmlCache = this.getXmlCache(); - return (xmlCache == null) ? null : xmlCache.getDisableHits(); - } - - public boolean isDefaultDisableHits() { - return this.defaultDisableHits; - } - - protected void setDefaultDisableHits(boolean disableHits) { - boolean old = this.defaultDisableHits; - this.defaultDisableHits = disableHits; - this.firePropertyChanged(DEFAULT_DISABLE_HITS_PROPERTY, old, disableHits); - } - - - // ********** coordination type ********** - - public EclipseLinkCacheCoordinationType getCoordinationType() { - return (this.specifiedCoordinationType != null) ? this.specifiedCoordinationType : this.defaultCoordinationType; - } - - public EclipseLinkCacheCoordinationType getSpecifiedCoordinationType() { - return this.specifiedCoordinationType; - } - - public void setSpecifiedCoordinationType(EclipseLinkCacheCoordinationType type) { - if (this.valuesAreDifferent(this.specifiedCoordinationType, type)) { - XmlCache xmlCache = this.getXmlCacheForUpdate(); - this.setSpecifiedCoordinationType_(type); - xmlCache.setCoordinationType(EclipseLinkCacheCoordinationType.toOrmResourceModel(type)); - this.removeXmlCacheIfUnset(); - } - - if (type != null) { - this.setSpecifiedShared(null); - } - } - - protected void setSpecifiedCoordinationType_(EclipseLinkCacheCoordinationType type) { - EclipseLinkCacheCoordinationType old = this.specifiedCoordinationType; - this.specifiedCoordinationType = type; - this.firePropertyChanged(SPECIFIED_COORDINATION_TYPE_PROPERTY, old, type); - } - - protected EclipseLinkCacheCoordinationType buildSpecifiedCoordinationType() { - XmlCache xmlCache = this.getXmlCache(); - return (xmlCache == null) ? null : EclipseLinkCacheCoordinationType.fromOrmResourceModel(xmlCache.getCoordinationType()); - } - - public EclipseLinkCacheCoordinationType getDefaultCoordinationType() { - return this.defaultCoordinationType; - } - - protected void setDefaultCoordinationType(EclipseLinkCacheCoordinationType type) { - EclipseLinkCacheCoordinationType old= this.defaultCoordinationType; - this.defaultCoordinationType = type; - this.firePropertyChanged(DEFAULT_COORDINATION_TYPE_PROPERTY, old, type); - } - - - // ********** expiry ********** - - public Integer getExpiry() { - return this.expiry; - } - - public void setExpiry(Integer expiry) { - if (this.valuesAreDifferent(this.expiry, expiry)) { - XmlCache xmlCache = this.getXmlCacheForUpdate(); - this.setExpiry_(expiry); - xmlCache.setExpiry(expiry); - this.removeXmlCacheIfUnset(); - } - - if (expiry != null) { - this.removeExpiryTimeOfDayIfNecessary(); - this.setSpecifiedShared(null); - } - } - - protected void setExpiry_(Integer expiry) { - Integer old = this.expiry; - this.expiry = expiry; - this.firePropertyChanged(EXPIRY_PROPERTY, old, expiry); - } - - protected Integer buildExpiry() { - XmlCache xmlCache = this.getXmlCache(); - return (xmlCache == null) ? null : xmlCache.getExpiry(); - } - - - // ********** expiry time of day ********** - - public EclipseLinkTimeOfDay getExpiryTimeOfDay() { - return this.expiryTimeOfDay; - } - - public EclipseLinkTimeOfDay addExpiryTimeOfDay() { - if (this.expiryTimeOfDay != null) { - throw new IllegalStateException("expiry time of day already exists: " + this.expiryTimeOfDay); //$NON-NLS-1$ - } - - XmlCache xmlCache = this.getXmlCacheForUpdate(); - XmlTimeOfDay xmlTimeOfDay = this.buildXmlTimeOfDay(); - EclipseLinkOrmTimeOfDay timeOfDay = this.buildExpiryTimeOfDay(xmlTimeOfDay); - this.setExpiryTimeOfDay(timeOfDay); - xmlCache.setExpiryTimeOfDay(xmlTimeOfDay); - - this.setExpiry(null); - this.setSpecifiedShared(null); - - return timeOfDay; - } - - protected XmlTimeOfDay buildXmlTimeOfDay() { - return EclipseLinkOrmFactory.eINSTANCE.createXmlTimeOfDay(); - } - - public void removeExpiryTimeOfDay() { - if (this.expiryTimeOfDay == null) { - throw new IllegalStateException("expiry time of day does not exist"); //$NON-NLS-1$ - } - this.removeExpiryTimeOfDay_(); - } - - protected void removeExpiryTimeOfDayIfNecessary() { - if (this.expiryTimeOfDay != null) { - this.removeExpiryTimeOfDay_(); - } - } - - protected void removeExpiryTimeOfDay_() { - this.setExpiryTimeOfDay(null); - this.getXmlCache().setExpiryTimeOfDay(null); - this.removeXmlCacheIfUnset(); - } - - protected void setExpiryTimeOfDay(EclipseLinkOrmTimeOfDay timeOfDay) { - EclipseLinkOrmTimeOfDay old = this.expiryTimeOfDay; - this.expiryTimeOfDay = timeOfDay; - this.firePropertyChanged(EXPIRY_TIME_OF_DAY_PROPERTY, old, timeOfDay); - } - - protected void syncExpiryTimeOfDay() { - XmlTimeOfDay xmlTimeOfDay = this.getXmlExpiryTimeOfDay(); - if (xmlTimeOfDay == null) { - if (this.expiryTimeOfDay != null) { - this.setExpiryTimeOfDay(null); - } - } else { - if ((this.expiryTimeOfDay != null) && (this.expiryTimeOfDay.getXmlTimeOfDay() == xmlTimeOfDay)) { - this.expiryTimeOfDay.synchronizeWithResourceModel(); - } else { - this.setExpiryTimeOfDay(this.buildExpiryTimeOfDay(xmlTimeOfDay)); - } - } - } - - protected EclipseLinkOrmTimeOfDay buildExpiryTimeOfDay() { - return this.buildExpiryTimeOfDay(this.getXmlExpiryTimeOfDay()); - } - - protected XmlTimeOfDay getXmlExpiryTimeOfDay() { - XmlCache xmlCache = this.getXmlCache(); - return (xmlCache == null) ? null : xmlCache.getExpiryTimeOfDay(); - } - - protected EclipseLinkOrmTimeOfDay buildExpiryTimeOfDay(XmlTimeOfDay xmlTimeOfDay) { - return (xmlTimeOfDay == null) ? null : new EclipseLinkOrmTimeOfDay(this, xmlTimeOfDay); - } - - - // ********** existence type ********** - - public EclipseLinkExistenceType getExistenceType() { - return (this.specifiedExistenceType != null) ? this.specifiedExistenceType : this.defaultExistenceType; - } - - public EclipseLinkExistenceType getSpecifiedExistenceType() { - return this.specifiedExistenceType; - } - - public void setSpecifiedExistenceType(EclipseLinkExistenceType type) { - if (this.setSpecifiedExistenceType_(type)) { - this.getXmlCacheHolder().setExistenceChecking(EclipseLinkExistenceType.toOrmResourceModel(type)); - } - } - - protected boolean setSpecifiedExistenceType_(EclipseLinkExistenceType type) { - EclipseLinkExistenceType old = this.specifiedExistenceType; - this.specifiedExistenceType = type; - return this.firePropertyChanged(SPECIFIED_EXISTENCE_TYPE_PROPERTY, old, type); - } - - protected EclipseLinkExistenceType buildSpecifiedExistenceType() { - XmlCacheHolder xmlCacheHolder = this.getXmlCacheHolder(); - return (xmlCacheHolder == null) ? null : EclipseLinkExistenceType.fromOrmResourceModel(xmlCacheHolder.getExistenceChecking()); - } - - public EclipseLinkExistenceType getDefaultExistenceType() { - return this.defaultExistenceType; - } - - protected void setDefaultExistenceType(EclipseLinkExistenceType type) { - EclipseLinkExistenceType old = this.defaultExistenceType; - this.defaultExistenceType = type; - this.firePropertyChanged(DEFAULT_EXISTENCE_TYPE_PROPERTY, old, type); - } - - - // ********** cacheable ********** - - public OrmCacheable2_0 getCacheable() { - return this.cacheable; - } - - protected OrmCacheable2_0 buildCacheable() { - return this.isOrmXml2_0Compatible() ? - this.getContextNodeFactory2_0().buildOrmCacheable(this) : - new NullOrmCacheable2_0(this); - } - - public boolean calculateDefaultCacheable() { - if ( ! this.getTypeMapping().isMetadataComplete()) { - JavaPersistentType javaPersistentType = this.getTypeMapping().getPersistentType().getJavaPersistentType(); - if ((javaPersistentType != null) && (javaPersistentType.getMapping() instanceof CacheableHolder2_0)) { - return ((CacheableHolder2_0) javaPersistentType.getMapping()).getCacheable().isCacheable(); - } - } - CacheableHolder2_0 superCacheableHolder = this.getCacheableSuperPersistentType(this.getTypeMapping().getPersistentType()); - return (superCacheableHolder != null) ? - superCacheableHolder.getCacheable().isCacheable() : - ((PersistenceUnit2_0) this.getPersistenceUnit()).calculateDefaultCacheable(); - } - - protected CacheableHolder2_0 getCacheableSuperPersistentType(PersistentType persistentType) { - PersistentType superPersistentType = persistentType.getSuperPersistentType(); - if (superPersistentType == null) { - return null; - } - TypeMapping superMapping = superPersistentType.getMapping(); - return (superMapping instanceof CacheableHolder2_0) ? - (CacheableHolder2_0) superMapping : - this.getCacheableSuperPersistentType(superPersistentType); // recurse - } - - - // ********** isolation ********** - - public EclipseLinkCacheIsolationType2_2 getIsolation() { - return (this.specifiedIsolation != null) ? this.specifiedIsolation : this.defaultIsolation; - } - - public EclipseLinkCacheIsolationType2_2 getSpecifiedIsolation() { - return this.specifiedIsolation; - } - - public void setSpecifiedIsolation(EclipseLinkCacheIsolationType2_2 isolation) { - if (this.valuesAreDifferent(this.specifiedIsolation, isolation)) { - XmlCache xmlCache = this.getXmlCacheForUpdate(); - this.setSpecifiedIsolation_(isolation); - xmlCache.setIsolation(EclipseLinkCacheIsolationType2_2.toOrmResourceModel(isolation)); - this.removeXmlCacheIfUnset(); - } - - if (isolation != null) { - this.setSpecifiedShared(null); - } - } - - protected void setSpecifiedIsolation_(EclipseLinkCacheIsolationType2_2 isolation) { - EclipseLinkCacheIsolationType2_2 old = this.specifiedIsolation; - this.specifiedIsolation = isolation; - this.firePropertyChanged(SPECIFIED_ISOLATION_PROPERTY, old, isolation); - } - - protected EclipseLinkCacheIsolationType2_2 buildSpecifiedIsolation() { - XmlCache xmlCache = this.getXmlCache(); - return (xmlCache == null) ? null : EclipseLinkCacheIsolationType2_2.fromOrmResourceModel(xmlCache.getIsolation()); - } - - public EclipseLinkCacheIsolationType2_2 getDefaultIsolation() { - return this.defaultIsolation; - } - - protected void setDefaultIsolation(EclipseLinkCacheIsolationType2_2 isolation) { - EclipseLinkCacheIsolationType2_2 old = this.defaultIsolation; - this.defaultIsolation = isolation; - this.firePropertyChanged(DEFAULT_ISOLATION_PROPERTY, old, isolation); - } - - // ********** XML cache ********** - - /** - * Return null if the XML cache does not exists. - */ - protected XmlCache getXmlCache() { - return this.getXmlCacheHolder().getCache(); - } - - /** - * Build the XML cache if it does not exist. - */ - protected XmlCache getXmlCacheForUpdate() { - XmlCache xmlCache = this.getXmlCache(); - return (xmlCache != null) ? xmlCache : this.buildXmlCache(); - } - - protected XmlCache buildXmlCache() { - XmlCache xmlCache = EclipseLinkOrmFactory.eINSTANCE.createXmlCache(); - this.getXmlCacheHolder().setCache(xmlCache); - return xmlCache; - } - - protected void removeXmlCacheIfUnset() { - if (this.getXmlCache().isUnset()) { - this.removeXmlCache(); - } - } - - protected void removeXmlCache() { - this.getXmlCacheHolder().setCache(null); - } - - - // ********** misc ********** - - @Override - public OrmEclipseLinkNonEmbeddableTypeMapping getParent() { - return (OrmEclipseLinkNonEmbeddableTypeMapping) super.getParent(); - } - - protected OrmEclipseLinkNonEmbeddableTypeMapping getTypeMapping() { - return this.getParent(); - } - - protected XmlTypeMapping getXmlTypeMapping() { - return this.getTypeMapping().getXmlTypeMapping(); - } - - public XmlCacheable_2_0 getXmlCacheable() { - return (XmlCacheable_2_0) this.getXmlTypeMapping(); - } - - protected XmlCacheHolder getXmlCacheHolder() { - return (XmlCacheHolder) this.getXmlTypeMapping(); - } - - protected JavaEclipseLinkNonEmbeddableTypeMapping getJavaTypeMappingForDefaults() { - return this.getTypeMapping().getJavaTypeMappingForDefaults(); - } - - protected JavaEclipseLinkCaching getJavaCachingForDefaults() { - JavaEclipseLinkNonEmbeddableTypeMapping javaTypeMapping = this.getJavaTypeMappingForDefaults(); - return (javaTypeMapping == null) ? null : javaTypeMapping.getCaching(); - } - - - // ********** validation ********** - - public TextRange getValidationTextRange() { - TextRange textRange = this.getXmlValidationTextRange(); - return (textRange != null) ? textRange : this.getTypeMapping().getValidationTextRange(); - } - - protected TextRange getXmlValidationTextRange() { - XmlCache xmlCache = this.getXmlCache(); - return (xmlCache == null) ? null : xmlCache.getValidationTextRange(); - } -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/orm/OrmEclipseLinkChangeTracking.java b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/orm/OrmEclipseLinkChangeTracking.java deleted file mode 100644 index 93f3076f1e..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/orm/OrmEclipseLinkChangeTracking.java +++ /dev/null @@ -1,172 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2008, 2012 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.eclipselink.core.internal.context.orm; - -import org.eclipse.jpt.common.core.utility.TextRange; -import org.eclipse.jpt.jpa.core.internal.context.orm.AbstractOrmXmlContextNode; -import org.eclipse.jpt.jpa.core.resource.orm.XmlTypeMapping; -import org.eclipse.jpt.jpa.eclipselink.core.context.EclipseLinkChangeTracking; -import org.eclipse.jpt.jpa.eclipselink.core.context.EclipseLinkChangeTrackingType; -import org.eclipse.jpt.jpa.eclipselink.core.context.java.EclipseLinkJavaTypeMapping; -import org.eclipse.jpt.jpa.eclipselink.core.context.orm.EclipseLinkOrmTypeMapping; -import org.eclipse.jpt.jpa.eclipselink.core.resource.orm.EclipseLinkOrmFactory; -import org.eclipse.jpt.jpa.eclipselink.core.resource.orm.XmlChangeTracking; -import org.eclipse.jpt.jpa.eclipselink.core.resource.orm.XmlChangeTrackingHolder; - -public class OrmEclipseLinkChangeTracking - extends AbstractOrmXmlContextNode - implements EclipseLinkChangeTracking -{ - protected EclipseLinkChangeTrackingType specifiedType; - protected EclipseLinkChangeTrackingType defaultType = DEFAULT_TYPE; - - - public OrmEclipseLinkChangeTracking(EclipseLinkOrmTypeMapping parent) { - super(parent); - this.specifiedType = this.buildSpecifiedType(); - } - - - // ********** synchronize/update ********** - - @Override - public void synchronizeWithResourceModel() { - super.synchronizeWithResourceModel(); - this.setSpecifiedType_(this.buildSpecifiedType()); - } - - @Override - public void update() { - super.update(); - this.setDefaultType(this.buildDefaultType()); - } - - - // ********** type ********** - - public EclipseLinkChangeTrackingType getType() { - return (this.specifiedType != null) ? this.specifiedType : this.defaultType; - } - - public EclipseLinkChangeTrackingType getSpecifiedType() { - return this.specifiedType; - } - - public void setSpecifiedType(EclipseLinkChangeTrackingType type) { - if (this.specifiedType != type) { - XmlChangeTracking xmlChangeTracking = this.getXmlChangeTrackingForUpdate(); - this.setSpecifiedType_(type); - xmlChangeTracking.setType(EclipseLinkChangeTrackingType.toOrmResourceModel(type)); - this.removeXmlChangeTrackingIfUnset(); - } - } - - protected void setSpecifiedType_(EclipseLinkChangeTrackingType type) { - EclipseLinkChangeTrackingType old = this.specifiedType; - this.specifiedType = type; - this.firePropertyChanged(SPECIFIED_TYPE_PROPERTY, old, type); - } - - protected EclipseLinkChangeTrackingType buildSpecifiedType() { - XmlChangeTracking xmlChangeTracking = this.getXmlChangeTracking(); - return (xmlChangeTracking == null) ? null : EclipseLinkChangeTrackingType.fromOrmResourceModel(xmlChangeTracking.getType()); - } - - public EclipseLinkChangeTrackingType getDefaultType() { - return this.defaultType; - } - - protected void setDefaultType(EclipseLinkChangeTrackingType type) { - EclipseLinkChangeTrackingType old = this.defaultType; - this.defaultType = type; - this.firePropertyChanged(DEFAULT_TYPE_PROPERTY, old, type); - } - - protected EclipseLinkChangeTrackingType buildDefaultType() { - EclipseLinkChangeTracking javaChangeTracking = this.getJavaChangeTrackingForDefaults(); - return (javaChangeTracking != null) ? javaChangeTracking.getType() : DEFAULT_TYPE; - } - - - // ********** xml customizer class ref ********** - - /** - * Return <code>null</code> if the XML change tracking does not exists. - */ - protected XmlChangeTracking getXmlChangeTracking() { - return this.getXmlChangeTrackingHolder().getChangeTracking(); - } - - /** - * Build the XML change tracking if it does not exist. - */ - protected XmlChangeTracking getXmlChangeTrackingForUpdate() { - XmlChangeTracking xmlChangeTracking = this.getXmlChangeTracking(); - return (xmlChangeTracking != null) ? xmlChangeTracking : this.buildXmlChangeTracking(); - } - - protected XmlChangeTracking buildXmlChangeTracking() { - XmlChangeTracking xmlChangeTracking = EclipseLinkOrmFactory.eINSTANCE.createXmlChangeTracking(); - this.getXmlChangeTrackingHolder().setChangeTracking(xmlChangeTracking); - return xmlChangeTracking; - } - - protected void removeXmlChangeTrackingIfUnset() { - if (this.getXmlChangeTracking().isUnset()) { - this.removeXmlChangeTracking(); - } - } - - protected void removeXmlChangeTracking() { - this.getXmlChangeTrackingHolder().setChangeTracking(null); - } - - - // ********** misc ********** - - @Override - public EclipseLinkOrmTypeMapping getParent() { - return (EclipseLinkOrmTypeMapping) super.getParent(); - } - - protected EclipseLinkOrmTypeMapping getTypeMapping() { - return this.getParent(); - } - - protected XmlTypeMapping getXmlTypeMapping() { - return this.getTypeMapping().getXmlTypeMapping(); - } - - protected XmlChangeTrackingHolder getXmlChangeTrackingHolder() { - return (XmlChangeTrackingHolder) this.getXmlTypeMapping(); - } - - protected EclipseLinkJavaTypeMapping getJavaTypeMappingForDefaults() { - return this.getTypeMapping().getJavaTypeMappingForDefaults(); - } - - protected EclipseLinkChangeTracking getJavaChangeTrackingForDefaults() { - EclipseLinkJavaTypeMapping javaTypeMapping = this.getJavaTypeMappingForDefaults(); - return (javaTypeMapping == null) ? null : javaTypeMapping.getChangeTracking(); - } - - - // ********** validation ********** - - public TextRange getValidationTextRange() { - TextRange textRange = this.getXmlValidationTextRange(); - return (textRange != null) ? textRange : this.getTypeMapping().getValidationTextRange(); - } - - protected TextRange getXmlValidationTextRange() { - XmlChangeTracking xmlChangeTracking = this.getXmlChangeTracking(); - return (xmlChangeTracking == null) ? null : xmlChangeTracking.getValidationTextRange(); - } -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/orm/OrmEclipseLinkConversionValue.java b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/orm/OrmEclipseLinkConversionValue.java deleted file mode 100644 index e4254a0cef..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/orm/OrmEclipseLinkConversionValue.java +++ /dev/null @@ -1,134 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2008, 2011 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.eclipselink.core.internal.context.orm; - -import java.util.List; -import org.eclipse.jpt.common.core.utility.TextRange; -import org.eclipse.jpt.common.utility.internal.Tools; -import org.eclipse.jpt.jpa.core.internal.context.orm.AbstractOrmXmlContextNode; -import org.eclipse.jpt.jpa.eclipselink.core.context.EclipseLinkConversionValue; -import org.eclipse.jpt.jpa.eclipselink.core.internal.context.java.JavaEclipseLinkConversionValue; -import org.eclipse.jpt.jpa.eclipselink.core.resource.orm.XmlConversionValue; -import org.eclipse.wst.validation.internal.provisional.core.IMessage; -import org.eclipse.wst.validation.internal.provisional.core.IReporter; - -public class OrmEclipseLinkConversionValue - extends AbstractOrmXmlContextNode - implements EclipseLinkConversionValue -{ - private final XmlConversionValue xmlConversionValue; - - private String dataValue; - - private String objectValue; - - - public OrmEclipseLinkConversionValue(OrmEclipseLinkObjectTypeConverter parent, XmlConversionValue xmlConversionValue) { - super(parent); - this.xmlConversionValue = xmlConversionValue; - this.dataValue = xmlConversionValue.getDataValue(); - this.objectValue = xmlConversionValue.getObjectValue(); - } - - - // ********** synchronize/update ********** - - @Override - public void synchronizeWithResourceModel() { - super.synchronizeWithResourceModel(); - this.setDataValue_(this.xmlConversionValue.getDataValue()); - this.setObjectValue_(this.xmlConversionValue.getObjectValue()); - } - - - // ********** data value ********** - - public String getDataValue() { - return this.dataValue; - } - - public void setDataValue(String value) { - this.setDataValue_(value); - this.xmlConversionValue.setDataValue(value); - } - - protected void setDataValue_(String value) { - String old = this.dataValue; - this.dataValue = value; - this.firePropertyChanged(DATA_VALUE_PROPERTY, old, value); - } - - - // ********** object value ********** - - public String getObjectValue() { - return this.objectValue; - } - - public void setObjectValue(String value) { - this.setObjectValue_(value); - this.xmlConversionValue.setObjectValue(value); - } - - protected void setObjectValue_(String value) { - String old = this.objectValue; - this.objectValue = value; - this.firePropertyChanged(OBJECT_VALUE_PROPERTY, old, value); - } - - - // ********** misc ********** - - @Override - public OrmEclipseLinkObjectTypeConverter getParent() { - return (OrmEclipseLinkObjectTypeConverter) super.getParent(); - } - - protected OrmEclipseLinkObjectTypeConverter getObjectTypeConverter() { - return this.getParent(); - } - - public XmlConversionValue getXmlConversionValue() { - return this.xmlConversionValue; - } - - - // ********** validation ********** - - @Override - public void validate(List<IMessage> messages, IReporter reporter) { - super.validate(messages, reporter); - } - - public TextRange getDataValueTextRange() { - return this.getValidationTextRange(this.xmlConversionValue.getDataValueTextRange()); - } - - protected TextRange getObjectValueTextRange() { - return this.getValidationTextRange(this.xmlConversionValue.getObjectValueTextRange()); - } - - public TextRange getValidationTextRange() { - TextRange textRange = this.xmlConversionValue.getValidationTextRange(); - return (textRange != null) ? textRange : this.getObjectTypeConverter().getValidationTextRange(); - } - - public boolean isEquivalentTo(EclipseLinkConversionValue conversionValue) { - return Tools.valuesAreEqual(this.dataValue, conversionValue.getDataValue()) && - Tools.valuesAreEqual(this.objectValue, conversionValue.getObjectValue()); - } - - // ********** validation ********** - - public void convertFrom(JavaEclipseLinkConversionValue value) { - this.setDataValue(value.getDataValue()); - this.setObjectValue(value.getObjectValue()); - } -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/orm/OrmEclipseLinkConvert.java b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/orm/OrmEclipseLinkConvert.java deleted file mode 100644 index 30e6084c70..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/orm/OrmEclipseLinkConvert.java +++ /dev/null @@ -1,188 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2008, 2012 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.eclipselink.core.internal.context.orm; - -import java.util.Arrays; -import org.eclipse.jpt.common.core.utility.TextRange; -import org.eclipse.jpt.common.utility.internal.iterables.CompositeIterable; -import org.eclipse.jpt.jpa.core.context.Converter; -import org.eclipse.jpt.jpa.core.context.orm.OrmAttributeMapping; -import org.eclipse.jpt.jpa.core.context.orm.OrmConverter; -import org.eclipse.jpt.jpa.core.context.orm.OrmXmlContextNodeFactory; -import org.eclipse.jpt.jpa.core.internal.context.JptValidator; -import org.eclipse.jpt.jpa.core.internal.jpa1.context.ConverterTextRangeResolver; -import org.eclipse.jpt.jpa.core.internal.jpa1.context.orm.AbstractOrmConverter; -import org.eclipse.jpt.jpa.core.resource.orm.XmlAttributeMapping; -import org.eclipse.jpt.jpa.eclipselink.core.context.EclipseLinkConvert; -import org.eclipse.jpt.jpa.eclipselink.core.context.persistence.EclipseLinkPersistenceUnit; -import org.eclipse.jpt.jpa.eclipselink.core.internal.context.EclipseLinkConvertValidator; -import org.eclipse.jpt.jpa.eclipselink.core.resource.orm.XmlConvertibleMapping; - -public class OrmEclipseLinkConvert - extends AbstractOrmConverter - implements EclipseLinkConvert -{ - protected String specifiedConverterName; - protected String defaultConverterName; - - public OrmEclipseLinkConvert(OrmAttributeMapping parent, OrmConverter.Owner owner) { - super(parent, owner); - this.specifiedConverterName = this.getXmlConvertibleMapping().getConvert(); - } - - - // ********** synchronize/update ********** - - @Override - public EclipseLinkPersistenceUnit getPersistenceUnit(){ - return (EclipseLinkPersistenceUnit) super.getPersistenceUnit(); - } - - @Override - public void synchronizeWithResourceModel() { - super.synchronizeWithResourceModel(); - this.setSpecifiedConverterName_(this.getXmlConvertibleMapping().getConvert()); - } - - @Override - public void update() { - super.update(); - this.setDefaultConverterName(this.buildDefaultConverterName()); - } - - - // ********** converter name ********** - - public String getConverterName() { - return (this.specifiedConverterName != null) ? this.specifiedConverterName : this.defaultConverterName; - } - - public String getSpecifiedConverterName() { - return this.specifiedConverterName; - } - - public void setSpecifiedConverterName(String name) { - this.setSpecifiedConverterName_(name); - this.getXmlConvertibleMapping().setConvert(name); - } - - protected void setSpecifiedConverterName_(String name) { - String old = this.specifiedConverterName; - this.specifiedConverterName = name; - this.firePropertyChanged(SPECIFIED_CONVERTER_NAME_PROPERTY, old, name); - } - - public String getDefaultConverterName() { - return this.defaultConverterName; - } - - protected void setDefaultConverterName(String name) { - String old = this.defaultConverterName; - this.defaultConverterName = name; - this.firePropertyChanged(DEFAULT_CONVERTER_NAME_PROPERTY, old, name); - } - - protected String buildDefaultConverterName() { - return DEFAULT_CONVERTER_NAME; - } - - - // ********** misc ********** - - protected XmlConvertibleMapping getXmlConvertibleMapping() { - // cast to EclipseLink type - return (XmlConvertibleMapping) super.getXmlAttributeMapping(); - } - - public Class<? extends Converter> getType() { - return EclipseLinkConvert.class; - } - - public void initialize() { - this.specifiedConverterName = ""; //$NON-NLS-1$ - this.getXmlConvertibleMapping().setConvert(this.specifiedConverterName); - } - - - // ********** validation ********** - - @Override - protected TextRange getXmlValidationTextRange() { - return this.getXmlConvertibleMapping().getConvertTextRange(); - } - - // ********** completion proposals ********** - - @Override - public Iterable<String> getXmlCompletionProposals(int pos) { - Iterable<String> result = super.getXmlCompletionProposals(pos); - if (result != null) { - return result; - } - if (this.convertValueTouches(pos)) { - return this.getConverterNames(); - } - return null; - } - - protected boolean convertValueTouches(int pos) { - return this.getXmlConvertibleMapping().convertTouches(pos); - } - - /** - * @return names of the user-defined converters and of reserved converters - */ - @SuppressWarnings("unchecked") - protected Iterable<String> getConverterNames() { - return new CompositeIterable<String>( - this.getPersistenceUnit().getUniqueConverterNames(), - Arrays.asList(EclipseLinkConvert.RESERVED_CONVERTER_NAMES)); - } - - // ********** adapter ********** - - public static class Adapter - implements OrmConverter.Adapter, OrmConverter.Owner - { - private static final Adapter INSTANCE = new Adapter(); - public static Adapter instance() { - return INSTANCE; - } - - private Adapter() { - super(); - } - - public Class<? extends Converter> getConverterType() { - return EclipseLinkConvert.class; - } - - public OrmConverter buildConverter(OrmAttributeMapping parent, OrmXmlContextNodeFactory factory) { - XmlConvertibleMapping xmlMapping = (XmlConvertibleMapping) parent.getXmlAttributeMapping(); - return (xmlMapping.getConvert() == null) ? null : new OrmEclipseLinkConvert(parent, this); - } - - public boolean isActive(XmlAttributeMapping xmlMapping) { - return ((XmlConvertibleMapping) xmlMapping).getConvert() != null; - } - - public OrmConverter buildNewConverter(OrmAttributeMapping parent, OrmXmlContextNodeFactory factory) { - return new OrmEclipseLinkConvert(parent, this); - } - - public void clearXmlValue(XmlAttributeMapping xmlMapping) { - ((XmlConvertibleMapping) xmlMapping).setConvert(null); - } - - public JptValidator buildValidator(Converter converter, ConverterTextRangeResolver textRangeResolver) { - return new EclipseLinkConvertValidator((EclipseLinkConvert) converter, textRangeResolver); - } - } -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/orm/OrmEclipseLinkConverter.java b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/orm/OrmEclipseLinkConverter.java deleted file mode 100644 index 7e229197e5..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/orm/OrmEclipseLinkConverter.java +++ /dev/null @@ -1,166 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2008, 2011 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.eclipselink.core.internal.context.orm; - -import java.util.List; -import org.eclipse.jdt.core.IPackageFragment; -import org.eclipse.jdt.core.IType; -import org.eclipse.jpt.common.core.utility.TextRange; -import org.eclipse.jpt.common.utility.internal.ArrayTools; -import org.eclipse.jpt.common.utility.internal.StringTools; -import org.eclipse.jpt.common.utility.internal.Tools; -import org.eclipse.jpt.jpa.core.context.JpaNamedContextNode; -import org.eclipse.jpt.jpa.core.context.XmlContextNode; -import org.eclipse.jpt.jpa.core.internal.context.orm.AbstractOrmXmlContextNode; -import org.eclipse.jpt.jpa.eclipselink.core.context.EclipseLinkConvert; -import org.eclipse.jpt.jpa.eclipselink.core.context.EclipseLinkConverter; -import org.eclipse.jpt.jpa.eclipselink.core.context.persistence.EclipseLinkPersistenceUnit; -import org.eclipse.jpt.jpa.eclipselink.core.internal.DefaultEclipseLinkJpaValidationMessages; -import org.eclipse.jpt.jpa.eclipselink.core.internal.EclipseLinkJpaValidationMessages; -import org.eclipse.jpt.jpa.eclipselink.core.internal.context.java.JavaEclipseLinkConverter; -import org.eclipse.jpt.jpa.eclipselink.core.resource.orm.XmlNamedConverter; -import org.eclipse.text.edits.ReplaceEdit; -import org.eclipse.wst.validation.internal.provisional.core.IMessage; -import org.eclipse.wst.validation.internal.provisional.core.IReporter; - -public abstract class OrmEclipseLinkConverter<X extends XmlNamedConverter> - extends AbstractOrmXmlContextNode - implements EclipseLinkConverter -{ - protected final X xmlConverter; - - protected String name; - - - protected OrmEclipseLinkConverter(XmlContextNode parent, X xmlConverter) { - super(parent); - this.xmlConverter = xmlConverter; - this.name = xmlConverter.getName(); - } - - - // ********** synchronize/update ********** - - @Override - public void synchronizeWithResourceModel() { - super.synchronizeWithResourceModel(); - this.setName_(this.xmlConverter.getName()); - } - - @Override - public void update() { - super.update(); - } - - - // ********** name ********** - - public String getName() { - return this.name; - } - - public void setName(String name) { - this.setName_(name); - this.xmlConverter.setName(name); - } - - protected void setName_(String name) { - String old = this.name; - this.name = name; - this.firePropertyChanged(NAME_PROPERTY, old, name); - } - - - // ********** misc ********** - - @Override - public XmlContextNode getParent() { - return (XmlContextNode) super.getParent(); - } - - public X getXmlConverter() { - return this.xmlConverter; - } - - @Override - public EclipseLinkPersistenceUnit getPersistenceUnit() { - return (EclipseLinkPersistenceUnit) super.getPersistenceUnit(); - } - - public char getEnclosingTypeSeparator() { - return '$'; - } - - - // ********** refactoring ********** - - public abstract Iterable<ReplaceEdit> createRenameTypeEdits(IType originalType, String newName); - - public abstract Iterable<ReplaceEdit> createMoveTypeEdits(IType originalType, IPackageFragment newPackage); - - public abstract Iterable<ReplaceEdit> createRenamePackageEdits(IPackageFragment originalPackage, String newName); - - - // ********** validation ********** - - @Override - public void validate(List<IMessage> messages, IReporter reporter) { - super.validate(messages, reporter); - this.validateName(messages); - } - - protected void validateName(List<IMessage> messages) { - if (StringTools.stringIsEmpty(this.name)) { - messages.add( - DefaultEclipseLinkJpaValidationMessages.buildMessage( - IMessage.HIGH_SEVERITY, - EclipseLinkJpaValidationMessages.CONVERTER_NAME_UNDEFINED, - EMPTY_STRING_ARRAY, - this, - this.getNameTextRange() - ) - ); - return; - } - - if (ArrayTools.contains(EclipseLinkConvert.RESERVED_CONVERTER_NAMES, this.name)) { - messages.add( - DefaultEclipseLinkJpaValidationMessages.buildMessage( - IMessage.HIGH_SEVERITY, - EclipseLinkJpaValidationMessages.RESERVED_CONVERTER_NAME, - EMPTY_STRING_ARRAY, - this, - this.getNameTextRange() - ) - ); - } - } - - public TextRange getValidationTextRange() { - TextRange textRange = this.xmlConverter.getValidationTextRange(); - return (textRange != null) ? textRange : this.getParent().getValidationTextRange(); - } - - public TextRange getNameTextRange() { - return this.getValidationTextRange(this.xmlConverter.getNameTextRange()); - } - - public boolean isEquivalentTo(JpaNamedContextNode node) { - return (this != node) && - (this.getType() == node.getType()) && - Tools.valuesAreEqual(this.name, node.getName()); - } - - // ********** metadata conversion ********** - - public void convertFrom(JavaEclipseLinkConverter<?> javaConverter) { - this.setName(javaConverter.getName()); - } -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/orm/OrmEclipseLinkConverterClassConverter.java b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/orm/OrmEclipseLinkConverterClassConverter.java deleted file mode 100644 index 349a25572b..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/orm/OrmEclipseLinkConverterClassConverter.java +++ /dev/null @@ -1,224 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2011, 2012 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.eclipselink.core.internal.context.orm; - -import java.util.List; -import org.eclipse.jdt.core.IPackageFragment; -import org.eclipse.jdt.core.IType; -import org.eclipse.jpt.common.core.internal.utility.JDTTools; -import org.eclipse.jpt.common.core.resource.java.JavaResourceAbstractType; -import org.eclipse.jpt.common.core.utility.TextRange; -import org.eclipse.jpt.common.utility.internal.StringTools; -import org.eclipse.jpt.common.utility.internal.Tools; -import org.eclipse.jpt.common.utility.internal.iterables.EmptyIterable; -import org.eclipse.jpt.common.utility.internal.iterables.SingleElementIterable; -import org.eclipse.jpt.jpa.core.context.JpaNamedContextNode; -import org.eclipse.jpt.jpa.core.context.XmlContextNode; -import org.eclipse.jpt.jpa.eclipselink.core.context.EclipseLinkConverterClassConverter; -import org.eclipse.jpt.jpa.eclipselink.core.internal.DefaultEclipseLinkJpaValidationMessages; -import org.eclipse.jpt.jpa.eclipselink.core.internal.EclipseLinkJpaValidationMessages; -import org.eclipse.jpt.jpa.eclipselink.core.resource.orm.XmlNamedConverter; -import org.eclipse.text.edits.ReplaceEdit; -import org.eclipse.wst.validation.internal.provisional.core.IMessage; -import org.eclipse.wst.validation.internal.provisional.core.IReporter; - -public abstract class OrmEclipseLinkConverterClassConverter<X extends XmlNamedConverter> - extends OrmEclipseLinkConverter<X> - implements EclipseLinkConverterClassConverter -{ - private String converterClass; - private String fullyQualifiedConverterClass; - - - public OrmEclipseLinkConverterClassConverter(XmlContextNode parent, X xmlConverter) { - super(parent, xmlConverter); - this.converterClass = this.getXmlConverterClass(); - } - - - // ********** synchronize/update ********** - - @Override - public void synchronizeWithResourceModel() { - super.synchronizeWithResourceModel(); - this.setConverterClass_(this.getXmlConverterClass()); - } - - @Override - public void update() { - super.update(); - this.setFullyQualifiedConverterClass(this.buildFullyQualifiedConverterClass()); - } - - // ********** converter class ********** - - public String getConverterClass() { - return this.converterClass; - } - - public void setConverterClass(String converterClass) { - this.setConverterClass_(converterClass); - this.setXmlConverterClass(converterClass); - } - - protected void setConverterClass_(String newConverterClass) { - String oldConverterClass = this.converterClass; - this.converterClass = newConverterClass; - this.firePropertyChanged(CONVERTER_CLASS_PROPERTY, oldConverterClass, newConverterClass); - } - - public String getFullyQualifiedConverterClass() { - return this.fullyQualifiedConverterClass; - } - - protected void setFullyQualifiedConverterClass(String converterClass) { - String old = this.fullyQualifiedConverterClass; - this.fullyQualifiedConverterClass = converterClass; - this.firePropertyChanged(FULLY_QUALIFIED_CONVERTER_CLASS_PROPERTY, old, converterClass); - } - - protected String buildFullyQualifiedConverterClass() { - return this.getMappingFileRoot().getFullyQualifiedName(this.converterClass); - } - - protected JavaResourceAbstractType getConverterJavaResourceType() { - if (this.fullyQualifiedConverterClass == null) { - return null; - } - return this.getJpaProject().getJavaResourceType(this.fullyQualifiedConverterClass); - } - - protected abstract String getXmlConverterClass(); - - protected abstract void setXmlConverterClass(String converterClass); - - - // ********** validation ********** - - @Override - public void validate(List<IMessage> messages, IReporter reporter) { - super.validate(messages, reporter); - this.validateConverterClass(messages); - } - - protected void validateConverterClass(List<IMessage> messages) { - if (StringTools.stringIsEmpty(this.converterClass)) { - messages.add( - DefaultEclipseLinkJpaValidationMessages.buildMessage( - IMessage.HIGH_SEVERITY, - EclipseLinkJpaValidationMessages.CONVERTER_CLASS_DEFINED, - this, - this.getConverterClassTextRange() - ) - ); - return; - } - - IType converterJdtType = JDTTools.findType(this.getJavaProject(), this.getFullyQualifiedConverterClass()); - if (converterJdtType == null) { - messages.add( - DefaultEclipseLinkJpaValidationMessages.buildMessage( - IMessage.HIGH_SEVERITY, - EclipseLinkJpaValidationMessages.CONVERTER_CLASS_EXISTS, - new String[] {this.getFullyQualifiedConverterClass()}, - this, - this.getConverterClassTextRange() - ) - ); - return; - } - - if ( ! this.converterClassImplementsInterface(this.getEclipseLinkConverterInterface())) { - messages.add( - DefaultEclipseLinkJpaValidationMessages.buildMessage( - IMessage.HIGH_SEVERITY, - this.getEclipseLinkConverterInterfaceErrorMessage(), - new String[] {this.getFullyQualifiedConverterClass()}, - this, - this.getConverterClassTextRange() - ) - ); - } - } - - /** - * Return the name of the EclipseLink interface the converter class must - * implement. - */ - protected abstract String getEclipseLinkConverterInterface(); - - protected abstract String getEclipseLinkConverterInterfaceErrorMessage(); - - /** - * Add <code>null</code> check. - */ - protected boolean typeImplementsInterface(String typeName, String interfaceName) { - return (typeName != null) && - JDTTools.typeIsSubType(this.getJavaProject(), typeName, interfaceName); - } - - protected boolean converterClassImplementsInterface(String interfaceName) { - return this.typeImplementsInterface(this.getFullyQualifiedConverterClass(), interfaceName); - } - - protected TextRange getConverterClassTextRange() { - return this.getValidationTextRange(this.getXmlConverterClassTextRange()); - } - - protected abstract TextRange getXmlConverterClassTextRange(); - - - @Override - public boolean isEquivalentTo(JpaNamedContextNode node) { - return super.isEquivalentTo(node) - && this.isEquivalentTo((EclipseLinkConverterClassConverter) node); - } - - protected boolean isEquivalentTo(EclipseLinkConverterClassConverter converter) { - return Tools.valuesAreEqual(this.getFullyQualifiedConverterClass(), converter.getFullyQualifiedConverterClass()); - } - - // ********** refactoring ********** - - @Override - public Iterable<ReplaceEdit> createRenameTypeEdits(IType originalType, String newName) { - return this.isFor(originalType.getFullyQualifiedName('.')) ? - new SingleElementIterable<ReplaceEdit>(this.createRenameEdit(originalType, newName)) : - EmptyIterable.<ReplaceEdit>instance(); - } - - protected abstract ReplaceEdit createRenameEdit(IType originalType, String newName); - - @Override - public Iterable<ReplaceEdit> createMoveTypeEdits(IType originalType, IPackageFragment newPackage) { - return this.isFor(originalType.getFullyQualifiedName('.')) ? - new SingleElementIterable<ReplaceEdit>(this.createRenamePackageEdit(newPackage.getElementName())) : - EmptyIterable.<ReplaceEdit>instance(); - } - - protected abstract ReplaceEdit createRenamePackageEdit(String newName); - - @Override - public Iterable<ReplaceEdit> createRenamePackageEdits(IPackageFragment originalPackage, String newName) { - return this.isIn(originalPackage) ? - new SingleElementIterable<ReplaceEdit>(this.createRenamePackageEdit(newName)) : - EmptyIterable.<ReplaceEdit>instance(); - } - - protected boolean isFor(String typeName) { - String converterType = this.getFullyQualifiedConverterClass(); - return (converterType != null) && converterType.equals(typeName); - } - - protected boolean isIn(IPackageFragment packageFragment) { - JavaResourceAbstractType converterType = this.getConverterJavaResourceType(); - return (converterType != null) && converterType.isIn(packageFragment); - } -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/orm/OrmEclipseLinkConverterContainerImpl.java b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/orm/OrmEclipseLinkConverterContainerImpl.java deleted file mode 100644 index 34f83c63ad..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/orm/OrmEclipseLinkConverterContainerImpl.java +++ /dev/null @@ -1,624 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2008, 2011 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.eclipselink.core.internal.context.orm; - -import java.util.List; -import org.eclipse.jdt.core.IPackageFragment; -import org.eclipse.jdt.core.IType; -import org.eclipse.jpt.common.core.utility.TextRange; -import org.eclipse.jpt.common.utility.internal.iterables.CompositeIterable; -import org.eclipse.jpt.common.utility.internal.iterables.ListIterable; -import org.eclipse.jpt.common.utility.internal.iterables.LiveCloneListIterable; -import org.eclipse.jpt.common.utility.internal.iterables.TransformationIterable; -import org.eclipse.jpt.jpa.core.context.XmlContextNode; -import org.eclipse.jpt.jpa.core.internal.context.orm.AbstractOrmXmlContextNode; -import org.eclipse.jpt.jpa.eclipselink.core.context.EclipseLinkConverter; -import org.eclipse.jpt.jpa.eclipselink.core.context.EclipseLinkCustomConverter; -import org.eclipse.jpt.jpa.eclipselink.core.context.EclipseLinkObjectTypeConverter; -import org.eclipse.jpt.jpa.eclipselink.core.context.EclipseLinkStructConverter; -import org.eclipse.jpt.jpa.eclipselink.core.context.EclipseLinkTypeConverter; -import org.eclipse.jpt.jpa.eclipselink.core.context.orm.OrmEclipseLinkConverterContainer; -import org.eclipse.jpt.jpa.eclipselink.core.resource.orm.EclipseLinkOrmFactory; -import org.eclipse.jpt.jpa.eclipselink.core.resource.orm.XmlConverter; -import org.eclipse.jpt.jpa.eclipselink.core.resource.orm.XmlConverterContainer; -import org.eclipse.jpt.jpa.eclipselink.core.resource.orm.XmlObjectTypeConverter; -import org.eclipse.jpt.jpa.eclipselink.core.resource.orm.XmlStructConverter; -import org.eclipse.jpt.jpa.eclipselink.core.resource.orm.XmlTypeConverter; -import org.eclipse.text.edits.ReplaceEdit; -import org.eclipse.wst.validation.internal.provisional.core.IMessage; -import org.eclipse.wst.validation.internal.provisional.core.IReporter; - -public class OrmEclipseLinkConverterContainerImpl - extends AbstractOrmXmlContextNode - implements OrmEclipseLinkConverterContainer -{ - - private final Owner owner; - private final XmlConverterContainer xmlConverterContainer; - - protected final ContextListContainer<OrmEclipseLinkCustomConverter, XmlConverter> customConverterContainer; - protected final ContextListContainer<OrmEclipseLinkObjectTypeConverter, XmlObjectTypeConverter> objectTypeConverterContainer; - protected final ContextListContainer<OrmEclipseLinkStructConverter, XmlStructConverter> structConverterContainer; - protected final ContextListContainer<OrmEclipseLinkTypeConverter, XmlTypeConverter> typeConverterContainer; - - - public OrmEclipseLinkConverterContainerImpl(XmlContextNode parent, Owner owner, XmlConverterContainer xmlConverterContainer) { - super(parent); - this.owner = owner; - this.xmlConverterContainer = xmlConverterContainer; - - this.customConverterContainer = this.buildCustomConverterContainer(); - this.objectTypeConverterContainer = this.buildObjectTypeConverterContainer(); - this.structConverterContainer = this.buildStructConverterContainer(); - this.typeConverterContainer = this.buildTypeConverterContainer(); - } - - - // ********** synchronize/update ********** - - @Override - public void synchronizeWithResourceModel() { - super.synchronizeWithResourceModel(); - this.syncCustomConverters(); - this.syncObjectTypeConverters(); - this.syncStructConverters(); - this.syncTypeConverters(); - } - - @Override - public void update() { - super.update(); - this.updateNodes(this.getCustomConverters()); - this.updateNodes(this.getObjectTypeConverters()); - this.updateNodes(this.getStructConverters()); - this.updateNodes(this.getTypeConverters()); - } - - - // ********** custom converters ********** - - public ListIterable<OrmEclipseLinkCustomConverter> getCustomConverters() { - return this.customConverterContainer.getContextElements(); - } - - public int getCustomConvertersSize() { - return this.customConverterContainer.getContextElementsSize(); - } - - public OrmEclipseLinkCustomConverter addCustomConverter() { - return this.addCustomConverter(this.getCustomConvertersSize()); - } - - public OrmEclipseLinkCustomConverter addCustomConverter(int index) { - XmlConverter xmlConverter = this.buildXmlCustomConverter(); - OrmEclipseLinkCustomConverter converter = this.customConverterContainer.addContextElement(index, xmlConverter); - this.xmlConverterContainer.getConverters().add(index, xmlConverter); - return converter; - } - - protected XmlConverter buildXmlCustomConverter() { - return EclipseLinkOrmFactory.eINSTANCE.createXmlConverter(); - } - - public void removeCustomConverter(EclipseLinkCustomConverter converter) { - this.removeCustomConverter(this.customConverterContainer.indexOfContextElement((OrmEclipseLinkCustomConverter) converter)); - } - - public void removeCustomConverter(int index) { - this.customConverterContainer.removeContextElement(index); - this.xmlConverterContainer.getConverters().remove(index); - } - - public void moveCustomConverter(int targetIndex, int sourceIndex) { - this.customConverterContainer.moveContextElement(targetIndex, sourceIndex); - this.xmlConverterContainer.getConverters().move(targetIndex, sourceIndex); - } - - protected OrmEclipseLinkCustomConverter buildCustomConverter(XmlConverter xmlConverter) { - return new OrmEclipseLinkCustomConverter(this, xmlConverter); - } - - protected void syncCustomConverters() { - this.customConverterContainer.synchronizeWithResourceModel(); - } - - protected ListIterable<XmlConverter> getXmlCustomConverters() { - // clone to reduce chance of concurrency problems - return new LiveCloneListIterable<XmlConverter>(this.xmlConverterContainer.getConverters()); - } - - protected ContextListContainer<OrmEclipseLinkCustomConverter, XmlConverter> buildCustomConverterContainer() { - CustomConverterContainer container = new CustomConverterContainer(); - container.initialize(); - return container; - } - - /** - * custom converter container - */ - protected class CustomConverterContainer - extends ContextListContainer<OrmEclipseLinkCustomConverter, XmlConverter> - { - @Override - protected String getContextElementsPropertyName() { - return CUSTOM_CONVERTERS_LIST; - } - @Override - protected OrmEclipseLinkCustomConverter buildContextElement(XmlConverter resourceElement) { - return OrmEclipseLinkConverterContainerImpl.this.buildCustomConverter(resourceElement); - } - @Override - protected ListIterable<XmlConverter> getResourceElements() { - return OrmEclipseLinkConverterContainerImpl.this.getXmlCustomConverters(); - } - @Override - protected XmlConverter getResourceElement(OrmEclipseLinkCustomConverter contextElement) { - return contextElement.getXmlConverter(); - } - } - - - // ********** object type converters ********** - - public ListIterable<OrmEclipseLinkObjectTypeConverter> getObjectTypeConverters() { - return this.objectTypeConverterContainer.getContextElements(); - } - - public int getObjectTypeConvertersSize() { - return this.objectTypeConverterContainer.getContextElementsSize(); - } - - public OrmEclipseLinkObjectTypeConverter addObjectTypeConverter() { - return this.addObjectTypeConverter(this.getObjectTypeConvertersSize()); - } - - public OrmEclipseLinkObjectTypeConverter addObjectTypeConverter(int index) { - XmlObjectTypeConverter xmlConverter = this.buildXmlObjectTypeConverter(); - OrmEclipseLinkObjectTypeConverter converter = this.objectTypeConverterContainer.addContextElement(index, xmlConverter); - this.xmlConverterContainer.getObjectTypeConverters().add(index, xmlConverter); - return converter; - } - - protected XmlObjectTypeConverter buildXmlObjectTypeConverter() { - return EclipseLinkOrmFactory.eINSTANCE.createXmlObjectTypeConverter(); - } - - public void removeObjectTypeConverter(EclipseLinkObjectTypeConverter converter) { - this.removeObjectTypeConverter(this.objectTypeConverterContainer.indexOfContextElement((OrmEclipseLinkObjectTypeConverter) converter)); - } - - public void removeObjectTypeConverter(int index) { - this.objectTypeConverterContainer.removeContextElement(index); - this.xmlConverterContainer.getObjectTypeConverters().remove(index); - } - - public void moveObjectTypeConverter(int targetIndex, int sourceIndex) { - this.objectTypeConverterContainer.moveContextElement(targetIndex, sourceIndex); - this.xmlConverterContainer.getObjectTypeConverters().move(targetIndex, sourceIndex); - } - - protected OrmEclipseLinkObjectTypeConverter buildObjectTypeConverter(XmlObjectTypeConverter xmlConverter) { - return new OrmEclipseLinkObjectTypeConverter(this, xmlConverter); - } - - protected void syncObjectTypeConverters() { - this.objectTypeConverterContainer.synchronizeWithResourceModel(); - } - - protected ListIterable<XmlObjectTypeConverter> getXmlObjectTypeConverters() { - // clone to reduce chance of concurrency problems - return new LiveCloneListIterable<XmlObjectTypeConverter>(this.xmlConverterContainer.getObjectTypeConverters()); - } - - protected ContextListContainer<OrmEclipseLinkObjectTypeConverter, XmlObjectTypeConverter> buildObjectTypeConverterContainer() { - ObjectTypeConverterContainer container = new ObjectTypeConverterContainer(); - container.initialize(); - return container; - } - - /** - * object type converter container - */ - protected class ObjectTypeConverterContainer - extends ContextListContainer<OrmEclipseLinkObjectTypeConverter, XmlObjectTypeConverter> - { - @Override - protected String getContextElementsPropertyName() { - return OBJECT_TYPE_CONVERTERS_LIST; - } - @Override - protected OrmEclipseLinkObjectTypeConverter buildContextElement(XmlObjectTypeConverter resourceElement) { - return OrmEclipseLinkConverterContainerImpl.this.buildObjectTypeConverter(resourceElement); - } - @Override - protected ListIterable<XmlObjectTypeConverter> getResourceElements() { - return OrmEclipseLinkConverterContainerImpl.this.getXmlObjectTypeConverters(); - } - @Override - protected XmlObjectTypeConverter getResourceElement(OrmEclipseLinkObjectTypeConverter contextElement) { - return contextElement.getXmlConverter(); - } - } - - // ********** struct converters ********** - - public ListIterable<OrmEclipseLinkStructConverter> getStructConverters() { - return this.structConverterContainer.getContextElements(); - } - - public int getStructConvertersSize() { - return this.structConverterContainer.getContextElementsSize(); - } - - public OrmEclipseLinkStructConverter addStructConverter() { - return this.addStructConverter(this.getStructConvertersSize()); - } - - public OrmEclipseLinkStructConverter addStructConverter(int index) { - XmlStructConverter xmlConverter = this.buildXmlStructConverter(); - OrmEclipseLinkStructConverter converter = this.structConverterContainer.addContextElement(index, xmlConverter); - this.xmlConverterContainer.getStructConverters().add(index, xmlConverter); - return converter; - } - - protected XmlStructConverter buildXmlStructConverter() { - return EclipseLinkOrmFactory.eINSTANCE.createXmlStructConverter(); - } - - public void removeStructConverter(EclipseLinkStructConverter converter) { - this.removeStructConverter(this.structConverterContainer.indexOfContextElement((OrmEclipseLinkStructConverter) converter)); - } - - public void removeStructConverter(int index) { - this.structConverterContainer.removeContextElement(index); - this.xmlConverterContainer.getStructConverters().remove(index); - } - - public void moveStructConverter(int targetIndex, int sourceIndex) { - this.structConverterContainer.moveContextElement(targetIndex, sourceIndex); - this.xmlConverterContainer.getStructConverters().move(targetIndex, sourceIndex); - } - - protected OrmEclipseLinkStructConverter buildStructConverter(XmlStructConverter xmlConverter) { - return new OrmEclipseLinkStructConverter(this, xmlConverter); - } - - protected void syncStructConverters() { - this.structConverterContainer.synchronizeWithResourceModel(); - } - - protected ListIterable<XmlStructConverter> getXmlStructConverters() { - // clone to reduce chance of concurrency problems - return new LiveCloneListIterable<XmlStructConverter>(this.xmlConverterContainer.getStructConverters()); - } - - protected ContextListContainer<OrmEclipseLinkStructConverter, XmlStructConverter> buildStructConverterContainer() { - StructConverterContainer container = new StructConverterContainer(); - container.initialize(); - return container; - } - - /** - * struct converter container - */ - protected class StructConverterContainer - extends ContextListContainer<OrmEclipseLinkStructConverter, XmlStructConverter> - { - @Override - protected String getContextElementsPropertyName() { - return STRUCT_CONVERTERS_LIST; - } - @Override - protected OrmEclipseLinkStructConverter buildContextElement(XmlStructConverter resourceElement) { - return OrmEclipseLinkConverterContainerImpl.this.buildStructConverter(resourceElement); - } - @Override - protected ListIterable<XmlStructConverter> getResourceElements() { - return OrmEclipseLinkConverterContainerImpl.this.getXmlStructConverters(); - } - @Override - protected XmlStructConverter getResourceElement(OrmEclipseLinkStructConverter contextElement) { - return contextElement.getXmlConverter(); - } - } - - - // ********** type converters ********** - - public ListIterable<OrmEclipseLinkTypeConverter> getTypeConverters() { - return this.typeConverterContainer.getContextElements(); - } - - public int getTypeConvertersSize() { - return this.typeConverterContainer.getContextElementsSize(); - } - - public OrmEclipseLinkTypeConverter addTypeConverter() { - return this.addTypeConverter(this.getTypeConvertersSize()); - } - - public OrmEclipseLinkTypeConverter addTypeConverter(int index) { - XmlTypeConverter xmlConverter = this.buildXmlTypeConverter(); - OrmEclipseLinkTypeConverter converter = this.typeConverterContainer.addContextElement(index, xmlConverter); - this.xmlConverterContainer.getTypeConverters().add(index, xmlConverter); - return converter; - } - - protected XmlTypeConverter buildXmlTypeConverter() { - return EclipseLinkOrmFactory.eINSTANCE.createXmlTypeConverter(); - } - - public void removeTypeConverter(EclipseLinkTypeConverter converter) { - this.removeTypeConverter(this.typeConverterContainer.indexOfContextElement((OrmEclipseLinkTypeConverter) converter)); - } - - public void removeTypeConverter(int index) { - this.typeConverterContainer.removeContextElement(index); - this.xmlConverterContainer.getTypeConverters().remove(index); - } - - public void moveTypeConverter(int targetIndex, int sourceIndex) { - this.typeConverterContainer.moveContextElement(targetIndex, sourceIndex); - this.xmlConverterContainer.getTypeConverters().move(targetIndex, sourceIndex); - } - - protected OrmEclipseLinkTypeConverter buildTypeConverter(XmlTypeConverter xmlConverter) { - return new OrmEclipseLinkTypeConverter(this, xmlConverter); - } - - protected void syncTypeConverters() { - this.typeConverterContainer.synchronizeWithResourceModel(); - } - - protected ListIterable<XmlTypeConverter> getXmlTypeConverters() { - // clone to reduce chance of concurrency problems - return new LiveCloneListIterable<XmlTypeConverter>(this.xmlConverterContainer.getTypeConverters()); - } - - protected ContextListContainer<OrmEclipseLinkTypeConverter, XmlTypeConverter> buildTypeConverterContainer() { - TypeConverterContainer container = new TypeConverterContainer(); - container.initialize(); - return container; - } - - /** - * type converter container - */ - protected class TypeConverterContainer - extends ContextListContainer<OrmEclipseLinkTypeConverter, XmlTypeConverter> - { - @Override - protected String getContextElementsPropertyName() { - return TYPE_CONVERTERS_LIST; - } - @Override - protected OrmEclipseLinkTypeConverter buildContextElement(XmlTypeConverter resourceElement) { - return OrmEclipseLinkConverterContainerImpl.this.buildTypeConverter(resourceElement); - } - @Override - protected ListIterable<XmlTypeConverter> getResourceElements() { - return OrmEclipseLinkConverterContainerImpl.this.getXmlTypeConverters(); - } - @Override - protected XmlTypeConverter getResourceElement(OrmEclipseLinkTypeConverter contextElement) { - return contextElement.getXmlConverter(); - } - } - - - // ********** refactoring ********** - - @SuppressWarnings("unchecked") - public Iterable<ReplaceEdit> createRenameTypeEdits(IType originalType, String newName) { - return new CompositeIterable<ReplaceEdit>( - this.createRenameObjectTypeConverterEdits(originalType, newName), - this.createRenameTypeConverterEdits(originalType, newName), - this.createRenameStructConverterEdits(originalType, newName), - this.createRenameCustomConverterEdits(originalType, newName)); - } - - protected Iterable<ReplaceEdit> createRenameObjectTypeConverterEdits(final IType originalType, final String newName) { - return new CompositeIterable<ReplaceEdit>( - new TransformationIterable<OrmEclipseLinkObjectTypeConverter, Iterable<ReplaceEdit>>(getObjectTypeConverters()) { - @Override - protected Iterable<ReplaceEdit> transform(OrmEclipseLinkObjectTypeConverter objectTypeConverter) { - return objectTypeConverter.createRenameTypeEdits(originalType, newName); - } - } - ); - } - - protected Iterable<ReplaceEdit> createRenameTypeConverterEdits(final IType originalType, final String newName) { - return new CompositeIterable<ReplaceEdit>( - new TransformationIterable<OrmEclipseLinkTypeConverter, Iterable<ReplaceEdit>>(getTypeConverters()) { - @Override - protected Iterable<ReplaceEdit> transform(OrmEclipseLinkTypeConverter typeConverter) { - return typeConverter.createRenameTypeEdits(originalType, newName); - } - } - ); - } - - protected Iterable<ReplaceEdit> createRenameStructConverterEdits(final IType originalType, final String newName) { - return new CompositeIterable<ReplaceEdit>( - new TransformationIterable<OrmEclipseLinkStructConverter, Iterable<ReplaceEdit>>(getStructConverters()) { - @Override - protected Iterable<ReplaceEdit> transform(OrmEclipseLinkStructConverter structConverter) { - return structConverter.createRenameTypeEdits(originalType, newName); - } - } - ); - } - - protected Iterable<ReplaceEdit> createRenameCustomConverterEdits(final IType originalType, final String newName) { - return new CompositeIterable<ReplaceEdit>( - new TransformationIterable<OrmEclipseLinkCustomConverter, Iterable<ReplaceEdit>>(getCustomConverters()) { - @Override - protected Iterable<ReplaceEdit> transform(OrmEclipseLinkCustomConverter customConverter) { - return customConverter.createRenameTypeEdits(originalType, newName); - } - } - ); - } - - @SuppressWarnings("unchecked") - public Iterable<ReplaceEdit> createMoveTypeEdits(IType originalType, IPackageFragment newPackage) { - return new CompositeIterable<ReplaceEdit>( - this.createMoveObjectTypeConverterEdits(originalType, newPackage), - this.createMoveTypeConverterEdits(originalType, newPackage), - this.createMoveStructConverterEdits(originalType, newPackage), - this.createMoveCustomConverterEdits(originalType, newPackage)); - } - - protected Iterable<ReplaceEdit> createMoveObjectTypeConverterEdits(final IType originalType, final IPackageFragment newPackage) { - return new CompositeIterable<ReplaceEdit>( - new TransformationIterable<OrmEclipseLinkObjectTypeConverter, Iterable<ReplaceEdit>>(getObjectTypeConverters()) { - @Override - protected Iterable<ReplaceEdit> transform(OrmEclipseLinkObjectTypeConverter objectTypeConverter) { - return objectTypeConverter.createMoveTypeEdits(originalType, newPackage); - } - } - ); - } - - protected Iterable<ReplaceEdit> createMoveTypeConverterEdits(final IType originalType, final IPackageFragment newPackage) { - return new CompositeIterable<ReplaceEdit>( - new TransformationIterable<OrmEclipseLinkTypeConverter, Iterable<ReplaceEdit>>(getTypeConverters()) { - @Override - protected Iterable<ReplaceEdit> transform(OrmEclipseLinkTypeConverter typeConverter) { - return typeConverter.createMoveTypeEdits(originalType, newPackage); - } - } - ); - } - - protected Iterable<ReplaceEdit> createMoveStructConverterEdits(final IType originalType, final IPackageFragment newPackage) { - return new CompositeIterable<ReplaceEdit>( - new TransformationIterable<OrmEclipseLinkStructConverter, Iterable<ReplaceEdit>>(getStructConverters()) { - @Override - protected Iterable<ReplaceEdit> transform(OrmEclipseLinkStructConverter structConverter) { - return structConverter.createMoveTypeEdits(originalType, newPackage); - } - } - ); - } - - protected Iterable<ReplaceEdit> createMoveCustomConverterEdits(final IType originalType, final IPackageFragment newPackage) { - return new CompositeIterable<ReplaceEdit>( - new TransformationIterable<OrmEclipseLinkCustomConverter, Iterable<ReplaceEdit>>(getCustomConverters()) { - @Override - protected Iterable<ReplaceEdit> transform(OrmEclipseLinkCustomConverter customConverter) { - return customConverter.createMoveTypeEdits(originalType, newPackage); - } - } - ); - } - - - @SuppressWarnings("unchecked") - public Iterable<ReplaceEdit> createRenamePackageEdits(IPackageFragment originalPackage, String newName) { - return new CompositeIterable<ReplaceEdit>( - this.createObjectTypeConverterRenamePackageEdits(originalPackage, newName), - this.createTypeConverterRenamePackageEdits(originalPackage, newName), - this.createStructConverterRenamePackageEdits(originalPackage, newName), - this.createCustomConverterRenamePackageEdits(originalPackage, newName)); - } - - protected Iterable<ReplaceEdit> createObjectTypeConverterRenamePackageEdits(final IPackageFragment originalPackage, final String newName) { - return new CompositeIterable<ReplaceEdit>( - new TransformationIterable<OrmEclipseLinkObjectTypeConverter, Iterable<ReplaceEdit>>(getObjectTypeConverters()) { - @Override - protected Iterable<ReplaceEdit> transform(OrmEclipseLinkObjectTypeConverter objectTypeConverter) { - return objectTypeConverter.createRenamePackageEdits(originalPackage, newName); - } - } - ); - } - - protected Iterable<ReplaceEdit> createTypeConverterRenamePackageEdits(final IPackageFragment originalPackage, final String newName) { - return new CompositeIterable<ReplaceEdit>( - new TransformationIterable<OrmEclipseLinkTypeConverter, Iterable<ReplaceEdit>>(getTypeConverters()) { - @Override - protected Iterable<ReplaceEdit> transform(OrmEclipseLinkTypeConverter typeConverter) { - return typeConverter.createRenamePackageEdits(originalPackage, newName); - } - } - ); - } - - protected Iterable<ReplaceEdit> createStructConverterRenamePackageEdits(final IPackageFragment originalPackage, final String newName) { - return new CompositeIterable<ReplaceEdit>( - new TransformationIterable<OrmEclipseLinkStructConverter, Iterable<ReplaceEdit>>(getStructConverters()) { - @Override - protected Iterable<ReplaceEdit> transform(OrmEclipseLinkStructConverter structConverter) { - return structConverter.createRenamePackageEdits(originalPackage, newName); - } - } - ); - } - - protected Iterable<ReplaceEdit> createCustomConverterRenamePackageEdits(final IPackageFragment originalPackage, final String newName) { - return new CompositeIterable<ReplaceEdit>( - new TransformationIterable<OrmEclipseLinkCustomConverter, Iterable<ReplaceEdit>>(getCustomConverters()) { - @Override - protected Iterable<ReplaceEdit> transform(OrmEclipseLinkCustomConverter customConverter) { - return customConverter.createRenamePackageEdits(originalPackage, newName); - } - } - ); - } - - - // ********** validation ********** - - /** - * The converters are validated in the persistence unit. - * @see org.eclipse.jpt.jpa.eclipselink.core.context.persistence.EclipseLinkPersistenceUnit#validateConverters(List, IReporter) - */ - @Override - public void validate(List<IMessage> messages, IReporter reporter) { - super.validate(messages, reporter); - // converters are validated in the persistence unit - } - - public TextRange getValidationTextRange() { - TextRange textRange = this.xmlConverterContainer.getValidationTextRange(); - return (textRange != null) ? textRange : this.getParent().getValidationTextRange(); - } - - - // ********** misc ********** - - @SuppressWarnings("unchecked") - public Iterable<EclipseLinkConverter> getConverters() { - return new CompositeIterable<EclipseLinkConverter>( - this.getCustomConverters(), - this.getObjectTypeConverters(), - this.getStructConverters(), - this.getTypeConverters() - ); - } - - public int getConvertersSize() { - return this.getCustomConvertersSize() - + this.getObjectTypeConvertersSize() - + this.getStructConvertersSize() - + this.getTypeConvertersSize(); - } - - public int getNumberSupportedConverters() { - return this.owner.getNumberSupportedConverters(); - } - - @Override - public XmlContextNode getParent() { - return (XmlContextNode) super.getParent(); - } -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/orm/OrmEclipseLinkCustomConverter.java b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/orm/OrmEclipseLinkCustomConverter.java deleted file mode 100644 index 88f752362f..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/orm/OrmEclipseLinkCustomConverter.java +++ /dev/null @@ -1,86 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2008, 2012 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.eclipselink.core.internal.context.orm; - -import org.eclipse.jdt.core.IType; -import org.eclipse.jpt.common.core.utility.TextRange; -import org.eclipse.jpt.jpa.core.context.XmlContextNode; -import org.eclipse.jpt.jpa.eclipselink.core.context.EclipseLinkCustomConverter; -import org.eclipse.jpt.jpa.eclipselink.core.internal.EclipseLinkJpaValidationMessages; -import org.eclipse.jpt.jpa.eclipselink.core.internal.context.java.JavaEclipseLinkCustomConverter; -import org.eclipse.jpt.jpa.eclipselink.core.resource.orm.XmlConverter; -import org.eclipse.text.edits.ReplaceEdit; - -public class OrmEclipseLinkCustomConverter - extends OrmEclipseLinkConverterClassConverter<XmlConverter> - implements EclipseLinkCustomConverter -{ - public OrmEclipseLinkCustomConverter(XmlContextNode parent, XmlConverter xmlConverter) { - super(parent, xmlConverter); - } - - - // ********** converter class ********** - - @Override - protected String getXmlConverterClass() { - return this.xmlConverter.getClassName(); - } - - @Override - protected void setXmlConverterClass(String converterClass) { - this.xmlConverter.setClassName(converterClass); - } - - - // ********** misc ********** - - public Class<EclipseLinkCustomConverter> getType() { - return EclipseLinkCustomConverter.class; - } - - - // ********** refactoring ********** - - @Override - protected ReplaceEdit createRenameEdit(IType originalType, String newName) { - return this.xmlConverter.createRenameEdit(originalType, newName); - } - - @Override - protected ReplaceEdit createRenamePackageEdit(String newName) { - return this.xmlConverter.createRenamePackageEdit(newName); - } - - - // ********** validation ********** - - @Override - protected String getEclipseLinkConverterInterface() { - return ECLIPSELINK_CONVERTER_CLASS_NAME; - } - - @Override - protected String getEclipseLinkConverterInterfaceErrorMessage() { - return EclipseLinkJpaValidationMessages.CONVERTER_CLASS_IMPLEMENTS_CONVERTER; - } - - @Override - protected TextRange getXmlConverterClassTextRange() { - return this.xmlConverter.getConverterClassTextRange(); - } - - // ********** metadata conversion ********** - - public void convertFrom(JavaEclipseLinkCustomConverter javaConverter) { - super.convertFrom(javaConverter); - this.setConverterClass(javaConverter.getFullyQualifiedConverterClass()); - } -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/orm/OrmEclipseLinkCustomizer.java b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/orm/OrmEclipseLinkCustomizer.java deleted file mode 100644 index cb71a673f4..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/orm/OrmEclipseLinkCustomizer.java +++ /dev/null @@ -1,319 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2008, 2012 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.eclipselink.core.internal.context.orm; - -import java.util.List; -import org.eclipse.jdt.core.IPackageFragment; -import org.eclipse.jdt.core.IType; -import org.eclipse.jpt.common.core.internal.utility.JDTTools; -import org.eclipse.jpt.common.core.resource.java.JavaResourceAbstractType; -import org.eclipse.jpt.common.core.utility.TextRange; -import org.eclipse.jpt.common.utility.internal.StringTools; -import org.eclipse.jpt.common.utility.internal.iterables.EmptyIterable; -import org.eclipse.jpt.common.utility.internal.iterables.SingleElementIterable; -import org.eclipse.jpt.jpa.core.context.orm.EntityMappings; -import org.eclipse.jpt.jpa.core.internal.context.orm.AbstractOrmXmlContextNode; -import org.eclipse.jpt.jpa.core.resource.orm.OrmFactory; -import org.eclipse.jpt.jpa.core.resource.orm.XmlClassReference; -import org.eclipse.jpt.jpa.core.resource.orm.XmlTypeMapping; -import org.eclipse.jpt.jpa.eclipselink.core.context.EclipseLinkCustomizer; -import org.eclipse.jpt.jpa.eclipselink.core.context.java.EclipseLinkJavaTypeMapping; -import org.eclipse.jpt.jpa.eclipselink.core.context.orm.EclipseLinkOrmTypeMapping; -import org.eclipse.jpt.jpa.eclipselink.core.internal.DefaultEclipseLinkJpaValidationMessages; -import org.eclipse.jpt.jpa.eclipselink.core.internal.EclipseLinkJpaValidationMessages; -import org.eclipse.jpt.jpa.eclipselink.core.internal.context.java.JavaEclipseLinkCustomizer; -import org.eclipse.jpt.jpa.eclipselink.core.resource.orm.XmlCustomizerHolder; -import org.eclipse.text.edits.ReplaceEdit; -import org.eclipse.wst.validation.internal.provisional.core.IMessage; -import org.eclipse.wst.validation.internal.provisional.core.IReporter; - -public class OrmEclipseLinkCustomizer - extends AbstractOrmXmlContextNode - implements EclipseLinkCustomizer -{ - protected String specifiedCustomizerClass; - protected String defaultCustomizerClass; - protected String fullyQualifiedCustomizerClass; - - - public OrmEclipseLinkCustomizer(EclipseLinkOrmTypeMapping parent) { - super(parent); - this.specifiedCustomizerClass = this.buildSpecifiedCustomizerClass(); - } - - - // ********** synchronize/update ********** - - @Override - public void synchronizeWithResourceModel() { - super.synchronizeWithResourceModel(); - this.setSpecifiedCustomizerClass_(this.buildSpecifiedCustomizerClass()); - } - - @Override - public void update() { - super.update(); - this.setDefaultCustomizerClass(this.buildDefaultCustomizerClass()); - this.setFullyQualifiedCustomizerClass(this.buildFullyQualifiedCustomizerClass()); - } - - - // ********** customizer class ********** - - public String getCustomizerClass() { - return (this.specifiedCustomizerClass != null) ? this.specifiedCustomizerClass : this.defaultCustomizerClass; - } - - public String getSpecifiedCustomizerClass() { - return this.specifiedCustomizerClass; - } - - public void setSpecifiedCustomizerClass(String customizerClass) { - if (this.valuesAreDifferent(this.specifiedCustomizerClass, customizerClass)) { - XmlClassReference xmlClassRef = this.getXmlCustomizerClassRefForUpdate(); - this.setSpecifiedCustomizerClass_(customizerClass); - xmlClassRef.setClassName(customizerClass); - this.removeXmlCustomizerClassRefIfUnset(); - } - } - - protected void setSpecifiedCustomizerClass_(String customizerClass) { - String old = this.specifiedCustomizerClass; - this.specifiedCustomizerClass = customizerClass; - this.firePropertyChanged(SPECIFIED_CUSTOMIZER_CLASS_PROPERTY, old, customizerClass); - } - - protected String buildSpecifiedCustomizerClass() { - XmlClassReference xmlClassRef = this.getXmlCustomizerClassRef(); - return (xmlClassRef == null) ? null : xmlClassRef.getClassName(); - } - - public String getDefaultCustomizerClass() { - return this.defaultCustomizerClass; - } - - protected void setDefaultCustomizerClass(String customizerClass) { - String old = this.defaultCustomizerClass; - this.defaultCustomizerClass = customizerClass; - this.firePropertyChanged(DEFAULT_CUSTOMIZER_CLASS_PROPERTY, old, customizerClass); - } - - protected String buildDefaultCustomizerClass() { - JavaEclipseLinkCustomizer javaCustomizer = this.getJavaCustomizerForDefaults(); - return (javaCustomizer == null) ? null : javaCustomizer.getFullyQualifiedCustomizerClass(); - } - - public String getFullyQualifiedCustomizerClass() { - return this.fullyQualifiedCustomizerClass; - } - - protected void setFullyQualifiedCustomizerClass(String customizerClass) { - String old = this.fullyQualifiedCustomizerClass; - this.fullyQualifiedCustomizerClass = customizerClass; - this.firePropertyChanged(FULLY_QUALIFIED_CUSTOMIZER_CLASS_PROPERTY, old, customizerClass); - } - - protected String buildFullyQualifiedCustomizerClass() { - return (this.specifiedCustomizerClass == null) ? - //this is the fully qualified java customizer class name - this.defaultCustomizerClass : - this.getEntityMappings().getFullyQualifiedName(this.specifiedCustomizerClass); - } - - - // ********** xml customizer class ref ********** - - /** - * Return null if the XML class ref does not exists. - */ - protected XmlClassReference getXmlCustomizerClassRef() { - return this.getXmlCustomizerHolder().getCustomizer(); - } - - /** - * Build the XML class ref if it does not exist. - */ - protected XmlClassReference getXmlCustomizerClassRefForUpdate() { - XmlClassReference xmlClassRef = this.getXmlCustomizerClassRef(); - return (xmlClassRef != null) ? xmlClassRef : this.buildXmlCustomizerClassRef(); - } - - protected XmlClassReference buildXmlCustomizerClassRef() { - XmlClassReference ref = OrmFactory.eINSTANCE.createXmlClassReference(); - this.getXmlCustomizerHolder().setCustomizer(ref); - return ref; - } - - protected void removeXmlCustomizerClassRefIfUnset() { - if (this.getXmlCustomizerClassRef().isUnset()) { - this.removeXmlCustomizerClassRef(); - } - } - - protected void removeXmlCustomizerClassRef() { - this.getXmlCustomizerHolder().setCustomizer(null); - } - - protected JavaResourceAbstractType getResourceCustomizerType() { - if (this.fullyQualifiedCustomizerClass == null) { - return null; - } - return this.getJpaProject().getJavaResourceType(this.fullyQualifiedCustomizerClass); - } - - - // ********** misc ********** - - @Override - public EclipseLinkOrmTypeMapping getParent() { - return (EclipseLinkOrmTypeMapping) super.getParent(); - } - - protected EclipseLinkOrmTypeMapping getTypeMapping() { - return this.getParent(); - } - - protected XmlTypeMapping getXmlTypeMapping() { - return this.getTypeMapping().getXmlTypeMapping(); - } - - protected XmlCustomizerHolder getXmlCustomizerHolder() { - return (XmlCustomizerHolder) this.getXmlTypeMapping(); - } - - protected EclipseLinkJavaTypeMapping getJavaTypeMappingForDefaults() { - return this.getTypeMapping().getJavaTypeMappingForDefaults(); - } - - protected JavaEclipseLinkCustomizer getJavaCustomizerForDefaults() { - EclipseLinkJavaTypeMapping javaTypeMapping = this.getJavaTypeMappingForDefaults(); - return (javaTypeMapping == null) ? null : (JavaEclipseLinkCustomizer) javaTypeMapping.getCustomizer(); - } - - protected EntityMappings getEntityMappings() { - return this.getMappingFileRoot(); - } - - protected boolean isFor(String typeName) { - JavaResourceAbstractType customizerType = this.getResourceCustomizerType(); - return (customizerType != null) && customizerType.getQualifiedName().equals(typeName); - } - - protected boolean isIn(IPackageFragment packageFragment) { - JavaResourceAbstractType customizerType = this.getResourceCustomizerType(); - return (customizerType != null) && customizerType.isIn(packageFragment); - } - - public char getCustomizerClassEnclosingTypeSeparator() { - return '$'; - } - - - // ********** refactoring ********** - - public Iterable<ReplaceEdit> createRenameTypeEdits(IType originalType, String newName) { - return this.getXmlCustomizerClassRef() != null && this.isFor(originalType.getFullyQualifiedName('.')) ? - new SingleElementIterable<ReplaceEdit>(this.createRenameTypeEdit(originalType, newName)) : - EmptyIterable.<ReplaceEdit>instance(); - } - - protected ReplaceEdit createRenameTypeEdit(IType originalType, String newName) { - return this.getXmlCustomizerClassRef().createRenameEdit(originalType, newName); - } - - public Iterable<ReplaceEdit> createMoveTypeEdits(IType originalType, IPackageFragment newPackage) { - return this.getXmlCustomizerClassRef() != null && this.isFor(originalType.getFullyQualifiedName('.')) ? - new SingleElementIterable<ReplaceEdit>(this.createRenamePackageEdit(newPackage.getElementName())) : - EmptyIterable.<ReplaceEdit>instance(); - } - - public Iterable<ReplaceEdit> createRenamePackageEdits(IPackageFragment originalPackage, String newName) { - return this.getXmlCustomizerClassRef() != null && this.isIn(originalPackage) ? - new SingleElementIterable<ReplaceEdit>(this.createRenamePackageEdit(newName)) : - EmptyIterable.<ReplaceEdit>instance(); - } - - protected ReplaceEdit createRenamePackageEdit(String newName) { - return this.getXmlCustomizerClassRef().createRenamePackageEdit(newName); - } - - - // ********** validation ********** - - @Override - public void validate(List<IMessage> messages, IReporter reporter) { - super.validate(messages, reporter); - this.validateCustomizerClass(messages); - } - - protected void validateCustomizerClass(List<IMessage> messages) { - if (this.getCustomizerClass() == null) { - return; - } - if (StringTools.stringIsEmpty(this.getCustomizerClass())) { - messages.add( - DefaultEclipseLinkJpaValidationMessages.buildMessage( - IMessage.HIGH_SEVERITY, - EclipseLinkJpaValidationMessages.DESCRIPTOR_CUSTOMIZER_CLASS_NOT_SPECIFIED, - EMPTY_STRING_ARRAY, - this, - this.getValidationTextRange() - ) - ); - return; - } - - IType customizerJdtType = JDTTools.findType(this.getJavaProject(), this.getFullyQualifiedCustomizerClass()); - if (customizerJdtType == null) { - messages.add( - DefaultEclipseLinkJpaValidationMessages.buildMessage( - IMessage.HIGH_SEVERITY, - EclipseLinkJpaValidationMessages.DESCRIPTOR_CUSTOMIZER_CLASS_NOT_EXIST, - new String[] {this.getFullyQualifiedCustomizerClass()}, - this, - this.getValidationTextRange() - ) - ); - return; - } - if (!JDTTools.typeHasPublicZeroArgConstructor(customizerJdtType)) { - messages.add( - DefaultEclipseLinkJpaValidationMessages.buildMessage( - IMessage.HIGH_SEVERITY, - EclipseLinkJpaValidationMessages.DESCRIPTOR_CUSTOMIZER_CLASS_NOT_VALID, - new String[] {this.getFullyQualifiedCustomizerClass()}, - this, - this.getValidationTextRange() - ) - ); - } - if (!JDTTools.typeIsSubType(this.getJavaProject(), customizerJdtType, ECLIPSELINK_DESCRIPTOR_CUSTOMIZER_CLASS_NAME)) { - messages.add( - DefaultEclipseLinkJpaValidationMessages.buildMessage( - IMessage.HIGH_SEVERITY, - EclipseLinkJpaValidationMessages.DESCRIPTOR_CUSTOMIZER_CLASS_IMPLEMENTS_DESCRIPTOR_CUSTOMIZER, - new String[] {this.getFullyQualifiedCustomizerClass()}, - this, - this.getValidationTextRange() - ) - ); - } - } - - public TextRange getValidationTextRange() { - TextRange textRange = this.getXmlValidationTextRange(); - return (textRange != null) ? textRange : this.getTypeMapping().getValidationTextRange(); - } - - protected TextRange getXmlValidationTextRange() { - XmlClassReference xmlClassRef = this.getXmlCustomizerClassRef(); - return (xmlClassRef == null) ? null : xmlClassRef.getClassNameTextRange(); - } -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/orm/OrmEclipseLinkEmbeddableImpl.java b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/orm/OrmEclipseLinkEmbeddableImpl.java deleted file mode 100644 index ae750c9a2d..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/orm/OrmEclipseLinkEmbeddableImpl.java +++ /dev/null @@ -1,288 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2008, 2012 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.eclipselink.core.internal.context.orm; - -import java.util.List; -import org.eclipse.jdt.core.IPackageFragment; -import org.eclipse.jdt.core.IType; -import org.eclipse.jpt.common.core.internal.utility.JDTTools; -import org.eclipse.jpt.common.core.utility.TextRange; -import org.eclipse.jpt.common.utility.internal.NotNullFilter; -import org.eclipse.jpt.common.utility.internal.iterables.CompositeIterable; -import org.eclipse.jpt.common.utility.internal.iterables.FilteringIterable; -import org.eclipse.jpt.common.utility.internal.iterables.TransformationIterable; -import org.eclipse.jpt.jpa.core.context.AttributeMapping; -import org.eclipse.jpt.jpa.core.context.orm.OrmPersistentType; -import org.eclipse.jpt.jpa.core.internal.context.JptValidator; -import org.eclipse.jpt.jpa.core.internal.context.orm.AbstractOrmEmbeddable; -import org.eclipse.jpt.jpa.eclipselink.core.context.EclipseLinkChangeTracking; -import org.eclipse.jpt.jpa.eclipselink.core.context.EclipseLinkConverter; -import org.eclipse.jpt.jpa.eclipselink.core.context.EclipseLinkCustomizer; -import org.eclipse.jpt.jpa.eclipselink.core.context.java.JavaEclipseLinkEmbeddable; -import org.eclipse.jpt.jpa.eclipselink.core.context.orm.OrmEclipseLinkConverterContainer; -import org.eclipse.jpt.jpa.eclipselink.core.context.orm.OrmEclipseLinkEmbeddable; -import org.eclipse.jpt.jpa.eclipselink.core.context.orm.EclipseLinkOrmPersistentType; -import org.eclipse.jpt.jpa.eclipselink.core.internal.DefaultEclipseLinkJpaValidationMessages; -import org.eclipse.jpt.jpa.eclipselink.core.internal.EclipseLinkJpaValidationMessages; -import org.eclipse.jpt.jpa.eclipselink.core.internal.context.EclipseLinkDynamicTypeMappingValidator; -import org.eclipse.jpt.jpa.eclipselink.core.internal.context.EclipseLinkTypeMappingValidator; -import org.eclipse.jpt.jpa.eclipselink.core.resource.orm.XmlEmbeddable; -import org.eclipse.text.edits.ReplaceEdit; -import org.eclipse.wst.validation.internal.provisional.core.IMessage; -import org.eclipse.wst.validation.internal.provisional.core.IReporter; - -/** - * EclipseLink - * <code>orm.xml</code> embeddable type mapping - */ -public class OrmEclipseLinkEmbeddableImpl - extends AbstractOrmEmbeddable<XmlEmbeddable> - implements - OrmEclipseLinkEmbeddable, - OrmEclipseLinkConverterContainer.Owner -{ - protected final OrmEclipseLinkConverterContainer converterContainer; - - protected final OrmEclipseLinkChangeTracking changeTracking; - - protected final OrmEclipseLinkCustomizer customizer; - - - public OrmEclipseLinkEmbeddableImpl(OrmPersistentType parent, XmlEmbeddable xmlEmbeddable) { - super(parent, xmlEmbeddable); - this.converterContainer = this.buildConverterContainer(); - this.changeTracking = this.buildChangeTracking(); - this.customizer = this.buildCustomizer(); - } - - - // ********** synchronize/update ********** - - @Override - public void synchronizeWithResourceModel() { - super.synchronizeWithResourceModel(); - this.converterContainer.synchronizeWithResourceModel(); - this.changeTracking.synchronizeWithResourceModel(); - this.customizer.synchronizeWithResourceModel(); - } - - @Override - public void update() { - super.update(); - this.converterContainer.update(); - this.changeTracking.update(); - this.customizer.update(); - } - - - // ********** converter container ********** - - public OrmEclipseLinkConverterContainer getConverterContainer() { - return this.converterContainer; - } - - protected OrmEclipseLinkConverterContainer buildConverterContainer() { - return new OrmEclipseLinkConverterContainerImpl(this, this, this.getXmlTypeMapping()); - } - - public int getNumberSupportedConverters() { - return Integer.MAX_VALUE; - } - - @SuppressWarnings("unchecked") - public Iterable<EclipseLinkConverter> getConverters() { - return new CompositeIterable<EclipseLinkConverter>( - this.converterContainer.getConverters(), - this.getAttributeMappingConverters() - ); - } - - protected Iterable<EclipseLinkConverter> getAttributeMappingConverters() { - return new FilteringIterable<EclipseLinkConverter>(this.getAttributeMappingConverters_(), NotNullFilter.<EclipseLinkConverter>instance()); - } - - protected Iterable<EclipseLinkConverter> getAttributeMappingConverters_() { - return new CompositeIterable<EclipseLinkConverter>(this.getAttributeMappingConverterLists()); - } - - protected Iterable<Iterable<EclipseLinkConverter>> getAttributeMappingConverterLists() { - return new TransformationIterable<AttributeMapping, Iterable<EclipseLinkConverter>>( - this.getAttributeMappings(), - ATTRIBUTE_MAPPING_CONVERTER_TRANSFORMER - ); - } - - - // ********** change tracking ********** - - public EclipseLinkChangeTracking getChangeTracking() { - return this.changeTracking; - } - - protected OrmEclipseLinkChangeTracking buildChangeTracking() { - return new OrmEclipseLinkChangeTracking(this); - } - - - // ********** customizer ********** - - public EclipseLinkCustomizer getCustomizer() { - return this.customizer; - } - - protected OrmEclipseLinkCustomizer buildCustomizer() { - return new OrmEclipseLinkCustomizer(this); - } - - - // ********** parent class ********** - - @Override - protected String buildSpecifiedParentClass() { - return this.xmlTypeMapping.getParentClass(); - } - - @Override - public void setSpecifiedParentClassInXml(String parentClass) { - this.xmlTypeMapping.setParentClass(parentClass); - } - - - // ********** misc ********** - - @Override - public JavaEclipseLinkEmbeddable getJavaTypeMapping() { - return (JavaEclipseLinkEmbeddable) super.getJavaTypeMapping(); - } - - @Override - public JavaEclipseLinkEmbeddable getJavaTypeMappingForDefaults() { - return (JavaEclipseLinkEmbeddable) super.getJavaTypeMappingForDefaults(); - } - - @Override - public EclipseLinkOrmPersistentType getPersistentType() { - return (EclipseLinkOrmPersistentType) super.getPersistentType(); - } - - public boolean usesPrimaryKeyColumns() { - return false; - } - - public boolean usesPrimaryKeyTenantDiscriminatorColumns() { - return false; - } - - - // ********** refactoring ********** - - @SuppressWarnings("unchecked") - @Override - public Iterable<ReplaceEdit> createRenameTypeEdits(IType originalType, String newName) { - return new CompositeIterable<ReplaceEdit>( - super.createRenameTypeEdits(originalType, newName), - this.createCustomizerRenameTypeEdits(originalType, newName), - this.createConverterHolderRenameTypeEdits(originalType, newName) - ); - } - - protected Iterable<ReplaceEdit> createCustomizerRenameTypeEdits(IType originalType, String newName) { - return this.customizer.createRenameTypeEdits(originalType, newName); - } - - protected Iterable<ReplaceEdit> createConverterHolderRenameTypeEdits(IType originalType, String newName) { - return this.converterContainer.createRenameTypeEdits(originalType, newName); - } - - @Override - @SuppressWarnings("unchecked") - public Iterable<ReplaceEdit> createMoveTypeEdits(IType originalType, IPackageFragment newPackage) { - return new CompositeIterable<ReplaceEdit>( - super.createMoveTypeEdits(originalType, newPackage), - this.createCustomizerMoveTypeEdits(originalType, newPackage), - this.createConverterHolderMoveTypeEdits(originalType, newPackage) - ); - } - - protected Iterable<ReplaceEdit> createCustomizerMoveTypeEdits(IType originalType, IPackageFragment newPackage) { - return this.customizer.createMoveTypeEdits(originalType, newPackage); - } - - protected Iterable<ReplaceEdit> createConverterHolderMoveTypeEdits(IType originalType, IPackageFragment newPackage) { - return this.converterContainer.createMoveTypeEdits(originalType, newPackage); - } - - @Override - @SuppressWarnings("unchecked") - public Iterable<ReplaceEdit> createRenamePackageEdits(IPackageFragment originalPackage, String newName) { - return new CompositeIterable<ReplaceEdit>( - super.createRenamePackageEdits(originalPackage, newName), - this.createCustomizerRenamePackageEdits(originalPackage, newName), - this.createConverterHolderRenamePackageEdits(originalPackage, newName) - ); - } - - protected Iterable<ReplaceEdit> createCustomizerRenamePackageEdits(IPackageFragment originalPackage, String newName) { - return this.customizer.createRenamePackageEdits(originalPackage, newName); - } - - protected Iterable<ReplaceEdit> createConverterHolderRenamePackageEdits(IPackageFragment originalPackage, String newName) { - return this.converterContainer.createRenamePackageEdits(originalPackage, newName); - } - - - // ********** validation ********** - - @Override - public void validate(List<IMessage> messages, IReporter reporter) { - super.validate(messages, reporter); - this.validateParentClass(messages, reporter); - this.customizer.validate(messages, reporter); - this.changeTracking.validate(messages, reporter); - this.converterContainer.validate(messages, reporter); - } - - @Override - protected JptValidator buildTypeMappingValidator() { - if (this.isDynamicType()) { - return new EclipseLinkDynamicTypeMappingValidator(this); - } - return new EclipseLinkTypeMappingValidator(this, getJavaResourceType(), buildTextRangeResolver()); - } - - protected boolean isDynamicType() { - return this.getPersistentType().isDynamic(); - } - - - protected void validateParentClass(List<IMessage> messages, IReporter reporter) { - if (this.specifiedParentClass == null) { - return; - } - if (this.getResolvedParentClass() == null) { - IType jdtType = JDTTools.findType(this.getJavaProject(), this.getFullyQualifiedParentClass()); - if (jdtType == null) { - messages.add( - DefaultEclipseLinkJpaValidationMessages.buildMessage( - IMessage.HIGH_SEVERITY, - EclipseLinkJpaValidationMessages.VIRTUAL_TYPE_PARENT_CLASS_DOES_NOT_EXIST, - new String[] {this.getFullyQualifiedParentClass()}, - this, - this.getParentClassTextRange() - ) - ); - } - } - } - - protected TextRange getParentClassTextRange() { - return this.getValidationTextRange(this.xmlTypeMapping.getParentClassTextRange()); - } -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/orm/OrmEclipseLinkEmbeddedIdMapping.java b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/orm/OrmEclipseLinkEmbeddedIdMapping.java deleted file mode 100644 index 3d9643aa97..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/orm/OrmEclipseLinkEmbeddedIdMapping.java +++ /dev/null @@ -1,93 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2012 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.eclipselink.core.internal.context.orm; - -import java.util.List; -import org.eclipse.jdt.core.IType; -import org.eclipse.jpt.common.core.internal.utility.JDTTools; -import org.eclipse.jpt.common.core.utility.TextRange; -import org.eclipse.jpt.common.utility.internal.StringTools; -import org.eclipse.jpt.jpa.core.context.orm.OrmPersistentAttribute; -import org.eclipse.jpt.jpa.core.internal.jpa1.context.orm.AbstractOrmEmbeddedIdMapping; -import org.eclipse.jpt.jpa.eclipselink.core.context.EclipseLinkAccessType; -import org.eclipse.jpt.jpa.eclipselink.core.internal.DefaultEclipseLinkJpaValidationMessages; -import org.eclipse.jpt.jpa.eclipselink.core.internal.EclipseLinkJpaValidationMessages; -import org.eclipse.jpt.jpa.eclipselink.core.resource.orm.XmlEmbeddedId; -import org.eclipse.wst.validation.internal.provisional.core.IMessage; - -/** - * <code>orm.xml</code> embedded mapping - */ -public class OrmEclipseLinkEmbeddedIdMapping - extends AbstractOrmEmbeddedIdMapping<XmlEmbeddedId> -{ - - public OrmEclipseLinkEmbeddedIdMapping(OrmPersistentAttribute parent, XmlEmbeddedId xmlMapping) { - super(parent, xmlMapping); - } - - - // ********** attribute type ********** - - @Override - protected String buildSpecifiedAttributeType() { - return this.xmlAttributeMapping.getAttributeType(); - } - - @Override - protected void setSpecifiedAttributeTypeInXml(String attributeType) { - this.xmlAttributeMapping.setAttributeType(attributeType); - } - - // ********** validation ********** - - @Override - protected boolean validateTargetEmbeddable(List<IMessage> messages) { - if (this.isVirtualAccess()) { - if (StringTools.stringIsEmpty(this.getAttributeType())) { - messages.add( - DefaultEclipseLinkJpaValidationMessages.buildMessage( - IMessage.HIGH_SEVERITY, - EclipseLinkJpaValidationMessages.VIRTUAL_ATTRIBUTE_NO_ATTRIBUTE_TYPE_SPECIFIED, - new String[] {this.getName()}, - this, - this.getAttributeTypeTextRange() - ) - ); - return false; - } - if (this.getResolvedAttributeType() == null) { - IType jdtType = JDTTools.findType(this.getJavaProject(), this.getFullyQualifiedAttributeType()); - if (jdtType == null) { - messages.add( - DefaultEclipseLinkJpaValidationMessages.buildMessage( - IMessage.HIGH_SEVERITY, - EclipseLinkJpaValidationMessages.VIRTUAL_ATTRIBUTE_ATTRIBUTE_TYPE_DOES_NOT_EXIST, - new String[] {this.getFullyQualifiedAttributeType()}, - this, - this.getAttributeTypeTextRange() - ) - ); - return false; - } - } - } - return super.validateTargetEmbeddable(messages); - } - - protected boolean isVirtualAccess() { - return this.getPersistentAttribute().getAccess() == EclipseLinkAccessType.VIRTUAL; - } - - @Override - protected TextRange getAttributeTypeTextRange() { - return this.getValidationTextRange(this.xmlAttributeMapping.getAttributeTypeTextRange()); - } -}
\ 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/context/orm/OrmEclipseLinkEmbeddedMapping.java b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/orm/OrmEclipseLinkEmbeddedMapping.java deleted file mode 100644 index bbfb4b7073..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/orm/OrmEclipseLinkEmbeddedMapping.java +++ /dev/null @@ -1,92 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2012 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.eclipselink.core.internal.context.orm; - -import java.util.List; -import org.eclipse.jdt.core.IType; -import org.eclipse.jpt.common.core.internal.utility.JDTTools; -import org.eclipse.jpt.common.core.utility.TextRange; -import org.eclipse.jpt.common.utility.internal.StringTools; -import org.eclipse.jpt.jpa.core.context.orm.OrmPersistentAttribute; -import org.eclipse.jpt.jpa.core.internal.jpa1.context.orm.AbstractOrmEmbeddedMapping; -import org.eclipse.jpt.jpa.eclipselink.core.context.EclipseLinkAccessType; -import org.eclipse.jpt.jpa.eclipselink.core.internal.DefaultEclipseLinkJpaValidationMessages; -import org.eclipse.jpt.jpa.eclipselink.core.internal.EclipseLinkJpaValidationMessages; -import org.eclipse.jpt.jpa.eclipselink.core.resource.orm.XmlEmbedded; -import org.eclipse.wst.validation.internal.provisional.core.IMessage; - -/** - * <code>orm.xml</code> embedded mapping - */ -public class OrmEclipseLinkEmbeddedMapping - extends AbstractOrmEmbeddedMapping<XmlEmbedded> -{ - public OrmEclipseLinkEmbeddedMapping(OrmPersistentAttribute parent, XmlEmbedded xmlMapping) { - super(parent, xmlMapping); - } - - - // ********** attribute type ********** - - @Override - protected String buildSpecifiedAttributeType() { - return this.xmlAttributeMapping.getAttributeType(); - } - - @Override - protected void setSpecifiedAttributeTypeInXml(String attributeType) { - this.xmlAttributeMapping.setAttributeType(attributeType); - } - - // ********** validation ********** - - @Override - protected boolean validateTargetEmbeddable(List<IMessage> messages) { - if (this.isVirtualAccess()) { - if (StringTools.stringIsEmpty(this.getAttributeType())) { - messages.add( - DefaultEclipseLinkJpaValidationMessages.buildMessage( - IMessage.HIGH_SEVERITY, - EclipseLinkJpaValidationMessages.VIRTUAL_ATTRIBUTE_NO_ATTRIBUTE_TYPE_SPECIFIED, - new String[] {this.getName()}, - this, - this.getAttributeTypeTextRange() - ) - ); - return false; - } - if (this.getResolvedAttributeType() == null) { - IType jdtType = JDTTools.findType(this.getJavaProject(), this.getFullyQualifiedAttributeType()); - if (jdtType == null) { - messages.add( - DefaultEclipseLinkJpaValidationMessages.buildMessage( - IMessage.HIGH_SEVERITY, - EclipseLinkJpaValidationMessages.VIRTUAL_ATTRIBUTE_ATTRIBUTE_TYPE_DOES_NOT_EXIST, - new String[] {this.getFullyQualifiedAttributeType()}, - this, - this.getAttributeTypeTextRange() - ) - ); - return false; - } - } - } - return super.validateTargetEmbeddable(messages); - } - - protected boolean isVirtualAccess() { - return this.getPersistentAttribute().getAccess() == EclipseLinkAccessType.VIRTUAL; - } - - @Override - protected TextRange getAttributeTypeTextRange() { - return this.getValidationTextRange(this.xmlAttributeMapping.getAttributeTypeTextRange()); - } -}
\ 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/context/orm/OrmEclipseLinkEntityImpl.java b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/orm/OrmEclipseLinkEntityImpl.java deleted file mode 100644 index b4b7872404..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/orm/OrmEclipseLinkEntityImpl.java +++ /dev/null @@ -1,476 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2008, 2012 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.eclipselink.core.internal.context.orm; - -import java.util.List; -import org.eclipse.jdt.core.IPackageFragment; -import org.eclipse.jdt.core.IType; -import org.eclipse.jpt.common.core.internal.utility.JDTTools; -import org.eclipse.jpt.common.core.resource.java.JavaResourceAbstractType; -import org.eclipse.jpt.common.core.resource.java.JavaResourceType; -import org.eclipse.jpt.common.core.utility.TextRange; -import org.eclipse.jpt.common.utility.internal.NotNullFilter; -import org.eclipse.jpt.common.utility.internal.iterables.CompositeIterable; -import org.eclipse.jpt.common.utility.internal.iterables.EmptyIterable; -import org.eclipse.jpt.common.utility.internal.iterables.FilteringIterable; -import org.eclipse.jpt.common.utility.internal.iterables.SingleElementIterable; -import org.eclipse.jpt.common.utility.internal.iterables.TransformationIterable; -import org.eclipse.jpt.jpa.core.context.AttributeMapping; -import org.eclipse.jpt.jpa.core.context.InheritanceType; -import org.eclipse.jpt.jpa.core.context.orm.OrmPersistentType; -import org.eclipse.jpt.jpa.core.internal.context.JptValidator; -import org.eclipse.jpt.jpa.core.internal.context.orm.AbstractOrmEntity; -import org.eclipse.jpt.jpa.core.jpa2.context.orm.OrmCacheable2_0; -import org.eclipse.jpt.jpa.core.jpa2.context.orm.OrmCacheableHolder2_0; -import org.eclipse.jpt.jpa.core.resource.orm.XmlClassReference; -import org.eclipse.jpt.jpa.core.resource.orm.v2_0.XmlCacheable_2_0; -import org.eclipse.jpt.jpa.eclipselink.core.JptJpaEclipseLinkCorePlugin; -import org.eclipse.jpt.jpa.eclipselink.core.context.EclipseLinkChangeTracking; -import org.eclipse.jpt.jpa.eclipselink.core.context.EclipseLinkConverter; -import org.eclipse.jpt.jpa.eclipselink.core.context.EclipseLinkCustomizer; -import org.eclipse.jpt.jpa.eclipselink.core.context.java.JavaEclipseLinkEntity; -import org.eclipse.jpt.jpa.eclipselink.core.context.orm.OrmEclipseLinkCaching; -import org.eclipse.jpt.jpa.eclipselink.core.context.orm.OrmEclipseLinkConverterContainer; -import org.eclipse.jpt.jpa.eclipselink.core.context.orm.OrmEclipseLinkEntity; -import org.eclipse.jpt.jpa.eclipselink.core.context.orm.OrmEclipseLinkMultitenancy2_3; -import org.eclipse.jpt.jpa.eclipselink.core.context.orm.EclipseLinkOrmPersistentType; -import org.eclipse.jpt.jpa.eclipselink.core.internal.DefaultEclipseLinkJpaValidationMessages; -import org.eclipse.jpt.jpa.eclipselink.core.internal.EclipseLinkJpaValidationMessages; -import org.eclipse.jpt.jpa.eclipselink.core.internal.context.EclipseLinkDynamicTypeMappingValidator; -import org.eclipse.jpt.jpa.eclipselink.core.internal.context.EclipseLinkEntityPrimaryKeyValidator; -import org.eclipse.jpt.jpa.eclipselink.core.internal.context.EclipseLinkTypeMappingValidator; -import org.eclipse.jpt.jpa.eclipselink.core.resource.java.EclipseLinkClassExtractorAnnotation2_1; -import org.eclipse.jpt.jpa.eclipselink.core.resource.orm.XmlEntity; -import org.eclipse.text.edits.ReplaceEdit; -import org.eclipse.wst.validation.internal.provisional.core.IMessage; -import org.eclipse.wst.validation.internal.provisional.core.IReporter; - -/** - * EclipseLink - * <code>orm.xml</code> entity type mapping - */ -public class OrmEclipseLinkEntityImpl - extends AbstractOrmEntity<XmlEntity> - implements - OrmEclipseLinkEntity, - OrmEclipseLinkConverterContainer.Owner -{ - protected final OrmEclipseLinkReadOnly readOnly; - - protected final OrmEclipseLinkCustomizer customizer; - - protected final OrmEclipseLinkChangeTracking changeTracking; - - protected final OrmEclipseLinkCaching caching; - - protected final OrmEclipseLinkConverterContainer converterContainer; - - protected final OrmEclipseLinkMultitenancy2_3 multitenancy; - - - public OrmEclipseLinkEntityImpl(OrmPersistentType parent, XmlEntity xmlEntity) { - super(parent, xmlEntity); - this.caching = this.buildCaching(); - this.readOnly = this.buildReadOnly(); - this.converterContainer = this.buildConverterContainer(); - this.changeTracking = this.buildChangeTracking(); - this.customizer = this.buildCustomizer(); - this.multitenancy = this.buildMultitenancy(); - } - - - // ********** synchronize/update ********** - - @Override - public void synchronizeWithResourceModel() { - super.synchronizeWithResourceModel(); - this.caching.synchronizeWithResourceModel(); - this.readOnly.synchronizeWithResourceModel(); - this.converterContainer.synchronizeWithResourceModel(); - this.changeTracking.synchronizeWithResourceModel(); - this.customizer.synchronizeWithResourceModel(); - this.multitenancy.synchronizeWithResourceModel(); - } - - @Override - public void update() { - super.update(); - this.caching.update(); - this.readOnly.update(); - this.converterContainer.update(); - this.changeTracking.update(); - this.customizer.update(); - this.multitenancy.update(); - } - - - // ********** caching ********** - - public OrmEclipseLinkCaching getCaching() { - return this.caching; - } - - protected OrmEclipseLinkCaching buildCaching() { - return new OrmEclipseLinkCachingImpl(this); - } - - - // ********** read only ********** - - public OrmEclipseLinkReadOnly getReadOnly() { - return this.readOnly; - } - - protected OrmEclipseLinkReadOnly buildReadOnly() { - return new OrmEclipseLinkReadOnly(this); - } - - - // ********** converter container ********** - - public OrmEclipseLinkConverterContainer getConverterContainer() { - return this.converterContainer; - } - - protected OrmEclipseLinkConverterContainer buildConverterContainer() { - return new OrmEclipseLinkConverterContainerImpl(this, this, this.xmlTypeMapping); - } - - public int getNumberSupportedConverters() { - return Integer.MAX_VALUE; - } - - @SuppressWarnings("unchecked") - public Iterable<EclipseLinkConverter> getConverters() { - return new CompositeIterable<EclipseLinkConverter>( - this.converterContainer.getConverters(), - this.getAttributeMappingConverters() - ); - } - - protected Iterable<EclipseLinkConverter> getAttributeMappingConverters() { - return new FilteringIterable<EclipseLinkConverter>(this.getAttributeMappingConverters_(), NotNullFilter.<EclipseLinkConverter>instance()); - } - - protected Iterable<EclipseLinkConverter> getAttributeMappingConverters_() { - return new CompositeIterable<EclipseLinkConverter>(this.getAttributeMappingConverterLists()); - } - - protected Iterable<Iterable<EclipseLinkConverter>> getAttributeMappingConverterLists() { - return new TransformationIterable<AttributeMapping, Iterable<EclipseLinkConverter>>( - this.getAttributeMappings(), - ATTRIBUTE_MAPPING_CONVERTER_TRANSFORMER - ); - } - - - // ********** change tracking ********** - - public EclipseLinkChangeTracking getChangeTracking() { - return this.changeTracking; - } - - protected OrmEclipseLinkChangeTracking buildChangeTracking() { - return new OrmEclipseLinkChangeTracking(this); - } - - - // ********** customizer ********** - - public EclipseLinkCustomizer getCustomizer() { - return this.customizer; - } - - protected OrmEclipseLinkCustomizer buildCustomizer() { - return new OrmEclipseLinkCustomizer(this); - } - - - // ********** multitenancy ********** - - public OrmEclipseLinkMultitenancy2_3 getMultitenancy() { - return this.multitenancy; - } - - protected OrmEclipseLinkMultitenancy2_3 buildMultitenancy() { - return this.isEclipseLink2_3Compatible() ? - new OrmEclipseLinkMultitenancyImpl2_3(this) : - new NullOrmEclipseLinkMultitenancy2_3(this); - } - - protected boolean isEclipseLink2_3Compatible() { - return JptJpaEclipseLinkCorePlugin.nodeIsEclipseLink2_3Compatible(this); - } - - public boolean isMultitenantMetadataAllowed() { - return this.isRootEntity() || this.isInheritanceStrategyTablePerClass(); - } - - protected boolean isInheritanceStrategyTablePerClass() { - return this.getInheritanceStrategy() == InheritanceType.TABLE_PER_CLASS; - } - - - // ********** parent class ********** - - @Override - protected String buildSpecifiedParentClass() { - return this.xmlTypeMapping.getParentClass(); - } - - @Override - public void setSpecifiedParentClassInXml(String parentClass) { - this.xmlTypeMapping.setParentClass(parentClass); - } - - - // ********** misc ********** - - @Override - public JavaEclipseLinkEntity getJavaTypeMapping() { - return (JavaEclipseLinkEntity) super.getJavaTypeMapping(); - } - - @Override - public JavaEclipseLinkEntity getJavaTypeMappingForDefaults() { - return (JavaEclipseLinkEntity) super.getJavaTypeMappingForDefaults(); - } - - @Override - public EclipseLinkOrmPersistentType getPersistentType() { - return (EclipseLinkOrmPersistentType) super.getPersistentType(); - } - - public boolean usesPrimaryKeyColumns() { - return (this.getXmlTypeMapping().getPrimaryKey() != null) - || this.usesJavaPrimaryKeyColumns(); - } - - protected boolean usesJavaPrimaryKeyColumns() { - JavaEclipseLinkEntity javaEntity = this.getJavaTypeMappingForDefaults(); - return (javaEntity != null) && javaEntity.usesPrimaryKeyColumns(); - } - - public boolean usesPrimaryKeyTenantDiscriminatorColumns() { - return getMultitenancy().usesPrimaryKeyTenantDiscriminatorColumns(); - } - - @Override - protected boolean buildSpecifiedDiscriminatorColumnIsAllowed() { - return super.buildSpecifiedDiscriminatorColumnIsAllowed() && ! this.classExtractorIsUsed(); - } - - protected boolean classExtractorIsUsed() { - return (this.getXmlClassExtractor() != null) || (this.getClassExtractorAnnotation() != null); - } - - protected XmlClassReference getXmlClassExtractor() { - return this.getXmlTypeMapping().getClassExtractor(); - } - - protected EclipseLinkClassExtractorAnnotation2_1 getClassExtractorAnnotation() { - if (this.getJavaTypeMappingForDefaults() != null) { - JavaResourceType jrpt = this.getJavaPersistentType().getJavaResourceType(); - return (EclipseLinkClassExtractorAnnotation2_1) jrpt.getAnnotation(EclipseLinkClassExtractorAnnotation2_1.ANNOTATION_NAME); - } - return null; - } - - public OrmCacheable2_0 getCacheable() { - return this.getCacheableHolder().getCacheable(); - } - - public boolean calculateDefaultCacheable() { - return this.getCacheableHolder().calculateDefaultCacheable(); - } - - protected OrmCacheableHolder2_0 getCacheableHolder() { - return (OrmCacheableHolder2_0) this.caching; - } - - public XmlCacheable_2_0 getXmlCacheable() { - return this.getXmlTypeMapping(); - } - - protected JavaResourceAbstractType getResourceClassExtractorType() { - XmlClassReference classExtractorClassRef = this.getXmlClassExtractor(); - if (classExtractorClassRef == null) { - return null; - } - - String className = classExtractorClassRef.getClassName(); - if (className == null) { - return null; - } - - return this.getMappingFileRoot().resolveJavaResourceType(className); - } - - protected boolean classExtractorIsFor(String typeName) { - JavaResourceAbstractType classExtractorType = this.getResourceClassExtractorType(); - return (classExtractorType != null) && classExtractorType.getQualifiedName().equals(typeName); - } - - protected boolean classExtractorIsIn(IPackageFragment packageFragment) { - JavaResourceAbstractType classExtractorType = this.getResourceClassExtractorType(); - return (classExtractorType != null) && classExtractorType.isIn(packageFragment); - } - - - // ********** refactoring ********** - - @Override - @SuppressWarnings("unchecked") - public Iterable<ReplaceEdit> createRenameTypeEdits(IType originalType, String newName) { - return new CompositeIterable<ReplaceEdit>( - super.createRenameTypeEdits(originalType, newName), - this.createCustomizerRenameTypeEdits(originalType, newName), - this.createConverterHolderRenameTypeEdits(originalType, newName), - this.createClassExtractorRenameTypeEdits(originalType, newName) - ); - } - - protected Iterable<ReplaceEdit> createCustomizerRenameTypeEdits(IType originalType, String newName) { - return this.customizer.createRenameTypeEdits(originalType, newName); - } - - protected Iterable<ReplaceEdit> createConverterHolderRenameTypeEdits(IType originalType, String newName) { - return this.converterContainer.createRenameTypeEdits(originalType, newName); - } - - protected Iterable<ReplaceEdit> createClassExtractorRenameTypeEdits(IType originalType, String newName) { - return this.classExtractorIsFor(originalType.getFullyQualifiedName('.')) ? - new SingleElementIterable<ReplaceEdit>(this.getXmlClassExtractor().createRenameEdit(originalType, newName)) : - EmptyIterable.<ReplaceEdit>instance(); - } - - @Override - @SuppressWarnings("unchecked") - public Iterable<ReplaceEdit> createMoveTypeEdits(IType originalType, IPackageFragment newPackage) { - return new CompositeIterable<ReplaceEdit>( - super.createMoveTypeEdits(originalType, newPackage), - this.createCustomizerMoveTypeEdits(originalType, newPackage), - this.createConverterHolderMoveTypeEdits(originalType, newPackage), - this.createClassExtractorMoveTypeEdits(originalType, newPackage) - ); - } - - protected Iterable<ReplaceEdit> createCustomizerMoveTypeEdits(IType originalType, IPackageFragment newPackage) { - return this.customizer.createMoveTypeEdits(originalType, newPackage); - } - - protected Iterable<ReplaceEdit> createConverterHolderMoveTypeEdits(IType originalType, IPackageFragment newPackage) { - return this.converterContainer.createMoveTypeEdits(originalType, newPackage); - } - - protected Iterable<ReplaceEdit> createClassExtractorMoveTypeEdits(IType originalType, IPackageFragment newPackage) { - return this.classExtractorIsFor(originalType.getFullyQualifiedName('.')) ? - new SingleElementIterable<ReplaceEdit>(this.getXmlClassExtractor().createRenamePackageEdit(newPackage.getElementName())) : - EmptyIterable.<ReplaceEdit>instance(); - } - - @SuppressWarnings("unchecked") - @Override - public Iterable<ReplaceEdit> createRenamePackageEdits(IPackageFragment originalPackage, String newName) { - return new CompositeIterable<ReplaceEdit>( - super.createRenamePackageEdits(originalPackage, newName), - this.createCustomizerRenamePackageEdits(originalPackage, newName), - this.createConverterHolderRenamePackageEdits(originalPackage, newName), - this.createClassExtractorRenamePackageEdits(originalPackage, newName) - ); - } - - protected Iterable<ReplaceEdit> createCustomizerRenamePackageEdits(IPackageFragment originalPackage, String newName) { - return this.customizer.createRenamePackageEdits(originalPackage, newName); - } - - protected Iterable<ReplaceEdit> createConverterHolderRenamePackageEdits(IPackageFragment originalPackage, String newName) { - return this.converterContainer.createRenamePackageEdits(originalPackage, newName); - } - - protected Iterable<ReplaceEdit> createClassExtractorRenamePackageEdits(IPackageFragment originalPackage, String newName) { - return this.classExtractorIsIn(originalPackage) ? - new SingleElementIterable<ReplaceEdit>(this.getXmlClassExtractor().createRenamePackageEdit(newName)) : - EmptyIterable.<ReplaceEdit>instance(); - } - - - // ********** validation ********** - - @Override - public void validate(List<IMessage> messages, IReporter reporter) { - super.validate(messages, reporter); - this.validateParentClass(messages, reporter); - this.caching.validate(messages, reporter); - this.readOnly.validate(messages, reporter); - this.converterContainer.validate(messages, reporter); - this.changeTracking.validate(messages, reporter); - this.customizer.validate(messages, reporter); - this.multitenancy.validate(messages, reporter); - } - - @Override - protected JptValidator buildPrimaryKeyValidator() { - return new EclipseLinkEntityPrimaryKeyValidator(this, buildTextRangeResolver()); - } - - @Override - protected JptValidator buildTypeMappingValidator() { - if (this.isDynamicType()) { - return new EclipseLinkDynamicTypeMappingValidator(this); - } - return new EclipseLinkTypeMappingValidator(this, getJavaResourceType(), buildTextRangeResolver()); - } - - protected boolean isDynamicType() { - return this.getPersistentType().isDynamic(); - } - - protected void validateParentClass(List<IMessage> messages, IReporter reporter) { - if (this.specifiedParentClass == null) { - return; - } - if (this.getResolvedParentClass() == null) { - IType jdtType = JDTTools.findType(this.getJavaProject(), this.getFullyQualifiedParentClass()); - if (jdtType == null) { - messages.add( - DefaultEclipseLinkJpaValidationMessages.buildMessage( - IMessage.HIGH_SEVERITY, - EclipseLinkJpaValidationMessages.VIRTUAL_TYPE_PARENT_CLASS_DOES_NOT_EXIST, - new String[] {this.getFullyQualifiedParentClass()}, - this, - this.getParentClassTextRange() - ) - ); - } - } - } - - protected TextRange getParentClassTextRange() { - return this.getValidationTextRange(this.xmlTypeMapping.getParentClassTextRange()); - } - - - // ********** completion proposals ********** - - @Override - public Iterable<String> getXmlCompletionProposals(int pos) { - Iterable<String> result = super.getXmlCompletionProposals(pos); - if (result != null) { - return result; - } - result = this.multitenancy.getXmlCompletionProposals(pos); - if (result != null) { - return result; - } - return null; - } - -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/orm/OrmEclipseLinkIdMapping.java b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/orm/OrmEclipseLinkIdMapping.java deleted file mode 100644 index c6373d412b..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/orm/OrmEclipseLinkIdMapping.java +++ /dev/null @@ -1,198 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2008, 2012 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.eclipselink.core.internal.context.orm; - -import java.util.List; -import org.eclipse.jdt.core.IPackageFragment; -import org.eclipse.jdt.core.IType; -import org.eclipse.jpt.common.core.internal.utility.JDTTools; -import org.eclipse.jpt.common.core.utility.TextRange; -import org.eclipse.jpt.common.utility.internal.StringTools; -import org.eclipse.jpt.common.utility.internal.iterables.CompositeIterable; -import org.eclipse.jpt.jpa.core.context.orm.OrmConverter; -import org.eclipse.jpt.jpa.core.context.orm.OrmPersistentAttribute; -import org.eclipse.jpt.jpa.core.internal.context.MappingTools; -import org.eclipse.jpt.jpa.core.internal.context.orm.AbstractOrmIdMapping; -import org.eclipse.jpt.jpa.eclipselink.core.context.EclipseLinkAccessType; -import org.eclipse.jpt.jpa.eclipselink.core.context.EclipseLinkIdMapping; -import org.eclipse.jpt.jpa.eclipselink.core.context.EclipseLinkMutable; -import org.eclipse.jpt.jpa.eclipselink.core.context.orm.EclipseLinkOrmConvertibleMapping; -import org.eclipse.jpt.jpa.eclipselink.core.context.orm.OrmEclipseLinkConverterContainer; -import org.eclipse.jpt.jpa.eclipselink.core.internal.DefaultEclipseLinkJpaValidationMessages; -import org.eclipse.jpt.jpa.eclipselink.core.internal.EclipseLinkJpaValidationMessages; -import org.eclipse.jpt.jpa.eclipselink.core.resource.orm.XmlId; -import org.eclipse.text.edits.ReplaceEdit; -import org.eclipse.wst.validation.internal.provisional.core.IMessage; -import org.eclipse.wst.validation.internal.provisional.core.IReporter; - -public class OrmEclipseLinkIdMapping - extends AbstractOrmIdMapping<XmlId> - implements - EclipseLinkIdMapping, - EclipseLinkOrmConvertibleMapping, - OrmEclipseLinkConverterContainer.Owner -{ - protected final OrmEclipseLinkMutable mutable; - - protected final OrmEclipseLinkConverterContainer converterContainer; - - - public OrmEclipseLinkIdMapping(OrmPersistentAttribute parent, XmlId xmlMapping) { - super(parent, xmlMapping); - this.mutable = new OrmEclipseLinkMutable(this); - this.converterContainer = this.buildConverterContainer(); - } - - - // ********** synchronize/update ********** - - @Override - public void synchronizeWithResourceModel() { - super.synchronizeWithResourceModel(); - this.mutable.synchronizeWithResourceModel(); - this.converterContainer.synchronizeWithResourceModel(); - } - - @Override - public void update() { - super.update(); - this.mutable.update(); - this.converterContainer.update(); - } - - - // ********** attribute type ********** - - @Override - protected String buildSpecifiedAttributeType() { - return this.xmlAttributeMapping.getAttributeType(); - } - - @Override - protected void setSpecifiedAttributeTypeInXml(String attributeType) { - this.xmlAttributeMapping.setAttributeType(attributeType); - } - - - // ********** mutable ********** - - public EclipseLinkMutable getMutable() { - return this.mutable; - } - - // ********** converters ********** - - public OrmEclipseLinkConverterContainer getConverterContainer() { - return this.converterContainer; - } - - protected OrmEclipseLinkConverterContainer buildConverterContainer() { - return new OrmEclipseLinkConverterContainerImpl(this, this, this.xmlAttributeMapping); - } - - public int getNumberSupportedConverters() { - return 1; - } - - - // ********** converter adapters ********** - - /** - * put the EclipseLink convert adapter first - this is the order EclipseLink searches - */ - @Override - protected Iterable<OrmConverter.Adapter> getConverterAdapters() { - return new CompositeIterable<OrmConverter.Adapter>(OrmEclipseLinkConvert.Adapter.instance(), super.getConverterAdapters()); - } - - - //************ refactoring ************ - - @Override - @SuppressWarnings("unchecked") - public Iterable<ReplaceEdit> createMoveTypeEdits(IType originalType, IPackageFragment newPackage) { - return new CompositeIterable<ReplaceEdit>( - super.createMoveTypeEdits(originalType, newPackage), - this.converterContainer.createMoveTypeEdits(originalType, newPackage) - ); - } - - @Override - @SuppressWarnings("unchecked") - public Iterable<ReplaceEdit> createRenamePackageEdits(IPackageFragment originalPackage, String newName) { - return new CompositeIterable<ReplaceEdit>( - super.createRenamePackageEdits(originalPackage, newName), - this.converterContainer.createRenamePackageEdits(originalPackage, newName) - ); - } - - @Override - @SuppressWarnings("unchecked") - public Iterable<ReplaceEdit> createRenameTypeEdits(IType originalType, String newName) { - return new CompositeIterable<ReplaceEdit>( - super.createRenameTypeEdits(originalType, newName), - this.converterContainer.createRenameTypeEdits(originalType, newName) - ); - } - - - // ********** validation ********** - - @Override - public void validate(List<IMessage> messages, IReporter reporter) { - super.validate(messages, reporter); - this.validateAttributeType(messages); - // TODO mutable validation - } - - //TODO copied from OrmEclipseLinkBasicMapping - protected void validateAttributeType(List<IMessage> messages) { - if (this.isVirtualAccess()) { - if (StringTools.stringIsEmpty(this.getAttributeType())) { - messages.add( - DefaultEclipseLinkJpaValidationMessages.buildMessage( - IMessage.HIGH_SEVERITY, - EclipseLinkJpaValidationMessages.VIRTUAL_ATTRIBUTE_NO_ATTRIBUTE_TYPE_SPECIFIED, - new String[] {this.getName()}, - this, - this.getAttributeTypeTextRange() - ) - ); - return; - } - if (MappingTools.typeIsBasic(this.getJavaProject(), this.getFullyQualifiedAttributeType())) { - return; - } - if (this.getResolvedAttributeType() == null) { - IType jdtType = JDTTools.findType(this.getJavaProject(), this.getFullyQualifiedAttributeType()); - if (jdtType == null) { - messages.add( - DefaultEclipseLinkJpaValidationMessages.buildMessage( - IMessage.HIGH_SEVERITY, - EclipseLinkJpaValidationMessages.VIRTUAL_ATTRIBUTE_ATTRIBUTE_TYPE_DOES_NOT_EXIST, - new String[] {this.getFullyQualifiedAttributeType()}, - this, - this.getAttributeTypeTextRange() - ) - ); - } - return; - } - } - } - - protected boolean isVirtualAccess() { - return getPersistentAttribute().getAccess() == EclipseLinkAccessType.VIRTUAL; - } - - protected TextRange getAttributeTypeTextRange() { - return this.getValidationTextRange(this.xmlAttributeMapping.getAttributeTypeTextRange()); - } -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/orm/OrmEclipseLinkJoinFetch.java b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/orm/OrmEclipseLinkJoinFetch.java deleted file mode 100644 index c29d55668b..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/orm/OrmEclipseLinkJoinFetch.java +++ /dev/null @@ -1,94 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2008, 2011 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.eclipselink.core.internal.context.orm; - -import org.eclipse.jpt.common.core.utility.TextRange; -import org.eclipse.jpt.jpa.core.context.orm.OrmAttributeMapping; -import org.eclipse.jpt.jpa.core.internal.context.orm.AbstractOrmXmlContextNode; -import org.eclipse.jpt.jpa.core.resource.orm.XmlAttributeMapping; -import org.eclipse.jpt.jpa.eclipselink.core.context.EclipseLinkJoinFetch; -import org.eclipse.jpt.jpa.eclipselink.core.context.EclipseLinkJoinFetchType; -import org.eclipse.jpt.jpa.eclipselink.core.resource.orm.XmlJoinFetch; - -public class OrmEclipseLinkJoinFetch - extends AbstractOrmXmlContextNode - implements EclipseLinkJoinFetch -{ - protected EclipseLinkJoinFetchType value; - - - public OrmEclipseLinkJoinFetch(OrmAttributeMapping parent) { - super(parent); - this.value = this.buildValue(); - } - - - // ********** synchronize/update ********** - - @Override - public void synchronizeWithResourceModel() { - super.synchronizeWithResourceModel(); - this.setValue_(this.buildValue()); - } - - - // ********** value ********** - - public EclipseLinkJoinFetchType getValue() { - return this.value; - } - - public void setValue(EclipseLinkJoinFetchType value) { - this.setValue_(value); - this.getXmlJoinFetch().setJoinFetch(EclipseLinkJoinFetchType.toOrmResourceModel(value)); - } - - protected void setValue_(EclipseLinkJoinFetchType value) { - EclipseLinkJoinFetchType old = this.value; - this.value = value; - this.firePropertyChanged(VALUE_PROPERTY, old, value); - } - - protected EclipseLinkJoinFetchType buildValue() { - return EclipseLinkJoinFetchType.fromOrmResourceModel(this.getXmlJoinFetch().getJoinFetch()); - } - - - // ********** misc ********** - - @Override - public OrmAttributeMapping getParent() { - return (OrmAttributeMapping) super.getParent(); - } - - protected OrmAttributeMapping getAttributeMapping() { - return this.getParent(); - } - - protected XmlAttributeMapping getXmlAttributeMapping() { - return this.getAttributeMapping().getXmlAttributeMapping(); - } - - protected XmlJoinFetch getXmlJoinFetch() { - return (XmlJoinFetch) this.getXmlAttributeMapping(); - } - - - // ********** validation ********** - - public TextRange getValidationTextRange() { - TextRange textRange = this.getXmlValidationTextRange(); - return (textRange != null) ? textRange : this.getAttributeMapping().getValidationTextRange(); - } - - protected TextRange getXmlValidationTextRange() { - return this.getXmlJoinFetch().getJoinFetchTextRange(); - } -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/orm/OrmEclipseLinkManyToManyMapping.java b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/orm/OrmEclipseLinkManyToManyMapping.java deleted file mode 100644 index 0910c4df1f..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/orm/OrmEclipseLinkManyToManyMapping.java +++ /dev/null @@ -1,182 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2008, 2012 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.eclipselink.core.internal.context.orm; - -import java.util.List; -import org.eclipse.jdt.core.IPackageFragment; -import org.eclipse.jdt.core.IType; -import org.eclipse.jpt.common.core.internal.utility.JDTTools; -import org.eclipse.jpt.common.core.utility.TextRange; -import org.eclipse.jpt.common.utility.internal.StringTools; -import org.eclipse.jpt.common.utility.internal.iterables.CompositeIterable; -import org.eclipse.jpt.jpa.core.context.orm.OrmPersistentAttribute; -import org.eclipse.jpt.jpa.core.internal.context.orm.AbstractOrmManyToManyMapping; -import org.eclipse.jpt.jpa.eclipselink.core.context.EclipseLinkAccessType; -import org.eclipse.jpt.jpa.eclipselink.core.context.EclipseLinkJoinFetch; -import org.eclipse.jpt.jpa.eclipselink.core.context.EclipseLinkManyToManyMapping; -import org.eclipse.jpt.jpa.eclipselink.core.context.orm.EclipseLinkOrmConvertibleMapping; -import org.eclipse.jpt.jpa.eclipselink.core.context.orm.OrmEclipseLinkConverterContainer; -import org.eclipse.jpt.jpa.eclipselink.core.internal.DefaultEclipseLinkJpaValidationMessages; -import org.eclipse.jpt.jpa.eclipselink.core.internal.EclipseLinkJpaValidationMessages; -import org.eclipse.jpt.jpa.eclipselink.core.resource.orm.XmlManyToMany; -import org.eclipse.text.edits.ReplaceEdit; -import org.eclipse.wst.validation.internal.provisional.core.IMessage; -import org.eclipse.wst.validation.internal.provisional.core.IReporter; - -public class OrmEclipseLinkManyToManyMapping - extends AbstractOrmManyToManyMapping<XmlManyToMany> - implements - EclipseLinkManyToManyMapping, - EclipseLinkOrmConvertibleMapping, - OrmEclipseLinkConverterContainer.Owner -{ - protected final OrmEclipseLinkJoinFetch joinFetch; - - protected final OrmEclipseLinkConverterContainer converterContainer; - - - public OrmEclipseLinkManyToManyMapping(OrmPersistentAttribute parent, XmlManyToMany xmlMapping) { - super(parent, xmlMapping); - this.joinFetch = new OrmEclipseLinkJoinFetch(this); - this.converterContainer = this.buildConverterContainer(); - } - - - // ********** synchronize/update ********** - - @Override - public void synchronizeWithResourceModel() { - super.synchronizeWithResourceModel(); - this.joinFetch.synchronizeWithResourceModel(); - this.converterContainer.synchronizeWithResourceModel(); - } - - @Override - public void update() { - super.update(); - this.joinFetch.update(); - this.converterContainer.update(); - } - - - // ********** attribute type ********** - - @Override - protected String buildSpecifiedAttributeType() { - return this.xmlAttributeMapping.getAttributeType(); - } - - @Override - protected void setSpecifiedAttributeTypeInXml(String attributeType) { - this.xmlAttributeMapping.setAttributeType(attributeType); - } - - - // ********** join fetch ********** - - public EclipseLinkJoinFetch getJoinFetch() { - return this.joinFetch; - } - - // ********** converters ********** - - public OrmEclipseLinkConverterContainer getConverterContainer() { - return this.converterContainer; - } - - protected OrmEclipseLinkConverterContainer buildConverterContainer() { - return new OrmEclipseLinkConverterContainerImpl(this, this, this.xmlAttributeMapping); - } - - public int getNumberSupportedConverters() { - return 1; - } - - - //************ refactoring ************ - - @Override - @SuppressWarnings("unchecked") - public Iterable<ReplaceEdit> createMoveTypeEdits(IType originalType, IPackageFragment newPackage) { - return new CompositeIterable<ReplaceEdit>( - super.createMoveTypeEdits(originalType, newPackage), - this.converterContainer.createMoveTypeEdits(originalType, newPackage) - ); - } - - @Override - @SuppressWarnings("unchecked") - public Iterable<ReplaceEdit> createRenamePackageEdits(IPackageFragment originalPackage, String newName) { - return new CompositeIterable<ReplaceEdit>( - super.createRenamePackageEdits(originalPackage, newName), - this.converterContainer.createRenamePackageEdits(originalPackage, newName) - ); - } - - @Override - @SuppressWarnings("unchecked") - public Iterable<ReplaceEdit> createRenameTypeEdits(IType originalType, String newName) { - return new CompositeIterable<ReplaceEdit>( - super.createRenameTypeEdits(originalType, newName), - this.converterContainer.createRenameTypeEdits(originalType, newName) - ); - } - - // ********** validation ********** - - @Override - public void validate(List<IMessage> messages, IReporter reporter) { - super.validate(messages, reporter); - // TODO join fetch validation - } - - @Override - protected void validateAttributeType(List<IMessage> messages, IReporter reporter) { - if (this.isVirtualAccess()) { - if (StringTools.stringIsEmpty(this.getAttributeType())) { - messages.add( - DefaultEclipseLinkJpaValidationMessages.buildMessage( - IMessage.HIGH_SEVERITY, - EclipseLinkJpaValidationMessages.VIRTUAL_ATTRIBUTE_NO_ATTRIBUTE_TYPE_SPECIFIED, - new String[] {this.getName()}, - this, - this.getAttributeTypeTextRange() - ) - ); - return; - } - if (this.getResolvedAttributeType() == null) { - IType jdtType = JDTTools.findType(this.getJavaProject(), this.getFullyQualifiedAttributeType()); - if (jdtType == null) { - messages.add( - DefaultEclipseLinkJpaValidationMessages.buildMessage( - IMessage.HIGH_SEVERITY, - EclipseLinkJpaValidationMessages.VIRTUAL_ATTRIBUTE_ATTRIBUTE_TYPE_DOES_NOT_EXIST, - new String[] {this.getFullyQualifiedAttributeType()}, - this, - this.getAttributeTypeTextRange() - ) - ); - return; - } - } - } - super.validateAttributeType(messages, reporter); - } - - protected boolean isVirtualAccess() { - return getPersistentAttribute().getAccess() == EclipseLinkAccessType.VIRTUAL; - } - - @Override - protected TextRange getAttributeTypeTextRange() { - return this.getValidationTextRange(this.xmlAttributeMapping.getAttributeTypeTextRange()); - } -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/orm/OrmEclipseLinkManyToOneMapping.java b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/orm/OrmEclipseLinkManyToOneMapping.java deleted file mode 100644 index 381c08a5ac..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/orm/OrmEclipseLinkManyToOneMapping.java +++ /dev/null @@ -1,63 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2008, 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.eclipselink.core.internal.context.orm; - -import java.util.List; -import org.eclipse.jpt.jpa.core.context.orm.OrmPersistentAttribute; -import org.eclipse.jpt.jpa.core.internal.context.orm.AbstractOrmManyToOneMapping; -import org.eclipse.jpt.jpa.eclipselink.core.context.EclipseLinkJoinFetch; -import org.eclipse.jpt.jpa.eclipselink.core.context.EclipseLinkRelationshipMapping; -import org.eclipse.jpt.jpa.eclipselink.core.resource.orm.XmlManyToOne; -import org.eclipse.wst.validation.internal.provisional.core.IMessage; -import org.eclipse.wst.validation.internal.provisional.core.IReporter; - -public class OrmEclipseLinkManyToOneMapping - extends AbstractOrmManyToOneMapping<XmlManyToOne> - implements EclipseLinkRelationshipMapping -{ - protected final OrmEclipseLinkJoinFetch joinFetch; - - - protected OrmEclipseLinkManyToOneMapping(OrmPersistentAttribute parent, XmlManyToOne xmlMapping) { - super(parent, xmlMapping); - this.joinFetch = new OrmEclipseLinkJoinFetch(this); - } - - - // ********** synchronize/update ********** - - @Override - public void synchronizeWithResourceModel() { - super.synchronizeWithResourceModel(); - this.joinFetch.synchronizeWithResourceModel(); - } - - @Override - public void update() { - super.update(); - this.joinFetch.update(); - } - - - // ********** join fetch ********** - - public EclipseLinkJoinFetch getJoinFetch() { - return this.joinFetch; - } - - - // ********** validation ********** - - @Override - public void validate(List<IMessage> messages, IReporter reporter) { - super.validate(messages, reporter); - // TODO - join fetch validation - } -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/orm/OrmEclipseLinkMappedSuperclassImpl.java b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/orm/OrmEclipseLinkMappedSuperclassImpl.java deleted file mode 100644 index 86fe9361e7..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/orm/OrmEclipseLinkMappedSuperclassImpl.java +++ /dev/null @@ -1,422 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2008, 2012 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.eclipselink.core.internal.context.orm; - -import java.util.List; -import org.eclipse.jdt.core.IPackageFragment; -import org.eclipse.jdt.core.IType; -import org.eclipse.jpt.common.core.internal.utility.JDTTools; -import org.eclipse.jpt.common.core.utility.TextRange; -import org.eclipse.jpt.common.utility.internal.NotNullFilter; -import org.eclipse.jpt.common.utility.internal.iterables.CompositeIterable; -import org.eclipse.jpt.common.utility.internal.iterables.FilteringIterable; -import org.eclipse.jpt.common.utility.internal.iterables.TransformationIterable; -import org.eclipse.jpt.jpa.core.context.AttributeMapping; -import org.eclipse.jpt.jpa.core.context.Query; -import org.eclipse.jpt.jpa.core.context.orm.OrmPersistentType; -import org.eclipse.jpt.jpa.core.context.orm.OrmQueryContainer; -import org.eclipse.jpt.jpa.core.internal.context.JptValidator; -import org.eclipse.jpt.jpa.core.internal.context.orm.AbstractOrmMappedSuperclass; -import org.eclipse.jpt.jpa.core.jpa2.context.orm.OrmCacheable2_0; -import org.eclipse.jpt.jpa.core.jpa2.context.orm.OrmCacheableHolder2_0; -import org.eclipse.jpt.jpa.core.resource.orm.v2_0.XmlCacheable_2_0; -import org.eclipse.jpt.jpa.eclipselink.core.JptJpaEclipseLinkCorePlugin; -import org.eclipse.jpt.jpa.eclipselink.core.context.EclipseLinkChangeTracking; -import org.eclipse.jpt.jpa.eclipselink.core.context.EclipseLinkConverter; -import org.eclipse.jpt.jpa.eclipselink.core.context.EclipseLinkCustomizer; -import org.eclipse.jpt.jpa.eclipselink.core.context.java.JavaEclipseLinkMappedSuperclass; -import org.eclipse.jpt.jpa.eclipselink.core.context.orm.OrmEclipseLinkCaching; -import org.eclipse.jpt.jpa.eclipselink.core.context.orm.OrmEclipseLinkConverterContainer; -import org.eclipse.jpt.jpa.eclipselink.core.context.orm.OrmEclipseLinkMappedSuperclass; -import org.eclipse.jpt.jpa.eclipselink.core.context.orm.OrmEclipseLinkMultitenancy2_3; -import org.eclipse.jpt.jpa.eclipselink.core.context.orm.EclipseLinkOrmPersistentType; -import org.eclipse.jpt.jpa.eclipselink.core.internal.DefaultEclipseLinkJpaValidationMessages; -import org.eclipse.jpt.jpa.eclipselink.core.internal.EclipseLinkJpaValidationMessages; -import org.eclipse.jpt.jpa.eclipselink.core.internal.context.EclipseLinkDynamicTypeMappingValidator; -import org.eclipse.jpt.jpa.eclipselink.core.internal.context.EclipseLinkMappedSuperclassPrimaryKeyValidator; -import org.eclipse.jpt.jpa.eclipselink.core.internal.context.EclipseLinkMappedSuperclassValidator; -import org.eclipse.jpt.jpa.eclipselink.core.resource.orm.XmlMappedSuperclass; -import org.eclipse.text.edits.ReplaceEdit; -import org.eclipse.wst.validation.internal.provisional.core.IMessage; -import org.eclipse.wst.validation.internal.provisional.core.IReporter; - -/** - * EclipseLink - * <code>orm.xml</code> mapped superclass - */ -public class OrmEclipseLinkMappedSuperclassImpl - extends AbstractOrmMappedSuperclass<XmlMappedSuperclass> - implements - OrmEclipseLinkMappedSuperclass, - OrmCacheableHolder2_0, - OrmEclipseLinkConverterContainer.Owner -{ - protected final OrmEclipseLinkReadOnly readOnly; - - protected final OrmEclipseLinkCustomizer customizer; - - protected final OrmEclipseLinkChangeTracking changeTracking; - - protected final OrmEclipseLinkCaching caching; - - protected final OrmEclipseLinkConverterContainer converterContainer; - - protected final OrmEclipseLinkMultitenancy2_3 multitenancy; - - protected final OrmQueryContainer queryContainer; - - - public OrmEclipseLinkMappedSuperclassImpl(OrmPersistentType parent, XmlMappedSuperclass xmlMappedSuperclass) { - super(parent, xmlMappedSuperclass); - this.caching = this.buildCaching(); - this.readOnly = this.buildReadOnly(); - this.converterContainer = this.buildConverterContainer(); - this.changeTracking = this.buildChangeTracking(); - this.customizer = this.buildCustomizer(); - this.multitenancy = this.buildMultitenancy(); - this.queryContainer = this.buildQueryContainer(); - } - - - // ********** synchronize/update ********** - - @Override - public void synchronizeWithResourceModel() { - super.synchronizeWithResourceModel(); - this.caching.synchronizeWithResourceModel(); - this.readOnly.synchronizeWithResourceModel(); - this.converterContainer.synchronizeWithResourceModel(); - this.changeTracking.synchronizeWithResourceModel(); - this.customizer.synchronizeWithResourceModel(); - this.multitenancy.synchronizeWithResourceModel(); - this.queryContainer.synchronizeWithResourceModel(); - } - - @Override - public void update() { - super.update(); - this.caching.update(); - this.readOnly.update(); - this.converterContainer.update(); - this.changeTracking.update(); - this.customizer.update(); - this.multitenancy.update(); - this.queryContainer.update(); - } - - - // ********** caching ********** - - public OrmEclipseLinkCaching getCaching() { - return this.caching; - } - - protected OrmEclipseLinkCaching buildCaching() { - return new OrmEclipseLinkCachingImpl(this); - } - - - // ********** read only ********** - - public OrmEclipseLinkReadOnly getReadOnly() { - return this.readOnly; - } - - protected OrmEclipseLinkReadOnly buildReadOnly() { - return new OrmEclipseLinkReadOnly(this); - } - - - // ********** converter container ********** - - public OrmEclipseLinkConverterContainer getConverterContainer() { - return this.converterContainer; - } - - protected OrmEclipseLinkConverterContainer buildConverterContainer() { - return new OrmEclipseLinkConverterContainerImpl(this, this, this.xmlTypeMapping); - } - - public int getNumberSupportedConverters() { - return Integer.MAX_VALUE; - } - - @SuppressWarnings("unchecked") - public Iterable<EclipseLinkConverter> getConverters() { - return new CompositeIterable<EclipseLinkConverter>( - this.converterContainer.getConverters(), - this.getAttributeMappingConverters() - ); - } - - protected Iterable<EclipseLinkConverter> getAttributeMappingConverters() { - return new FilteringIterable<EclipseLinkConverter>(this.getAttributeMappingConverters_(), NotNullFilter.<EclipseLinkConverter>instance()); - } - - protected Iterable<EclipseLinkConverter> getAttributeMappingConverters_() { - return new CompositeIterable<EclipseLinkConverter>(this.getAttributeMappingConverterLists()); - } - - protected Iterable<Iterable<EclipseLinkConverter>> getAttributeMappingConverterLists() { - return new TransformationIterable<AttributeMapping, Iterable<EclipseLinkConverter>>( - this.getAttributeMappings(), - ATTRIBUTE_MAPPING_CONVERTER_TRANSFORMER - ); - } - - - // ********** change tracking ********** - - public EclipseLinkChangeTracking getChangeTracking() { - return this.changeTracking; - } - - protected OrmEclipseLinkChangeTracking buildChangeTracking() { - return new OrmEclipseLinkChangeTracking(this); - } - - - // ********** customizer ********** - - public EclipseLinkCustomizer getCustomizer() { - return this.customizer; - } - - protected OrmEclipseLinkCustomizer buildCustomizer() { - return new OrmEclipseLinkCustomizer(this); - } - - - // ********** multitenancy ********** - - public OrmEclipseLinkMultitenancy2_3 getMultitenancy() { - return this.multitenancy; - } - - - protected OrmEclipseLinkMultitenancy2_3 buildMultitenancy() { - return this.isEclipseLink2_3Compatible() ? - new OrmEclipseLinkMultitenancyImpl2_3(this) : - new NullOrmEclipseLinkMultitenancy2_3(this); - } - - protected boolean isEclipseLink2_3Compatible() { - return JptJpaEclipseLinkCorePlugin.nodeIsEclipseLink2_3Compatible(this); - } - - // ********** query container ********** - - public OrmQueryContainer getQueryContainer() { - return this.queryContainer; - } - - protected OrmQueryContainer buildQueryContainer() { - return this.getContextNodeFactory().buildOrmQueryContainer(this, this.xmlTypeMapping); - } - - @Override - public Iterable<Query> getQueries() { - return this.queryContainer.getQueries(); - } - - public boolean isMultitenantMetadataAllowed() { - return true; - } - - - // ********** parent class ********** - - @Override - protected String buildSpecifiedParentClass() { - return this.xmlTypeMapping.getParentClass(); - } - - @Override - public void setSpecifiedParentClassInXml(String parentClass) { - this.xmlTypeMapping.setParentClass(parentClass); - } - - - // ********** misc ********** - - @Override - public JavaEclipseLinkMappedSuperclass getJavaTypeMapping() { - return (JavaEclipseLinkMappedSuperclass) super.getJavaTypeMapping(); - } - - @Override - public JavaEclipseLinkMappedSuperclass getJavaTypeMappingForDefaults() { - return (JavaEclipseLinkMappedSuperclass) super.getJavaTypeMappingForDefaults(); - } - - @Override - public EclipseLinkOrmPersistentType getPersistentType() { - return (EclipseLinkOrmPersistentType) super.getPersistentType(); - } - - public boolean usesPrimaryKeyColumns() { - return (this.getXmlTypeMapping().getPrimaryKey() != null) - || this.usesJavaPrimaryKeyColumns(); - } - - protected boolean usesJavaPrimaryKeyColumns() { - JavaEclipseLinkMappedSuperclass javaMappedSuperclass = this.getJavaTypeMappingForDefaults(); - return (javaMappedSuperclass != null) && javaMappedSuperclass.usesPrimaryKeyColumns(); - } - - public boolean usesPrimaryKeyTenantDiscriminatorColumns() { - return getMultitenancy().usesPrimaryKeyTenantDiscriminatorColumns(); - } - - public OrmCacheable2_0 getCacheable() { - return this.getCacheableHolder().getCacheable(); - } - - public boolean calculateDefaultCacheable() { - return this.getCacheableHolder().calculateDefaultCacheable(); - } - - protected OrmCacheableHolder2_0 getCacheableHolder() { - return (OrmCacheableHolder2_0) this.caching; - } - - public XmlCacheable_2_0 getXmlCacheable() { - return this.getXmlTypeMapping(); - } - - - // ********** refactoring ********** - - @Override - @SuppressWarnings("unchecked") - public Iterable<ReplaceEdit> createRenameTypeEdits(IType originalType, String newName) { - return new CompositeIterable<ReplaceEdit>( - super.createRenameTypeEdits(originalType, newName), - this.createCustomizerRenameTypeEdits(originalType, newName), - this.createConverterHolderRenameTypeEdits(originalType, newName) - ); - } - - protected Iterable<ReplaceEdit> createCustomizerRenameTypeEdits(IType originalType, String newName) { - return this.customizer.createRenameTypeEdits(originalType, newName); - } - - protected Iterable<ReplaceEdit> createConverterHolderRenameTypeEdits(IType originalType, String newName) { - return this.converterContainer.createRenameTypeEdits(originalType, newName); - } - - - @Override - @SuppressWarnings("unchecked") - public Iterable<ReplaceEdit> createMoveTypeEdits(IType originalType, IPackageFragment newPackage) { - return new CompositeIterable<ReplaceEdit>( - super.createMoveTypeEdits(originalType, newPackage), - this.createCustomizerMoveTypeEdits(originalType, newPackage), - this.createConverterHolderMoveTypeEdits(originalType, newPackage) - ); - } - - protected Iterable<ReplaceEdit> createCustomizerMoveTypeEdits(IType originalType, IPackageFragment newPackage) { - return this.customizer.createMoveTypeEdits(originalType, newPackage); - } - - protected Iterable<ReplaceEdit> createConverterHolderMoveTypeEdits(IType originalType, IPackageFragment newPackage) { - return this.converterContainer.createMoveTypeEdits(originalType, newPackage); - } - - @Override - @SuppressWarnings("unchecked") - public Iterable<ReplaceEdit> createRenamePackageEdits(IPackageFragment originalPackage, String newName) { - return new CompositeIterable<ReplaceEdit>( - super.createRenamePackageEdits(originalPackage, newName), - this.createCustomizerRenamePackageEdits(originalPackage, newName), - this.createConverterHolderRenamePackageEdits(originalPackage, newName) - ); - } - - protected Iterable<ReplaceEdit> createCustomizerRenamePackageEdits(IPackageFragment originalPackage, String newName) { - return this.customizer.createRenamePackageEdits(originalPackage, newName); - } - - protected Iterable<ReplaceEdit> createConverterHolderRenamePackageEdits(IPackageFragment originalPackage, String newName) { - return this.converterContainer.createRenamePackageEdits(originalPackage, newName); - } - - - // ********** validation ********** - - @Override - public void validate(List<IMessage> messages, IReporter reporter) { - super.validate(messages, reporter); - this.validateParentClass(messages, reporter); - this.caching.validate(messages, reporter); - this.readOnly.validate(messages, reporter); - this.converterContainer.validate(messages, reporter); - this.changeTracking.validate(messages, reporter); - this.customizer.validate(messages, reporter); - this.multitenancy.validate(messages, reporter); - } - - @Override - protected JptValidator buildPrimaryKeyValidator() { - return new EclipseLinkMappedSuperclassPrimaryKeyValidator(this, this.buildTextRangeResolver()); - } - - @Override - protected JptValidator buildTypeMappingValidator() { - if (this.isDynamicType()) { - return new EclipseLinkDynamicTypeMappingValidator(this); - } - return new EclipseLinkMappedSuperclassValidator(this, this.getJavaResourceType(), this.buildTextRangeResolver()); - } - - protected boolean isDynamicType() { - return this.getPersistentType().isDynamic(); - } - - protected void validateParentClass(List<IMessage> messages, IReporter reporter) { - if (this.specifiedParentClass == null) { - return; - } - if (this.getResolvedParentClass() == null) { - IType jdtType = JDTTools.findType(this.getJavaProject(), this.getFullyQualifiedParentClass()); - if (jdtType == null) { - messages.add( - DefaultEclipseLinkJpaValidationMessages.buildMessage( - IMessage.HIGH_SEVERITY, - EclipseLinkJpaValidationMessages.VIRTUAL_TYPE_PARENT_CLASS_DOES_NOT_EXIST, - new String[] {this.getFullyQualifiedParentClass()}, - this, - this.getParentClassTextRange() - ) - ); - } - } - } - - protected TextRange getParentClassTextRange() { - return this.getValidationTextRange(this.xmlTypeMapping.getParentClassTextRange()); - } - - // ********** completion proposals ********** - - @Override - public Iterable<String> getXmlCompletionProposals(int pos) { - Iterable<String> result = super.getXmlCompletionProposals(pos); - if (result != null) { - return result; - } - result = this.multitenancy.getXmlCompletionProposals(pos); - if (result != null) { - return result; - } - return null; - } -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/orm/OrmEclipseLinkMultitenancyImpl2_3.java b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/orm/OrmEclipseLinkMultitenancyImpl2_3.java deleted file mode 100644 index 4e12dff7de..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/orm/OrmEclipseLinkMultitenancyImpl2_3.java +++ /dev/null @@ -1,795 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2012 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.eclipselink.core.internal.context.orm; - -import java.util.List; -import org.eclipse.jpt.common.core.utility.TextRange; -import org.eclipse.jpt.common.utility.internal.CollectionTools; -import org.eclipse.jpt.common.utility.internal.iterables.EmptyListIterable; -import org.eclipse.jpt.common.utility.internal.iterables.ListIterable; -import org.eclipse.jpt.common.utility.internal.iterables.LiveCloneListIterable; -import org.eclipse.jpt.common.utility.internal.iterables.SingleElementListIterable; -import org.eclipse.jpt.common.utility.internal.iterables.SuperListIterableWrapper; -import org.eclipse.jpt.jpa.core.context.DiscriminatorType; -import org.eclipse.jpt.jpa.core.context.Entity; -import org.eclipse.jpt.jpa.core.context.InheritanceType; -import org.eclipse.jpt.jpa.core.context.ReadOnlyNamedColumn; -import org.eclipse.jpt.jpa.core.context.ReadOnlyNamedDiscriminatorColumn; -import org.eclipse.jpt.jpa.core.context.TypeMapping; -import org.eclipse.jpt.jpa.core.internal.context.JptValidator; -import org.eclipse.jpt.jpa.core.internal.context.NamedColumnTextRangeResolver; -import org.eclipse.jpt.jpa.core.internal.context.orm.AbstractOrmXmlContextNode; -import org.eclipse.jpt.jpa.core.resource.orm.XmlTypeMapping; -import org.eclipse.jpt.jpa.db.Table; -import org.eclipse.jpt.jpa.eclipselink.core.context.EclipseLinkEntity; -import org.eclipse.jpt.jpa.eclipselink.core.context.EclipseLinkMappedSuperclass; -import org.eclipse.jpt.jpa.eclipselink.core.context.EclipseLinkMultitenantType2_3; -import org.eclipse.jpt.jpa.eclipselink.core.context.ReadOnlyTenantDiscriminatorColumn2_3; -import org.eclipse.jpt.jpa.eclipselink.core.context.TenantDiscriminatorColumn2_3; -import org.eclipse.jpt.jpa.eclipselink.core.context.java.JavaEclipseLinkMultitenancy2_3; -import org.eclipse.jpt.jpa.eclipselink.core.context.java.JavaEclipseLinkNonEmbeddableTypeMapping; -import org.eclipse.jpt.jpa.eclipselink.core.context.java.JavaTenantDiscriminatorColumn2_3; -import org.eclipse.jpt.jpa.eclipselink.core.context.orm.EclipseLinkEntityMappings; -import org.eclipse.jpt.jpa.eclipselink.core.context.orm.OrmEclipseLinkMultitenancy2_3; -import org.eclipse.jpt.jpa.eclipselink.core.context.orm.OrmEclipseLinkNonEmbeddableTypeMapping; -import org.eclipse.jpt.jpa.eclipselink.core.context.orm.OrmReadOnlyTenantDiscriminatorColumn2_3; -import org.eclipse.jpt.jpa.eclipselink.core.context.orm.OrmTenantDiscriminatorColumn2_3; -import org.eclipse.jpt.jpa.eclipselink.core.context.orm.OrmVirtualTenantDiscriminatorColumn2_3; -import org.eclipse.jpt.jpa.eclipselink.core.context.persistence.EclipseLinkPersistenceUnit; -import org.eclipse.jpt.jpa.eclipselink.core.context.persistence.TargetDatabase; -import org.eclipse.jpt.jpa.eclipselink.core.internal.DefaultEclipseLinkJpaValidationMessages; -import org.eclipse.jpt.jpa.eclipselink.core.internal.EclipseLinkJpaValidationMessages; -import org.eclipse.jpt.jpa.eclipselink.core.internal.context.TenantDiscriminatorColumnValidator2_3; -import org.eclipse.jpt.jpa.eclipselink.core.resource.orm.EclipseLinkOrmFactory; -import org.eclipse.jpt.jpa.eclipselink.core.resource.orm.XmlMultitenant; -import org.eclipse.jpt.jpa.eclipselink.core.resource.orm.XmlMultitenantHolder; -import org.eclipse.jpt.jpa.eclipselink.core.resource.orm.XmlTenantDiscriminatorColumn; -import org.eclipse.jpt.jpa.eclipselink.core.resource.orm.v2_3.XmlTenantDiscriminatorColumn_2_3; -import org.eclipse.jpt.jpa.eclipselink.core.resource.orm.v2_4.XmlMultitenant_2_4; -import org.eclipse.wst.validation.internal.provisional.core.IMessage; -import org.eclipse.wst.validation.internal.provisional.core.IReporter; - -public class OrmEclipseLinkMultitenancyImpl2_3 - extends AbstractOrmXmlContextNode - implements OrmEclipseLinkMultitenancy2_3 -{ - protected boolean specifiedMultitenant; - protected boolean defaultMultitenant; - - protected EclipseLinkMultitenantType2_3 specifiedType; - protected EclipseLinkMultitenantType2_3 defaultType; - - protected Boolean specifiedIncludeCriteria; - protected boolean defaultIncludeCriteria = DEFAULT_INCLUDE_CRITERIA; - - protected final ContextListContainer<OrmTenantDiscriminatorColumn2_3, XmlTenantDiscriminatorColumn_2_3> specifiedTenantDiscriminatorColumnContainer; - protected final OrmReadOnlyTenantDiscriminatorColumn2_3.Owner tenantDiscriminatorColumnOwner; - - protected final ContextListContainer<OrmVirtualTenantDiscriminatorColumn2_3, ReadOnlyTenantDiscriminatorColumn2_3> defaultTenantDiscriminatorColumnContainer; - - protected final OrmReadOnlyTenantDiscriminatorColumn2_3 defaultTenantDiscriminatorColumn; - - protected boolean specifiedTenantDiscriminatorColumnsAllowed; - - public OrmEclipseLinkMultitenancyImpl2_3(OrmEclipseLinkNonEmbeddableTypeMapping parent) { - super(parent); - - this.specifiedMultitenant = isMultitenantElementSpecified(); - this.specifiedType = this.buildSpecifiedType(); - this.specifiedIncludeCriteria = this.buildSpecifiedIncludeCriteria(); - this.tenantDiscriminatorColumnOwner = this.buildTenantDiscriminatorColumnOwner(); - this.specifiedTenantDiscriminatorColumnContainer = this.buildSpecifiedTenantDiscriminatorColumnContainer(); - this.defaultTenantDiscriminatorColumn = this.buildTenantDiscriminatorColumn(null); - this.defaultTenantDiscriminatorColumnContainer = this.buildDefaultTenantDiscriminatorColumnContainer(); - } - - - // ********** synchronize/update ********** - - @Override - public void synchronizeWithResourceModel() { - super.synchronizeWithResourceModel(); - this.setSpecifiedMultitenant_(isMultitenantElementSpecified()); - this.setSpecifiedType_(this.buildSpecifiedType()); - this.setSpecifiedIncludeCriteria_(this.buildSpecifiedIncludeCriteria()); - this.syncSpecifiedTenantDiscriminatorColumns(); - } - - @Override - public void update() { - super.update(); - this.updateNodes(this.getSpecifiedTenantDiscriminatorColumns()); - - boolean xmlMultitenantNotSpecified = (this.getXmlMultitenant() == null); - JavaEclipseLinkMultitenancy2_3 javaMultitenantPolicy = this.getJavaMultitenancyPolicyForDefaults(); - boolean javaMultitenantPolicySpecified = javaMultitenantPolicy != null; - boolean useJavaValue = (xmlMultitenantNotSpecified && javaMultitenantPolicySpecified); - - this.setDefaultMultitenant(useJavaValue ? javaMultitenantPolicy.isMultitenant() : this.buildDefaultMultitenant()); - this.setDefaultType(useJavaValue ? javaMultitenantPolicy.getType() : this.buildDefaultType()); - this.setDefaultIncludeCriteria(useJavaValue ? javaMultitenantPolicy.isIncludeCriteria() : this.buildDefaultIncludeCriteria()); - this.setSpecifiedTenantDiscriminatorColumnsAllowed(this.buildSpecifiedTenantDiscriminatorColumnsAllowed()); - this.updateDefaultTenantDiscriminatorColumns(); - } - - - // ********** multitenant ********** - - public boolean isMultitenant() { - return isSpecifiedMultitenant() || isDefaultMultitenant(); - } - - public boolean isDefaultMultitenant() { - return this.defaultMultitenant; - } - - public void setDefaultMultitenant(boolean defaultMultitenant) { - boolean old = this.defaultMultitenant; - this.defaultMultitenant = defaultMultitenant; - this.firePropertyChanged(DEFAULT_MULTITENANT_PROPERTY, old, defaultMultitenant); - } - - protected boolean buildDefaultMultitenant() { - return this.isMultitenantInheritanceHierarchy() || this.isSuperMappedSuperclassMultitenant(); - } - - public boolean isSpecifiedMultitenant() { - return this.specifiedMultitenant; - } - - public void setSpecifiedMultitenant(boolean isMultitenant) { - if (isMultitenant) { - if (getXmlMultitenant() != null) { - throw new IllegalStateException("Multitenant element already specified"); //$NON-NLS-1$ - } - this.addXmlMultitenant(); - } - else { - if (getXmlMultitenant() == null) { - throw new IllegalStateException("Multitenant element does not exist"); //$NON-NLS-1$ - } - this.removeXmlMultitenant(); - this.setSpecifiedType(null); - for (int i = this.getSpecifiedTenantDiscriminatorColumnsSize(); i-- > 0; ) { - this.removeSpecifiedTenantDiscriminatorColumn(i); - } - } - this.setSpecifiedMultitenant_(isMultitenant); - } - - protected void setSpecifiedMultitenant_(boolean isMultitenant) { - boolean old = this.specifiedMultitenant; - this.specifiedMultitenant = isMultitenant; - this.firePropertyChanged(SPECIFIED_MULTITENANT_PROPERTY, old, isMultitenant); - } - - - // ********** type ********** - - public EclipseLinkMultitenantType2_3 getType() { - return (this.specifiedType != null) ? this.specifiedType : this.getDefaultType(); - } - - public EclipseLinkMultitenantType2_3 getSpecifiedType() { - return this.specifiedType; - } - - public void setSpecifiedType(EclipseLinkMultitenantType2_3 type) { - if (this.valuesAreDifferent(this.specifiedType, type)) { - XmlMultitenant xmlMultitenant = this.getXmlMultitenantForUpdate(); - this.setSpecifiedType_(type); - xmlMultitenant.setType(EclipseLinkMultitenantType2_3.toOrmResourceModel(type)); - } - } - - protected void setSpecifiedType_(EclipseLinkMultitenantType2_3 type) { - EclipseLinkMultitenantType2_3 old = this.specifiedType; - this.specifiedType = type; - this.firePropertyChanged(SPECIFIED_TYPE_PROPERTY, old, type); - } - - protected EclipseLinkMultitenantType2_3 buildSpecifiedType() { - XmlMultitenant xmlMultitenant = this.getXmlMultitenant(); - return (xmlMultitenant == null) ? null : EclipseLinkMultitenantType2_3.fromOrmResourceModel(xmlMultitenant.getType()); - } - - public EclipseLinkMultitenantType2_3 getDefaultType() { - return this.defaultType; - } - - protected void setDefaultType(EclipseLinkMultitenantType2_3 type) { - EclipseLinkMultitenantType2_3 old = this.defaultType; - this.defaultType = type; - this.firePropertyChanged(DEFAULT_TYPE_PROPERTY, old, type); - } - - protected EclipseLinkMultitenantType2_3 buildDefaultType() { - if (!isMultitenant()) { - return null; - } - if (isSpecifiedMultitenant()) { - return DEFAULT_TYPE; - } - if (this.isMultitenantInheritanceHierarchy()) { - return getRootEntity().getMultitenancy().getType(); - } - EclipseLinkMappedSuperclass superMappedSuperclass = getSuperMappedSuperclass(); - return superMappedSuperclass != null ? superMappedSuperclass.getMultitenancy().getType() : DEFAULT_TYPE; - } - - - // ********** include criteria ********** - - public boolean isIncludeCriteria() { - return (this.specifiedIncludeCriteria != null) ? this.specifiedIncludeCriteria.booleanValue() : this.defaultIncludeCriteria; - } - - public Boolean getSpecifiedIncludeCriteria() { - return this.specifiedIncludeCriteria; - } - - public void setSpecifiedIncludeCriteria(Boolean includeCriteria) { - if (this.valuesAreDifferent(this.specifiedIncludeCriteria, includeCriteria)) { - XmlMultitenant xmlMultitenant = this.getXmlMultitenantForUpdate(); - this.setSpecifiedIncludeCriteria_(includeCriteria); - xmlMultitenant.setIncludeCriteria(includeCriteria); - } - } - - protected void setSpecifiedIncludeCriteria_(Boolean includeCriteria) { - Boolean old = this.specifiedIncludeCriteria; - this.specifiedIncludeCriteria = includeCriteria; - this.firePropertyChanged(SPECIFIED_INCLUDE_CRITERIA_PROPERTY, old, includeCriteria); - } - - protected Boolean buildSpecifiedIncludeCriteria() { - XmlMultitenant xmlMultitenant = this.getXmlMultitenant(); - return (xmlMultitenant == null) ? null : xmlMultitenant.getIncludeCriteria(); - } - - - public boolean isDefaultIncludeCriteria() { - return this.defaultIncludeCriteria; - } - - protected void setDefaultIncludeCriteria(boolean includeCriteria) { - boolean old = this.defaultIncludeCriteria; - this.defaultIncludeCriteria = includeCriteria; - this.firePropertyChanged(DEFAULT_INCLUDE_CRITERIA_PROPERTY, old, includeCriteria); - } - - protected boolean buildDefaultIncludeCriteria() { - if (getType() == EclipseLinkMultitenantType2_3.VPD) { - return false; - } - return DEFAULT_INCLUDE_CRITERIA; - } - - - // ********** tenant discriminator columns ********** - - public ListIterable<OrmReadOnlyTenantDiscriminatorColumn2_3> getTenantDiscriminatorColumns() { - return this.hasSpecifiedTenantDiscriminatorColumns() ? - this.getReadOnlySpecifiedTenantDiscriminatorColumns() : - this.getReadOnlyDefaultTenantDiscriminatorColumns(); - } - - public int getTenantDiscriminatorColumnsSize() { - return this.hasSpecifiedTenantDiscriminatorColumns() ? - this.getSpecifiedTenantDiscriminatorColumnsSize() : - this.getDefaultTenantDiscriminatorColumnsSize(); - } - - // ********** specified tenant discriminator columns ********** - - public ListIterable<OrmTenantDiscriminatorColumn2_3> getSpecifiedTenantDiscriminatorColumns() { - return this.specifiedTenantDiscriminatorColumnContainer.getContextElements(); - } - - protected ListIterable<OrmReadOnlyTenantDiscriminatorColumn2_3> getReadOnlySpecifiedTenantDiscriminatorColumns() { - return new SuperListIterableWrapper<OrmReadOnlyTenantDiscriminatorColumn2_3>(this.getSpecifiedTenantDiscriminatorColumns()); - } - - public int getSpecifiedTenantDiscriminatorColumnsSize() { - return this.specifiedTenantDiscriminatorColumnContainer.getContextElementsSize(); - } - - public boolean hasSpecifiedTenantDiscriminatorColumns() { - return this.getSpecifiedTenantDiscriminatorColumnsSize() != 0; - } - - public OrmTenantDiscriminatorColumn2_3 addSpecifiedTenantDiscriminatorColumn() { - return this.addSpecifiedTenantDiscriminatorColumn(this.getSpecifiedTenantDiscriminatorColumnsSize()); - } - - public OrmTenantDiscriminatorColumn2_3 addSpecifiedTenantDiscriminatorColumn(int index) { - XmlTenantDiscriminatorColumn xmlJoinColumn = this.buildXmlTenantDiscriminatorColumn(); - OrmTenantDiscriminatorColumn2_3 joinColumn = this.specifiedTenantDiscriminatorColumnContainer.addContextElement(index, xmlJoinColumn); - this.getXmlMultitenantForUpdate().getTenantDiscriminatorColumns().add(index, xmlJoinColumn); - return joinColumn; - } - - protected XmlTenantDiscriminatorColumn buildXmlTenantDiscriminatorColumn() { - return EclipseLinkOrmFactory.eINSTANCE.createXmlTenantDiscriminatorColumn(); - } - - public void removeSpecifiedTenantDiscriminatorColumn(TenantDiscriminatorColumn2_3 tenantDiscriminatorColumn) { - this.removeSpecifiedTenantDiscriminatorColumn(this.specifiedTenantDiscriminatorColumnContainer.indexOfContextElement((OrmTenantDiscriminatorColumn2_3) tenantDiscriminatorColumn)); - } - - public void removeSpecifiedTenantDiscriminatorColumn(int index) { - this.specifiedTenantDiscriminatorColumnContainer.removeContextElement(index); - this.getXmlMultitenant().getTenantDiscriminatorColumns().remove(index); - } - - public void moveSpecifiedTenantDiscriminatorColumn(int targetIndex, int sourceIndex) { - this.specifiedTenantDiscriminatorColumnContainer.moveContextElement(targetIndex, sourceIndex); - this.getXmlMultitenant().getTenantDiscriminatorColumns().move(targetIndex, sourceIndex); - } - - - protected void syncSpecifiedTenantDiscriminatorColumns() { - this.specifiedTenantDiscriminatorColumnContainer.synchronizeWithResourceModel(); - } - - protected ListIterable<XmlTenantDiscriminatorColumn_2_3> getXmlTenantDiscriminatorColumns() { - if (getXmlMultitenant() == null) { - return EmptyListIterable.instance(); - } - // clone to reduce chance of concurrency problems - return new LiveCloneListIterable<XmlTenantDiscriminatorColumn_2_3>(this.getXmlMultitenant().getTenantDiscriminatorColumns()); - } - - /** - * specified tenant discriminator column container - */ - protected class SpecifiedTenantDiscriminatorColumnContainer - extends ContextListContainer<OrmTenantDiscriminatorColumn2_3, XmlTenantDiscriminatorColumn_2_3> - { - @Override - protected String getContextElementsPropertyName() { - return SPECIFIED_TENANT_DISCRIMINATOR_COLUMNS_LIST; - } - @Override - protected OrmTenantDiscriminatorColumn2_3 buildContextElement(XmlTenantDiscriminatorColumn_2_3 resourceElement) { - return OrmEclipseLinkMultitenancyImpl2_3.this.buildTenantDiscriminatorColumn(resourceElement); - } - @Override - protected ListIterable<XmlTenantDiscriminatorColumn_2_3> getResourceElements() { - return OrmEclipseLinkMultitenancyImpl2_3.this.getXmlTenantDiscriminatorColumns(); - } - @Override - protected XmlTenantDiscriminatorColumn_2_3 getResourceElement(OrmTenantDiscriminatorColumn2_3 contextElement) { - return contextElement.getXmlColumn(); - } - } - - protected OrmReadOnlyTenantDiscriminatorColumn2_3.Owner buildTenantDiscriminatorColumnOwner() { - return new TenantDiscriminatorColumnOwner(); - } - - protected ContextListContainer<OrmTenantDiscriminatorColumn2_3, XmlTenantDiscriminatorColumn_2_3> buildSpecifiedTenantDiscriminatorColumnContainer() { - SpecifiedTenantDiscriminatorColumnContainer container = new SpecifiedTenantDiscriminatorColumnContainer(); - container.initialize(); - return container; - } - - protected OrmTenantDiscriminatorColumn2_3 buildTenantDiscriminatorColumn(XmlTenantDiscriminatorColumn_2_3 xmlTenantDiscriminatorColumn) { - return new EclipseLinkOrmTenantDiscriminatorColumn2_3(this, this.tenantDiscriminatorColumnOwner, xmlTenantDiscriminatorColumn); - } - - - // ********** default tenant discriminator columns ********** - - public ListIterable<OrmVirtualTenantDiscriminatorColumn2_3> getDefaultTenantDiscriminatorColumns() { - return this.defaultTenantDiscriminatorColumnContainer.getContextElements(); - } - - protected ListIterable<OrmReadOnlyTenantDiscriminatorColumn2_3> getReadOnlyDefaultTenantDiscriminatorColumns() { - return new SuperListIterableWrapper<OrmReadOnlyTenantDiscriminatorColumn2_3>(this.getDefaultTenantDiscriminatorColumns()); - } - - public int getDefaultTenantDiscriminatorColumnsSize() { - return this.defaultTenantDiscriminatorColumnContainer.getContextElementsSize(); - } - - protected void clearDefaultTenantDiscriminatorColumns() { - this.defaultTenantDiscriminatorColumnContainer.clearContextList(); - } - - /** - * If there are any specified tenant discriminator columns, then there are no default - * tenant discriminator columns. - * If there are Java specified tenant discriminator columns, then those are the default - * tenant discriminator columns. - * @see #getTenantDiscriminatorColumnsForDefaults() - */ - protected void updateDefaultTenantDiscriminatorColumns() { - this.defaultTenantDiscriminatorColumnContainer.update(); - } - - protected ListIterable<ReadOnlyTenantDiscriminatorColumn2_3> getTenantDiscriminatorColumnsForDefaults() { - if (this.getType() == null || this.getType() == EclipseLinkMultitenantType2_3.TABLE_PER_TENANT) { - return EmptyListIterable.instance(); - } - JavaEclipseLinkMultitenancy2_3 javaMultitenancy = this.getJavaMultitenancyPolicyForDefaults(); - if (javaMultitenancy != null && !this.isSpecifiedMultitenant()) { - if (javaMultitenancy.hasSpecifiedTenantDiscriminatorColumns()) { - return new SuperListIterableWrapper<ReadOnlyTenantDiscriminatorColumn2_3>(javaMultitenancy.getSpecifiedTenantDiscriminatorColumns()); - } - } - if (this.isMultitenantInheritanceHierarchy()) { - return new SuperListIterableWrapper<ReadOnlyTenantDiscriminatorColumn2_3>(this.getRootEntity().getMultitenancy().getTenantDiscriminatorColumns()); - } - if (!isSpecifiedMultitenant()) { - EclipseLinkMappedSuperclass superMappedSuperclass = this.getSuperMappedSuperclass(); - if (superMappedSuperclass != null && superMappedSuperclass.getMultitenancy().isMultitenant()) { - return new SuperListIterableWrapper<ReadOnlyTenantDiscriminatorColumn2_3>(superMappedSuperclass.getMultitenancy().getTenantDiscriminatorColumns()); - } - } - if (this.getSpecifiedTenantDiscriminatorColumnsSize() == 0) { - ListIterable<ReadOnlyTenantDiscriminatorColumn2_3> contextColumns = this.getContextDefaultTenantDiscriminatorColumns(); - if (CollectionTools.isEmpty(contextColumns)) { - return new SingleElementListIterable<ReadOnlyTenantDiscriminatorColumn2_3>(this.defaultTenantDiscriminatorColumn); - } - return contextColumns; - } - return EmptyListIterable.instance(); - } - - protected ListIterable<ReadOnlyTenantDiscriminatorColumn2_3> getContextDefaultTenantDiscriminatorColumns() { - EclipseLinkEntityMappings entityMappings = this.getEclipseLinkEntityMappings(); - return (entityMappings != null) ? entityMappings.getTenantDiscriminatorColumns() : this.getPersistenceUnit().getDefaultTenantDiscriminatorColumns(); - } - - - protected void moveDefaultTenantDiscriminatorColumn(int index, OrmVirtualTenantDiscriminatorColumn2_3 tenantDiscriminatorColumn) { - this.defaultTenantDiscriminatorColumnContainer.moveContextElement(index, tenantDiscriminatorColumn); - } - - protected OrmVirtualTenantDiscriminatorColumn2_3 addDefaultTenantDiscriminatorColumn(int index, JavaTenantDiscriminatorColumn2_3 javaTenantDiscriminatorColumn) { - return this.defaultTenantDiscriminatorColumnContainer.addContextElement(index, javaTenantDiscriminatorColumn); - } - - protected OrmVirtualTenantDiscriminatorColumn2_3 buildVirtualTenantDiscriminatorColumn(ReadOnlyTenantDiscriminatorColumn2_3 tenantDiscriminatorColumn) { - return new GenericOrmVirtualTenantDiscriminatorColumn2_3(this, this.tenantDiscriminatorColumnOwner, tenantDiscriminatorColumn); - } - - protected void removeDefaultTenantDiscriminatorColumn(OrmVirtualTenantDiscriminatorColumn2_3 tenantDiscriminatorColumn) { - this.defaultTenantDiscriminatorColumnContainer.removeContextElement(tenantDiscriminatorColumn); - } - - protected ContextListContainer<OrmVirtualTenantDiscriminatorColumn2_3, ReadOnlyTenantDiscriminatorColumn2_3> buildDefaultTenantDiscriminatorColumnContainer() { - return new DefaultTenantDiscriminatorColumnContainer(); - } - - public boolean specifiedTenantDiscriminatorColumnsAllowed() { - return this.specifiedTenantDiscriminatorColumnsAllowed; - } - - public void setSpecifiedTenantDiscriminatorColumnsAllowed(boolean allowed) { - boolean old = this.specifiedTenantDiscriminatorColumnsAllowed; - this.specifiedTenantDiscriminatorColumnsAllowed = allowed; - this.firePropertyChanged(SPECIFIED_TENANT_DISCRIMINATOR_COLUMNS_ALLOWED_PROPERTY, old, allowed); - } - - protected boolean buildSpecifiedTenantDiscriminatorColumnsAllowed() { - return this.getParent().isMultitenantMetadataAllowed(); - } - - - /** - * default tenant discriminator column container - */ - protected class DefaultTenantDiscriminatorColumnContainer - extends ContextListContainer<OrmVirtualTenantDiscriminatorColumn2_3, ReadOnlyTenantDiscriminatorColumn2_3> - { - @Override - protected String getContextElementsPropertyName() { - return DEFAULT_TENANT_DISCRIMINATOR_COLUMNS_LIST; - } - @Override - protected OrmVirtualTenantDiscriminatorColumn2_3 buildContextElement(ReadOnlyTenantDiscriminatorColumn2_3 resourceElement) { - return OrmEclipseLinkMultitenancyImpl2_3.this.buildVirtualTenantDiscriminatorColumn(resourceElement); - } - @Override - protected ListIterable<ReadOnlyTenantDiscriminatorColumn2_3> getResourceElements() { - return OrmEclipseLinkMultitenancyImpl2_3.this.getTenantDiscriminatorColumnsForDefaults(); - } - @Override - protected ReadOnlyTenantDiscriminatorColumn2_3 getResourceElement(OrmVirtualTenantDiscriminatorColumn2_3 contextElement) { - return contextElement.getOverriddenColumn(); - } - } - - - // ********** OrmReadOnlyTenantDiscriminatorColumn.Owner implementation ********** - - protected class TenantDiscriminatorColumnOwner - implements OrmReadOnlyTenantDiscriminatorColumn2_3.Owner - { - - public String getDefaultContextPropertyName() { - return ReadOnlyTenantDiscriminatorColumn2_3.DEFAULT_CONTEXT_PROPERTY; - } - - public boolean getDefaultPrimaryKey() { - return ReadOnlyTenantDiscriminatorColumn2_3.DEFAULT_PRIMARY_KEY; - } - - public int getDefaultLength() { - return ReadOnlyNamedDiscriminatorColumn.DEFAULT_LENGTH; - } - - public DiscriminatorType getDefaultDiscriminatorType() { - return ReadOnlyNamedDiscriminatorColumn.DEFAULT_DISCRIMINATOR_TYPE; - } - - public String getDefaultTableName() { - return getTypeMapping().getPrimaryTableName(); - } - - public String getDefaultColumnName(ReadOnlyNamedColumn column) { - return ReadOnlyTenantDiscriminatorColumn2_3.DEFAULT_NAME; - } - - public Table resolveDbTable(String tableName) { - return getTypeMapping().resolveDbTable(tableName); - } - - public Iterable<String> getCandidateTableNames() { - return getTypeMapping().getAllAssociatedTableNames(); - } - - public boolean tableNameIsInvalid(String tableName) { - return getTypeMapping().tableNameIsInvalid(tableName); - } - - public JptValidator buildColumnValidator(ReadOnlyNamedColumn column, NamedColumnTextRangeResolver textRangeResolver) { - return new TenantDiscriminatorColumnValidator2_3((ReadOnlyTenantDiscriminatorColumn2_3) column, textRangeResolver); - } - - public TextRange getValidationTextRange() { - return OrmEclipseLinkMultitenancyImpl2_3.this.getValidationTextRange(); - } - } - - // ********** XML multitenant ********** - - /** - * Return null if the XML multitenant does not exists. - */ - protected XmlMultitenant getXmlMultitenant() { - return getXmlMultitenantHolder().getMultitenant(); - } - - protected XmlMultitenantHolder getXmlMultitenantHolder() { - return (XmlMultitenantHolder) this.getXmlTypeMapping(); - } - - /** - * Build the XML multitenant if it does not exist. - */ - protected XmlMultitenant getXmlMultitenantForUpdate() { - XmlMultitenant xmlMultitenant = this.getXmlMultitenant(); - return (xmlMultitenant != null) ? xmlMultitenant : this.buildXmlMultitenant(); - } - - protected XmlMultitenant buildXmlMultitenant() { - XmlMultitenant xmlMultitenant = EclipseLinkOrmFactory.eINSTANCE.createXmlMultitenant(); - this.getXmlMultitenantHolder().setMultitenant(xmlMultitenant); - return xmlMultitenant; - } - - public boolean isMultitenantElementSpecified() { - return this.getXmlMultitenant() != null; - } - - protected XmlMultitenant addXmlMultitenant() { - XmlMultitenant xmlMultitenant = this.buildXmlMultitenant(); - this.getXmlMultitenantHolder().setMultitenant(xmlMultitenant); - return xmlMultitenant; - } - - protected void removeXmlMultitenant() { - this.getXmlMultitenantHolder().setMultitenant(null); - } - - // ********** misc ********** - - @Override - public OrmEclipseLinkNonEmbeddableTypeMapping getParent() { - return (OrmEclipseLinkNonEmbeddableTypeMapping) super.getParent(); - } - - protected OrmEclipseLinkNonEmbeddableTypeMapping getTypeMapping() { - return this.getParent(); - } - - protected XmlTypeMapping getXmlTypeMapping() { - return this.getTypeMapping().getXmlTypeMapping(); - } - - public EclipseLinkEntityMappings getEclipseLinkEntityMappings() { - return (EclipseLinkEntityMappings) super.getMappingFileRoot(); - } - - @Override - public EclipseLinkPersistenceUnit getPersistenceUnit() { - return (EclipseLinkPersistenceUnit) super.getPersistenceUnit(); - } - - protected JavaEclipseLinkNonEmbeddableTypeMapping getJavaTypeMappingForDefaults() { - return this.getTypeMapping().getJavaTypeMappingForDefaults(); - } - - protected JavaEclipseLinkMultitenancy2_3 getJavaMultitenancyPolicyForDefaults() { - JavaEclipseLinkNonEmbeddableTypeMapping javaTypeMapping = this.getJavaTypeMappingForDefaults(); - return (javaTypeMapping == null) ? null : javaTypeMapping.getMultitenancy(); - } - - protected boolean isMultitenantInheritanceHierarchy() { - if (this.isInheritanceStrategyTablePerClass()) { - return false; - } - return this.isRootEntityMultitenant(); - } - - protected boolean isInheritanceStrategyTablePerClass() { - return this.getParent().getInheritanceStrategy() == InheritanceType.TABLE_PER_CLASS; - } - - protected boolean isRootEntityMultitenant() { - EclipseLinkEntity rootEntity = this.getRootEntity(); - return rootEntity != null && rootEntity != getParent() && rootEntity.getMultitenancy().isMultitenant(); - } - - protected EclipseLinkEntity getRootEntity() { - //instanceof check in case the rootEntity is in an orm.xml instead of an eclipselinkorm.xml file. - Entity entity = getParent().getRootEntity(); - return entity instanceof EclipseLinkEntity ? (EclipseLinkEntity) entity : null; - } - - protected boolean isSuperMappedSuperclassMultitenant() { - EclipseLinkMappedSuperclass mappedSuperclass = this.getSuperMappedSuperclass(getParent()); - return mappedSuperclass != null && mappedSuperclass.getMultitenancy().isMultitenant(); - } - - protected EclipseLinkMappedSuperclass getSuperMappedSuperclass() { - return this.getSuperMappedSuperclass(this.getParent()); - } - - protected EclipseLinkMappedSuperclass getSuperMappedSuperclass(TypeMapping typeMapping) { - TypeMapping superTypeMapping = typeMapping.getSuperTypeMapping(); - if (superTypeMapping == null) { - return null; - } - //instanceof check in case the mapped superclass is in an orm.xml instead of an eclipselinkorm.xml file. - if (superTypeMapping instanceof EclipseLinkMappedSuperclass) { - return (EclipseLinkMappedSuperclass) superTypeMapping; - } - return this.getSuperMappedSuperclass(superTypeMapping); - } - - public boolean usesPrimaryKeyTenantDiscriminatorColumns() { - for (ReadOnlyTenantDiscriminatorColumn2_3 column : getTenantDiscriminatorColumns()) { - if (column.isPrimaryKey()) { - return true; - } - } - return false; - } - - - // ********** validation ********** - - @Override - public void validate(List<IMessage> messages, IReporter reporter) { - super.validate(messages, reporter); - if (getType() == EclipseLinkMultitenantType2_3.TABLE_PER_TENANT) { - messages.add( - DefaultEclipseLinkJpaValidationMessages.buildMessage( - IMessage.NORMAL_SEVERITY, - EclipseLinkJpaValidationMessages.MULTITENANT_TABLE_PER_TENANT_NOT_SUPPORTED, - EMPTY_STRING_ARRAY, - this, - this.getValidationTextRange() - ) - ); - } - if (getType() == EclipseLinkMultitenantType2_3.VPD) { - String targetDatabase = getPersistenceUnit().getOptions().getTargetDatabase(); - if (targetDatabase == null) { - messages.add( - DefaultEclipseLinkJpaValidationMessages.buildMessage( - IMessage.LOW_SEVERITY, - EclipseLinkJpaValidationMessages.MULTITENANT_VPD_MIGHT_NOT_BE_NOT_SUPPORTED, - EMPTY_STRING_ARRAY, - this, - this.getValidationTextRange() - ) - ); - } - else if (!TargetDatabase.isOracleDatabase(targetDatabase)) { - messages.add( - DefaultEclipseLinkJpaValidationMessages.buildMessage( - IMessage.NORMAL_SEVERITY, - EclipseLinkJpaValidationMessages.MULTITENANT_VPD_NOT_SUPPORTED_ON_NON_ORACLE_DATABASE_PLATFORM, - new String[] {targetDatabase}, - this, - this.getValidationTextRange() - ) - ); - } - } - if (getSpecifiedTenantDiscriminatorColumnsSize() > 0) { - if (!this.specifiedTenantDiscriminatorColumnsAllowed()) { - messages.add( - DefaultEclipseLinkJpaValidationMessages.buildMessage( - IMessage.NORMAL_SEVERITY, - EclipseLinkJpaValidationMessages.MULTITENANT_METADATA_CANNOT_BE_SPECIFIED_ON_NON_ROOT_ENTITY, - EMPTY_STRING_ARRAY, - this, - this.getXmlMultitenant().getValidationTextRange() - ) - ); - } - else { - for (OrmTenantDiscriminatorColumn2_3 column : this.getSpecifiedTenantDiscriminatorColumns()) { - column.validate(messages, reporter); - } - } - } - if (this.specifiedTenantDiscriminatorColumnsAllowed()) { - //bug 360731 no need to validate, they will be validated where they are specified - for (OrmVirtualTenantDiscriminatorColumn2_3 column : this.getDefaultTenantDiscriminatorColumns()) { - column.validate(messages, reporter); - } - } - if (this.getSpecifiedIncludeCriteria() == Boolean.TRUE && getType() == EclipseLinkMultitenantType2_3.VPD) { - messages.add( - DefaultEclipseLinkJpaValidationMessages.buildMessage( - IMessage.NORMAL_SEVERITY, - EclipseLinkJpaValidationMessages.MULTITENANT_VPD_INCLUDE_CRITERIA_WILL_BE_IGNORED, - EMPTY_STRING_ARRAY, - this, - this.getXmlMultitenant().getIncludeCriteriaTextRange() - ) - ); - } - } - - public TextRange getValidationTextRange() { - TextRange textRange = this.getXmlMultitenantValidationTextRange(); - return (textRange != null) ? textRange : this.getTypeMapping().getValidationTextRange(); - } - - protected TextRange getXmlMultitenantValidationTextRange() { - XmlMultitenant_2_4 xmlMultitenant = this.getXmlMultitenant(); - return (xmlMultitenant == null) ? null : xmlMultitenant.getValidationTextRange(); - } - - // ********** completion proposals ********** - - @Override - public Iterable<String> getXmlCompletionProposals(int pos) { - Iterable<String> result = super.getXmlCompletionProposals(pos); - if (result != null) { - return result; - } - for (OrmTenantDiscriminatorColumn2_3 tenantDiscriminatorColumn : this.getSpecifiedTenantDiscriminatorColumns()) { - result = tenantDiscriminatorColumn.getXmlCompletionProposals(pos); - if (result != null) { - return result; - } - } - return null; - } -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/orm/OrmEclipseLinkMutable.java b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/orm/OrmEclipseLinkMutable.java deleted file mode 100644 index 6d2d947109..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/orm/OrmEclipseLinkMutable.java +++ /dev/null @@ -1,132 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2008, 2012 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.eclipselink.core.internal.context.orm; - -import org.eclipse.jpt.common.core.utility.TextRange; -import org.eclipse.jpt.jpa.core.context.orm.OrmAttributeMapping; -import org.eclipse.jpt.jpa.core.internal.context.orm.AbstractOrmXmlContextNode; -import org.eclipse.jpt.jpa.eclipselink.core.context.EclipseLinkMutable; -import org.eclipse.jpt.jpa.eclipselink.core.context.java.JavaEclipseLinkPersistentAttribute; -import org.eclipse.jpt.jpa.eclipselink.core.context.persistence.EclipseLinkPersistenceUnit; -import org.eclipse.jpt.jpa.eclipselink.core.resource.orm.XmlMutable; - -public class OrmEclipseLinkMutable - extends AbstractOrmXmlContextNode - implements EclipseLinkMutable -{ - protected Boolean specifiedMutable; - protected boolean defaultMutable; - - - public OrmEclipseLinkMutable(OrmAttributeMapping parent) { - super(parent); - this.specifiedMutable = this.buildSpecifiedMutable(); - } - - - // ********** synchronize/update ********** - - @Override - public void synchronizeWithResourceModel() { - super.synchronizeWithResourceModel(); - this.setSpecifiedMutable_(this.buildSpecifiedMutable()); - } - - @Override - public void update() { - super.update(); - this.setDefaultMutable(this.buildDefaultMutable()); - } - - - // ********** mutable ********** - - public boolean isMutable() { - return (this.specifiedMutable != null) ? this.specifiedMutable.booleanValue() : this.defaultMutable; - } - - public Boolean getSpecifiedMutable() { - return this.specifiedMutable; - } - - public void setSpecifiedMutable(Boolean mutable) { - this.setSpecifiedMutable_(mutable); - this.getXmlMutable().setMutable(mutable); - } - - protected void setSpecifiedMutable_(Boolean mutable) { - Boolean old = this.specifiedMutable; - this.specifiedMutable = mutable; - this.firePropertyChanged(SPECIFIED_MUTABLE_PROPERTY, old, mutable); - } - - protected Boolean buildSpecifiedMutable() { - return this.getXmlMutable().getMutable(); - } - - public boolean isDefaultMutable() { - return this.defaultMutable; - } - - protected void setDefaultMutable(boolean mutable) { - boolean old = this.defaultMutable; - this.defaultMutable = mutable; - this.firePropertyChanged(DEFAULT_MUTABLE_PROPERTY, old, mutable); - } - - protected boolean buildDefaultMutable() { - JavaEclipseLinkPersistentAttribute javaAttribute = this.getJavaPersistentAttribute(); - if (javaAttribute == null) { - return false; - } - if (javaAttribute.typeIsDateOrCalendar()) { - Boolean puTemporalMutable = this.getPersistenceUnit().getOptions().getTemporalMutable(); - return (puTemporalMutable == null) ? false : puTemporalMutable.booleanValue(); - } - return javaAttribute.typeIsSerializable(); - } - - - // ********** misc ********** - - @Override - public OrmAttributeMapping getParent() { - return (OrmAttributeMapping) super.getParent(); - } - - protected OrmAttributeMapping getAttributeMapping() { - return this.getParent(); - } - - protected XmlMutable getXmlMutable() { - return (XmlMutable) this.getAttributeMapping().getXmlAttributeMapping(); - } - - protected JavaEclipseLinkPersistentAttribute getJavaPersistentAttribute() { - return (JavaEclipseLinkPersistentAttribute) this.getAttributeMapping().getPersistentAttribute().getJavaPersistentAttribute(); - } - - @Override - public EclipseLinkPersistenceUnit getPersistenceUnit() { - return (EclipseLinkPersistenceUnit) super.getPersistenceUnit(); - } - - - // ********** validation ********** - - public TextRange getValidationTextRange() { - TextRange textRange = this.getXmlValidationTextRange(); - return (textRange != null) ? textRange : this.getAttributeMapping().getValidationTextRange(); - } - - protected TextRange getXmlValidationTextRange() { - return this.getXmlMutable().getMutableTextRange(); - } -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/orm/OrmEclipseLinkObjectTypeConverter.java b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/orm/OrmEclipseLinkObjectTypeConverter.java deleted file mode 100644 index 646ce317ac..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/orm/OrmEclipseLinkObjectTypeConverter.java +++ /dev/null @@ -1,481 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2008, 2012 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.eclipselink.core.internal.context.orm; - -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import org.eclipse.jdt.core.IPackageFragment; -import org.eclipse.jdt.core.IType; -import org.eclipse.jpt.common.core.resource.java.JavaResourceAbstractType; -import org.eclipse.jpt.common.utility.internal.Tools; -import org.eclipse.jpt.common.utility.internal.iterables.CompositeIterable; -import org.eclipse.jpt.common.utility.internal.iterables.EmptyIterable; -import org.eclipse.jpt.common.utility.internal.iterables.ListIterable; -import org.eclipse.jpt.common.utility.internal.iterables.LiveCloneListIterable; -import org.eclipse.jpt.common.utility.internal.iterables.SingleElementIterable; -import org.eclipse.jpt.common.utility.internal.iterables.TransformationIterable; -import org.eclipse.jpt.jpa.core.context.JpaNamedContextNode; -import org.eclipse.jpt.jpa.core.context.XmlContextNode; -import org.eclipse.jpt.jpa.eclipselink.core.context.EclipseLinkConversionValue; -import org.eclipse.jpt.jpa.eclipselink.core.context.EclipseLinkObjectTypeConverter; -import org.eclipse.jpt.jpa.eclipselink.core.internal.DefaultEclipseLinkJpaValidationMessages; -import org.eclipse.jpt.jpa.eclipselink.core.internal.EclipseLinkJpaValidationMessages; -import org.eclipse.jpt.jpa.eclipselink.core.internal.context.java.JavaEclipseLinkConversionValue; -import org.eclipse.jpt.jpa.eclipselink.core.internal.context.java.JavaEclipseLinkObjectTypeConverter; -import org.eclipse.jpt.jpa.eclipselink.core.resource.orm.EclipseLinkOrmFactory; -import org.eclipse.jpt.jpa.eclipselink.core.resource.orm.XmlConversionValue; -import org.eclipse.jpt.jpa.eclipselink.core.resource.orm.XmlObjectTypeConverter; -import org.eclipse.text.edits.ReplaceEdit; -import org.eclipse.wst.validation.internal.provisional.core.IMessage; -import org.eclipse.wst.validation.internal.provisional.core.IReporter; - -public class OrmEclipseLinkObjectTypeConverter - extends OrmEclipseLinkConverter<XmlObjectTypeConverter> - implements EclipseLinkObjectTypeConverter -{ - private String dataType; - private String fullyQualifiedDataType; - - private String objectType; - private String fullyQualifiedObjectType; - - - protected final ContextListContainer<OrmEclipseLinkConversionValue, XmlConversionValue> conversionValueContainer; - - private String defaultObjectValue; - - - public OrmEclipseLinkObjectTypeConverter(XmlContextNode parent, XmlObjectTypeConverter xmlConverter) { - super(parent, xmlConverter); - this.dataType = xmlConverter.getDataType(); - this.objectType = xmlConverter.getObjectType(); - this.conversionValueContainer = this.buildConversionValueContainer(); - this.defaultObjectValue = xmlConverter.getDefaultObjectValue(); - } - - - // ********** synchronize/update ********** - - @Override - public void synchronizeWithResourceModel() { - super.synchronizeWithResourceModel(); - this.setDataType_(this.xmlConverter.getDataType()); - this.setObjectType_(this.xmlConverter.getObjectType()); - this.syncConversionValues(); - this.setDefaultObjectValue_(this.xmlConverter.getDefaultObjectValue()); - } - - @Override - public void update() { - super.update(); - this.setFullyQualifiedDataType(this.buildFullyQualifiedDataType()); - this.setFullyQualifiedObjectType(this.buildFullyQualifiedObjectType()); - this.updateNodes(this.getConversionValues()); - } - - - // ********** data type ********** - - public String getDataType() { - return this.dataType; - } - - public void setDataType(String dataType) { - this.setDataType_(dataType); - this.xmlConverter.setDataType(dataType); - } - - protected void setDataType_(String dataType) { - String old = this.dataType; - this.dataType = dataType; - this.firePropertyChanged(DATA_TYPE_PROPERTY, old, dataType); - } - - public String getFullyQualifiedDataType() { - return this.fullyQualifiedDataType; - } - - protected void setFullyQualifiedDataType(String dataType) { - String old = this.fullyQualifiedDataType; - this.fullyQualifiedDataType = dataType; - this.firePropertyChanged(FULLY_QUALIFIED_DATA_TYPE_PROPERTY, old, dataType); - } - - protected String buildFullyQualifiedDataType() { - return this.getMappingFileRoot().getFullyQualifiedName(this.dataType); - } - - protected boolean dataTypeIsFor(String typeName) { - return this.typeIsFor(this.getDataTypeJavaResourceType(), typeName); - } - - protected boolean dataTypeIsIn(IPackageFragment packageFragment) { - return this.typeIsIn(this.getDataTypeJavaResourceType(), packageFragment); - } - - protected JavaResourceAbstractType getDataTypeJavaResourceType() { - if (this.fullyQualifiedDataType == null) { - return null; - } - return this.getJpaProject().getJavaResourceType(this.fullyQualifiedDataType); - } - - - // ********** object type ********** - - public String getObjectType() { - return this.objectType; - } - - public void setObjectType(String objectType) { - this.setObjectType_(objectType); - this.xmlConverter.setObjectType(objectType); - } - - protected void setObjectType_(String objectType) { - String old = this.objectType; - this.objectType = objectType; - this.firePropertyChanged(OBJECT_TYPE_PROPERTY, old, objectType); - } - - public String getFullyQualifiedObjectType() { - return this.fullyQualifiedObjectType; - } - - protected void setFullyQualifiedObjectType(String objectType) { - String old = this.fullyQualifiedObjectType; - this.fullyQualifiedObjectType = objectType; - this.firePropertyChanged(FULLY_QUALIFIED_OBJECT_TYPE_PROPERTY, old, objectType); - } - - protected String buildFullyQualifiedObjectType() { - return this.getMappingFileRoot().getFullyQualifiedName(this.objectType); - } - - protected boolean objectTypeIsFor(String typeName) { - return this.typeIsFor(this.getObjectTypeJavaResourceType(), typeName); - } - - protected boolean objectTypeIsIn(IPackageFragment packageFragment) { - return this.typeIsIn(this.getObjectTypeJavaResourceType(), packageFragment); - } - - protected JavaResourceAbstractType getObjectTypeJavaResourceType() { - if (this.fullyQualifiedObjectType == null) { - return null; - } - return this.getJpaProject().getJavaResourceType(this.fullyQualifiedObjectType); - } - - - // ********** conversion values ********** - - public ListIterable<OrmEclipseLinkConversionValue> getConversionValues() { - return this.conversionValueContainer.getContextElements(); - } - - public int getConversionValuesSize() { - return this.conversionValueContainer.getContextElementsSize(); - } - - public EclipseLinkConversionValue getConversionValue(int index) { - return this.conversionValueContainer.get(index); - } - - public OrmEclipseLinkConversionValue addConversionValue() { - return this.addConversionValue(this.getConversionValuesSize()); - } - - public OrmEclipseLinkConversionValue addConversionValue(int index) { - XmlConversionValue xmlConversionValue = this.buildXmlConversionValue(); - OrmEclipseLinkConversionValue conversionValue = this.conversionValueContainer.addContextElement(index, xmlConversionValue); - this.xmlConverter.getConversionValues().add(index, xmlConversionValue); - return conversionValue; - } - - protected XmlConversionValue buildXmlConversionValue() { - return EclipseLinkOrmFactory.eINSTANCE.createXmlConversionValue(); - } - - public void removeConversionValue(EclipseLinkConversionValue conversionValue) { - this.removeConversionValue(this.conversionValueContainer.indexOfContextElement((OrmEclipseLinkConversionValue) conversionValue)); - } - - public void removeConversionValue(int index) { - this.conversionValueContainer.removeContextElement(index); - this.xmlConverter.getConversionValues().remove(index); - } - - public void moveConversionValue(int targetIndex, int sourceIndex) { - this.conversionValueContainer.moveContextElement(targetIndex, sourceIndex); - this.xmlConverter.getConversionValues().move(targetIndex, sourceIndex); - } - - - protected OrmEclipseLinkConversionValue buildConversionValue(XmlConversionValue xmlConversionValue) { - return new OrmEclipseLinkConversionValue(this, xmlConversionValue); - } - - protected void syncConversionValues() { - this.conversionValueContainer.synchronizeWithResourceModel(); - } - - protected ListIterable<XmlConversionValue> getXmlConversionValues() { - // clone to reduce chance of concurrency problems - return new LiveCloneListIterable<XmlConversionValue>(this.xmlConverter.getConversionValues()); - } - - protected ContextListContainer<OrmEclipseLinkConversionValue, XmlConversionValue> buildConversionValueContainer() { - ConversionValueContainer container = new ConversionValueContainer(); - container.initialize(); - return container; - } - - /** - * conversion value container - */ - protected class ConversionValueContainer - extends ContextListContainer<OrmEclipseLinkConversionValue, XmlConversionValue> { - - @Override - protected String getContextElementsPropertyName() { - return CONVERSION_VALUES_LIST; - } - - @Override - protected OrmEclipseLinkConversionValue buildContextElement(XmlConversionValue resourceElement) { - return OrmEclipseLinkObjectTypeConverter.this.buildConversionValue(resourceElement); - } - - @Override - protected ListIterable<XmlConversionValue> getResourceElements() { - return OrmEclipseLinkObjectTypeConverter.this.getXmlConversionValues(); - } - - @Override - protected XmlConversionValue getResourceElement(OrmEclipseLinkConversionValue contextElement) { - return contextElement.getXmlConversionValue(); - } - } - - - // ********** data values ********** - - public Iterable<String> getDataValues() { - return new TransformationIterable<OrmEclipseLinkConversionValue, String>(this.getConversionValues()) { - @Override - protected String transform(OrmEclipseLinkConversionValue conversionValue) { - return conversionValue.getDataValue(); - } - }; - } - - public int getDataValuesSize() { - return this.getConversionValuesSize(); - } - - - // ********** default object value ********** - - public String getDefaultObjectValue() { - return this.defaultObjectValue; - } - - public void setDefaultObjectValue(String value) { - this.setDefaultObjectValue_(value); - this.xmlConverter.setDefaultObjectValue(value); - } - - protected void setDefaultObjectValue_(String value) { - String old = this.defaultObjectValue; - this.defaultObjectValue = value; - this.firePropertyChanged(DEFAULT_OBJECT_VALUE_PROPERTY, old, value); - } - - - // ********** misc ********** - - public Class<EclipseLinkObjectTypeConverter> getType() { - return EclipseLinkObjectTypeConverter.class; - } - - protected boolean typeIsFor(JavaResourceAbstractType type, String typeName) { - return (type != null) && type.getQualifiedName().equals(typeName); - } - - protected boolean typeIsIn(JavaResourceAbstractType type, IPackageFragment packageFragment) { - return (type != null) && type.isIn(packageFragment); - } - - - // ********** refactoring ********** - - @Override - @SuppressWarnings("unchecked") - public Iterable<ReplaceEdit> createRenameTypeEdits(IType originalType, String newName) { - return new CompositeIterable<ReplaceEdit>( - this.createRenameDataTypeEdits(originalType, newName), - this.createRenameObjectTypeEdits(originalType, newName) - ); - } - - protected Iterable<ReplaceEdit> createRenameDataTypeEdits(IType originalType, String newName) { - return this.dataTypeIsFor(originalType.getFullyQualifiedName('.')) ? - new SingleElementIterable<ReplaceEdit>(this.createRenameDataTypeEdit(originalType, newName)) : - EmptyIterable.<ReplaceEdit>instance(); - } - - protected ReplaceEdit createRenameDataTypeEdit(IType originalType, String newName) { - return this.xmlConverter.createRenameDataTypeEdit(originalType, newName); - } - - protected Iterable<ReplaceEdit> createRenameObjectTypeEdits(IType originalType, String newName) { - return this.objectTypeIsFor(originalType.getFullyQualifiedName('.')) ? - new SingleElementIterable<ReplaceEdit>(this.createRenameObjectTypeEdit(originalType, newName)) : - EmptyIterable.<ReplaceEdit>instance(); - } - - protected ReplaceEdit createRenameObjectTypeEdit(IType originalType, String newName) { - return this.xmlConverter.createRenameObjectTypeEdit(originalType, newName); - } - - @Override - @SuppressWarnings("unchecked") - public Iterable<ReplaceEdit> createMoveTypeEdits(IType originalType, IPackageFragment newPackage) { - return new CompositeIterable<ReplaceEdit>( - this.createMoveDataTypeEdits(originalType, newPackage), - this.createMoveObjectTypeEdits(originalType, newPackage) - ); - } - - protected Iterable<ReplaceEdit> createMoveDataTypeEdits(IType originalType, IPackageFragment newPackage) { - return this.dataTypeIsFor(originalType.getFullyQualifiedName('.')) ? - new SingleElementIterable<ReplaceEdit>(this.createRenameDataTypePackageEdit(newPackage.getElementName())) : - EmptyIterable.<ReplaceEdit>instance(); - } - - protected ReplaceEdit createRenameDataTypePackageEdit(String newName) { - return this.xmlConverter.createRenameDataTypePackageEdit(newName); - } - - protected Iterable<ReplaceEdit> createMoveObjectTypeEdits(IType originalType, IPackageFragment newPackage) { - return this.objectTypeIsFor(originalType.getFullyQualifiedName('.')) ? - new SingleElementIterable<ReplaceEdit>(this.createRenameObjectTypePackageEdit(newPackage.getElementName())) : - EmptyIterable.<ReplaceEdit>instance(); - } - - protected ReplaceEdit createRenameObjectTypePackageEdit(String newName) { - return this.xmlConverter.createRenameObjectTypePackageEdit(newName); - } - - @Override - @SuppressWarnings("unchecked") - public Iterable<ReplaceEdit> createRenamePackageEdits(IPackageFragment originalPackage, String newName) { - return new CompositeIterable<ReplaceEdit>( - this.createRenameDataTypePackageEdits(originalPackage, newName), - this.createRenameObjectTypePackageEdits(originalPackage, newName) - ); - } - - protected Iterable<ReplaceEdit> createRenameDataTypePackageEdits(IPackageFragment originalPackage, String newName) { - return this.dataTypeIsIn(originalPackage) ? - new SingleElementIterable<ReplaceEdit>(this.createRenameDataTypePackageEdit(newName)) : - EmptyIterable.<ReplaceEdit>instance(); - } - - protected Iterable<ReplaceEdit> createRenameObjectTypePackageEdits(IPackageFragment originalPackage, String newName) { - return this.objectTypeIsIn(originalPackage) ? - new SingleElementIterable<ReplaceEdit>(this.createRenameObjectTypePackageEdit(newName)) : - EmptyIterable.<ReplaceEdit>instance(); - } - - - // ********** validation ********** - - @Override - public void validate(List<IMessage> messages, IReporter reporter) { - super.validate(messages, reporter); - this.checkForDuplicateDataValues(messages); - for (OrmEclipseLinkConversionValue conversionValue : this.getConversionValues()) { - conversionValue.validate(messages, reporter); - } - } - - protected void checkForDuplicateDataValues(List<IMessage> messages) { - for (ArrayList<OrmEclipseLinkConversionValue> dups : this.mapConversionValuesByDataValue().values()) { - if (dups.size() > 1) { - for (OrmEclipseLinkConversionValue dup : dups) { - messages.add( - DefaultEclipseLinkJpaValidationMessages.buildMessage( - IMessage.HIGH_SEVERITY, - EclipseLinkJpaValidationMessages.MULTIPLE_OBJECT_VALUES_FOR_DATA_VALUE, - new String[] {dup.getDataValue()}, - this, - dup.getDataValueTextRange() - ) - ); - } - } - } - } - - protected HashMap<String, ArrayList<OrmEclipseLinkConversionValue>> mapConversionValuesByDataValue() { - HashMap<String, ArrayList<OrmEclipseLinkConversionValue>> map = new HashMap<String, ArrayList<OrmEclipseLinkConversionValue>>(this.getConversionValuesSize()); - for (OrmEclipseLinkConversionValue conversionValue : this.getConversionValues()) { - String dataValue = conversionValue.getDataValue(); - ArrayList<OrmEclipseLinkConversionValue> list = map.get(dataValue); - if (list == null) { - list = new ArrayList<OrmEclipseLinkConversionValue>(); - map.put(dataValue, list); - } - list.add(conversionValue); - } - return map; - } - - @Override - public boolean isEquivalentTo(JpaNamedContextNode node) { - return super.isEquivalentTo(node) - && this.isEquivalentTo((EclipseLinkObjectTypeConverter) node); - } - - protected boolean isEquivalentTo(EclipseLinkObjectTypeConverter converter) { - return Tools.valuesAreEqual(this.fullyQualifiedObjectType, converter.getFullyQualifiedObjectType()) && - Tools.valuesAreEqual(this.fullyQualifiedDataType, converter.getFullyQualifiedDataType()) && - Tools.valuesAreEqual(this.defaultObjectValue, converter.getDefaultObjectValue()) && - this.conversionValuesAreEquivalentTo(converter); - } - - protected boolean conversionValuesAreEquivalentTo(EclipseLinkObjectTypeConverter converter) { - if (this.getConversionValuesSize() != converter.getConversionValuesSize()) { - return false; - } - - for (int i=0; i<this.getConversionValuesSize(); i++) { - if ( ! this.conversionValueContainer.get(i).isEquivalentTo(converter.getConversionValue(i))) { - return false; - } - } - return true; - } - - // ********** metadata conversion ********** - - public void convertFrom(JavaEclipseLinkObjectTypeConverter javaConverter) { - super.convertFrom(javaConverter); - this.setDataType(javaConverter.getFullyQualifiedDataType()); - this.setObjectType(javaConverter.getFullyQualifiedObjectType()); - this.setDefaultObjectValue(javaConverter.getDefaultObjectValue()); - for (JavaEclipseLinkConversionValue value : javaConverter.getConversionValues()) { - this.addConversionValue().convertFrom(value); - } - } -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/orm/OrmEclipseLinkOneToManyMapping.java b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/orm/OrmEclipseLinkOneToManyMapping.java deleted file mode 100644 index 4468c91467..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/orm/OrmEclipseLinkOneToManyMapping.java +++ /dev/null @@ -1,213 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2008, 2012 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.eclipselink.core.internal.context.orm; - -import java.util.List; -import org.eclipse.jdt.core.IPackageFragment; -import org.eclipse.jdt.core.IType; -import org.eclipse.jpt.common.core.internal.utility.JDTTools; -import org.eclipse.jpt.common.core.utility.TextRange; -import org.eclipse.jpt.common.utility.internal.StringTools; -import org.eclipse.jpt.common.utility.internal.iterables.CompositeIterable; -import org.eclipse.jpt.jpa.core.context.orm.OrmPersistentAttribute; -import org.eclipse.jpt.jpa.core.internal.context.orm.AbstractOrmOneToManyMapping; -import org.eclipse.jpt.jpa.core.jpa2.context.orm.OrmOneToManyRelationship2_0; -import org.eclipse.jpt.jpa.eclipselink.core.context.EclipseLinkAccessType; -import org.eclipse.jpt.jpa.eclipselink.core.context.EclipseLinkJoinFetch; -import org.eclipse.jpt.jpa.eclipselink.core.context.EclipseLinkOneToManyMapping2_0; -import org.eclipse.jpt.jpa.eclipselink.core.context.EclipseLinkPrivateOwned; -import org.eclipse.jpt.jpa.eclipselink.core.context.orm.EclipseLinkOrmConvertibleMapping; -import org.eclipse.jpt.jpa.eclipselink.core.context.orm.EclipseLinkOrmOneToManyRelationship2_0; -import org.eclipse.jpt.jpa.eclipselink.core.context.orm.OrmEclipseLinkConverterContainer; -import org.eclipse.jpt.jpa.eclipselink.core.internal.DefaultEclipseLinkJpaValidationMessages; -import org.eclipse.jpt.jpa.eclipselink.core.internal.EclipseLinkJpaValidationMessages; -import org.eclipse.jpt.jpa.eclipselink.core.resource.orm.XmlOneToMany; -import org.eclipse.text.edits.ReplaceEdit; -import org.eclipse.wst.validation.internal.provisional.core.IMessage; -import org.eclipse.wst.validation.internal.provisional.core.IReporter; - -public class OrmEclipseLinkOneToManyMapping - extends AbstractOrmOneToManyMapping<XmlOneToMany> - implements - EclipseLinkOneToManyMapping2_0, - EclipseLinkOrmConvertibleMapping, - OrmEclipseLinkConverterContainer.Owner -{ - protected final OrmEclipseLinkPrivateOwned privateOwned; - - protected final OrmEclipseLinkJoinFetch joinFetch; - - protected final OrmEclipseLinkConverterContainer converterContainer; - - - public OrmEclipseLinkOneToManyMapping(OrmPersistentAttribute parent, XmlOneToMany xmlMapping) { - super(parent, xmlMapping); - this.privateOwned = new OrmEclipseLinkPrivateOwned(this); - this.joinFetch = new OrmEclipseLinkJoinFetch(this); - this.converterContainer = this.buildConverterContainer(); - } - - - // ********** synchronize/update ********** - - @Override - public void synchronizeWithResourceModel() { - super.synchronizeWithResourceModel(); - this.privateOwned.synchronizeWithResourceModel(); - this.joinFetch.synchronizeWithResourceModel(); - this.converterContainer.synchronizeWithResourceModel(); - } - - @Override - public void update() { - super.update(); - this.privateOwned.update(); - this.joinFetch.update(); - this.converterContainer.update(); - } - - - // ********** attribute type ********** - - @Override - protected String buildSpecifiedAttributeType() { - return this.xmlAttributeMapping.getAttributeType(); - } - - @Override - protected void setSpecifiedAttributeTypeInXml(String attributeType) { - this.xmlAttributeMapping.setAttributeType(attributeType); - } - - - // ********** private owned ********** - - public EclipseLinkPrivateOwned getPrivateOwned() { - return this.privateOwned; - } - - - // ********** join fetch ********** - - public EclipseLinkJoinFetch getJoinFetch() { - return this.joinFetch; - } - - - // ********** converters ********** - - public OrmEclipseLinkConverterContainer getConverterContainer() { - return this.converterContainer; - } - - protected OrmEclipseLinkConverterContainer buildConverterContainer() { - return new OrmEclipseLinkConverterContainerImpl(this, this, this.xmlAttributeMapping); - } - - public int getNumberSupportedConverters() { - return 1; - } - - - // ********** relationship ********** - - @Override - protected OrmOneToManyRelationship2_0 buildRelationship() { - return new EclipseLinkOrmOneToManyRelationship(this); - } - - @Override - public EclipseLinkOrmOneToManyRelationship2_0 getRelationship() { - return (EclipseLinkOrmOneToManyRelationship) super.getRelationship(); - } - - - //************ refactoring ************ - - @Override - @SuppressWarnings("unchecked") - public Iterable<ReplaceEdit> createMoveTypeEdits(IType originalType, IPackageFragment newPackage) { - return new CompositeIterable<ReplaceEdit>( - super.createMoveTypeEdits(originalType, newPackage), - this.converterContainer.createMoveTypeEdits(originalType, newPackage) - ); - } - - @Override - @SuppressWarnings("unchecked") - public Iterable<ReplaceEdit> createRenamePackageEdits(IPackageFragment originalPackage, String newName) { - return new CompositeIterable<ReplaceEdit>( - super.createRenamePackageEdits(originalPackage, newName), - this.converterContainer.createRenamePackageEdits(originalPackage, newName) - ); - } - - @Override - @SuppressWarnings("unchecked") - public Iterable<ReplaceEdit> createRenameTypeEdits(IType originalType, String newName) { - return new CompositeIterable<ReplaceEdit>( - super.createRenameTypeEdits(originalType, newName), - this.converterContainer.createRenameTypeEdits(originalType, newName) - ); - } - - - // ********** validation ********** - - @Override - public void validate(List<IMessage> messages, IReporter reporter) { - super.validate(messages, reporter); - // TODO - private owned, join fetch validation - } - - - @Override - protected void validateAttributeType(List<IMessage> messages, IReporter reporter) { - if (this.isVirtualAccess()) { - if (StringTools.stringIsEmpty(this.getAttributeType())) { - messages.add( - DefaultEclipseLinkJpaValidationMessages.buildMessage( - IMessage.HIGH_SEVERITY, - EclipseLinkJpaValidationMessages.VIRTUAL_ATTRIBUTE_NO_ATTRIBUTE_TYPE_SPECIFIED, - new String[] {this.getName()}, - this, - this.getAttributeTypeTextRange() - ) - ); - return; - } - if (this.getResolvedAttributeType() == null) { - IType jdtType = JDTTools.findType(this.getJavaProject(), this.getFullyQualifiedAttributeType()); - if (jdtType == null) { - messages.add( - DefaultEclipseLinkJpaValidationMessages.buildMessage( - IMessage.HIGH_SEVERITY, - EclipseLinkJpaValidationMessages.VIRTUAL_ATTRIBUTE_ATTRIBUTE_TYPE_DOES_NOT_EXIST, - new String[] {this.getFullyQualifiedAttributeType()}, - this, - this.getAttributeTypeTextRange() - ) - ); - return; - } - } - } - super.validateAttributeType(messages, reporter); - } - - protected boolean isVirtualAccess() { - return getPersistentAttribute().getAccess() == EclipseLinkAccessType.VIRTUAL; - } - - @Override - protected TextRange getAttributeTypeTextRange() { - return this.getValidationTextRange(this.xmlAttributeMapping.getAttributeTypeTextRange()); - } -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/orm/OrmEclipseLinkOneToOneMapping.java b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/orm/OrmEclipseLinkOneToOneMapping.java deleted file mode 100644 index fba126803e..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/orm/OrmEclipseLinkOneToOneMapping.java +++ /dev/null @@ -1,76 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2008, 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.eclipselink.core.internal.context.orm; - -import java.util.List; -import org.eclipse.jpt.jpa.core.context.orm.OrmPersistentAttribute; -import org.eclipse.jpt.jpa.core.internal.context.orm.AbstractOrmOneToOneMapping; -import org.eclipse.jpt.jpa.eclipselink.core.context.EclipseLinkJoinFetch; -import org.eclipse.jpt.jpa.eclipselink.core.context.EclipseLinkOneToOneMapping; -import org.eclipse.jpt.jpa.eclipselink.core.context.EclipseLinkPrivateOwned; -import org.eclipse.jpt.jpa.eclipselink.core.resource.orm.XmlOneToOne; -import org.eclipse.wst.validation.internal.provisional.core.IMessage; -import org.eclipse.wst.validation.internal.provisional.core.IReporter; - -public class OrmEclipseLinkOneToOneMapping - extends AbstractOrmOneToOneMapping<XmlOneToOne> - implements EclipseLinkOneToOneMapping -{ - protected final OrmEclipseLinkPrivateOwned privateOwned; - - protected final OrmEclipseLinkJoinFetch joinFetch; - - - protected OrmEclipseLinkOneToOneMapping(OrmPersistentAttribute parent, XmlOneToOne xmlMapping) { - super(parent, xmlMapping); - this.privateOwned = new OrmEclipseLinkPrivateOwned(this); - this.joinFetch = new OrmEclipseLinkJoinFetch(this); - } - - - // ********** synchronize/update ********** - - @Override - public void synchronizeWithResourceModel() { - super.synchronizeWithResourceModel(); - this.privateOwned.synchronizeWithResourceModel(); - this.joinFetch.synchronizeWithResourceModel(); - } - - @Override - public void update() { - super.update(); - this.privateOwned.update(); - this.joinFetch.update(); - } - - - // ********** private owned ********** - - public EclipseLinkPrivateOwned getPrivateOwned() { - return this.privateOwned; - } - - - // ********** join fetch ********** - - public EclipseLinkJoinFetch getJoinFetch() { - return this.joinFetch; - } - - - // ********** validation ********** - - @Override - public void validate(List<IMessage> messages, IReporter reporter) { - super.validate(messages, reporter); - // TODO - private owned, join fetch validation - } -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/orm/OrmEclipseLinkPersistenceUnitDefaults.java b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/orm/OrmEclipseLinkPersistenceUnitDefaults.java deleted file mode 100644 index f69f857e75..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/orm/OrmEclipseLinkPersistenceUnitDefaults.java +++ /dev/null @@ -1,374 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2006, 2012 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.eclipselink.core.internal.context.orm; - -import org.eclipse.jpt.common.core.utility.TextRange; -import org.eclipse.jpt.common.utility.internal.iterables.EmptyIterable; -import org.eclipse.jpt.common.utility.internal.iterables.EmptyListIterable; -import org.eclipse.jpt.common.utility.internal.iterables.ListIterable; -import org.eclipse.jpt.common.utility.internal.iterables.LiveCloneListIterable; -import org.eclipse.jpt.jpa.core.context.DiscriminatorType; -import org.eclipse.jpt.jpa.core.context.ReadOnlyNamedColumn; -import org.eclipse.jpt.jpa.core.context.ReadOnlyNamedDiscriminatorColumn; -import org.eclipse.jpt.jpa.core.context.orm.OrmPersistenceUnitMetadata; -import org.eclipse.jpt.jpa.core.internal.context.JptValidator; -import org.eclipse.jpt.jpa.core.internal.context.NamedColumnTextRangeResolver; -import org.eclipse.jpt.jpa.core.internal.jpa1.context.orm.AbstractOrmPersistenceUnitDefaults; -import org.eclipse.jpt.jpa.db.Table; -import org.eclipse.jpt.jpa.eclipselink.core.context.ReadOnlyTenantDiscriminatorColumn2_3; -import org.eclipse.jpt.jpa.eclipselink.core.context.orm.EclipseLinkPersistenceUnitDefaults; -import org.eclipse.jpt.jpa.eclipselink.core.context.orm.OrmReadOnlyTenantDiscriminatorColumn2_3; -import org.eclipse.jpt.jpa.eclipselink.core.context.orm.OrmTenantDiscriminatorColumn2_3; -import org.eclipse.jpt.jpa.eclipselink.core.resource.orm.EclipseLinkOrmFactory; -import org.eclipse.jpt.jpa.eclipselink.core.resource.orm.XmlAccessMethods; -import org.eclipse.jpt.jpa.eclipselink.core.resource.orm.XmlPersistenceUnitDefaults; -import org.eclipse.jpt.jpa.eclipselink.core.resource.orm.XmlTenantDiscriminatorColumn; -import org.eclipse.jpt.jpa.eclipselink.core.resource.orm.v2_3.XmlTenantDiscriminatorColumn_2_3; - -/** - * EclipseLink <code>orm.xml</code> file - * <br> - * <code>persistence-unit-defaults</code> element - */ -public class OrmEclipseLinkPersistenceUnitDefaults - extends AbstractOrmPersistenceUnitDefaults - implements EclipseLinkPersistenceUnitDefaults -{ - - protected final ContextListContainer<OrmTenantDiscriminatorColumn2_3, XmlTenantDiscriminatorColumn_2_3> tenantDiscriminatorColumnContainer; - protected final OrmReadOnlyTenantDiscriminatorColumn2_3.Owner tenantDiscriminatorColumnOwner; - - protected String specifiedGetMethod; - protected String specifiedSetMethod; - - // ********** constructor/initialization ********** - - public OrmEclipseLinkPersistenceUnitDefaults(OrmPersistenceUnitMetadata parent) { - super(parent); - this.tenantDiscriminatorColumnOwner = this.buildTenantDiscriminatorColumnOwner(); - this.tenantDiscriminatorColumnContainer = this.buildTenantDiscriminatorColumnContainer(); - this.specifiedGetMethod = this.buildSpecifiedGetMethod(); - this.specifiedSetMethod = this.buildSpecifiedSetMethod(); - } - - @Override - protected XmlPersistenceUnitDefaults buildXmlPersistenceUnitDefaults() { - return EclipseLinkOrmFactory.eINSTANCE.createXmlPersistenceUnitDefaults(); - } - - @Override - protected XmlPersistenceUnitDefaults getXmlDefaults() { - return (XmlPersistenceUnitDefaults) super.getXmlDefaults(); - } - - @Override - protected XmlPersistenceUnitDefaults getXmlDefaultsForUpdate() { - return (XmlPersistenceUnitDefaults) super.getXmlDefaultsForUpdate(); - } - - // ********** synchronize/update ********** - - @Override - public void synchronizeWithResourceModel() { - super.synchronizeWithResourceModel(); - this.syncTenantDiscriminatorColumns(); - this.setSpecifiedGetMethod_(this.buildSpecifiedGetMethod()); - this.setSpecifiedSetMethod_(this.buildSpecifiedSetMethod()); - } - - @Override - public void update() { - super.update(); - this.updateNodes(this.getTenantDiscriminatorColumns()); - } - - - // ********** tenant discriminator columns ********** - - public ListIterable<OrmTenantDiscriminatorColumn2_3> getTenantDiscriminatorColumns() { - return this.tenantDiscriminatorColumnContainer.getContextElements(); - } - - public int getTenantDiscriminatorColumnsSize() { - return this.tenantDiscriminatorColumnContainer.getContextElementsSize(); - } - - public boolean hasTenantDiscriminatorColumns() { - return this.getTenantDiscriminatorColumnsSize() != 0; - } - - public OrmTenantDiscriminatorColumn2_3 getTenantDiscriminatorColumn(int index) { - return this.tenantDiscriminatorColumnContainer.getContextElement(index); - } - - public OrmTenantDiscriminatorColumn2_3 addTenantDiscriminatorColumn() { - return this.addTenantDiscriminatorColumn(this.getTenantDiscriminatorColumnsSize()); - } - - public OrmTenantDiscriminatorColumn2_3 addTenantDiscriminatorColumn(int index) { - XmlTenantDiscriminatorColumn xmlJoinColumn = this.buildXmlTenantDiscriminatorColumn(); - OrmTenantDiscriminatorColumn2_3 joinColumn = this.tenantDiscriminatorColumnContainer.addContextElement(index, xmlJoinColumn); - this.getXmlDefaultsForUpdate().getTenantDiscriminatorColumns().add(index, xmlJoinColumn); - return joinColumn; - } - - protected XmlTenantDiscriminatorColumn buildXmlTenantDiscriminatorColumn() { - return EclipseLinkOrmFactory.eINSTANCE.createXmlTenantDiscriminatorColumn(); - } - - public void removeTenantDiscriminatorColumn(OrmTenantDiscriminatorColumn2_3 tenantDiscriminatorColumn) { - this.removeTenantDiscriminatorColumn(this.tenantDiscriminatorColumnContainer.indexOfContextElement(tenantDiscriminatorColumn)); - } - - public void removeTenantDiscriminatorColumn(int index) { - this.tenantDiscriminatorColumnContainer.removeContextElement(index); - this.getXmlDefaults().getTenantDiscriminatorColumns().remove(index); - } - - public void moveTenantDiscriminatorColumn(int targetIndex, int sourceIndex) { - this.tenantDiscriminatorColumnContainer.moveContextElement(targetIndex, sourceIndex); - this.getXmlDefaults().getTenantDiscriminatorColumns().move(targetIndex, sourceIndex); - } - - protected void syncTenantDiscriminatorColumns() { - this.tenantDiscriminatorColumnContainer.synchronizeWithResourceModel(); - } - - protected ListIterable<XmlTenantDiscriminatorColumn_2_3> getXmlTenantDiscriminatorColumns() { - if (getXmlDefaults() == null) { - return EmptyListIterable.instance(); - } - // clone to reduce chance of concurrency problems - return new LiveCloneListIterable<XmlTenantDiscriminatorColumn_2_3>(this.getXmlDefaults().getTenantDiscriminatorColumns()); - } - - /** - * tenant discriminator column container - */ - protected class TenantDiscriminatorColumnContainer - extends ContextListContainer<OrmTenantDiscriminatorColumn2_3, XmlTenantDiscriminatorColumn_2_3> - { - @Override - protected String getContextElementsPropertyName() { - return TENANT_DISCRIMINATOR_COLUMNS_LIST; - } - @Override - protected OrmTenantDiscriminatorColumn2_3 buildContextElement(XmlTenantDiscriminatorColumn_2_3 resourceElement) { - return OrmEclipseLinkPersistenceUnitDefaults.this.buildTenantDiscriminatorColumn(resourceElement); - } - @Override - protected ListIterable<XmlTenantDiscriminatorColumn_2_3> getResourceElements() { - return OrmEclipseLinkPersistenceUnitDefaults.this.getXmlTenantDiscriminatorColumns(); - } - @Override - protected XmlTenantDiscriminatorColumn_2_3 getResourceElement(OrmTenantDiscriminatorColumn2_3 contextElement) { - return contextElement.getXmlColumn(); - } - } - - protected OrmReadOnlyTenantDiscriminatorColumn2_3.Owner buildTenantDiscriminatorColumnOwner() { - return new TenantDiscriminatorColumnOwner(); - } - - protected OrmTenantDiscriminatorColumn2_3 buildTenantDiscriminatorColumn(XmlTenantDiscriminatorColumn_2_3 xmlTenantDiscriminatorColumn) { - return new EclipseLinkOrmTenantDiscriminatorColumn2_3(this, this.tenantDiscriminatorColumnOwner, xmlTenantDiscriminatorColumn); - } - - protected ContextListContainer<OrmTenantDiscriminatorColumn2_3, XmlTenantDiscriminatorColumn_2_3> buildTenantDiscriminatorColumnContainer() { - TenantDiscriminatorColumnContainer container = new TenantDiscriminatorColumnContainer(); - container.initialize(); - return container; - } - - - // ********** OrmReadOnlyTenantDiscriminatorColumn.Owner implementation ********** - - protected class TenantDiscriminatorColumnOwner - implements OrmReadOnlyTenantDiscriminatorColumn2_3.Owner - { - - public String getDefaultContextPropertyName() { - return ReadOnlyTenantDiscriminatorColumn2_3.DEFAULT_CONTEXT_PROPERTY; - } - - public boolean getDefaultPrimaryKey() { - return ReadOnlyTenantDiscriminatorColumn2_3.DEFAULT_PRIMARY_KEY; - } - - public int getDefaultLength() { - return ReadOnlyNamedDiscriminatorColumn.DEFAULT_LENGTH; - } - - public DiscriminatorType getDefaultDiscriminatorType() { - return ReadOnlyNamedDiscriminatorColumn.DEFAULT_DISCRIMINATOR_TYPE; - } - - /** - * No default table name in the context of the persistence unit defaults - */ - public String getDefaultTableName() { - return null; - } - - public String getDefaultColumnName(ReadOnlyNamedColumn column) { - return ReadOnlyTenantDiscriminatorColumn2_3.DEFAULT_NAME; - } - - /** - * No table in the context of the persistence unit defaults - */ - public Table resolveDbTable(String tableName) { - return null; - } - - public Iterable<String> getCandidateTableNames() { - return EmptyIterable.instance(); - } - - public boolean tableNameIsInvalid(String tableName) { - return false; - } - - /** - * no column validation can be done in the context of the persistence unit defaults - */ - public JptValidator buildColumnValidator(ReadOnlyNamedColumn column, NamedColumnTextRangeResolver textRangeResolver) { - return JptValidator.Null.instance(); - } - - public TextRange getValidationTextRange() { - return OrmEclipseLinkPersistenceUnitDefaults.this.getValidationTextRange(); - } - } - - - //*************** get method ***************** - - public String getGetMethod() { - return this.getSpecifiedGetMethod(); - } - - public String getDefaultGetMethod() { - return null; - } - - public String getSpecifiedGetMethod() { - return this.specifiedGetMethod; - } - - public void setSpecifiedGetMethod(String getMethod) { - if (this.valuesAreDifferent(this.specifiedGetMethod, getMethod)) { - XmlAccessMethods xmlAccessMethods = this.getXmlAccessMethodsForUpdate(); - this.setSpecifiedGetMethod_(getMethod); - xmlAccessMethods.setGetMethod(getMethod); - this.removeXmlAccessMethodsIfUnset(); - } - } - - protected void setSpecifiedGetMethod_(String getMethod) { - String old = this.specifiedGetMethod; - this.specifiedGetMethod = getMethod; - this.firePropertyChanged(SPECIFIED_GET_METHOD_PROPERTY, old, getMethod); - } - - protected String buildSpecifiedGetMethod() { - XmlAccessMethods accessMethods = this.getXmlAccessMethods(); - return accessMethods != null ? accessMethods.getGetMethod() : null; - } - - - //*************** set method ***************** - - public String getSetMethod() { - return this.getSpecifiedSetMethod(); - } - - public String getDefaultSetMethod() { - return null; - } - - public String getSpecifiedSetMethod() { - return this.specifiedSetMethod; - } - - public void setSpecifiedSetMethod(String setMethod) { - if (this.valuesAreDifferent(this.specifiedSetMethod, setMethod)) { - XmlAccessMethods xmlAccessMethods = this.getXmlAccessMethodsForUpdate(); - this.setSpecifiedSetMethod_(setMethod); - xmlAccessMethods.setSetMethod(setMethod); - this.removeXmlAccessMethodsIfUnset(); - } - } - - protected void setSpecifiedSetMethod_(String setMethod) { - String old = this.specifiedSetMethod; - this.specifiedSetMethod = setMethod; - this.firePropertyChanged(SPECIFIED_SET_METHOD_PROPERTY, old, setMethod); - } - - protected String buildSpecifiedSetMethod() { - XmlAccessMethods accessMethods = this.getXmlAccessMethods(); - return accessMethods != null ? accessMethods.getSetMethod() : null; - } - - - //*************** XML access methods ***************** - - protected XmlAccessMethods getXmlAccessMethods() { - XmlPersistenceUnitDefaults xmlDefaults = getXmlDefaults(); - return xmlDefaults != null ? getXmlDefaults().getAccessMethods() : null; - } - - /** - * Build the XML access methods (and XML defaults and XML metadata if necessary) if it does not exist. - */ - protected XmlAccessMethods getXmlAccessMethodsForUpdate() { - XmlPersistenceUnitDefaults xmlDefaults = this.getXmlDefaultsForUpdate(); - XmlAccessMethods xmlAccessMethods = xmlDefaults.getAccessMethods(); - return (xmlAccessMethods != null) ? xmlAccessMethods : this.buildXmlAccessMethods(); - } - - protected XmlAccessMethods buildXmlAccessMethods() { - XmlAccessMethods xmlAccessMethods = this.buildXmlAccessMethods_(); - this.getXmlDefaults().setAccessMethods(xmlAccessMethods); - return xmlAccessMethods; - } - - protected XmlAccessMethods buildXmlAccessMethods_() { - return EclipseLinkOrmFactory.eINSTANCE.createXmlAccessMethods(); - } - - /** - * clear the XML access methods (and the XML defaults and XML metadata) if appropriate - */ - protected void removeXmlAccessMethodsIfUnset() { - if (this.getXmlAccessMethods().isUnset()) { - this.getXmlDefaults().setAccessMethods(null); - this.removeXmlDefaultsIfUnset(); - } - } - - // ********** completion proposals ********** - - @Override - public Iterable<String> getXmlCompletionProposals(int pos) { - Iterable<String> result = super.getXmlCompletionProposals(pos); - if (result != null) { - return result; - } - for (OrmTenantDiscriminatorColumn2_3 tenantDiscriminatorColumn : this.getTenantDiscriminatorColumns()) { - result = tenantDiscriminatorColumn.getXmlCompletionProposals(pos); - if (result != null) { - return result; - } - } - return null; - } -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/orm/OrmEclipseLinkPersistenceUnitMetadata.java b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/orm/OrmEclipseLinkPersistenceUnitMetadata.java deleted file mode 100644 index c80019d987..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/orm/OrmEclipseLinkPersistenceUnitMetadata.java +++ /dev/null @@ -1,45 +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, 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.eclipselink.core.internal.context.orm; - -import org.eclipse.jpt.jpa.core.context.orm.EntityMappings; -import org.eclipse.jpt.jpa.core.internal.jpa1.context.orm.AbstractOrmPersistenceUnitMetadata; -import org.eclipse.jpt.jpa.core.resource.xml.EmfTools; -import org.eclipse.jpt.jpa.eclipselink.core.context.orm.EclipseLinkPersistenceUnitDefaults; -import org.eclipse.jpt.jpa.eclipselink.core.resource.orm.EclipseLinkOrmPackage; -import org.eclipse.jpt.jpa.eclipselink.core.resource.orm.XmlPersistenceUnitMetadata; - -/** - * <code>eclipselink orm.xml</code> file - * <br> - * <code>persistence-unit-metadata</code> element - */ -public class OrmEclipseLinkPersistenceUnitMetadata - extends AbstractOrmPersistenceUnitMetadata -{ - - public OrmEclipseLinkPersistenceUnitMetadata(EntityMappings parent) { - super(parent); - } - - @Override - public EclipseLinkPersistenceUnitDefaults getPersistenceUnitDefaults() { - return (EclipseLinkPersistenceUnitDefaults) super.getPersistenceUnitDefaults(); - } - - @Override - protected XmlPersistenceUnitMetadata buildXmlPersistenceUnitMetadata_() { - return EmfTools.create( - this.getResourceNodeFactory(), - EclipseLinkOrmPackage.eINSTANCE.getXmlPersistenceUnitMetadata(), - XmlPersistenceUnitMetadata.class - ); - } -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/orm/OrmEclipseLinkPersistentAttribute.java b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/orm/OrmEclipseLinkPersistentAttribute.java deleted file mode 100644 index b95dd6f0e7..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/orm/OrmEclipseLinkPersistentAttribute.java +++ /dev/null @@ -1,143 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2009, 2012 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.eclipselink.core.internal.context.orm; - -import org.eclipse.jpt.jpa.core.context.java.JavaPersistentAttribute; -import org.eclipse.jpt.jpa.core.context.orm.OrmPersistentType; -import org.eclipse.jpt.jpa.core.internal.context.JptValidator; -import org.eclipse.jpt.jpa.core.internal.context.orm.SpecifiedOrmPersistentAttribute; -import org.eclipse.jpt.jpa.eclipselink.core.context.EclipseLinkAccessMethodsHolder; -import org.eclipse.jpt.jpa.eclipselink.core.context.EclipseLinkAccessType; -import org.eclipse.jpt.jpa.eclipselink.core.internal.context.EclipseLinkPersistentAttributeValidator; -import org.eclipse.jpt.jpa.eclipselink.core.resource.orm.XmlAccessMethods; -import org.eclipse.jpt.jpa.eclipselink.core.resource.orm.XmlAccessMethodsHolder; -import org.eclipse.jpt.jpa.eclipselink.core.resource.orm.XmlAttributeMapping; - -/** - * EclipseLink - * <code>orm.xml</code> persistent attribute - */ -public class OrmEclipseLinkPersistentAttribute - extends SpecifiedOrmPersistentAttribute - implements EclipseLinkAccessMethodsHolder -{ - //TODO defaults from the persistentType if the access is VIRTUAL - protected String specifiedGetMethod; - protected String specifiedSetMethod; - - public OrmEclipseLinkPersistentAttribute(OrmPersistentType parent, XmlAttributeMapping xmlMapping) { - super(parent, xmlMapping); - this.specifiedGetMethod = this.buildSpecifiedGetMethod(); - this.specifiedSetMethod = this.buildSpecifiedSetMethod(); - } - - - // ********** synchronize/update ********** - - @Override - public void synchronizeWithResourceModel() { - super.synchronizeWithResourceModel(); - this.setSpecifiedGetMethod_(this.buildSpecifiedGetMethod()); - this.setSpecifiedSetMethod_(this.buildSpecifiedSetMethod()); - } - - //*************** get method ***************** - - public String getGetMethod() { - String specifiedGetMethod = this.getSpecifiedGetMethod(); - return (specifiedGetMethod != null) ? specifiedGetMethod : this.getDefaultGetMethod(); - } - - public String getDefaultGetMethod() { - return DEFAULT_GET_METHOD; - } - - public String getSpecifiedGetMethod() { - return this.specifiedGetMethod; - } - - public void setSpecifiedGetMethod(String getMethod) { - this.setSpecifiedGetMethod_(getMethod); - this.getXmlAccessMethods().setGetMethod(getMethod); - } - - protected void setSpecifiedGetMethod_(String getMethod) { - String old = this.specifiedGetMethod; - this.specifiedGetMethod = getMethod; - this.firePropertyChanged(SPECIFIED_GET_METHOD_PROPERTY, old, getMethod); - } - - protected String buildSpecifiedGetMethod() { - XmlAccessMethods xmlAccessMethods = getXmlAccessMethods(); - return xmlAccessMethods != null ? xmlAccessMethods.getGetMethod() : null; - } - - protected XmlAccessMethodsHolder getXmlAccessMethodsHolder() { - return this.getXmlAttributeMapping(); - } - - protected XmlAccessMethods getXmlAccessMethods() { - return getXmlAccessMethodsHolder().getAccessMethods(); - } - - - //*************** set method ***************** - public String getSetMethod() { - String specifiedSetMethod = this.getSpecifiedSetMethod(); - return (specifiedSetMethod != null) ? specifiedSetMethod : this.getDefaultSetMethod(); - } - - public String getDefaultSetMethod() { - return DEFAULT_SET_METHOD; - } - - public String getSpecifiedSetMethod() { - return this.specifiedSetMethod; - } - public void setSpecifiedSetMethod(String setMethod) { - this.setSpecifiedSetMethod_(setMethod); - this.getXmlAccessMethods().setSetMethod(setMethod); - } - - protected void setSpecifiedSetMethod_(String setMethod) { - String old = this.specifiedSetMethod; - this.specifiedSetMethod = setMethod; - this.firePropertyChanged(SPECIFIED_SET_METHOD_PROPERTY, old, setMethod); - } - - protected String buildSpecifiedSetMethod() { - XmlAccessMethods xmlAccessMethods = getXmlAccessMethods(); - return xmlAccessMethods != null ? xmlAccessMethods.getSetMethod() : null; - } - - - @Override - protected JavaPersistentAttribute getCachedJavaAttribute() { - if (this.getAccess() == EclipseLinkAccessType.VIRTUAL) { - //if VIRTUAL we will always have to build and cache the 'javaAttribute' - //we clear out the cached 'javaAttribute in setSpecifiedAccess_() and setDefaultAccess_() - if (this.cachedJavaPersistentAttribute == null) { - this.cachedJavaPersistentAttribute = new VirtualJavaPersistentAttribute(this.getParent(), this.getXmlAttributeMapping()); - } - return this.cachedJavaPersistentAttribute; - } - return super.getCachedJavaAttribute(); - } - - @Override - protected XmlAttributeMapping getXmlAttributeMapping() { - return (XmlAttributeMapping) super.getXmlAttributeMapping(); - } - - @Override - protected JptValidator buildAttibuteValidator() { - return new EclipseLinkPersistentAttributeValidator(this, buildTextRangeResolver()); - } -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/orm/OrmEclipseLinkPrivateOwned.java b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/orm/OrmEclipseLinkPrivateOwned.java deleted file mode 100644 index 4b5d9640b6..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/orm/OrmEclipseLinkPrivateOwned.java +++ /dev/null @@ -1,93 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2008, 2011 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.eclipselink.core.internal.context.orm; - -import org.eclipse.jpt.common.core.utility.TextRange; -import org.eclipse.jpt.jpa.core.context.orm.OrmAttributeMapping; -import org.eclipse.jpt.jpa.core.internal.context.orm.AbstractOrmXmlContextNode; -import org.eclipse.jpt.jpa.core.resource.orm.XmlAttributeMapping; -import org.eclipse.jpt.jpa.eclipselink.core.context.EclipseLinkPrivateOwned; -import org.eclipse.jpt.jpa.eclipselink.core.resource.orm.XmlPrivateOwned; - -public class OrmEclipseLinkPrivateOwned - extends AbstractOrmXmlContextNode - implements EclipseLinkPrivateOwned -{ - protected boolean privateOwned; - - - public OrmEclipseLinkPrivateOwned(OrmAttributeMapping parent) { - super(parent); - this.privateOwned = this.buildPrivateOwned(); - } - - - // ********** synchronize/update ********** - - @Override - public void synchronizeWithResourceModel() { - super.synchronizeWithResourceModel(); - this.setPrivateOwned_(this.buildPrivateOwned()); - } - - - // ********** private owned ********** - - public boolean isPrivateOwned() { - return this.privateOwned; - } - - public void setPrivateOwned(boolean privateOwned) { - this.setPrivateOwned_(privateOwned); - this.getXmlPrivateOwned().setPrivateOwned(privateOwned); - } - - protected void setPrivateOwned_(boolean privateOwned) { - boolean old = this.privateOwned; - this.privateOwned = privateOwned; - this.firePropertyChanged(PRIVATE_OWNED_PROPERTY, old, privateOwned); - } - - protected boolean buildPrivateOwned() { - return this.getXmlPrivateOwned().isPrivateOwned(); - } - - - // ********** misc ********** - - @Override - public OrmAttributeMapping getParent() { - return (OrmAttributeMapping) super.getParent(); - } - - protected OrmAttributeMapping getAttributeMapping() { - return this.getParent(); - } - - protected XmlAttributeMapping getXmlAttributeMapping() { - return this.getAttributeMapping().getXmlAttributeMapping(); - } - - protected XmlPrivateOwned getXmlPrivateOwned() { - return (XmlPrivateOwned) this.getXmlAttributeMapping(); - } - - - // ********** validation ********** - - public TextRange getValidationTextRange() { - TextRange textRange = this.getXmlValidationTextRange(); - return (textRange != null) ? textRange : this.getAttributeMapping().getValidationTextRange(); - } - - protected TextRange getXmlValidationTextRange() { - return this.getXmlPrivateOwned().getPrivateOwnedTextRange(); - } -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/orm/OrmEclipseLinkReadOnly.java b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/orm/OrmEclipseLinkReadOnly.java deleted file mode 100644 index 35ecc5d959..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/orm/OrmEclipseLinkReadOnly.java +++ /dev/null @@ -1,129 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2008, 2011 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.eclipselink.core.internal.context.orm; - -import org.eclipse.jpt.common.core.utility.TextRange; -import org.eclipse.jpt.jpa.core.internal.context.orm.AbstractOrmXmlContextNode; -import org.eclipse.jpt.jpa.core.resource.orm.XmlTypeMapping; -import org.eclipse.jpt.jpa.eclipselink.core.context.EclipseLinkReadOnly; -import org.eclipse.jpt.jpa.eclipselink.core.context.java.JavaEclipseLinkNonEmbeddableTypeMapping; -import org.eclipse.jpt.jpa.eclipselink.core.context.orm.OrmEclipseLinkNonEmbeddableTypeMapping; -import org.eclipse.jpt.jpa.eclipselink.core.resource.orm.XmlReadOnly; - -public class OrmEclipseLinkReadOnly - extends AbstractOrmXmlContextNode - implements EclipseLinkReadOnly -{ - protected Boolean specifiedReadOnly; - protected boolean defaultReadOnly; - - - public OrmEclipseLinkReadOnly(OrmEclipseLinkNonEmbeddableTypeMapping parent) { - super(parent); - this.specifiedReadOnly = this.buildSpecifiedReadOnly(); - } - - - // ********** synchronize/update ********** - - @Override - public void synchronizeWithResourceModel() { - super.synchronizeWithResourceModel(); - this.setSpecifiedReadOnly_(this.buildSpecifiedReadOnly()); - } - - @Override - public void update() { - super.update(); - this.setDefaultReadOnly(this.buildDefaultReadOnly()); - } - - - // ********** read-only ********** - - public boolean isReadOnly() { - return (this.specifiedReadOnly != null) ? this.specifiedReadOnly.booleanValue() : this.defaultReadOnly; - } - - public Boolean getSpecifiedReadOnly() { - return this.specifiedReadOnly; - } - - public void setSpecifiedReadOnly(Boolean readOnly) { - this.setSpecifiedReadOnly_(readOnly); - this.getXmlReadOnly().setReadOnly(readOnly); - } - - protected void setSpecifiedReadOnly_(Boolean readOnly) { - Boolean old = this.specifiedReadOnly; - this.specifiedReadOnly = readOnly; - this.firePropertyChanged(SPECIFIED_READ_ONLY_PROPERTY, old, readOnly); - } - - protected Boolean buildSpecifiedReadOnly() { - return this.getXmlReadOnly().getReadOnly(); - } - - public boolean isDefaultReadOnly() { - return this.defaultReadOnly; - } - - protected void setDefaultReadOnly(boolean readOnly) { - boolean old = this.defaultReadOnly; - this.defaultReadOnly = readOnly; - this.firePropertyChanged(DEFAULT_READ_ONLY_PROPERTY, old, readOnly); - } - - protected boolean buildDefaultReadOnly() { - EclipseLinkReadOnly javaReadOnly = this.getJavaReadOnlyForDefaults(); - return (javaReadOnly != null) ? javaReadOnly.isReadOnly() : DEFAULT_READ_ONLY; - } - - - // ********** misc ********** - - @Override - public OrmEclipseLinkNonEmbeddableTypeMapping getParent() { - return (OrmEclipseLinkNonEmbeddableTypeMapping) super.getParent(); - } - - protected OrmEclipseLinkNonEmbeddableTypeMapping getTypeMapping() { - return this.getParent(); - } - - protected XmlTypeMapping getXmlTypeMapping() { - return this.getTypeMapping().getXmlTypeMapping(); - } - - protected XmlReadOnly getXmlReadOnly() { - return (XmlReadOnly) this.getXmlTypeMapping(); - } - - protected JavaEclipseLinkNonEmbeddableTypeMapping getJavaTypeMappingForDefaults() { - return this.getTypeMapping().getJavaTypeMappingForDefaults(); - } - - protected EclipseLinkReadOnly getJavaReadOnlyForDefaults() { - JavaEclipseLinkNonEmbeddableTypeMapping javaTypeMapping = this.getJavaTypeMappingForDefaults(); - return (javaTypeMapping == null) ? null : javaTypeMapping.getReadOnly(); - } - - - // ********** validation ********** - - public TextRange getValidationTextRange() { - TextRange textRange = this.getXmlValidationTextRange(); - return (textRange != null) ? textRange : this.getTypeMapping().getValidationTextRange(); - } - - protected TextRange getXmlValidationTextRange() { - return this.getXmlReadOnly().getReadOnlyTextRange(); - } -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/orm/OrmEclipseLinkStructConverter.java b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/orm/OrmEclipseLinkStructConverter.java deleted file mode 100644 index 5ea9b0b87c..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/orm/OrmEclipseLinkStructConverter.java +++ /dev/null @@ -1,86 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2008, 2011 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.eclipselink.core.internal.context.orm; - -import org.eclipse.jdt.core.IType; -import org.eclipse.jpt.common.core.utility.TextRange; -import org.eclipse.jpt.jpa.core.context.XmlContextNode; -import org.eclipse.jpt.jpa.eclipselink.core.context.EclipseLinkStructConverter; -import org.eclipse.jpt.jpa.eclipselink.core.internal.EclipseLinkJpaValidationMessages; -import org.eclipse.jpt.jpa.eclipselink.core.internal.context.java.JavaEclipseLinkStructConverter; -import org.eclipse.jpt.jpa.eclipselink.core.resource.orm.XmlStructConverter; -import org.eclipse.text.edits.ReplaceEdit; - -public class OrmEclipseLinkStructConverter - extends OrmEclipseLinkConverterClassConverter<XmlStructConverter> - implements EclipseLinkStructConverter -{ - public OrmEclipseLinkStructConverter(XmlContextNode parent, XmlStructConverter xmlConverter) { - super(parent, xmlConverter); - } - - - // ********** converter class ********** - - @Override - protected String getXmlConverterClass() { - return this.xmlConverter.getConverter(); - } - - @Override - protected void setXmlConverterClass(String converterClass) { - this.xmlConverter.setConverter(converterClass); - } - - - // ********** misc ********** - - public Class<EclipseLinkStructConverter> getType() { - return EclipseLinkStructConverter.class; - } - - - // ********** refactoring ********** - - @Override - protected ReplaceEdit createRenameEdit(IType originalType, String newName) { - return this.xmlConverter.createRenameEdit(originalType, newName); - } - - @Override - protected ReplaceEdit createRenamePackageEdit(String newName) { - return this.xmlConverter.createRenamePackageEdit(newName); - } - - - // ********** validation ********** - - @Override - protected String getEclipseLinkConverterInterface() { - return ECLIPSELINK_STRUCT_CONVERTER_CLASS_NAME; - } - - @Override - protected String getEclipseLinkConverterInterfaceErrorMessage() { - return EclipseLinkJpaValidationMessages.STRUCT_CONVERTER_CLASS_IMPLEMENTS_STRUCT_CONVERTER; - } - - @Override - protected TextRange getXmlConverterClassTextRange() { - return this.xmlConverter.getConverterClassTextRange(); - } - - // ********** metadata conversion ********** - - public void convertFrom(JavaEclipseLinkStructConverter javaConverter) { - super.convertFrom(javaConverter); - this.setConverterClass(javaConverter.getConverterClass()); - } -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/orm/OrmEclipseLinkStructureMapping2_3.java b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/orm/OrmEclipseLinkStructureMapping2_3.java deleted file mode 100644 index eb9be0e741..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/orm/OrmEclipseLinkStructureMapping2_3.java +++ /dev/null @@ -1,63 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2011, 2012 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.eclipselink.core.internal.context.orm; - -import org.eclipse.jpt.jpa.core.context.orm.OrmAttributeMapping; -import org.eclipse.jpt.jpa.core.context.orm.OrmPersistentAttribute; -import org.eclipse.jpt.jpa.core.internal.context.orm.AbstractOrmAttributeMapping; -import org.eclipse.jpt.jpa.eclipselink.core.EclipseLinkMappingKeys; -import org.eclipse.jpt.jpa.eclipselink.core.context.EclipseLinkStructureMapping2_3; -import org.eclipse.jpt.jpa.eclipselink.core.resource.orm.Attributes; -import org.eclipse.jpt.jpa.eclipselink.core.resource.orm.XmlStructure; - -public class OrmEclipseLinkStructureMapping2_3 - extends AbstractOrmAttributeMapping<XmlStructure> - implements EclipseLinkStructureMapping2_3 -{ - public OrmEclipseLinkStructureMapping2_3(OrmPersistentAttribute parent, XmlStructure xmlMapping) { - super(parent, xmlMapping); - } - - - // ********** attribute type ********** - - @Override - protected String buildSpecifiedAttributeType() { - return this.xmlAttributeMapping.getAttributeType(); - } - - @Override - protected void setSpecifiedAttributeTypeInXml(String attributeType) { - this.xmlAttributeMapping.setAttributeType(attributeType); - } - - - // ********** misc ********** - - public String getKey() { - return EclipseLinkMappingKeys.STRUCTURE_ATTRIBUTE_MAPPING_KEY; - } - - public int getXmlSequence() { - return 100; - } - - public void initializeOn(OrmAttributeMapping newMapping) { - newMapping.initializeFromOrmAttributeMapping(this); - } - - public void addXmlAttributeMappingTo(org.eclipse.jpt.jpa.core.resource.orm.Attributes xmlAttributes) { - ((Attributes) xmlAttributes).getStructures().add(this.xmlAttributeMapping); - } - - public void removeXmlAttributeMappingFrom(org.eclipse.jpt.jpa.core.resource.orm.Attributes xmlAttributes) { - ((Attributes) xmlAttributes).getStructures().remove(this.xmlAttributeMapping); - } -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/orm/OrmEclipseLinkStructureMapping2_3Definition.java b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/orm/OrmEclipseLinkStructureMapping2_3Definition.java deleted file mode 100644 index 57c1934e7b..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/orm/OrmEclipseLinkStructureMapping2_3Definition.java +++ /dev/null @@ -1,64 +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, 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.eclipselink.core.internal.context.orm; - -import org.eclipse.emf.ecore.EFactory; -import org.eclipse.jpt.jpa.core.context.orm.OrmAttributeMapping; -import org.eclipse.jpt.jpa.core.context.orm.OrmAttributeMappingDefinition; -import org.eclipse.jpt.jpa.core.context.orm.OrmPersistentAttribute; -import org.eclipse.jpt.jpa.core.context.orm.OrmXmlContextNodeFactory; -import org.eclipse.jpt.jpa.core.resource.orm.XmlAttributeMapping; -import org.eclipse.jpt.jpa.core.resource.xml.EmfTools; -import org.eclipse.jpt.jpa.eclipselink.core.EclipseLinkMappingKeys; -import org.eclipse.jpt.jpa.eclipselink.core.resource.orm.EclipseLinkOrmPackage; -import org.eclipse.jpt.jpa.eclipselink.core.resource.orm.XmlStructure; - -public class OrmEclipseLinkStructureMapping2_3Definition - implements OrmAttributeMappingDefinition -{ - // singleton - private static final OrmEclipseLinkStructureMapping2_3Definition INSTANCE = - new OrmEclipseLinkStructureMapping2_3Definition(); - - - /** - * Return the singleton - */ - public static OrmAttributeMappingDefinition instance() { - return INSTANCE; - } - - - /** - * Enforce singleton usage - */ - private OrmEclipseLinkStructureMapping2_3Definition() { - super(); - } - - - public String getKey() { - return EclipseLinkMappingKeys.STRUCTURE_ATTRIBUTE_MAPPING_KEY; - } - - public XmlAttributeMapping buildResourceMapping(EFactory factory) { - return EmfTools.create( - factory, - EclipseLinkOrmPackage.eINSTANCE.getXmlStructure(), - XmlStructure.class); - } - - public OrmAttributeMapping buildContextMapping( - OrmPersistentAttribute parent, - XmlAttributeMapping resourceMapping, - OrmXmlContextNodeFactory factory) { - return new OrmEclipseLinkStructureMapping2_3(parent, (XmlStructure) resourceMapping); - } -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/orm/OrmEclipseLinkTransformationMapping.java b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/orm/OrmEclipseLinkTransformationMapping.java deleted file mode 100644 index 8bb804af28..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/orm/OrmEclipseLinkTransformationMapping.java +++ /dev/null @@ -1,63 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2008, 2012 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.eclipselink.core.internal.context.orm; - -import org.eclipse.jpt.jpa.core.context.orm.OrmAttributeMapping; -import org.eclipse.jpt.jpa.core.context.orm.OrmPersistentAttribute; -import org.eclipse.jpt.jpa.core.internal.context.orm.AbstractOrmAttributeMapping; -import org.eclipse.jpt.jpa.eclipselink.core.EclipseLinkMappingKeys; -import org.eclipse.jpt.jpa.eclipselink.core.context.EclipseLinkTransformationMapping; -import org.eclipse.jpt.jpa.eclipselink.core.resource.orm.Attributes; -import org.eclipse.jpt.jpa.eclipselink.core.resource.orm.XmlTransformation; - -public class OrmEclipseLinkTransformationMapping - extends AbstractOrmAttributeMapping<XmlTransformation> - implements EclipseLinkTransformationMapping -{ - public OrmEclipseLinkTransformationMapping(OrmPersistentAttribute parent, XmlTransformation xmlMapping) { - super(parent, xmlMapping); - } - - - // ********** attribute type ********** - - @Override - protected String buildSpecifiedAttributeType() { - return this.xmlAttributeMapping.getAttributeType(); - } - - @Override - protected void setSpecifiedAttributeTypeInXml(String attributeType) { - this.xmlAttributeMapping.setAttributeType(attributeType); - } - - - // ********** misc ********** - - public String getKey() { - return EclipseLinkMappingKeys.TRANSFORMATION_ATTRIBUTE_MAPPING_KEY; - } - - public int getXmlSequence() { - return 85; - } - - public void initializeOn(OrmAttributeMapping newMapping) { - newMapping.initializeFromOrmAttributeMapping(this); - } - - public void addXmlAttributeMappingTo(org.eclipse.jpt.jpa.core.resource.orm.Attributes xmlAttributes) { - ((Attributes) xmlAttributes).getTransformations().add(this.xmlAttributeMapping); - } - - public void removeXmlAttributeMappingFrom(org.eclipse.jpt.jpa.core.resource.orm.Attributes xmlAttributes) { - ((Attributes) xmlAttributes).getTransformations().remove(this.xmlAttributeMapping); - } -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/orm/OrmEclipseLinkTransformationMappingDefinition.java b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/orm/OrmEclipseLinkTransformationMappingDefinition.java deleted file mode 100644 index aec93cdb79..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/orm/OrmEclipseLinkTransformationMappingDefinition.java +++ /dev/null @@ -1,65 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2008, 2009 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.eclipselink.core.internal.context.orm; - -import org.eclipse.emf.ecore.EFactory; -import org.eclipse.jpt.jpa.core.context.orm.OrmAttributeMapping; -import org.eclipse.jpt.jpa.core.context.orm.OrmAttributeMappingDefinition; -import org.eclipse.jpt.jpa.core.context.orm.OrmPersistentAttribute; -import org.eclipse.jpt.jpa.core.context.orm.OrmXmlContextNodeFactory; -import org.eclipse.jpt.jpa.core.resource.orm.XmlAttributeMapping; -import org.eclipse.jpt.jpa.core.resource.xml.EmfTools; -import org.eclipse.jpt.jpa.eclipselink.core.EclipseLinkMappingKeys; -import org.eclipse.jpt.jpa.eclipselink.core.resource.orm.EclipseLinkOrmPackage; -import org.eclipse.jpt.jpa.eclipselink.core.resource.orm.XmlTransformation; - -public class OrmEclipseLinkTransformationMappingDefinition - implements OrmAttributeMappingDefinition -{ - // singleton - private static final OrmEclipseLinkTransformationMappingDefinition INSTANCE = - new OrmEclipseLinkTransformationMappingDefinition(); - - - /** - * Return the singleton - */ - public static OrmAttributeMappingDefinition instance() { - return INSTANCE; - } - - - /** - * Enforce singleton usage - */ - private OrmEclipseLinkTransformationMappingDefinition() { - super(); - } - - - public String getKey() { - return EclipseLinkMappingKeys.TRANSFORMATION_ATTRIBUTE_MAPPING_KEY; - } - - public XmlAttributeMapping buildResourceMapping(EFactory factory) { - return EmfTools.create( - factory, - EclipseLinkOrmPackage.eINSTANCE.getXmlTransformation(), - XmlTransformation.class); - } - - public OrmAttributeMapping buildContextMapping( - OrmPersistentAttribute parent, - XmlAttributeMapping resourceMapping, - OrmXmlContextNodeFactory factory) { - return ((EclipseLinkOrmXmlContextNodeFactory) factory). - buildOrmEclipseLinkTransformationMapping(parent, (XmlTransformation) resourceMapping); - } -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/orm/OrmEclipseLinkTypeConverter.java b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/orm/OrmEclipseLinkTypeConverter.java deleted file mode 100644 index a2e753ba40..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/orm/OrmEclipseLinkTypeConverter.java +++ /dev/null @@ -1,269 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2008, 2012 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.eclipselink.core.internal.context.orm; - -import org.eclipse.jdt.core.IPackageFragment; -import org.eclipse.jdt.core.IType; -import org.eclipse.jpt.common.core.resource.java.JavaResourceAbstractType; -import org.eclipse.jpt.common.utility.internal.Tools; -import org.eclipse.jpt.common.utility.internal.iterables.CompositeIterable; -import org.eclipse.jpt.common.utility.internal.iterables.EmptyIterable; -import org.eclipse.jpt.common.utility.internal.iterables.SingleElementIterable; -import org.eclipse.jpt.jpa.core.context.JpaNamedContextNode; -import org.eclipse.jpt.jpa.core.context.XmlContextNode; -import org.eclipse.jpt.jpa.eclipselink.core.context.EclipseLinkTypeConverter; -import org.eclipse.jpt.jpa.eclipselink.core.internal.context.java.JavaEclipseLinkTypeConverter; -import org.eclipse.jpt.jpa.eclipselink.core.resource.orm.XmlTypeConverter; -import org.eclipse.text.edits.ReplaceEdit; - -public class OrmEclipseLinkTypeConverter - extends OrmEclipseLinkConverter<XmlTypeConverter> - implements EclipseLinkTypeConverter -{ - private String dataType; - private String fullyQualifiedDataType; - - private String objectType; - private String fullyQualifiedObjectType; - - - public OrmEclipseLinkTypeConverter(XmlContextNode parent, XmlTypeConverter xmlConverter) { - super(parent, xmlConverter); - this.dataType = xmlConverter.getDataType(); - this.objectType = xmlConverter.getObjectType(); - } - - - // ********** synchronize/update ********** - - @Override - public void synchronizeWithResourceModel() { - super.synchronizeWithResourceModel(); - this.setDataType_(this.xmlConverter.getDataType()); - this.setObjectType_(this.xmlConverter.getObjectType()); - } - - @Override - public void update() { - super.update(); - this.setFullyQualifiedDataType(this.buildFullyQualifiedDataType()); - this.setFullyQualifiedObjectType(this.buildFullyQualifiedObjectType()); - } - - - // ********** data type ********** - - public String getDataType() { - return this.dataType; - } - - public void setDataType(String dataType) { - this.setDataType_(dataType); - this.xmlConverter.setDataType(dataType); - } - - protected void setDataType_(String dataType) { - String old = this.dataType; - this.dataType = dataType; - this.firePropertyChanged(DATA_TYPE_PROPERTY, old, dataType); - } - public String getFullyQualifiedDataType() { - return this.fullyQualifiedDataType; - } - - protected void setFullyQualifiedDataType(String dataType) { - String old = this.fullyQualifiedDataType; - this.fullyQualifiedDataType = dataType; - this.firePropertyChanged(FULLY_QUALIFIED_DATA_TYPE_PROPERTY, old, dataType); - } - - protected String buildFullyQualifiedDataType() { - return this.getMappingFileRoot().getFullyQualifiedName(this.dataType); - } - - protected boolean dataTypeIsFor(String typeName) { - return this.typeIsFor(this.getDataTypeJavaResourceType(), typeName); - } - - protected boolean dataTypeIsIn(IPackageFragment packageFragment) { - return this.typeIsIn(this.getDataTypeJavaResourceType(), packageFragment); - } - - protected JavaResourceAbstractType getDataTypeJavaResourceType() { - if (this.fullyQualifiedDataType == null) { - return null; - } - return this.getJpaProject().getJavaResourceType(this.fullyQualifiedDataType); - } - - // ********** object type ********** - - public String getObjectType() { - return this.objectType; - } - - public void setObjectType(String objectType) { - this.setObjectType_(objectType); - this.xmlConverter.setObjectType(objectType); - } - - protected void setObjectType_(String objectType) { - String old = this.objectType; - this.objectType = objectType; - this.firePropertyChanged(OBJECT_TYPE_PROPERTY, old, objectType); - } - - public String getFullyQualifiedObjectType() { - return this.fullyQualifiedObjectType; - } - - protected void setFullyQualifiedObjectType(String objectType) { - String old = this.fullyQualifiedObjectType; - this.fullyQualifiedObjectType = objectType; - this.firePropertyChanged(FULLY_QUALIFIED_OBJECT_TYPE_PROPERTY, old, objectType); - } - - protected String buildFullyQualifiedObjectType() { - return this.getMappingFileRoot().getFullyQualifiedName(this.objectType); - } - - protected boolean objectTypeIsFor(String typeName) { - return this.typeIsFor(this.getObjectTypeJavaResourceType(), typeName); - } - - protected boolean objectTypeIsIn(IPackageFragment packageFragment) { - return this.typeIsIn(this.getObjectTypeJavaResourceType(), packageFragment); - } - - protected JavaResourceAbstractType getObjectTypeJavaResourceType() { - if (this.fullyQualifiedObjectType == null) { - return null; - } - return this.getJpaProject().getJavaResourceType(this.fullyQualifiedObjectType); - } - - - // ********** refactoring ********** - - @Override - @SuppressWarnings("unchecked") - public Iterable<ReplaceEdit> createRenameTypeEdits(IType originalType, String newName) { - return new CompositeIterable<ReplaceEdit>( - this.createRenameDataTypeEdits(originalType, newName), - this.createRenameObjectTypeEdits(originalType, newName) - ); - } - - protected Iterable<ReplaceEdit> createRenameDataTypeEdits(IType originalType, String newName) { - return this.dataTypeIsFor(originalType.getFullyQualifiedName('.')) ? - new SingleElementIterable<ReplaceEdit>(this.createRenameDataTypeEdit(originalType, newName)) : - EmptyIterable.<ReplaceEdit>instance(); - } - - protected ReplaceEdit createRenameDataTypeEdit(IType originalType, String newName) { - return this.xmlConverter.createRenameDataTypeEdit(originalType, newName); - } - - protected Iterable<ReplaceEdit> createRenameObjectTypeEdits(IType originalType, String newName) { - return this.objectTypeIsFor(originalType.getFullyQualifiedName('.')) ? - new SingleElementIterable<ReplaceEdit>(this.createRenameObjectTypeEdit(originalType, newName)) : - EmptyIterable.<ReplaceEdit>instance(); - } - - protected ReplaceEdit createRenameObjectTypeEdit(IType originalType, String newName) { - return this.xmlConverter.createRenameObjectTypeEdit(originalType, newName); - } - - @Override - @SuppressWarnings("unchecked") - public Iterable<ReplaceEdit> createMoveTypeEdits(IType originalType, IPackageFragment newPackage) { - return new CompositeIterable<ReplaceEdit>( - this.createMoveDataTypeEdits(originalType, newPackage), - this.createMoveObjectTypeEdits(originalType, newPackage) - ); - } - - protected Iterable<ReplaceEdit> createMoveDataTypeEdits(IType originalType, IPackageFragment newPackage) { - return this.dataTypeIsFor(originalType.getFullyQualifiedName('.')) ? - new SingleElementIterable<ReplaceEdit>(this.createRenameDataTypePackageEdit(newPackage.getElementName())) : - EmptyIterable.<ReplaceEdit>instance(); - } - - protected ReplaceEdit createRenameDataTypePackageEdit(String newName) { - return this.xmlConverter.createRenameDataTypePackageEdit(newName); - } - - protected Iterable<ReplaceEdit> createMoveObjectTypeEdits(IType originalType, IPackageFragment newPackage) { - return this.objectTypeIsFor(originalType.getFullyQualifiedName('.')) ? - new SingleElementIterable<ReplaceEdit>(this.createRenameObjectTypePackageEdit(newPackage.getElementName())) : - EmptyIterable.<ReplaceEdit>instance(); - } - - protected ReplaceEdit createRenameObjectTypePackageEdit(String newName) { - return this.xmlConverter.createRenameObjectTypePackageEdit(newName); - } - - @Override - @SuppressWarnings("unchecked") - public Iterable<ReplaceEdit> createRenamePackageEdits(IPackageFragment originalPackage, String newName) { - return new CompositeIterable<ReplaceEdit>( - this.createRenameDataTypePackageEdits(originalPackage, newName), - this.createRenameObjectTypePackageEdits(originalPackage, newName) - ); - } - - protected Iterable<ReplaceEdit> createRenameDataTypePackageEdits(IPackageFragment originalPackage, String newName) { - return this.dataTypeIsIn(originalPackage) ? - new SingleElementIterable<ReplaceEdit>(this.createRenameDataTypePackageEdit(newName)) : - EmptyIterable.<ReplaceEdit>instance(); - } - - protected Iterable<ReplaceEdit> createRenameObjectTypePackageEdits(IPackageFragment originalPackage, String newName) { - return this.objectTypeIsIn(originalPackage) ? - new SingleElementIterable<ReplaceEdit>(this.createRenameObjectTypePackageEdit(newName)) : - EmptyIterable.<ReplaceEdit>instance(); - } - - - // ********** misc ********** - - public Class<EclipseLinkTypeConverter> getType() { - return EclipseLinkTypeConverter.class; - } - - protected boolean typeIsFor(JavaResourceAbstractType type, String typeName) { - return (type != null) && type.getQualifiedName().equals(typeName); - } - - protected boolean typeIsIn(JavaResourceAbstractType type, IPackageFragment packageFragment) { - return (type != null) && type.isIn(packageFragment); - } - - // ********** validation ********* - - @Override - public boolean isEquivalentTo(JpaNamedContextNode node) { - return super.isEquivalentTo(node) - && this.isEquivalentTo((EclipseLinkTypeConverter) node); - } - - protected boolean isEquivalentTo(EclipseLinkTypeConverter converter) { - return Tools.valuesAreEqual(this.fullyQualifiedDataType, converter.getFullyQualifiedDataType()) && - Tools.valuesAreEqual(this.fullyQualifiedObjectType, converter.getFullyQualifiedObjectType()); - } - - // ********** metadata conversion ********** - - public void convertFrom(JavaEclipseLinkTypeConverter javaConverter) { - super.convertFrom(javaConverter); - this.setDataType(javaConverter.getFullyQualifiedDataType()); - this.setObjectType(javaConverter.getFullyQualifiedObjectType()); - } -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/orm/OrmEclipseLinkVariableOneToOneMapping.java b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/orm/OrmEclipseLinkVariableOneToOneMapping.java deleted file mode 100644 index 0e7351cfca..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/orm/OrmEclipseLinkVariableOneToOneMapping.java +++ /dev/null @@ -1,47 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2009, 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.eclipselink.core.internal.context.orm; - -import org.eclipse.jpt.jpa.core.context.orm.OrmAttributeMapping; -import org.eclipse.jpt.jpa.core.context.orm.OrmPersistentAttribute; -import org.eclipse.jpt.jpa.core.internal.context.orm.AbstractOrmAttributeMapping; -import org.eclipse.jpt.jpa.eclipselink.core.EclipseLinkMappingKeys; -import org.eclipse.jpt.jpa.eclipselink.core.context.EclipseLinkVariableOneToOneMapping; -import org.eclipse.jpt.jpa.eclipselink.core.resource.orm.Attributes; -import org.eclipse.jpt.jpa.eclipselink.core.resource.orm.XmlVariableOneToOne; - -public class OrmEclipseLinkVariableOneToOneMapping - extends AbstractOrmAttributeMapping<XmlVariableOneToOne> - implements EclipseLinkVariableOneToOneMapping -{ - public OrmEclipseLinkVariableOneToOneMapping(OrmPersistentAttribute parent, XmlVariableOneToOne xmlMapping) { - super(parent, xmlMapping); - } - - public String getKey() { - return EclipseLinkMappingKeys.VARIABLE_ONE_TO_ONE_ATTRIBUTE_MAPPING_KEY; - } - - public int getXmlSequence() { - return 65; - } - - public void initializeOn(OrmAttributeMapping newMapping) { - newMapping.initializeFromOrmAttributeMapping(this); - } - - public void addXmlAttributeMappingTo(org.eclipse.jpt.jpa.core.resource.orm.Attributes xmlAttributes) { - ((Attributes) xmlAttributes).getVariableOneToOnes().add(this.xmlAttributeMapping); - } - - public void removeXmlAttributeMappingFrom(org.eclipse.jpt.jpa.core.resource.orm.Attributes xmlAttributes) { - ((Attributes) xmlAttributes).getVariableOneToOnes().remove(this.xmlAttributeMapping); - } -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/orm/OrmEclipseLinkVariableOneToOneMappingDefinition.java b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/orm/OrmEclipseLinkVariableOneToOneMappingDefinition.java deleted file mode 100644 index 308eb723ac..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/orm/OrmEclipseLinkVariableOneToOneMappingDefinition.java +++ /dev/null @@ -1,65 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2009 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.eclipselink.core.internal.context.orm; - -import org.eclipse.emf.ecore.EFactory; -import org.eclipse.jpt.jpa.core.context.orm.OrmAttributeMapping; -import org.eclipse.jpt.jpa.core.context.orm.OrmAttributeMappingDefinition; -import org.eclipse.jpt.jpa.core.context.orm.OrmPersistentAttribute; -import org.eclipse.jpt.jpa.core.context.orm.OrmXmlContextNodeFactory; -import org.eclipse.jpt.jpa.core.resource.orm.XmlAttributeMapping; -import org.eclipse.jpt.jpa.core.resource.xml.EmfTools; -import org.eclipse.jpt.jpa.eclipselink.core.EclipseLinkMappingKeys; -import org.eclipse.jpt.jpa.eclipselink.core.resource.orm.EclipseLinkOrmPackage; -import org.eclipse.jpt.jpa.eclipselink.core.resource.orm.XmlVariableOneToOne; - -public class OrmEclipseLinkVariableOneToOneMappingDefinition - implements OrmAttributeMappingDefinition -{ - // singleton - private static final OrmEclipseLinkVariableOneToOneMappingDefinition INSTANCE = - new OrmEclipseLinkVariableOneToOneMappingDefinition(); - - - /** - * Return the singleton - */ - public static OrmAttributeMappingDefinition instance() { - return INSTANCE; - } - - - /** - * Enforce singleton usage - */ - private OrmEclipseLinkVariableOneToOneMappingDefinition() { - super(); - } - - - public String getKey() { - return EclipseLinkMappingKeys.VARIABLE_ONE_TO_ONE_ATTRIBUTE_MAPPING_KEY; - } - - public XmlAttributeMapping buildResourceMapping(EFactory factory) { - return EmfTools.create( - factory, - EclipseLinkOrmPackage.eINSTANCE.getXmlVariableOneToOne(), - XmlVariableOneToOne.class); - } - - public OrmAttributeMapping buildContextMapping( - OrmPersistentAttribute parent, - XmlAttributeMapping resourceMapping, - OrmXmlContextNodeFactory factory) { - return ((EclipseLinkOrmXmlContextNodeFactory) factory). - buildOrmEclipseLinkVariableOneToOneMapping(parent, (XmlVariableOneToOne) resourceMapping); - } -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/orm/OrmEclipseLinkVersionMapping.java b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/orm/OrmEclipseLinkVersionMapping.java deleted file mode 100644 index e243c6ecaf..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/orm/OrmEclipseLinkVersionMapping.java +++ /dev/null @@ -1,209 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2008, 2012 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.eclipselink.core.internal.context.orm; - -import java.util.List; - -import org.eclipse.jdt.core.IPackageFragment; -import org.eclipse.jdt.core.IType; -import org.eclipse.jpt.common.core.internal.utility.JDTTools; -import org.eclipse.jpt.common.core.utility.TextRange; -import org.eclipse.jpt.common.utility.internal.ArrayTools; -import org.eclipse.jpt.common.utility.internal.StringTools; -import org.eclipse.jpt.common.utility.internal.iterables.CompositeIterable; -import org.eclipse.jpt.jpa.core.context.orm.OrmConverter; -import org.eclipse.jpt.jpa.core.context.orm.OrmPersistentAttribute; -import org.eclipse.jpt.jpa.core.internal.context.MappingTools; -import org.eclipse.jpt.jpa.core.internal.context.orm.AbstractOrmVersionMapping; -import org.eclipse.jpt.jpa.eclipselink.core.context.EclipseLinkAccessType; -import org.eclipse.jpt.jpa.eclipselink.core.context.EclipseLinkMutable; -import org.eclipse.jpt.jpa.eclipselink.core.context.EclipseLinkVersionMapping; -import org.eclipse.jpt.jpa.eclipselink.core.context.orm.EclipseLinkOrmConvertibleMapping; -import org.eclipse.jpt.jpa.eclipselink.core.context.orm.OrmEclipseLinkConverterContainer; -import org.eclipse.jpt.jpa.eclipselink.core.internal.DefaultEclipseLinkJpaValidationMessages; -import org.eclipse.jpt.jpa.eclipselink.core.internal.EclipseLinkJpaValidationMessages; -import org.eclipse.jpt.jpa.eclipselink.core.resource.orm.XmlVersion; -import org.eclipse.text.edits.ReplaceEdit; -import org.eclipse.wst.validation.internal.provisional.core.IMessage; -import org.eclipse.wst.validation.internal.provisional.core.IReporter; - -public class OrmEclipseLinkVersionMapping - extends AbstractOrmVersionMapping<XmlVersion> - implements - EclipseLinkVersionMapping, - EclipseLinkOrmConvertibleMapping, - OrmEclipseLinkConverterContainer.Owner -{ - protected final OrmEclipseLinkMutable mutable; - - protected final OrmEclipseLinkConverterContainer converterContainer; - - - public OrmEclipseLinkVersionMapping(OrmPersistentAttribute parent, XmlVersion xmlMapping) { - super(parent, xmlMapping); - this.mutable = new OrmEclipseLinkMutable(this); - this.converterContainer = this.buildConverterContainer(); - } - - - // ********** synchronize/update ********** - - @Override - public void synchronizeWithResourceModel() { - super.synchronizeWithResourceModel(); - this.mutable.synchronizeWithResourceModel(); - this.converterContainer.synchronizeWithResourceModel(); - } - - @Override - public void update() { - super.update(); - this.mutable.update(); - this.converterContainer.update(); - } - - - // ********** attribute type ********** - - @Override - protected String buildSpecifiedAttributeType() { - return this.xmlAttributeMapping.getAttributeType(); - } - - @Override - protected void setSpecifiedAttributeTypeInXml(String attributeType) { - this.xmlAttributeMapping.setAttributeType(attributeType); - } - - - // ********** mutable ********** - - public EclipseLinkMutable getMutable() { - return this.mutable; - } - - // ********** converters ********** - - public OrmEclipseLinkConverterContainer getConverterContainer() { - return this.converterContainer; - } - - protected OrmEclipseLinkConverterContainer buildConverterContainer() { - return new OrmEclipseLinkConverterContainerImpl(this, this, this.xmlAttributeMapping); - } - - public int getNumberSupportedConverters() { - return 1; - } - - - // ********** converter adapters ********** - - /** - * put the EclipseLink convert adapter first - this is the order EclipseLink searches - */ - @Override - protected Iterable<OrmConverter.Adapter> getConverterAdapters() { - return new CompositeIterable<OrmConverter.Adapter>(OrmEclipseLinkConvert.Adapter.instance(), super.getConverterAdapters()); - } - - - //************ refactoring ************ - - @Override - @SuppressWarnings("unchecked") - public Iterable<ReplaceEdit> createMoveTypeEdits(IType originalType, IPackageFragment newPackage) { - return new CompositeIterable<ReplaceEdit>( - super.createMoveTypeEdits(originalType, newPackage), - this.converterContainer.createMoveTypeEdits(originalType, newPackage) - ); - } - - @Override - @SuppressWarnings("unchecked") - public Iterable<ReplaceEdit> createRenamePackageEdits(IPackageFragment originalPackage, String newName) { - return new CompositeIterable<ReplaceEdit>( - super.createRenamePackageEdits(originalPackage, newName), - this.converterContainer.createRenamePackageEdits(originalPackage, newName) - ); - } - - @Override - @SuppressWarnings("unchecked") - public Iterable<ReplaceEdit> createRenameTypeEdits(IType originalType, String newName) { - return new CompositeIterable<ReplaceEdit>( - super.createRenameTypeEdits(originalType, newName), - this.converterContainer.createRenameTypeEdits(originalType, newName) - ); - } - - - // ********** validation ********** - - @Override - public void validate(List<IMessage> messages, IReporter reporter) { - super.validate(messages, reporter); - // TODO mutable validation - } - - @Override - protected void validateAttributeType(List<IMessage> messages) { - //TODO copied from OrmEclipseLinkBasicMapping - if (this.isVirtualAccess()) { - if (StringTools.stringIsEmpty(this.getAttributeType())) { - messages.add( - DefaultEclipseLinkJpaValidationMessages.buildMessage( - IMessage.HIGH_SEVERITY, - EclipseLinkJpaValidationMessages.VIRTUAL_ATTRIBUTE_NO_ATTRIBUTE_TYPE_SPECIFIED, - new String[] {this.getName()}, - this, - this.getAttributeTypeTextRange() - ) - ); - return; - } - if (MappingTools.typeIsBasic(this.getJavaProject(), this.getFullyQualifiedAttributeType())) { - return; - } - IType jdtType = JDTTools.findType(this.getJavaProject(), this.getFullyQualifiedAttributeType()); - if (jdtType == null && this.getResolvedAttributeType() == null) { - messages.add( - DefaultEclipseLinkJpaValidationMessages.buildMessage( - IMessage.HIGH_SEVERITY, - EclipseLinkJpaValidationMessages.VIRTUAL_ATTRIBUTE_ATTRIBUTE_TYPE_DOES_NOT_EXIST, - new String[] {this.getFullyQualifiedAttributeType()}, - this, - this.getAttributeTypeTextRange() - ) - ); - return; - } - } - if (!ArrayTools.contains(SUPPORTED_TYPE_NAMES, this.getAttributeType())) { - messages.add( - DefaultEclipseLinkJpaValidationMessages.buildMessage( - IMessage.HIGH_SEVERITY, - EclipseLinkJpaValidationMessages.PERSISTENT_ATTRIBUTE_INVALID_VERSION_MAPPING_TYPE, - new String[] {this.getName()}, - this, - this.getAttributeTypeTextRange() - ) - ); - } - } - - protected boolean isVirtualAccess() { - return getPersistentAttribute().getAccess() == EclipseLinkAccessType.VIRTUAL; - } - - protected TextRange getAttributeTypeTextRange() { - return this.getValidationTextRange(this.xmlAttributeMapping.getAttributeTypeTextRange()); - } -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/orm/VirtualJavaPersistentAttribute.java b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/orm/VirtualJavaPersistentAttribute.java deleted file mode 100644 index 0076d351e7..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/orm/VirtualJavaPersistentAttribute.java +++ /dev/null @@ -1,395 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2012 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.eclipselink.core.internal.context.orm; - -import org.eclipse.jdt.core.IType; -import org.eclipse.jdt.core.JavaModelException; -import org.eclipse.jdt.core.dom.CompilationUnit; -import org.eclipse.jpt.common.core.internal.utility.JDTTools; -import org.eclipse.jpt.common.core.resource.java.JavaResourceAttribute; -import org.eclipse.jpt.common.core.resource.java.JavaResourceField; -import org.eclipse.jpt.common.core.resource.java.JavaResourceMethod; -import org.eclipse.jpt.common.core.utility.TextRange; -import org.eclipse.jpt.common.utility.internal.ClassName; -import org.eclipse.jpt.common.utility.internal.iterables.ArrayIterable; -import org.eclipse.jpt.jpa.core.JpaStructureNode; -import org.eclipse.jpt.jpa.core.context.AccessType; -import org.eclipse.jpt.jpa.core.context.CollectionMapping; -import org.eclipse.jpt.jpa.core.context.TypeMapping; -import org.eclipse.jpt.jpa.core.context.java.Accessor; -import org.eclipse.jpt.jpa.core.context.java.JavaAttributeMapping; -import org.eclipse.jpt.jpa.core.context.java.JavaPersistentAttribute; -import org.eclipse.jpt.jpa.core.context.orm.EntityMappings; -import org.eclipse.jpt.jpa.core.context.orm.OrmPersistentType; -import org.eclipse.jpt.jpa.core.internal.context.java.AbstractJavaJpaContextNode; -import org.eclipse.jpt.jpa.core.internal.jpa1.context.java.GenericJavaNullAttributeMapping; -import org.eclipse.jpt.jpa.core.jpa2.context.MetamodelField; -import org.eclipse.jpt.jpa.core.jpa2.context.java.JavaPersistentAttribute2_0; -import org.eclipse.jpt.jpa.core.jpa2.resource.java.JPA2_0; -import org.eclipse.jpt.jpa.eclipselink.core.JptJpaEclipseLinkCorePlugin; -import org.eclipse.jpt.jpa.eclipselink.core.context.java.JavaEclipseLinkPersistentAttribute; -import org.eclipse.jpt.jpa.eclipselink.core.resource.orm.XmlAttributeMapping; - -public class VirtualJavaPersistentAttribute extends AbstractJavaJpaContextNode - implements JavaPersistentAttribute2_0, JavaEclipseLinkPersistentAttribute -{ - private final XmlAttributeMapping xmlAttributeMapping; - - private final JavaAttributeMapping attributeMapping; - - public VirtualJavaPersistentAttribute(OrmPersistentType parent, XmlAttributeMapping xmlAttributeMapping) { - super(parent); - this.xmlAttributeMapping = xmlAttributeMapping; - this.attributeMapping = new GenericJavaNullAttributeMapping(this); - } - - public XmlAttributeMapping getXmlAttributeMapping() { - return this.xmlAttributeMapping; - } - - public JavaAttributeMapping getMapping() { - return this.attributeMapping; - } - - public JavaAttributeMapping setMappingKey(String key) { - throw new UnsupportedOperationException("cannot set anything on a virtual java persistent attribute"); //$NON-NLS-1$ - } - - public Accessor getAccessor() { - return null; - } - - public JavaResourceAttribute getResourceAttribute() { - return null; - } - - public boolean isFor(JavaResourceField resourceField) { - return false; - } - - public boolean isFor(JavaResourceMethod resourceGetter, JavaResourceMethod resourceSetter) { - return false; - } - - public boolean contains(int offset, CompilationUnit astRoot) { - throw new UnsupportedOperationException(); - } - - public String getTypeName() { - String typeName = this.xmlAttributeMapping.getAttributeType(); - return typeName == null ? null : this.getEntityMappings().getFullyQualifiedName(typeName); - } - - public boolean typeIsBasic() { - return false;//not valid for a default basic mapping, specified in orm.xml - } - - public String getSingleReferenceTargetTypeName() { - return null; //used for building default target entity/embeddable, must be specified in a virtual mapping - } - - public String getMultiReferenceTargetTypeName() { - return null; //used for building default target entity/target class, must be specified in a virtual mapping - } - - public String getMultiReferenceMapKeyTypeName() { - return null; //used for building default map key class, must be specified in a virtual mapping - } - - public String getName() { - return this.xmlAttributeMapping.getName(); - } - - public String getMappingKey() { - return null; - } - - public String getDefaultMappingKey() { - return null; - } - - public boolean isVirtual() { - throw new UnsupportedOperationException("Owing orm persistent attribute is specified, this should not be called."); //$NON-NLS-1$ - } - - public JavaPersistentAttribute getJavaPersistentAttribute() { - return this; - } - - - // ********** JpaStructureNode implementation ********** - - - public JpaStructureNode getStructureNode(int textOffset) { - throw new UnsupportedOperationException("There is no resource for a virtual java persistent attribute"); //$NON-NLS-1$ - } - - public TextRange getSelectionTextRange() { - throw new UnsupportedOperationException("There is no resource for a virtual java persistent attribute"); //$NON-NLS-1$ - } - - public ContextType getContextType() { - throw new UnsupportedOperationException("There is no resource for a virtual java persistent attribute"); //$NON-NLS-1$ - } - - public Class<? extends JpaStructureNode> getType() { - throw new UnsupportedOperationException("There is no resource for a virtual java persistent attribute"); //$NON-NLS-1$ - } - - public void dispose() { - throw new UnsupportedOperationException("There is no resource for a virtual java persistent attribute"); //$NON-NLS-1$ - } - - public AccessType getAccess() { - return null; - } - - public AccessType getSpecifiedAccess() { - return null; - } - - public void setSpecifiedAccess(AccessType newSpecifiedAccess) { - throw new UnsupportedOperationException("cannot set anything on a virtual java persistent attribute"); //$NON-NLS-1$ - } - - public AccessType getDefaultAccess() { - return null; - } - - public TextRange getValidationTextRange(CompilationUnit astRoot) { - throw new UnsupportedOperationException(); - } - - - public boolean typeIsDateOrCalendar() { - String typeName = this.getTypeName(); - if (typeName == null) { - return false; - } - return JDTTools.typeIsSubType(this.getJavaProject(), typeName, DATE_TYPE_NAME) - || JDTTools.typeIsSubType(this.getJavaProject(), typeName, CALENDAR_TYPE_NAME); - } - - public boolean typeIsSerializable() { - String typeName = this.getTypeName(); - if (typeName == null) { - return false; - } - return JDTTools.typeIsSubType(this.getJavaProject(), typeName, JDTTools.SERIALIZABLE_CLASS_NAME); - } - - public boolean typeIsValidForVariableOneToOne() { - String typeName = this.getTypeName(); - if (typeName == null) { - return false; - } - IType type = JDTTools.findType(getJavaProject(), typeName); - try { - return type != null && - type.isInterface() && - this.interfaceIsValidForVariableOneToOne(typeName); - } - catch (JavaModelException e) { - JptJpaEclipseLinkCorePlugin.log(e); - return false; - } - } - - protected boolean interfaceIsValidForVariableOneToOne(String interfaceName) { - return ! this.interfaceIsInvalidForVariableOneToOne(interfaceName); - } - - // TODO we could probably add more interfaces to this list... - protected boolean interfaceIsInvalidForVariableOneToOne(String interfaceName) { - return (interfaceName == null) || - this.typeIsContainer(interfaceName) || - interfaceName.equals("org.eclipse.persistence.indirection.ValueHolderInterface"); //$NON-NLS-1$ - } - - /** - * return whether the specified type is one of the container - * types allowed by the JPA spec - */ - protected boolean typeIsContainer(String typeName) { - return this.getJpaContainerDefinition(typeName).isContainer(); - } - - - // ********** metamodel ********** - - public String getMetamodelContainerFieldTypeName() { - throw new UnsupportedOperationException("parent OrmPersistentAttribute implements this"); //$NON-NLS-1$ - } - - public String getMetamodelContainerFieldMapKeyTypeName() { - throw new UnsupportedOperationException("parent OrmPersistentAttribute implements this"); //$NON-NLS-1$ - } - - - public String getMetamodelTypeName() { - String typeName = this.getTypeName(); - if (typeName == null) { - return MetamodelField.DEFAULT_TYPE_NAME; - } - if (ClassName.isPrimitive(typeName)) { - return ClassName.getWrapperClassName(typeName); // ??? - } - return typeName; - } - - public JpaContainerDefinition getJpaContainerDefinition() { - // 'typeName' may include array brackets ("[]") - // but not generic type arguments (e.g. "<java.lang.String>") - return this.getJpaContainerDefinition(this.getTypeName()); - } - - //I don't think we should be doing this here, I think OrmAttributeMappings should be responsible for their own JpaContainerDefinition - //Generic can just get it from the JavaPersistentAttribute - /** - * Return the JPA container definition corresponding to the specified type; - * return a "null" definition if the specified type is not "assignable to" one of the - * container types allowed by the JPA spec. - */ - protected JpaContainerDefinition getJpaContainerDefinition(String typeName) { - if (typeName != null) { - for (JpaContainerDefinition definition : getJpaContainerDefinitions()) { - if (definition.isAssignableFrom(typeName)) { - return definition; - } - } - } - return JpaContainerDefinition.Null.instance(); - } - - protected Iterable<JpaContainerDefinition> getJpaContainerDefinitions() { - return JPA_CONTAINER_DEFINITIONS; - } - - protected static final JpaContainerDefinition[] JPA_CONTAINER_DEFINITION_ARRAY = new JpaContainerDefinition[] { - new CollectionJpaContainerDefinition(java.util.Set.class, JPA2_0.SET_ATTRIBUTE), - new CollectionJpaContainerDefinition(java.util.List.class, JPA2_0.LIST_ATTRIBUTE), - new CollectionJpaContainerDefinition(java.util.Collection.class, JPA2_0.COLLECTION_ATTRIBUTE), - new MapJpaContainerDefinition(java.util.Map.class, JPA2_0.MAP_ATTRIBUTE) - }; - - protected static final Iterable<JpaContainerDefinition> JPA_CONTAINER_DEFINITIONS = new ArrayIterable<JpaContainerDefinition>(JPA_CONTAINER_DEFINITION_ARRAY); - - - /** - * Abstract JPA container definition - */ - protected abstract static class AbstractJpaContainerDefinition - implements JpaContainerDefinition - { - protected final Class<?> containerClass; - protected final String metamodelContainerFieldTypeName; - - protected AbstractJpaContainerDefinition(Class<?> containerClass, String metamodelContainerFieldTypeName) { - super(); - if ((containerClass == null) || (metamodelContainerFieldTypeName == null)) { - throw new NullPointerException(); - } - this.containerClass = containerClass; - this.metamodelContainerFieldTypeName = metamodelContainerFieldTypeName; - } - - public boolean isAssignableFrom(String typeName) { - try { - return this.containerClass.isAssignableFrom(Class.forName(typeName)); - } - catch (ClassNotFoundException e) { - return false; - } - } - - public boolean isContainer() { - return true; - } - - public String getMetamodelContainerFieldTypeName() { - return this.metamodelContainerFieldTypeName; - } - - public String getMultiReferenceTargetTypeName(JavaResourceAttribute resourceAttribute) { - throw new UnsupportedOperationException(); - } - - public String getMultiReferenceMapKeyTypeName(JavaResourceAttribute resourceAttribute) { - throw new UnsupportedOperationException(); - } - } - - /** - * Collection JPA container definition - */ - protected static class CollectionJpaContainerDefinition - extends AbstractJpaContainerDefinition - { - protected CollectionJpaContainerDefinition(Class<?> collectionClass, String staticMetamodelTypeDeclarationTypeName) { - super(collectionClass, staticMetamodelTypeDeclarationTypeName); - } - - public String getMetamodelContainerFieldMapKeyTypeName(CollectionMapping mapping) { - return null; - } - - public boolean isMap() { - return false; - } - } - - /** - * Map JPA container definition - */ - protected static class MapJpaContainerDefinition - extends AbstractJpaContainerDefinition - { - protected MapJpaContainerDefinition(Class<?> mapClass, String staticMetamodelTypeDeclarationTypeName) { - super(mapClass, staticMetamodelTypeDeclarationTypeName); - } - - public String getMetamodelContainerFieldMapKeyTypeName(CollectionMapping mapping) { - return mapping.getMetamodelFieldMapKeyTypeName(); - } - - public boolean isMap() { - return true; - } - } - - - // ********** misc ********** - - @Override - public OrmPersistentType getParent() { - return (OrmPersistentType) super.getParent(); - } - - public OrmPersistentType getOwningPersistentType() { - return this.getParent(); - } - - public TypeMapping getOwningTypeMapping() { - return this.getOwningPersistentType().getMapping(); - } - - protected EntityMappings getEntityMappings() { - return (EntityMappings) getParent().getMappingFileRoot(); - } - - public String getPrimaryKeyColumnName() { - throw new UnsupportedOperationException("Owing orm persistent attribute should handle, this should not be called."); //$NON-NLS-1$ - } - - @Override - public void toString(StringBuilder sb) { - sb.append(this.getName()); - } -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/orm/VirtualJavaPersistentType.java b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/orm/VirtualJavaPersistentType.java deleted file mode 100644 index 725fa84776..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/orm/VirtualJavaPersistentType.java +++ /dev/null @@ -1,350 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2012 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.eclipselink.core.internal.context.orm; - -import java.util.Collection; -import java.util.HashSet; -import java.util.List; -import java.util.Map; -import org.eclipse.core.resources.IFile; -import org.eclipse.jdt.core.IPackageFragment; -import org.eclipse.jdt.core.dom.CompilationUnit; -import org.eclipse.jpt.common.core.resource.java.JavaResourceAnnotatedElement; -import org.eclipse.jpt.common.core.resource.java.JavaResourceAttribute; -import org.eclipse.jpt.common.core.resource.java.JavaResourceType; -import org.eclipse.jpt.common.core.utility.BodySourceWriter; -import org.eclipse.jpt.common.core.utility.TextRange; -import org.eclipse.jpt.common.utility.internal.CollectionTools; -import org.eclipse.jpt.common.utility.internal.StringTools; -import org.eclipse.jpt.common.utility.internal.iterables.ChainIterable; -import org.eclipse.jpt.common.utility.internal.iterables.EmptyIterable; -import org.eclipse.jpt.common.utility.internal.iterables.EmptyListIterable; -import org.eclipse.jpt.common.utility.internal.iterables.ListIterable; -import org.eclipse.jpt.jpa.core.JpaStructureNode; -import org.eclipse.jpt.jpa.core.context.AccessType; -import org.eclipse.jpt.jpa.core.context.PersistentType; -import org.eclipse.jpt.jpa.core.context.ReadOnlyPersistentAttribute; -import org.eclipse.jpt.jpa.core.context.java.JavaPersistentAttribute; -import org.eclipse.jpt.jpa.core.context.java.JavaTypeMapping; -import org.eclipse.jpt.jpa.core.internal.context.java.AbstractJavaJpaContextNode; -import org.eclipse.jpt.jpa.core.internal.context.java.JavaNullTypeMapping; -import org.eclipse.jpt.jpa.core.jpa2.context.MetamodelSourceType; -import org.eclipse.jpt.jpa.core.jpa2.context.java.JavaPersistentType2_0; -import org.eclipse.jpt.jpa.eclipselink.core.context.orm.EclipseLinkEntityMappings; -import org.eclipse.jpt.jpa.eclipselink.core.context.orm.EclipseLinkOrmPersistentType; -import org.eclipse.jpt.jpa.eclipselink.core.resource.orm.XmlTypeMapping; -import org.eclipse.wst.validation.internal.provisional.core.IMessage; -import org.eclipse.wst.validation.internal.provisional.core.IReporter; - -public class VirtualJavaPersistentType - extends AbstractJavaJpaContextNode - implements JavaPersistentType2_0 -{ - - private final XmlTypeMapping xmlTypeMapping; - - protected final JavaTypeMapping mapping; - protected PersistentType superPersistentType; - - public VirtualJavaPersistentType(EclipseLinkOrmPersistentType parent, XmlTypeMapping xmlTypeMapping) { - super(parent); - this.xmlTypeMapping = xmlTypeMapping; - this.mapping = new JavaNullTypeMapping(this); - } - - @Override - public EclipseLinkOrmPersistentType getParent() { - return (EclipseLinkOrmPersistentType) super.getParent(); - } - - protected EclipseLinkEntityMappings getEntityMappings() { - return (EclipseLinkEntityMappings) getParent().getMappingFileRoot(); - } - - - // ********** synchronize/update ********** - @Override - public void synchronizeWithResourceModel() { - super.synchronizeWithResourceModel(); - } - - @Override - public void update() { - super.update(); - this.setSuperPersistentType(this.buildSuperPersistentType()); - } - - - // ********** name ********** - - //The parent OrmPersistentType builds its name from the specified class and package. - //In SpecifiedOrmPersistentType.updateJavaPersistentType(), it compares the names and - //rebuilds if the name has changed. We don't need to rebuild the virtual java persistent - //type based on a name change, it will get rebuilt if the dynamic state changes. - public String getName() { - return this.getParent().getName(); - } - - public String getSimpleName() { - return this.getParent().getSimpleName(); - } - - - // ********** access ********** - - public AccessType getSpecifiedAccess() { - return null; - } - - public void setSpecifiedAccess(AccessType newSpecifiedAccess) { - throw new UnsupportedOperationException(); - } - - public AccessType getDefaultAccess() { - return null; - } - - public AccessType getAccess() { - return null; - } - - - // ********** mapping ********** - - public JavaTypeMapping getMapping() { - return this.mapping; - } - - public String getMappingKey() { - return this.mapping.getKey(); - } - - public void setMappingKey(String key) { - throw new UnsupportedOperationException(); - } - - public boolean isMapped() { - return false; - } - - - // ********** super persistent type ********** - - public PersistentType getSuperPersistentType() { - return this.superPersistentType; - } - - protected void setSuperPersistentType(PersistentType superPersistentType) { - PersistentType old = this.superPersistentType; - this.superPersistentType = superPersistentType; - this.firePropertyChanged(SUPER_PERSISTENT_TYPE_PROPERTY, old, superPersistentType); - } - - protected PersistentType buildSuperPersistentType() { - HashSet<JavaResourceType> visited = new HashSet<JavaResourceType>(); - PersistentType spt = this.resolveSuperPersistentType(this.xmlTypeMapping.getParentClass(), visited); - if (spt == null) { - return null; - } - if (CollectionTools.contains(spt.getInheritanceHierarchy(), this)) { - return null; // short-circuit in this case, we have circular inheritance - } - return spt.isMapped() ? spt : spt.getSuperPersistentType(); - } - - /** - * The JPA spec allows non-persistent types in a persistent type's - * inheritance hierarchy. We check for a persistent type with the - * specified name in the persistence unit (Use the EntityMapping - * API for this because it will append the package name if unqualified). - * If it is not found we use java resource type and look for <em>its</em> super type. - * <p> - * The <code>visited</code> collection is used to detect a cycle in the - * <em>resource</em> type inheritance hierarchy and prevent the resulting - * stack overflow. Any cycles in the <em>context</em> type inheritance - * hierarchy are handled in {@link #buildSuperPersistentType()}. - */ - protected PersistentType resolveSuperPersistentType(String typeName, Collection<JavaResourceType> visited) { - if (StringTools.stringIsEmpty(typeName)) { - return null; - } - PersistentType spt = this.resolvePersistentType(typeName); - if (spt != null) { - return spt; - } - JavaResourceType resourceType = this.resolveJavaResourceType(typeName); - visited.add(resourceType); - return (resourceType == null) ? null : this.resolveSuperPersistentType(resourceType.getSuperclassQualifiedName(), visited); // recurse - } - - protected PersistentType resolvePersistentType(String typeName) { - return getEntityMappings().resolvePersistentType(typeName); - } - - protected JavaResourceType resolveJavaResourceType(String typeName) { - return (JavaResourceType) this.getEntityMappings().resolveJavaResourceType(typeName, JavaResourceAnnotatedElement.Kind.TYPE); - } - - - // ********** attributes ********** - //The VirtualJavaPersistentAttributes are built by the OrmEclipseLinkPersistentAttribute, no attributes here - - public ListIterable<JavaPersistentAttribute> getAttributes() { - return EmptyListIterable.instance(); - } - - public JavaPersistentAttribute getAttributeNamed(String attributeName) { - return null; - } - - public boolean hasAnyAnnotatedAttributes() { - return false; - } - - public JavaPersistentAttribute getAttributeFor(JavaResourceAttribute javaResourceAttribute) { - return null; - } - - public int getAttributesSize() { - return 0; - } - - public Iterable<String> getAttributeNames() { - return EmptyIterable.instance(); - } - - public Iterable<ReadOnlyPersistentAttribute> getAllAttributes() { - return EmptyIterable.instance(); - } - - public Iterable<String> getAllAttributeNames() { - return EmptyIterable.instance(); - } - - public ReadOnlyPersistentAttribute resolveAttribute(String attributeName) { - return null; - } - - - // ********** inheritance ********** - - public Iterable<PersistentType> getInheritanceHierarchy() { - return this.getInheritanceHierarchyOf(this); - } - - public Iterable<PersistentType> getAncestors() { - return this.getInheritanceHierarchyOf(this.superPersistentType); - } - - protected Iterable<PersistentType> getInheritanceHierarchyOf(PersistentType start) { - // using a chain iterable to traverse up the inheritance tree - return new ChainIterable<PersistentType>(start) { - @Override - protected PersistentType nextLink(PersistentType persistentType) { - return persistentType.getSuperPersistentType(); - } - }; - } - - - // ********** JpaStructureNode implementation ********** - - public ContextType getContextType() { - throw new UnsupportedOperationException("There is no resource for a virtual java persistent type"); //$NON-NLS-1$ - } - - public Class<? extends JpaStructureNode> getType() { - throw new UnsupportedOperationException("There is no resource for a virtual java persistent type"); //$NON-NLS-1$ - } - - public JpaStructureNode getStructureNode(int textOffset) { - throw new UnsupportedOperationException("There is no resource for a virtual java persistent type"); //$NON-NLS-1$ - } - - public TextRange getSelectionTextRange() { - throw new UnsupportedOperationException("There is no resource for a virtual java persistent type"); //$NON-NLS-1$ - } - - - // ********** validation ********** - - public void validate(List<IMessage> messages, IReporter reporter) { - throw new UnsupportedOperationException(); - } - - public TextRange getValidationTextRange() { - throw new UnsupportedOperationException(); - } - - public TextRange getValidationTextRange(CompilationUnit astRoot) { - throw new UnsupportedOperationException(); - } - - - // ********** misc ********** - - public JavaResourceType getJavaResourceType() { - return null; - } - - public AccessType getOwnerOverrideAccess() { - throw new UnsupportedOperationException(); - } - - public AccessType getOwnerDefaultAccess() { - throw new UnsupportedOperationException(); - } - - public boolean isFor(String typeName) { - throw new UnsupportedOperationException(); - } - - public boolean isIn(IPackageFragment packageFragment) { - throw new UnsupportedOperationException(); - } - - public PersistentType getOverriddenPersistentType() { - throw new UnsupportedOperationException(); - } - - public String getDeclaringTypeName() { - String className = this.xmlTypeMapping.getClassName(); - int index = className == null ? -1 : className.lastIndexOf('$'); - if (index == -1) { - return null; - } - return className.substring(0, index).replace('$', '.'); - } - - public boolean isManaged() { - throw new UnsupportedOperationException(); - } - - public IFile getMetamodelFile() { - throw new UnsupportedOperationException(); - } - - public void synchronizeMetamodel(Map<String, Collection<MetamodelSourceType>> memberTypeTree) { - throw new UnsupportedOperationException(); - } - - public void printBodySourceOn(BodySourceWriter pw, Map<String, Collection<MetamodelSourceType>> memberTypeTree) { - throw new UnsupportedOperationException(); - } - - @Override - public void toString(StringBuilder sb) { - sb.append(this.getName()); - } - - public void dispose() { - //nothing to dispose - } -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/persistence/EclipseLink2_0PersistenceXmlContextNodeFactory.java b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/persistence/EclipseLink2_0PersistenceXmlContextNodeFactory.java deleted file mode 100644 index 307c355616..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/persistence/EclipseLink2_0PersistenceXmlContextNodeFactory.java +++ /dev/null @@ -1,52 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2009, 2011 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.eclipselink.core.internal.context.persistence; - -import org.eclipse.jpt.jpa.core.context.persistence.JarFileRef; -import org.eclipse.jpt.jpa.core.context.persistence.Persistence; -import org.eclipse.jpt.jpa.core.context.persistence.PersistenceUnit; -import org.eclipse.jpt.jpa.core.context.persistence.PersistenceUnitProperties; -import org.eclipse.jpt.jpa.core.internal.context.persistence.AbstractPersistenceXmlContextNodeFactory; -import org.eclipse.jpt.jpa.core.jpa2.context.persistence.PersistenceUnit2_0; -import org.eclipse.jpt.jpa.core.jpa2.context.persistence.connection.JpaConnection2_0; -import org.eclipse.jpt.jpa.core.jpa2.context.persistence.options.JpaOptions2_0; -import org.eclipse.jpt.jpa.core.resource.persistence.XmlJarFileRef; -import org.eclipse.jpt.jpa.core.resource.persistence.XmlPersistenceUnit; -import org.eclipse.jpt.jpa.eclipselink.core.context.persistence.EclipseLinkPersistenceUnit; -import org.eclipse.jpt.jpa.eclipselink.core.context.persistence.EclipseLinkPersistenceXmlContextNodeFactory; - - -public class EclipseLink2_0PersistenceXmlContextNodeFactory - extends AbstractPersistenceXmlContextNodeFactory - implements EclipseLinkPersistenceXmlContextNodeFactory -{ - - @Override - public PersistenceUnit buildPersistenceUnit(Persistence parent, XmlPersistenceUnit xmlPersistenceUnit) { - return new EclipseLinkPersistenceUnit(parent, xmlPersistenceUnit); - } - - @Override - public JarFileRef buildJarFileRef(PersistenceUnit parent, XmlJarFileRef xmlJarFileRef) { - return new EclipseLinkJarFileRef(parent, xmlJarFileRef); - } - - public JpaConnection2_0 buildConnection(PersistenceUnit parent) { - return new EclipseLinkConnection2_0((PersistenceUnit2_0) parent); - } - - public JpaOptions2_0 buildOptions(PersistenceUnit parent) { - return new EclipseLinkOptions2_0((PersistenceUnit2_0) parent); - } - - public PersistenceUnitProperties buildLogging(PersistenceUnit parent) { - return new EclipseLinkLogging2_0((PersistenceUnit2_0) parent); - } -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/persistence/EclipseLink2_0PersistenceXmlDefinition.java b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/persistence/EclipseLink2_0PersistenceXmlDefinition.java deleted file mode 100644 index 1b37aec558..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/persistence/EclipseLink2_0PersistenceXmlDefinition.java +++ /dev/null @@ -1,53 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2008, 2011 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.eclipselink.core.internal.context.persistence; - -import org.eclipse.emf.ecore.EFactory; -import org.eclipse.jpt.common.core.JptResourceType; -import org.eclipse.jpt.jpa.core.JptJpaCorePlugin; -import org.eclipse.jpt.jpa.core.context.persistence.PersistenceXmlContextNodeFactory; -import org.eclipse.jpt.jpa.core.context.persistence.PersistenceXmlDefinition; -import org.eclipse.jpt.jpa.core.internal.context.persistence.AbstractPersistenceXmlDefinition; -import org.eclipse.jpt.jpa.core.resource.persistence.v2_0.PersistenceV2_0Factory; - -public class EclipseLink2_0PersistenceXmlDefinition - extends AbstractPersistenceXmlDefinition -{ - // singleton - private static final PersistenceXmlDefinition INSTANCE = new EclipseLink2_0PersistenceXmlDefinition(); - - /** - * Return the singleton - */ - public static PersistenceXmlDefinition instance() { - return INSTANCE; - } - - - /** - * Enforce singleton usage - */ - private EclipseLink2_0PersistenceXmlDefinition() { - super(); - } - - public JptResourceType getResourceType() { - return JptJpaCorePlugin.PERSISTENCE_XML_2_0_RESOURCE_TYPE; - } - - public EFactory getResourceNodeFactory() { - return PersistenceV2_0Factory.eINSTANCE; - } - - @Override - protected PersistenceXmlContextNodeFactory buildContextNodeFactory() { - return new EclipseLink2_0PersistenceXmlContextNodeFactory(); - } -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/persistence/EclipseLinkCaching.java b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/persistence/EclipseLinkCaching.java deleted file mode 100644 index bf63d03e17..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/persistence/EclipseLinkCaching.java +++ /dev/null @@ -1,586 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2008, 2011 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - *******************************************************************************/ -package org.eclipse.jpt.jpa.eclipselink.core.internal.context.persistence; - -import java.util.ArrayList; -import java.util.List; -import java.util.Map; -import java.util.Set; -import org.eclipse.jpt.common.utility.internal.StringTools; -import org.eclipse.jpt.common.utility.internal.iterables.ListIterable; -import org.eclipse.jpt.common.utility.internal.iterables.LiveCloneListIterable; -import org.eclipse.jpt.common.utility.internal.iterables.TransformationIterable; -import org.eclipse.jpt.jpa.core.context.persistence.PersistenceUnit; -import org.eclipse.jpt.jpa.eclipselink.core.context.persistence.CacheType; -import org.eclipse.jpt.jpa.eclipselink.core.context.persistence.Caching; -import org.eclipse.jpt.jpa.eclipselink.core.context.persistence.CachingEntity; -import org.eclipse.jpt.jpa.eclipselink.core.context.persistence.FlushClearCache; - -/** - * EclipseLinkCaching encapsulates EclipseLink Caching properties. - */ -public class EclipseLinkCaching extends EclipseLinkPersistenceUnitProperties - implements Caching -{ - // ********** EclipseLink properties ********** - private CacheType cacheTypeDefault; - private Integer cacheSizeDefault; - private Boolean sharedCacheDefault; - private FlushClearCache flushClearCache; - - private List<CachingEntity> entities; - - // ********** constructors ********** - public EclipseLinkCaching(PersistenceUnit parent) { - super(parent); - } - - // ********** initialization ********** - /** - * Initializes properties with values from the persistence unit. - */ - @Override - protected void initializeProperties() { - this.entities = new ArrayList<CachingEntity>(); - this.cacheTypeDefault = - this.getEnumValue(ECLIPSELINK_CACHE_TYPE_DEFAULT, CacheType.values()); - this.cacheSizeDefault = - this.getIntegerValue(ECLIPSELINK_CACHE_SIZE_DEFAULT); - this.sharedCacheDefault = - this.getBooleanValue(ECLIPSELINK_CACHE_SHARED_DEFAULT); - this.flushClearCache = - this.getEnumValue(ECLIPSELINK_FLUSH_CLEAR_CACHE, FlushClearCache.values()); - - Set<PersistenceUnit.Property> cacheTypeProperties = - this.getPropertiesSetWithPrefix(ECLIPSELINK_CACHE_TYPE); - Set<PersistenceUnit.Property> cacheSizeProperties = - this.getPropertiesSetWithPrefix(ECLIPSELINK_CACHE_SIZE); - Set<PersistenceUnit.Property> sharedCacheProperties = - this.getPropertiesSetWithPrefix(ECLIPSELINK_SHARED_CACHE); - - this.initializeEntitiesCacheType(cacheTypeProperties); - this.initializeEntitiesCacheSize(cacheSizeProperties); - this.initializeEntitiesSharedCache(sharedCacheProperties); - } - - private void initializeEntitiesCacheType(Set<PersistenceUnit.Property> cacheTypeProperties) { - for (PersistenceUnit.Property cacheTypeProperty : cacheTypeProperties) { - this.setEntityCacheTypeOf(cacheTypeProperty); - } - } - - private void initializeEntitiesCacheSize(Set<PersistenceUnit.Property> cacheSizeProperties) { - for (PersistenceUnit.Property cacheSizeProperty : cacheSizeProperties) { - this.setEntityCacheSizeOf(cacheSizeProperty); - } - } - - private void initializeEntitiesSharedCache(Set<PersistenceUnit.Property> sharedCacheProperties) { - for (PersistenceUnit.Property sharedCacheProperty : sharedCacheProperties) { - this.setEntitySharedCacheOf(sharedCacheProperty); - } - } - - // ********** behavior ********** - - public void propertyValueChanged(String propertyName, String newValue) { - if (propertyName.equals(ECLIPSELINK_CACHE_TYPE_DEFAULT)) { - this.cacheTypeDefaultChanged(newValue); - } - else if (propertyName.equals(ECLIPSELINK_CACHE_SIZE_DEFAULT)) { - this.cacheSizeDefaultChanged(newValue); - } - else if (propertyName.equals(ECLIPSELINK_CACHE_SHARED_DEFAULT)) { - this.sharedCacheDefaultChanged(newValue); - } - else if (propertyName.startsWith(ECLIPSELINK_CACHE_TYPE)) { - this.cacheTypeChanged(propertyName, newValue); - } - else if (propertyName.startsWith(ECLIPSELINK_CACHE_SIZE)) { - this.cacheSizeChanged(propertyName, newValue); - } - else if (propertyName.startsWith(ECLIPSELINK_SHARED_CACHE)) { - this.sharedCacheChanged(propertyName, newValue); - } - else if (propertyName.equals(ECLIPSELINK_FLUSH_CLEAR_CACHE)) { - this.flushClearCacheChanged(newValue); - } - } - - public void propertyRemoved(String propertyName) { - if (propertyName.equals(ECLIPSELINK_CACHE_TYPE_DEFAULT)) { - this.cacheTypeDefaultChanged(null); - } - else if (propertyName.equals(ECLIPSELINK_CACHE_SIZE_DEFAULT)) { - this.cacheSizeDefaultChanged(null); - } - else if (propertyName.equals(ECLIPSELINK_CACHE_SHARED_DEFAULT)) { - this.sharedCacheDefaultChanged(null); - } - else if (propertyName.startsWith(ECLIPSELINK_CACHE_TYPE)) { - this.cacheTypeChanged(propertyName, null); - } - else if (propertyName.startsWith(ECLIPSELINK_CACHE_SIZE)) { - this.cacheSizeChanged(propertyName, null); - } - else if (propertyName.startsWith(ECLIPSELINK_SHARED_CACHE)) { - this.sharedCacheChanged(propertyName, null); - } - else if (propertyName.equals(ECLIPSELINK_FLUSH_CLEAR_CACHE)) { - this.flushClearCacheChanged(null); - } - } - - /** - * Adds property names key/value pairs, where: - * key = EclipseLink property key; - * value = property id - */ - @Override - protected void addPropertyNames(Map<String, String> propertyNames) { - propertyNames.put( - ECLIPSELINK_CACHE_TYPE_DEFAULT, - CACHE_TYPE_DEFAULT_PROPERTY); - propertyNames.put( - ECLIPSELINK_CACHE_SIZE_DEFAULT, - CACHE_SIZE_DEFAULT_PROPERTY); - propertyNames.put( - ECLIPSELINK_CACHE_SHARED_DEFAULT, - SHARED_CACHE_DEFAULT_PROPERTY); - propertyNames.put( - ECLIPSELINK_FLUSH_CLEAR_CACHE, - FLUSH_CLEAR_CACHE_PROPERTY); - - // Don't need to initialize propertyNames for: - // cacheType, sharedCache, cacheSize - } - - /** - * Method used for identifying the given property. - */ - @Override - public boolean itemIsProperty(PersistenceUnit.Property item) { - boolean isProperty = super.itemIsProperty(item); - - if ( ! isProperty && item.getName() != null) { - if (item.getName().startsWith(ECLIPSELINK_CACHE_TYPE) || - item.getName().startsWith(ECLIPSELINK_CACHE_SIZE) || - item.getName().startsWith(ECLIPSELINK_SHARED_CACHE)) { - return true; - } - } - return isProperty; - } - - /** - * Returns the property name used for change notification of the given - * property. - */ - @Override - public String propertyIdOf(PersistenceUnit.Property property) { - try { - return super.propertyIdOf(property); - } - catch (IllegalArgumentException e) { - if (property.getName().startsWith(ECLIPSELINK_CACHE_TYPE)) { - return CACHE_TYPE_PROPERTY; - } - else if (property.getName().startsWith(ECLIPSELINK_CACHE_SIZE)) { - return CACHE_SIZE_PROPERTY; - } - else if (property.getName().startsWith(ECLIPSELINK_SHARED_CACHE)) { - return SHARED_CACHE_PROPERTY; - } - } - throw new IllegalArgumentException("Illegal property: " + property.toString()); //$NON-NLS-1$ - } - - public CachingEntity addEntity(String entityName) { - if (this.entityExists(entityName)) { - throw new IllegalStateException("Duplicate entity: " + entityName); //$NON-NLS-1$ - } - CachingEntity newEntity = this.buildEntity(entityName); - this.addItemToList(newEntity, this.entities, ENTITIES_LIST); - return newEntity; - } - - public void removeEntity(String entityName) { - if ( ! this.entityExists(entityName)) { - return; - } - CachingEntity entity = this.getEntityNamed(entityName); - this.clearEntity(entity); - this.removeEntity(entity); - } - - // ********** CacheType ********** - public CacheType getCacheTypeOf(String entityName) { - CachingEntity entity = this.getEntityNamed(entityName); - return (entity == null) ? null : entity.getCacheType(); - } - - public void setCacheTypeOf(String entityName, CacheType newCacheType) { - CachingEntity old = this.setEntityCacheTypeOf(entityName, newCacheType); - this.putEnumValue(ECLIPSELINK_CACHE_TYPE, entityName, newCacheType, false); - this.firePropertyChanged(CACHE_TYPE_PROPERTY, old, this.getEntityNamed(entityName)); - } - - private void cacheTypeChanged(String propertyName, String stringValue) { - String entityName = this.extractEntityNameOf(propertyName); - if( ! StringTools.stringIsEmpty(entityName)) { - CachingEntity old = this.setEntityCacheTypeOf(entityName, stringValue); - this.firePropertyChanged(CACHE_TYPE_PROPERTY, old, this.getEntityNamed(entityName)); - } - } - - public CacheType getDefaultCacheType() { - return (this.cacheTypeDefault == null) ? DEFAULT_CACHE_TYPE : this.cacheTypeDefault; - } - - // ********** CacheSize ********** - public Integer getCacheSizeOf(String entityName) { - CachingEntity entity = this.getEntityNamed(entityName); - return (entity == null) ? null : entity.getCacheSize(); - } - - public void setCacheSizeOf(String entityName, Integer newCacheSize) { - CachingEntity old = this.setEntityCacheSizeOf(entityName, newCacheSize); - this.putIntegerValue(ECLIPSELINK_CACHE_SIZE + entityName, newCacheSize); - this.firePropertyChanged(CACHE_SIZE_PROPERTY, old, this.getEntityNamed(entityName)); - } - - private void cacheSizeChanged(String propertyName, String stringValue) { - String entityName = this.extractEntityNameOf(propertyName); - if( ! StringTools.stringIsEmpty(entityName)) { - CachingEntity old = this.setEntityCacheSizeOf(entityName, stringValue); - this.firePropertyChanged(CACHE_SIZE_PROPERTY, old, this.getEntityNamed(entityName)); - } - } - - public Integer getDefaultCacheSize() { - return (this.cacheSizeDefault == null) ? DEFAULT_CACHE_SIZE : this.cacheSizeDefault; - } - - // ********** SharedCache ********** - public Boolean getSharedCacheOf(String entityName) { - CachingEntity entity = this.getEntityNamed(entityName); - return (entity == null) ? null : entity.cacheIsShared(); - } - - public void setSharedCacheOf(String entityName, Boolean newSharedCache) { - CachingEntity old = this.setEntitySharedCacheOf(entityName, newSharedCache); - this.putBooleanValue(ECLIPSELINK_SHARED_CACHE, entityName, newSharedCache, false); - this.firePropertyChanged(SHARED_CACHE_PROPERTY, old, this.getEntityNamed(entityName)); - } - - private void sharedCacheChanged(String propertyName, String stringValue) { - String entityName = this.extractEntityNameOf(propertyName); - if( ! StringTools.stringIsEmpty(entityName)) { - CachingEntity old = this.setEntitySharedCacheOf(entityName, stringValue); - this.firePropertyChanged(SHARED_CACHE_PROPERTY, old, this.getEntityNamed(entityName)); - } - } - - public Boolean getDefaultSharedCache() { - return (this.sharedCacheDefault == null) ? DEFAULT_SHARED_CACHE : this.sharedCacheDefault; - } - - // ********** CacheTypeDefault ********** - public CacheType getCacheTypeDefault() { - return this.cacheTypeDefault; - } - - public void setCacheTypeDefault(CacheType newCacheTypeDefault) { - CacheType old = this.cacheTypeDefault; - this.cacheTypeDefault = newCacheTypeDefault; - this.putProperty(CACHE_TYPE_DEFAULT_PROPERTY, newCacheTypeDefault); - this.firePropertyChanged(CACHE_TYPE_DEFAULT_PROPERTY, old, newCacheTypeDefault); - } - - private void cacheTypeDefaultChanged(String stringValue) { - CacheType newValue = getEnumValueOf(stringValue, CacheType.values()); - CacheType old = this.cacheTypeDefault; - this.cacheTypeDefault = newValue; - this.firePropertyChanged(CACHE_TYPE_DEFAULT_PROPERTY, old, newValue); - } - - public CacheType getDefaultCacheTypeDefault() { - return DEFAULT_CACHE_TYPE_DEFAULT; - } - - // ********** CacheSizeDefault ********** - public Integer getCacheSizeDefault() { - return this.cacheSizeDefault; - } - - public void setCacheSizeDefault(Integer newCacheSizeDefault) { - Integer old = this.cacheSizeDefault; - this.cacheSizeDefault = newCacheSizeDefault; - this.putProperty(CACHE_SIZE_DEFAULT_PROPERTY, newCacheSizeDefault); - this.firePropertyChanged(CACHE_SIZE_DEFAULT_PROPERTY, old, newCacheSizeDefault); - } - - private void cacheSizeDefaultChanged(String stringValue) { - Integer newValue = getIntegerValueOf(stringValue); - Integer old = this.cacheSizeDefault; - this.cacheSizeDefault = newValue; - this.firePropertyChanged(CACHE_SIZE_DEFAULT_PROPERTY, old, newValue); - } - - public Integer getDefaultCacheSizeDefault() { - return DEFAULT_CACHE_SIZE_DEFAULT; - } - - // ********** SharedCacheDefault ********** - public Boolean getSharedCacheDefault() { - return this.sharedCacheDefault; - } - - public void setSharedCacheDefault(Boolean newSharedCacheDefault) { - Boolean old = this.sharedCacheDefault; - this.sharedCacheDefault = newSharedCacheDefault; - this.putProperty(SHARED_CACHE_DEFAULT_PROPERTY, newSharedCacheDefault); - this.firePropertyChanged(SHARED_CACHE_DEFAULT_PROPERTY, old, newSharedCacheDefault); - } - - private void sharedCacheDefaultChanged(String stringValue) { - Boolean newValue = getBooleanValueOf(stringValue); - - Boolean old = this.sharedCacheDefault; - this.sharedCacheDefault = newValue; - this.firePropertyChanged(SHARED_CACHE_DEFAULT_PROPERTY, old, newValue); - } - - public Boolean getDefaultSharedCacheDefault() { - return DEFAULT_SHARED_CACHE_DEFAULT; - } - - // ********** FlushClearCache ********** - - public FlushClearCache getFlushClearCache() { - return this.flushClearCache; - } - - public void setFlushClearCache(FlushClearCache newFlushClearCache) { - FlushClearCache old = this.flushClearCache; - this.flushClearCache = newFlushClearCache; - this.putProperty(FLUSH_CLEAR_CACHE_PROPERTY, newFlushClearCache); - this.firePropertyChanged(FLUSH_CLEAR_CACHE_PROPERTY, old, newFlushClearCache); - } - - private void flushClearCacheChanged(String stringValue) { - FlushClearCache newValue = getEnumValueOf(stringValue, FlushClearCache.values()); - FlushClearCache old = this.flushClearCache; - this.flushClearCache = newValue; - this.firePropertyChanged(FLUSH_CLEAR_CACHE_PROPERTY, old, newValue); - } - - public FlushClearCache getDefaultFlushClearCache() { - return DEFAULT_FLUSH_CLEAR_CACHE; - } - - // ****** Entity CacheType ******* - /** - * Returns the old Entity - */ - private CachingEntity setEntityCacheTypeOf(String entityName, String stringValue) { - if(( ! this.entityExists(entityName)) && StringTools.stringIsEmpty(stringValue)) { - //this is a property that is currently being added, we don't need to deal with it until the value is set - return null; - } - CacheType newValue = getEnumValueOf(stringValue, CacheType.values()); - return this.setEntityCacheTypeOf(entityName, newValue); - } - - /** - * Returns the old Entity - */ - private CachingEntity setEntityCacheTypeOf(String entityName, CacheType cacheType) { - CachingEntity entity = (this.entityExists(entityName)) ? - this.getEntityNamed(entityName) : - this.addEntity(entityName); - return this.setEntityCacheTypeOf(entity, cacheType); - } - - /** - * Returns the old Entity - */ - private CachingEntity setEntityCacheTypeOf(CachingEntity entity, CacheType cacheType) { - if(entity == null) { - throw new IllegalArgumentException(); - } - CachingEntity old = entity.clone(); - entity.setCacheType(cacheType); - return old; - } - - private void setEntityCacheTypeOf(PersistenceUnit.Property cacheTypeProperty) { - String entityName = this.extractEntityNameOf(cacheTypeProperty); - this.setEntityCacheTypeOf(entityName, cacheTypeProperty.getValue()); - } - - // ****** Entity Cache size ******* - /** - * Returns the old Entity - */ - private CachingEntity setEntityCacheSizeOf(String entityName, String stringValue) { - if(( ! this.entityExists(entityName)) && StringTools.stringIsEmpty(stringValue)) { - //this is a property that is currently being added, we don't need to deal with it until the value is set - return null; - } - Integer newValue = getIntegerValueOf(stringValue); - return this.setEntityCacheSizeOf(entityName, newValue); - } - - /** - * Returns the old Entity - */ - private CachingEntity setEntityCacheSizeOf(String entityName, Integer size) { - CachingEntity entity = (this.entityExists(entityName)) ? - this.getEntityNamed(entityName) : - this.addEntity(entityName); - return this.setEntityCacheSizeOf(entity, size); - } - - /** - * Returns the old Entity - */ - private CachingEntity setEntityCacheSizeOf(CachingEntity entity, Integer size) { - if(entity == null) { - throw new IllegalArgumentException(); - } - CachingEntity old = entity.clone(); - entity.setCacheSize(size); - return old; - } - - private void setEntityCacheSizeOf(PersistenceUnit.Property cacheSizeProperty) { - String entityName = this.extractEntityNameOf(cacheSizeProperty); - this.setEntityCacheSizeOf(entityName, cacheSizeProperty.getValue()); - } - - // ****** Entity SharedCache ******* - /** - * Returns the old Entity - */ - private CachingEntity setEntitySharedCacheOf(String entityName, String stringValue) { - if(( ! this.entityExists(entityName)) && StringTools.stringIsEmpty(stringValue)) { - //this is a property that is currently being added, we don't need to deal with it until the value is set - return null; - } - Boolean newValue = getBooleanValueOf(stringValue); - return this.setEntitySharedCacheOf(entityName, newValue); - } - - /** - * Returns the old Entity - */ - private CachingEntity setEntitySharedCacheOf(String entityName, Boolean sharedCache) { - CachingEntity entity = (this.entityExists(entityName)) ? - this.getEntityNamed(entityName) : - this.addEntity(entityName); - return this.setEntitySharedCacheOf(entity, sharedCache); - } - - /** - * Returns the old Entity - */ - private CachingEntity setEntitySharedCacheOf(CachingEntity entity, Boolean sharedCache) { - if(entity == null) { - throw new IllegalArgumentException(); - } - CachingEntity old = entity.clone(); - entity.setSharedCache(sharedCache); - return old; - } - - private void setEntitySharedCacheOf(PersistenceUnit.Property sharedCacheProperty) { - String entityName = this.extractEntityNameOf(sharedCacheProperty); - this.setEntitySharedCacheOf(entityName, sharedCacheProperty.getValue()); - } - - // ****** convenience methods ******* - - /** - * Set all Entity properties to default. - */ - private void clearEntity(CachingEntity entity) { - if(entity.isEmpty()) { - return; - } - String entityName = entity.getName(); - this.setCacheTypeOf(entityName, null); - this.setCacheSizeOf(entityName, null); - this.setSharedCacheOf(entityName, null); - } - - /** - * Returns the Entity with the given name. - */ - private CachingEntity getEntityNamed(String name) { - for(CachingEntity entity: this.entities) { - if(entity.getName().equals(name)) { - return entity; - } - } - return null; - } - - private CachingEntity buildEntity(String name) { - return new CachingEntity(this, name); - } - - private void removeEntity(CachingEntity entity) { - if(entity == null) { - throw new NullPointerException(); - } - this.removeItemFromList(entity, this.entities, ENTITIES_LIST); - } - - /** - * Return whether the Entity exist. - */ - public boolean entityExists(String name) { - for(CachingEntity entity: this.entities) { - if(entity.getName().equals(name)) { - return true; - } - } - return false; - } - - /** - * Removes cacheTypeDefault, cacheSizeDefault, flushClearCache properties. - */ - public void removeDefaultCachingProperties() { - this.setCacheTypeDefault(null); - this.setCacheSizeDefault(null); - this.setFlushClearCache(null); - } - - // ****** entities list ******* - - public ListIterable<CachingEntity> getEntities() { - return new LiveCloneListIterable<CachingEntity>(this.entities); - } - - public Iterable<String> getEntityNames() { - return new TransformationIterable<CachingEntity, String>(this.getEntities()) { - @Override - protected String transform(CachingEntity entity) { - return entity.getName(); - } - }; - } - - public int getEntitiesSize() { - return this.entities.size(); - } -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/persistence/EclipseLinkConnection.java b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/persistence/EclipseLinkConnection.java deleted file mode 100644 index 9ab04c3bae..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/persistence/EclipseLinkConnection.java +++ /dev/null @@ -1,676 +0,0 @@ -/******************************************************************************* -* Copyright (c) 2008, 2011 Oracle. All rights reserved. -* This program and the accompanying materials are made available under the -* terms of the Eclipse Public License v1.0, which accompanies this distribution -* and is available at http://www.eclipse.org/legal/epl-v10.html. -* -* Contributors: -* Oracle - initial API and implementation -*******************************************************************************/ -package org.eclipse.jpt.jpa.eclipselink.core.internal.context.persistence; - -import java.util.Map; - -import org.eclipse.jpt.jpa.core.context.persistence.PersistenceUnit; -import org.eclipse.jpt.jpa.eclipselink.core.context.persistence.BatchWriting; -import org.eclipse.jpt.jpa.eclipselink.core.context.persistence.Connection; -import org.eclipse.jpt.jpa.eclipselink.core.context.persistence.ExclusiveConnectionMode; - -/** - * EclipseLinkConnection - */ -public class EclipseLinkConnection extends EclipseLinkPersistenceUnitProperties - implements Connection -{ - - // ********** EclipseLink properties ********** - private BatchWriting batchWriting; - private Boolean nativeSql; - private Boolean cacheStatements; - private Integer cacheStatementsSize; - protected String driver; - protected String url; - protected String user; - protected String password; - private Boolean bindParameters; - private Boolean readConnectionsShared; - private Integer readConnectionsMin; - private Integer readConnectionsMax; - private Integer writeConnectionsMin; - private Integer writeConnectionsMax; - private ExclusiveConnectionMode exclusiveConnectionMode; - private Boolean lazyConnection; - - - // ********** constructors ********** - public EclipseLinkConnection(PersistenceUnit parent) { - super(parent); - } - - // ********** initialization ********** - /** - * Initializes properties with values from the persistence unit. - */ - @Override - protected void initializeProperties() { - this.initializeDatabaseConnectionProperties(); - - this.batchWriting = - this.getEnumValue(ECLIPSELINK_BATCH_WRITING, BatchWriting.values()); - this.nativeSql = - this.getBooleanValue(ECLIPSELINK_NATIVE_SQL); - this.cacheStatements = - this.getBooleanValue(ECLIPSELINK_CACHE_STATEMENTS); - this.cacheStatementsSize = - this.getIntegerValue(ECLIPSELINK_CACHE_STATEMENTS_SIZE); - this.bindParameters = - this.getBooleanValue(ECLIPSELINK_BIND_PARAMETERS); - this.readConnectionsShared = - this.getBooleanValue(ECLIPSELINK_READ_CONNECTIONS_SHARED); - this.readConnectionsMin = - this.getIntegerValue(ECLIPSELINK_READ_CONNECTIONS_MIN); - this.readConnectionsMax = - this.getIntegerValue(ECLIPSELINK_READ_CONNECTIONS_MAX); - this.writeConnectionsMin = - this.getIntegerValue(ECLIPSELINK_WRITE_CONNECTIONS_MIN); - this.writeConnectionsMax = - this.getIntegerValue(ECLIPSELINK_WRITE_CONNECTIONS_MAX); - this.exclusiveConnectionMode = - this.getEnumValue(ECLIPSELINK_EXCLUSIVE_CONNECTION_MODE, ExclusiveConnectionMode.values()); - this.lazyConnection = - this.getBooleanValue(ECLIPSELINK_LAZY_CONNECTION); - } - - protected void initializeDatabaseConnectionProperties() { - this.driver = - this.getStringValue(ECLIPSELINK_DRIVER); - this.url = - this.getStringValue(ECLIPSELINK_URL); - this.user = - this.getStringValue(ECLIPSELINK_USER); - this.password = - this.getStringValue(ECLIPSELINK_PASSWORD); - } - - // ********** behavior ********** - - public void propertyValueChanged(String propertyName, String newValue) { - if (propertyName.equals(ECLIPSELINK_NATIVE_SQL)) { - this.nativeSqlChanged(newValue); - } - else if (propertyName.equals(ECLIPSELINK_BATCH_WRITING)) { - this.batchWritingChanged(newValue); - } - else if (propertyName.equals(ECLIPSELINK_CACHE_STATEMENTS)) { - this.cacheStatementsChanged(newValue); - } - else if (propertyName.equals(ECLIPSELINK_DRIVER)) { - this.driverChanged(newValue); - } - else if (propertyName.equals(ECLIPSELINK_URL)) { - this.urlChanged(newValue); - } - else if (propertyName.equals(ECLIPSELINK_USER)) { - this.userChanged(newValue); - } - else if (propertyName.equals(ECLIPSELINK_PASSWORD)) { - this.passwordChanged(newValue); - } - else if (propertyName.equals(ECLIPSELINK_BIND_PARAMETERS)) { - this.bindParametersChanged(newValue); - } - else if (propertyName.equals(ECLIPSELINK_READ_CONNECTIONS_SHARED)) { - this.readConnectionsSharedChanged(newValue); - } - else if (propertyName.equals(ECLIPSELINK_CACHE_STATEMENTS_SIZE)) { - this.cacheStatementsSizeChanged(newValue); - } - else if (propertyName.equals(ECLIPSELINK_READ_CONNECTIONS_MIN)) { - readConnectionsMinChanged(newValue); - } - else if (propertyName.equals(ECLIPSELINK_READ_CONNECTIONS_MAX)) { - readConnectionsMaxChanged(newValue); - } - else if (propertyName.equals(ECLIPSELINK_WRITE_CONNECTIONS_MIN)) { - writeConnectionsMinChanged(newValue); - } - else if (propertyName.equals(ECLIPSELINK_WRITE_CONNECTIONS_MAX)) { - writeConnectionsMaxChanged(newValue); - } - else if (propertyName.equals(ECLIPSELINK_EXCLUSIVE_CONNECTION_MODE)) { - this.exclusiveConnectionModeChanged(newValue); - } - else if (propertyName.equals(ECLIPSELINK_LAZY_CONNECTION)) { - this.lazyConnectionChanged(newValue); - } - } - - public void propertyRemoved(String propertyName) { - if (propertyName.equals(ECLIPSELINK_NATIVE_SQL)) { - this.nativeSqlChanged(null); - } - else if (propertyName.equals(ECLIPSELINK_BATCH_WRITING)) { - this.batchWritingChanged(null); - } - else if (propertyName.equals(ECLIPSELINK_CACHE_STATEMENTS)) { - this.cacheStatementsChanged(null); - } - else if (propertyName.equals(ECLIPSELINK_DRIVER)) { - this.driverChanged(null); - } - else if (propertyName.equals(ECLIPSELINK_URL)) { - this.urlChanged(null); - } - else if (propertyName.equals(ECLIPSELINK_USER)) { - this.userChanged(null); - } - else if (propertyName.equals(ECLIPSELINK_PASSWORD)) { - this.passwordChanged(null); - } - else if (propertyName.equals(ECLIPSELINK_BIND_PARAMETERS)) { - this.bindParametersChanged(null); - } - else if (propertyName.equals(ECLIPSELINK_READ_CONNECTIONS_SHARED)) { - this.readConnectionsSharedChanged(null); - } - else if (propertyName.equals(ECLIPSELINK_CACHE_STATEMENTS_SIZE)) { - this.cacheStatementsSizeChanged(null); - } - else if (propertyName.equals(ECLIPSELINK_READ_CONNECTIONS_MIN)) { - readConnectionsMinChanged(null); - } - else if (propertyName.equals(ECLIPSELINK_READ_CONNECTIONS_MAX)) { - readConnectionsMaxChanged(null); - } - else if (propertyName.equals(ECLIPSELINK_WRITE_CONNECTIONS_MIN)) { - writeConnectionsMinChanged(null); - } - else if (propertyName.equals(ECLIPSELINK_WRITE_CONNECTIONS_MAX)) { - writeConnectionsMaxChanged(null); - } - else if (propertyName.equals(ECLIPSELINK_EXCLUSIVE_CONNECTION_MODE)) { - this.exclusiveConnectionModeChanged(null); - } - else if (propertyName.equals(ECLIPSELINK_LAZY_CONNECTION)) { - this.lazyConnectionChanged(null); - } - } - - /** - * Adds property names key/value pairs, where: - * key = EclipseLink property key - * value = property id - */ - @Override - protected void addPropertyNames(Map<String, String> propertyNames) { - this.addDatabaseConnectionPropertyNames(propertyNames); - - propertyNames.put( - ECLIPSELINK_NATIVE_SQL, - NATIVE_SQL_PROPERTY); - propertyNames.put( - ECLIPSELINK_BATCH_WRITING, - BATCH_WRITING_PROPERTY); - propertyNames.put( - ECLIPSELINK_CACHE_STATEMENTS, - CACHE_STATEMENTS_PROPERTY); - propertyNames.put( - ECLIPSELINK_CACHE_STATEMENTS_SIZE, - CACHE_STATEMENTS_SIZE_PROPERTY); - propertyNames.put( - ECLIPSELINK_BIND_PARAMETERS, - BIND_PARAMETERS_PROPERTY); - propertyNames.put( - ECLIPSELINK_READ_CONNECTIONS_SHARED, - READ_CONNECTIONS_SHARED_PROPERTY); - propertyNames.put( - ECLIPSELINK_READ_CONNECTIONS_MIN, - READ_CONNECTIONS_MIN_PROPERTY); - propertyNames.put( - ECLIPSELINK_READ_CONNECTIONS_MAX, - READ_CONNECTIONS_MAX_PROPERTY); - propertyNames.put( - ECLIPSELINK_WRITE_CONNECTIONS_MIN, - WRITE_CONNECTIONS_MIN_PROPERTY); - propertyNames.put( - ECLIPSELINK_WRITE_CONNECTIONS_MAX, - WRITE_CONNECTIONS_MAX_PROPERTY); - propertyNames.put( - ECLIPSELINK_EXCLUSIVE_CONNECTION_MODE, - EXCLUSIVE_CONNECTION_MODE_PROPERTY); - propertyNames.put( - ECLIPSELINK_LAZY_CONNECTION, - LAZY_CONNECTION_PROPERTY); - } - - protected void addDatabaseConnectionPropertyNames(Map<String, String> propertyNames) { - propertyNames.put( - ECLIPSELINK_DRIVER, - DRIVER_PROPERTY); - propertyNames.put( - ECLIPSELINK_URL, - URL_PROPERTY); - propertyNames.put( - ECLIPSELINK_USER, - USER_PROPERTY); - propertyNames.put( - ECLIPSELINK_PASSWORD, - PASSWORD_PROPERTY); - } - - /** - * Does all pre-treatment in this method before the property is set - */ - protected void preSetProperty() { - // do nothing by default - } - - // ********** NativeSql ********** - public Boolean getNativeSql() { - return this.nativeSql; - } - - public void setNativeSql(Boolean newNativeSql) { - this.preSetProperty(); - - Boolean old = this.nativeSql; - this.nativeSql = newNativeSql; - this.putProperty(NATIVE_SQL_PROPERTY, newNativeSql); - this.firePropertyChanged(NATIVE_SQL_PROPERTY, old, newNativeSql); - } - - private void nativeSqlChanged(String stringValue) { - Boolean newValue = getBooleanValueOf(stringValue); - - Boolean old = this.nativeSql; - this.nativeSql = newValue; - this.firePropertyChanged(NATIVE_SQL_PROPERTY, old, newValue); - } - - public Boolean getDefaultNativeSql() { - return DEFAULT_NATIVE_SQL; - } - - // ********** BatchWriting ********** - - public BatchWriting getBatchWriting() { - return this.batchWriting; - } - - public void setBatchWriting(BatchWriting newBatchWriting) { - this.preSetProperty(); - - BatchWriting old = this.batchWriting; - this.batchWriting = newBatchWriting; - this.putProperty(BATCH_WRITING_PROPERTY, newBatchWriting); - this.firePropertyChanged(BATCH_WRITING_PROPERTY, old, newBatchWriting); - } - - private void batchWritingChanged(String stringValue) { - BatchWriting newValue = getEnumValueOf(stringValue, BatchWriting.values()); - BatchWriting old = this.batchWriting; - this.batchWriting = newValue; - this.firePropertyChanged(BATCH_WRITING_PROPERTY, old, newValue); - } - - public BatchWriting getDefaultBatchWriting() { - return DEFAULT_BATCH_WRITING; - } - - // ********** CacheStatements ********** - public Boolean getCacheStatements() { - return this.cacheStatements; - } - - public void setCacheStatements(Boolean newCacheStatements) { - this.preSetProperty(); - - Boolean old = this.cacheStatements; - this.cacheStatements = newCacheStatements; - this.putProperty(CACHE_STATEMENTS_PROPERTY, newCacheStatements); - this.firePropertyChanged(CACHE_STATEMENTS_PROPERTY, old, newCacheStatements); - } - - private void cacheStatementsChanged(String stringValue) { - Boolean newValue = getBooleanValueOf(stringValue); - - Boolean old = this.cacheStatements; - this.cacheStatements = newValue; - this.firePropertyChanged(CACHE_STATEMENTS_PROPERTY, old, newValue); - } - - public Boolean getDefaultCacheStatements() { - return DEFAULT_CACHE_STATEMENTS; - } - - // ********** CacheStatementsSize ********** - public Integer getCacheStatementsSize() { - return this.cacheStatementsSize; - } - - public void setCacheStatementsSize(Integer newCacheStatementsSize) { - this.preSetProperty(); - - Integer old = this.cacheStatementsSize; - this.cacheStatementsSize = newCacheStatementsSize; - this.putProperty(CACHE_STATEMENTS_SIZE_PROPERTY, newCacheStatementsSize); - this.firePropertyChanged(CACHE_STATEMENTS_SIZE_PROPERTY, old, newCacheStatementsSize); - } - - private void cacheStatementsSizeChanged(String stringValue) { - Integer newValue = getIntegerValueOf(stringValue); - - Integer old = this.cacheStatementsSize; - this.cacheStatementsSize = newValue; - this.firePropertyChanged(CACHE_STATEMENTS_SIZE_PROPERTY, old, newValue); - } - - public Integer getDefaultCacheStatementsSize() { - return DEFAULT_CACHE_STATEMENTS_SIZE; - } - - // ********** Driver ********** - public String getDriver() { - return this.driver; - } - - public void setDriver(String newDriver) { - this.preSetProperty(); - - String old = this.driver; - this.driver = newDriver; - this.putProperty(DRIVER_PROPERTY, newDriver); - this.firePropertyChanged(DRIVER_PROPERTY, old, newDriver); - } - - protected void driverChanged(String newValue) { - String old = this.driver; - this.driver = newValue; - this.firePropertyChanged(DRIVER_PROPERTY, old, newValue); - } - - public String getDefaultDriver() { - return DEFAULT_DRIVER; - } - - // ********** URL ********** - public String getUrl() { - return this.url; - } - - public void setUrl(String newUrl) { - this.preSetProperty(); - - String old = this.url; - this.url = newUrl; - this.putProperty(URL_PROPERTY, newUrl); - this.firePropertyChanged(URL_PROPERTY, old, newUrl); - } - - protected void urlChanged(String newValue) { - String old = this.url; - this.url = newValue; - this.firePropertyChanged(URL_PROPERTY, old, newValue); - } - - public String getDefaultUrl() { - return DEFAULT_URL; - } - - // ********** User ********** - public String getUser() { - return this.user; - } - - public void setUser(String newUser) { - this.preSetProperty(); - - String old = this.user; - this.user = newUser; - this.putProperty(USER_PROPERTY, newUser); - this.firePropertyChanged(USER_PROPERTY, old, newUser); - } - - protected void userChanged(String newValue) { - String old = this.user; - this.user = newValue; - this.firePropertyChanged(USER_PROPERTY, old, newValue); - } - - public String getDefaultUser() { - return DEFAULT_USER; - } - - // ********** Password ********** - public String getPassword() { - return this.password; - } - - public void setPassword(String newPassword) { - this.preSetProperty(); - - String old = this.password; - this.password = newPassword; - this.putProperty(PASSWORD_PROPERTY, newPassword); - this.firePropertyChanged(PASSWORD_PROPERTY, old, newPassword); - } - - protected void passwordChanged(String newValue) { - String old = this.password; - this.password = newValue; - this.firePropertyChanged(PASSWORD_PROPERTY, old, newValue); - } - - public String getDefaultPassword() { - return DEFAULT_PASSWORD; - } - - // ********** BindParameters ********** - public Boolean getBindParameters() { - return this.bindParameters; - } - - public void setBindParameters(Boolean newBindParameters) { - this.preSetProperty(); - - Boolean old = this.bindParameters; - this.bindParameters = newBindParameters; - this.putProperty(BIND_PARAMETERS_PROPERTY, newBindParameters); - this.firePropertyChanged(BIND_PARAMETERS_PROPERTY, old, newBindParameters); - } - - private void bindParametersChanged(String stringValue) { - Boolean newValue = getBooleanValueOf(stringValue); - - Boolean old = this.bindParameters; - this.bindParameters = newValue; - this.firePropertyChanged(BIND_PARAMETERS_PROPERTY, old, newValue); - } - - public Boolean getDefaultBindParameters() { - return DEFAULT_BIND_PARAMETERS; - } - - // ********** ReadConnectionsShared ********** - public Boolean getReadConnectionsShared() { - return this.readConnectionsShared; - } - - public void setReadConnectionsShared(Boolean newReadConnectionsShared) { - this.preSetProperty(); - - Boolean old = this.readConnectionsShared; - this.readConnectionsShared = newReadConnectionsShared; - this.putProperty(READ_CONNECTIONS_SHARED_PROPERTY, newReadConnectionsShared); - this.firePropertyChanged(READ_CONNECTIONS_SHARED_PROPERTY, old, newReadConnectionsShared); - } - - private void readConnectionsSharedChanged(String stringValue) { - Boolean newValue = getBooleanValueOf(stringValue); - - Boolean old = this.readConnectionsShared; - this.readConnectionsShared = newValue; - this.firePropertyChanged(READ_CONNECTIONS_SHARED_PROPERTY, old, newValue); - } - - public Boolean getDefaultReadConnectionsShared() { - return DEFAULT_READ_CONNECTIONS_SHARED; - } - - // ********** ReadConnectionsMin ********** - public Integer getReadConnectionsMin() { - return this.readConnectionsMin; - } - - public void setReadConnectionsMin(Integer newReadConnectionsMin) { - this.preSetProperty(); - - Integer old = this.readConnectionsMin; - this.readConnectionsMin = newReadConnectionsMin; - this.putProperty(READ_CONNECTIONS_MIN_PROPERTY, newReadConnectionsMin); - this.firePropertyChanged(READ_CONNECTIONS_MIN_PROPERTY, old, newReadConnectionsMin); - } - - private void readConnectionsMinChanged(String stringValue) { - Integer newValue = getIntegerValueOf(stringValue); - - Integer old = this.readConnectionsMin; - this.readConnectionsMin = newValue; - this.firePropertyChanged(READ_CONNECTIONS_MIN_PROPERTY, old, newValue); - } - - public Integer getDefaultReadConnectionsMin() { - return DEFAULT_READ_CONNECTIONS_MIN; - } - - // ********** ReadConnectionsMax ********** - public Integer getReadConnectionsMax() { - return this.readConnectionsMax; - } - - public void setReadConnectionsMax(Integer newReadConnectionsMax) { - this.preSetProperty(); - - Integer old = this.readConnectionsMax; - this.readConnectionsMax = newReadConnectionsMax; - this.putProperty(READ_CONNECTIONS_MAX_PROPERTY, newReadConnectionsMax); - this.firePropertyChanged(READ_CONNECTIONS_MAX_PROPERTY, old, newReadConnectionsMax); - } - - private void readConnectionsMaxChanged(String stringValue) { - Integer newValue = getIntegerValueOf(stringValue); - - Integer old = this.readConnectionsMax; - this.readConnectionsMax = newValue; - this.firePropertyChanged(READ_CONNECTIONS_MAX_PROPERTY, old, newValue); - } - - public Integer getDefaultReadConnectionsMax() { - return DEFAULT_READ_CONNECTIONS_MAX; - } - - // ********** WriteConnectionsMin ********** - public Integer getWriteConnectionsMin() { - return this.writeConnectionsMin; - } - - public void setWriteConnectionsMin(Integer newWriteConnectionsMin) { - this.preSetProperty(); - - Integer old = this.writeConnectionsMin; - this.writeConnectionsMin = newWriteConnectionsMin; - this.putProperty(WRITE_CONNECTIONS_MIN_PROPERTY, newWriteConnectionsMin); - this.firePropertyChanged(WRITE_CONNECTIONS_MIN_PROPERTY, old, newWriteConnectionsMin); - } - - private void writeConnectionsMinChanged(String stringValue) { - Integer newValue = getIntegerValueOf(stringValue); - - Integer old = this.writeConnectionsMin; - this.writeConnectionsMin = newValue; - this.firePropertyChanged(WRITE_CONNECTIONS_MIN_PROPERTY, old, newValue); - } - - public Integer getDefaultWriteConnectionsMin() { - return DEFAULT_WRITE_CONNECTIONS_MIN; - } - - // ********** WriteConnectionsMax ********** - public Integer getWriteConnectionsMax() { - return this.writeConnectionsMax; - } - - public void setWriteConnectionsMax(Integer newWriteConnectionsMax) { - this.preSetProperty(); - - Integer old = this.writeConnectionsMax; - this.writeConnectionsMax = newWriteConnectionsMax; - this.putProperty(WRITE_CONNECTIONS_MAX_PROPERTY, newWriteConnectionsMax); - this.firePropertyChanged(WRITE_CONNECTIONS_MAX_PROPERTY, old, newWriteConnectionsMax); - } - - private void writeConnectionsMaxChanged(String stringValue) { - Integer newValue = getIntegerValueOf(stringValue); - - Integer old = this.writeConnectionsMax; - this.writeConnectionsMax = newValue; - this.firePropertyChanged(WRITE_CONNECTIONS_MAX_PROPERTY, old, newValue); - } - - public Integer getDefaultWriteConnectionsMax() { - return DEFAULT_WRITE_CONNECTIONS_MAX; - } - - // ********** ExclusiveConnectionMode ********** - - public ExclusiveConnectionMode getExclusiveConnectionMode() { - return this.exclusiveConnectionMode; - } - - public void setExclusiveConnectionMode(ExclusiveConnectionMode newExclusiveConnectionMode) { - this.preSetProperty(); - - ExclusiveConnectionMode old = this.exclusiveConnectionMode; - this.exclusiveConnectionMode = newExclusiveConnectionMode; - this.putProperty(EXCLUSIVE_CONNECTION_MODE_PROPERTY, newExclusiveConnectionMode); - this.firePropertyChanged(EXCLUSIVE_CONNECTION_MODE_PROPERTY, old, newExclusiveConnectionMode); - } - - private void exclusiveConnectionModeChanged(String stringValue) { - ExclusiveConnectionMode newValue = getEnumValueOf(stringValue, ExclusiveConnectionMode.values()); - ExclusiveConnectionMode old = this.exclusiveConnectionMode; - this.exclusiveConnectionMode = newValue; - this.firePropertyChanged(EXCLUSIVE_CONNECTION_MODE_PROPERTY, old, newValue); - } - - public ExclusiveConnectionMode getDefaultExclusiveConnectionMode() { - return DEFAULT_EXCLUSIVE_CONNECTION_MODE; - } - - // ********** LazyConnection ********** - public Boolean getLazyConnection() { - return this.lazyConnection; - } - - public void setLazyConnection(Boolean newLazyConnection) { - this.preSetProperty(); - - Boolean old = this.lazyConnection; - this.lazyConnection = newLazyConnection; - this.putProperty(LAZY_CONNECTION_PROPERTY, newLazyConnection); - this.firePropertyChanged(LAZY_CONNECTION_PROPERTY, old, newLazyConnection); - } - - private void lazyConnectionChanged(String stringValue) { - Boolean newValue = getBooleanValueOf(stringValue); - - Boolean old = this.lazyConnection; - this.lazyConnection = newValue; - this.firePropertyChanged(LAZY_CONNECTION_PROPERTY, old, newValue); - } - - public Boolean getDefaultLazyConnection() { - return DEFAULT_LAZY_CONNECTION; - } - -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/persistence/EclipseLinkConnection2_0.java b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/persistence/EclipseLinkConnection2_0.java deleted file mode 100644 index 50e6aa126d..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/persistence/EclipseLinkConnection2_0.java +++ /dev/null @@ -1,152 +0,0 @@ -/******************************************************************************* -* Copyright (c) 2009, 2011 Oracle. All rights reserved. -* This program and the accompanying materials are made available under the -* terms of the Eclipse Public License v1.0, which accompanies this distribution -* and is available at http://www.eclipse.org/legal/epl-v10.html. -* -* Contributors: -* Oracle - initial API and implementation -*******************************************************************************/ -package org.eclipse.jpt.jpa.eclipselink.core.internal.context.persistence; - -import java.util.Map; - -import org.eclipse.jpt.jpa.core.jpa2.context.persistence.PersistenceUnit2_0; -import org.eclipse.jpt.jpa.core.jpa2.context.persistence.connection.JpaConnection2_0; -import org.eclipse.jpt.jpa.eclipselink.core.context.persistence.Connection; -import org.eclipse.jpt.jpa.eclipselink.core.context.persistence.Connection2_0; - - -/** - * EclipseLinkConnection2_0 - */ -public class EclipseLinkConnection2_0 extends EclipseLinkConnection - implements Connection2_0 -{ - - // ********** constructors ********** - public EclipseLinkConnection2_0(PersistenceUnit2_0 parent) { - super(parent); - } - - // ********** initialization ********** - @Override - protected void initializeDatabaseConnectionProperties() { - this.driver = - this.getStringValue(JpaConnection2_0.PERSISTENCE_JDBC_DRIVER); - this.url = - this.getStringValue(JpaConnection2_0.PERSISTENCE_JDBC_URL); - this.user = - this.getStringValue(JpaConnection2_0.PERSISTENCE_JDBC_USER); - this.password = - this.getStringValue(JpaConnection2_0.PERSISTENCE_JDBC_PASSWORD); - } - - @Override - protected void postInitialize() { - super.postInitialize(); - - // Initialize Properties from legacy properties names if not initialized. - if(this.persistenceUnitKeyExists(ECLIPSELINK_DRIVER)) { - if(this.driver == null) { - this.driver = this.getStringValue(ECLIPSELINK_DRIVER); - } - } - if(this.persistenceUnitKeyExists(ECLIPSELINK_URL)) { - if(this.url == null) { - this.url = this.getStringValue(ECLIPSELINK_URL); - } - } - if(this.persistenceUnitKeyExists(ECLIPSELINK_USER)) { - if(this.user == null) { - this.user = this.getStringValue(ECLIPSELINK_USER); - } - } - if(this.persistenceUnitKeyExists(ECLIPSELINK_PASSWORD)) { - if(this.password == null) { - this.password = this.getStringValue(ECLIPSELINK_PASSWORD); - } - } - } - - // ********** behavior ********** - - @Override - public void propertyValueChanged(String propertyName, String newValue) { - super.propertyValueChanged(propertyName, newValue); - - if (propertyName.equals(JpaConnection2_0.PERSISTENCE_JDBC_DRIVER)) { - this.driverChanged(newValue); - } - else if (propertyName.equals(JpaConnection2_0.PERSISTENCE_JDBC_URL)) { - this.urlChanged(newValue); - } - else if (propertyName.equals(JpaConnection2_0.PERSISTENCE_JDBC_USER)) { - this.userChanged(newValue); - } - else if (propertyName.equals(JpaConnection2_0.PERSISTENCE_JDBC_PASSWORD)) { - this.passwordChanged(newValue); - } - } - - @Override - public void propertyRemoved(String propertyName) { - super.propertyRemoved(propertyName); - - if (propertyName.equals(JpaConnection2_0.PERSISTENCE_JDBC_DRIVER)) { - this.driverChanged(null); - } - else if (propertyName.equals(JpaConnection2_0.PERSISTENCE_JDBC_URL)) { - this.urlChanged(null); - } - else if (propertyName.equals(JpaConnection2_0.PERSISTENCE_JDBC_USER)) { - this.userChanged(null); - } - else if (propertyName.equals(JpaConnection2_0.PERSISTENCE_JDBC_PASSWORD)) { - this.passwordChanged(null); - } - } - - @Override - protected void addDatabaseConnectionPropertyNames(Map<String, String> propertyNames) { - propertyNames.put( - JpaConnection2_0.PERSISTENCE_JDBC_DRIVER, - Connection.DRIVER_PROPERTY); - propertyNames.put( - JpaConnection2_0.PERSISTENCE_JDBC_URL, - Connection.URL_PROPERTY); - propertyNames.put( - JpaConnection2_0.PERSISTENCE_JDBC_USER, - Connection.USER_PROPERTY); - propertyNames.put( - JpaConnection2_0.PERSISTENCE_JDBC_PASSWORD, - Connection.PASSWORD_PROPERTY); - } - - /** - * Migrate properties names to EclipseLink 2.0 names. - */ - private void migrateProperties() { - this.migrateStringProperty(ECLIPSELINK_DRIVER, JpaConnection2_0.PERSISTENCE_JDBC_DRIVER, this.driver); - this.migrateStringProperty(ECLIPSELINK_URL, JpaConnection2_0.PERSISTENCE_JDBC_URL, this.url); - this.migrateStringProperty(ECLIPSELINK_USER, JpaConnection2_0.PERSISTENCE_JDBC_USER, this.user); - this.migrateStringProperty(ECLIPSELINK_PASSWORD, JpaConnection2_0.PERSISTENCE_JDBC_PASSWORD, this.password); - } - - private void migrateStringProperty(String oldKey, String newKey, String value) { - if(this.persistenceUnitKeyExists(oldKey)) { - this.getPersistenceUnit().removeProperty(oldKey); - this.getPersistenceUnit().setProperty(newKey, value); - } - } - - /** - * Migrate all properties names before the property is set - */ - @Override - protected void preSetProperty() { - - this.migrateProperties(); - } - -}
\ 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/context/persistence/EclipseLinkCustomization.java b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/persistence/EclipseLinkCustomization.java deleted file mode 100644 index 3d5af04ef5..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/persistence/EclipseLinkCustomization.java +++ /dev/null @@ -1,870 +0,0 @@ -/******************************************************************************* -* Copyright (c) 2008, 2011 Oracle. All rights reserved. -* This program and the accompanying materials are made available under the -* terms of the Eclipse Public License v1.0, which accompanies this distribution -* and is available at http://www.eclipse.org/legal/epl-v10.html. -* -* Contributors: -* Oracle - initial API and implementation -*******************************************************************************/ -package org.eclipse.jpt.jpa.eclipselink.core.internal.context.persistence; - -import java.util.ArrayList; -import java.util.List; -import java.util.Map; -import java.util.Set; -import org.eclipse.jdt.core.IPackageFragment; -import org.eclipse.jdt.core.IType; -import org.eclipse.jpt.common.utility.internal.CollectionTools; -import org.eclipse.jpt.common.utility.internal.StringTools; -import org.eclipse.jpt.common.utility.internal.iterables.CompositeIterable; -import org.eclipse.jpt.common.utility.internal.iterables.EmptyIterable; -import org.eclipse.jpt.common.utility.internal.iterables.ListIterable; -import org.eclipse.jpt.common.utility.internal.iterables.LiveCloneListIterable; -import org.eclipse.jpt.common.utility.internal.iterables.TransformationIterable; -import org.eclipse.jpt.jpa.core.context.persistence.PersistenceUnit; -import org.eclipse.jpt.jpa.eclipselink.core.context.persistence.Customization; -import org.eclipse.jpt.jpa.eclipselink.core.context.persistence.CustomizationEntity; -import org.eclipse.jpt.jpa.eclipselink.core.context.persistence.Profiler; -import org.eclipse.jpt.jpa.eclipselink.core.context.persistence.Weaving; -import org.eclipse.text.edits.ReplaceEdit; - -/** - * EclipseLinkCustomization - */ -public class EclipseLinkCustomization extends EclipseLinkPersistenceUnitProperties - implements Customization -{ - // ********** EclipseLink properties ********** - private Boolean throwExceptions; - private Weaving weaving; - private Boolean weavingLazy; - private Boolean weavingChangeTracking; - private Boolean weavingFetchGroups; - private Boolean weavingInternal; - private Boolean weavingEager; - private Boolean validationOnly; - private Boolean validateSchema; - private List<String> sessionCustomizers; - private String profiler; // storing EclipseLinkStringValue since value can be Profiler or custom class - private String exceptionHandler; - - private List<CustomizationEntity> entities; - - // ********** constructors ********** - public EclipseLinkCustomization(PersistenceUnit parent) { - super(parent); - } - - // ********** initialization ********** - /** - * Initializes properties with values from the persistence unit. - */ - @Override - protected void initializeProperties() { - this.entities = new ArrayList<CustomizationEntity>(); - - this.throwExceptions = - this.getBooleanValue(ECLIPSELINK_THROW_EXCEPTIONS); - this.weaving = - this.getEnumValue(ECLIPSELINK_WEAVING, Weaving.values()); - this.weavingLazy = - this.getBooleanValue(ECLIPSELINK_WEAVING_LAZY); - this.weavingChangeTracking = - this.getBooleanValue(ECLIPSELINK_WEAVING_CHANGE_TRACKING); - this.weavingFetchGroups = - this.getBooleanValue(ECLIPSELINK_WEAVING_FETCH_GROUPS); - this.weavingInternal = - this.getBooleanValue(ECLIPSELINK_WEAVING_INTERNAL); - this.weavingEager = - this.getBooleanValue(ECLIPSELINK_WEAVING_EAGER); - this.validationOnly = - this.getBooleanValue(ECLIPSELINK_VALIDATION_ONLY); - this.validateSchema = - this.getBooleanValue(ECLIPSELINK_VALIDATE_SCHEMA); - this.initializeSessionCustomizersFromPersistenceUnit(); - - Set<PersistenceUnit.Property> properties = - this.getPropertiesSetWithPrefix(ECLIPSELINK_DESCRIPTOR_CUSTOMIZER); - this.initializeEntitiesCustomizerClass(properties); - - this.profiler = this.getProfilerPropertyValue(); - this.exceptionHandler = - this.getStringValue(ECLIPSELINK_EXCEPTION_HANDLER); - } - - private void initializeSessionCustomizersFromPersistenceUnit() { - this.sessionCustomizers = this.buildSessionCustomizers(); - } - - private List<String> buildSessionCustomizers() { - return CollectionTools.list(this.convertToValues(this.getPropertiesSetWithPrefix(ECLIPSELINK_SESSION_CUSTOMIZER))); - } - - private Iterable<String> convertToValues(Iterable<PersistenceUnit.Property> properties) { - return new TransformationIterable<PersistenceUnit.Property, String>(properties) { - @Override - protected String transform(PersistenceUnit.Property property) { - return property.getValue(); - } - }; - } - - private void initializeEntitiesCustomizerClass(Set<PersistenceUnit.Property> descriptorCustomizerProperties) { - for (PersistenceUnit.Property descriptorCustomizerProperty : descriptorCustomizerProperties) { - this.setEntityDescriptorCustomizerOf(descriptorCustomizerProperty); - } - } - - /** - * Gets the Profiler property from the persistence unit. - */ - private String getProfilerPropertyValue() { - - String value = this.getStringValue(ECLIPSELINK_PROFILER); - if (value == null) { - return null; // no property found - } - Profiler standardProfiler = this.getEnumValue(ECLIPSELINK_PROFILER, Profiler.values()); - return (standardProfiler == null) ? value : getPropertyStringValueOf(standardProfiler); - } - - // ********** behavior ********** - - public void propertyValueChanged(String propertyName, String newValue) { - if (propertyName.equals(ECLIPSELINK_THROW_EXCEPTIONS)) { - this.throwExceptionsChanged(newValue); - } - else if (propertyName.equals(ECLIPSELINK_WEAVING)) { - this.weavingChanged(newValue); - } - else if (propertyName.equals(ECLIPSELINK_WEAVING_LAZY)) { - this.weavingLazyChanged(newValue); - } - else if (propertyName.equals(ECLIPSELINK_WEAVING_CHANGE_TRACKING)) { - this.weavingChangeTrackingChanged(newValue); - } - else if (propertyName.equals(ECLIPSELINK_WEAVING_FETCH_GROUPS)) { - this.weavingFetchGroupsChanged(newValue); - } - else if (propertyName.equals(ECLIPSELINK_WEAVING_INTERNAL)) { - this.weavingInternalChanged(newValue); - } - else if (propertyName.equals(ECLIPSELINK_WEAVING_EAGER)) { - this.weavingEagerChanged(newValue); - } - else if (propertyName.equals(ECLIPSELINK_VALIDATION_ONLY)) { - this.validationOnlyChanged(newValue); - } - else if (propertyName.equals(ECLIPSELINK_VALIDATE_SCHEMA)) { - this.validateSchemaChanged(newValue); - } - else if (propertyName.equals(ECLIPSELINK_SESSION_CUSTOMIZER)) { - this.sessionCustomizersChanged(); - } - else if (propertyName.startsWith(ECLIPSELINK_DESCRIPTOR_CUSTOMIZER)) { - this.descriptorCustomizerChanged(propertyName, newValue); - } - else if (propertyName.equals(ECLIPSELINK_PROFILER)) { - this.profilerChanged(newValue); - } - else if (propertyName.equals(ECLIPSELINK_EXCEPTION_HANDLER)) { - this.exceptionHandlerChanged(newValue); - } - } - - public void propertyRemoved(String propertyName) { - if (propertyName.equals(ECLIPSELINK_THROW_EXCEPTIONS)) { - this.throwExceptionsChanged(null); - } - else if (propertyName.equals(ECLIPSELINK_WEAVING)) { - this.weavingChanged(null); - } - else if (propertyName.equals(ECLIPSELINK_WEAVING_LAZY)) { - this.weavingLazyChanged(null); - } - else if (propertyName.equals(ECLIPSELINK_WEAVING_CHANGE_TRACKING)) { - this.weavingChangeTrackingChanged(null); - } - else if (propertyName.equals(ECLIPSELINK_WEAVING_FETCH_GROUPS)) { - this.weavingFetchGroupsChanged(null); - } - else if (propertyName.equals(ECLIPSELINK_WEAVING_INTERNAL)) { - this.weavingInternalChanged(null); - } - else if (propertyName.equals(ECLIPSELINK_WEAVING_EAGER)) { - this.weavingEagerChanged(null); - } - else if (propertyName.equals(ECLIPSELINK_VALIDATION_ONLY)) { - this.validationOnlyChanged(null); - } - else if (propertyName.equals(ECLIPSELINK_VALIDATE_SCHEMA)) { - this.validateSchemaChanged(null); - } - else if (propertyName.equals(ECLIPSELINK_SESSION_CUSTOMIZER)) { - this.sessionCustomizersChanged(); - } - else if (propertyName.startsWith(ECLIPSELINK_DESCRIPTOR_CUSTOMIZER)) { - this.descriptorCustomizerChanged(propertyName, null); - } - else if (propertyName.equals(ECLIPSELINK_PROFILER)) { - this.profilerChanged(null); - } - else if (propertyName.equals(ECLIPSELINK_EXCEPTION_HANDLER)) { - this.exceptionHandlerChanged(null); - } - - } - - /** - * Adds property names key/value pairs, where: - * key = EclipseLink property key - * value = property id - */ - @Override - protected void addPropertyNames(Map<String, String> propertyNames) { - propertyNames.put( - ECLIPSELINK_THROW_EXCEPTIONS, - THROW_EXCEPTIONS_PROPERTY); - propertyNames.put( - ECLIPSELINK_WEAVING, - WEAVING_PROPERTY); - propertyNames.put( - ECLIPSELINK_WEAVING_LAZY, - WEAVING_LAZY_PROPERTY); - propertyNames.put( - ECLIPSELINK_WEAVING_CHANGE_TRACKING, - WEAVING_CHANGE_TRACKING_PROPERTY); - propertyNames.put( - ECLIPSELINK_WEAVING_FETCH_GROUPS, - WEAVING_FETCH_GROUPS_PROPERTY); - propertyNames.put( - ECLIPSELINK_WEAVING_INTERNAL, - WEAVING_INTERNAL_PROPERTY); - propertyNames.put( - ECLIPSELINK_WEAVING_EAGER, - WEAVING_EAGER_PROPERTY); - propertyNames.put( - ECLIPSELINK_VALIDATION_ONLY, - VALIDATION_ONLY_PROPERTY); - propertyNames.put( - ECLIPSELINK_VALIDATE_SCHEMA, - VALIDATE_SCHEMA_PROPERTY); - propertyNames.put( - ECLIPSELINK_SESSION_CUSTOMIZER, - SESSION_CUSTOMIZER_PROPERTY); - propertyNames.put( - ECLIPSELINK_PROFILER, - PROFILER_PROPERTY); - propertyNames.put( - ECLIPSELINK_EXCEPTION_HANDLER, - EXCEPTION_HANDLER_PROPERTY); - - // Don't need to initialize propertyNames for: - // descriptorCustomizerProperty - } - - /** - * Method used for identifying the given property. - */ - @Override - public boolean itemIsProperty(PersistenceUnit.Property item) { - boolean isProperty = super.itemIsProperty(item); - - if ( ! isProperty && item.getName() != null) { - if (item.getName().startsWith(ECLIPSELINK_DESCRIPTOR_CUSTOMIZER)) { - return true; - } - } - return isProperty; - } - - /** - * Returns the property name used for change notification of the given - * property. - */ - @Override - public String propertyIdOf(PersistenceUnit.Property property) { - try { - return super.propertyIdOf(property); - } - catch (IllegalArgumentException e) { - if (property.getName().startsWith(ECLIPSELINK_DESCRIPTOR_CUSTOMIZER)) { - return DESCRIPTOR_CUSTOMIZER_PROPERTY; - } - } - throw new IllegalArgumentException("Illegal property: " + property); //$NON-NLS-1$ - } - - public CustomizationEntity addEntity(String entityName) { - if (this.entityExists(entityName)) { - throw new IllegalStateException("Duplicate entity: " + entityName); //$NON-NLS-1$ - } - CustomizationEntity newEntity = this.buildEntity(entityName); - this.addItemToList(newEntity, this.entities, ENTITIES_LIST); - return newEntity; - } - - public void removeEntity(String entityName) { - if ( ! this.entityExists(entityName)) { - return; - } - CustomizationEntity entity = this.getEntityNamed(entityName); - this.clearEntity(entity); - this.removeEntity(entity); - } - - - // ********** ThrowExceptions ********** - public Boolean getThrowExceptions() { - return this.throwExceptions; - } - - public void setThrowExceptions(Boolean newThrowExceptions) { - Boolean old = this.throwExceptions; - this.throwExceptions = newThrowExceptions; - this.putProperty(THROW_EXCEPTIONS_PROPERTY, newThrowExceptions); - this.firePropertyChanged(THROW_EXCEPTIONS_PROPERTY, old, newThrowExceptions); - } - - private void throwExceptionsChanged(String stringValue) { - Boolean newValue = getBooleanValueOf(stringValue); - - Boolean old = this.throwExceptions; - this.throwExceptions = newValue; - this.firePropertyChanged(THROW_EXCEPTIONS_PROPERTY, old, newValue); - } - - public Boolean getDefaultThrowExceptions() { - return DEFAULT_THROW_EXCEPTIONS; - } - - // ********** WeavingLazy ********** - public Boolean getWeavingLazy() { - return this.weavingLazy; - } - - public void setWeavingLazy(Boolean newWeavingLazy) { - Boolean old = this.weavingLazy; - this.weavingLazy = newWeavingLazy; - this.putProperty(WEAVING_LAZY_PROPERTY, newWeavingLazy); - this.firePropertyChanged(WEAVING_LAZY_PROPERTY, old, newWeavingLazy); - } - - private void weavingLazyChanged(String stringValue) { - Boolean newValue = getBooleanValueOf(stringValue); - - Boolean old = this.weavingLazy; - this.weavingLazy = newValue; - this.firePropertyChanged(WEAVING_LAZY_PROPERTY, old, newValue); - } - - public Boolean getDefaultWeavingLazy() { - return DEFAULT_WEAVING_LAZY; - } - - // ********** WeavingChangeTracking ********** - public Boolean getWeavingChangeTracking() { - return this.weavingChangeTracking; - } - - public void setWeavingChangeTracking(Boolean newWeavingChangeTracking) { - Boolean old = this.weavingChangeTracking; - this.weavingChangeTracking = newWeavingChangeTracking; - this.putProperty(WEAVING_CHANGE_TRACKING_PROPERTY, newWeavingChangeTracking); - this.firePropertyChanged(WEAVING_CHANGE_TRACKING_PROPERTY, old, newWeavingChangeTracking); - } - - private void weavingChangeTrackingChanged(String stringValue) { - Boolean newValue = getBooleanValueOf(stringValue); - - Boolean old = this.weavingChangeTracking; - this.weavingChangeTracking = newValue; - this.firePropertyChanged(WEAVING_CHANGE_TRACKING_PROPERTY, old, newValue); - } - - public Boolean getDefaultWeavingChangeTracking() { - return DEFAULT_WEAVING_CHANGE_TRACKING; - } - - // ********** WeavingFetchGroups ********** - public Boolean getWeavingFetchGroups() { - return this.weavingFetchGroups; - } - - public void setWeavingFetchGroups(Boolean newWeavingFetchGroups) { - Boolean old = this.weavingFetchGroups; - this.weavingFetchGroups = newWeavingFetchGroups; - this.putProperty(WEAVING_FETCH_GROUPS_PROPERTY, newWeavingFetchGroups); - this.firePropertyChanged(WEAVING_FETCH_GROUPS_PROPERTY, old, newWeavingFetchGroups); - } - - private void weavingFetchGroupsChanged(String stringValue) { - Boolean newValue = getBooleanValueOf(stringValue); - - Boolean old = this.weavingFetchGroups; - this.weavingFetchGroups = newValue; - this.firePropertyChanged(WEAVING_FETCH_GROUPS_PROPERTY, old, newValue); - } - - public Boolean getDefaultWeavingFetchGroups() { - return DEFAULT_WEAVING_FETCH_GROUPS; - } - - // ********** WeavingInternal ********** - public Boolean getWeavingInternal() { - return this.weavingInternal; - } - - public void setWeavingInternal(Boolean newWeavingInternal) { - Boolean old = this.weavingInternal; - this.weavingInternal = newWeavingInternal; - this.putProperty(WEAVING_INTERNAL_PROPERTY, newWeavingInternal); - this.firePropertyChanged(WEAVING_INTERNAL_PROPERTY, old, newWeavingInternal); - } - - private void weavingInternalChanged(String stringValue) { - Boolean newValue = getBooleanValueOf(stringValue); - - Boolean old = this.weavingInternal; - this.weavingInternal = newValue; - this.firePropertyChanged(WEAVING_INTERNAL_PROPERTY, old, newValue); - } - - public Boolean getDefaultWeavingInternal() { - return DEFAULT_WEAVING_INTERNAL; - } - - // ********** WeavingEager ********** - public Boolean getWeavingEager() { - return this.weavingEager; - } - - public void setWeavingEager(Boolean newWeavingEager) { - Boolean old = this.weavingEager; - this.weavingEager = newWeavingEager; - this.putProperty(WEAVING_EAGER_PROPERTY, newWeavingEager); - this.firePropertyChanged(WEAVING_EAGER_PROPERTY, old, newWeavingEager); - } - - private void weavingEagerChanged(String stringValue) { - Boolean newValue = getBooleanValueOf(stringValue); - - Boolean old = this.weavingEager; - this.weavingEager = newValue; - this.firePropertyChanged(WEAVING_EAGER_PROPERTY, old, newValue); - } - - public Boolean getDefaultWeavingEager() { - return DEFAULT_WEAVING_EAGER; - } - - // ********** ValidationOnly ********** - public Boolean getValidationOnly() { - return this.validationOnly; - } - - public void setValidationOnly(Boolean newValidationOnly) { - Boolean old = this.validationOnly; - this.validationOnly = newValidationOnly; - this.putProperty(VALIDATION_ONLY_PROPERTY, newValidationOnly); - this.firePropertyChanged(VALIDATION_ONLY_PROPERTY, old, newValidationOnly); - } - - private void validationOnlyChanged(String stringValue) { - Boolean newValue = getBooleanValueOf(stringValue); - - Boolean old = this.validationOnly; - this.validationOnly = newValue; - this.firePropertyChanged(VALIDATION_ONLY_PROPERTY, old, newValue); - } - - public Boolean getDefaultValidationOnly() { - return DEFAULT_VALIDATION_ONLY; - } - - // ********** ValidateSchema ********** - public Boolean getValidateSchema() { - return this.validateSchema; - } - - public void setValidateSchema(Boolean newValidateSchema) { - Boolean old = this.validateSchema; - this.validateSchema = newValidateSchema; - this.putProperty(VALIDATE_SCHEMA_PROPERTY, newValidateSchema); - this.firePropertyChanged(VALIDATE_SCHEMA_PROPERTY, old, newValidateSchema); - } - - private void validateSchemaChanged(String stringValue) { - Boolean newValue = getBooleanValueOf(stringValue); - - Boolean old = this.validateSchema; - this.validateSchema = newValue; - this.firePropertyChanged(VALIDATE_SCHEMA_PROPERTY, old, newValue); - } - - public Boolean getDefaultValidateSchema() { - return DEFAULT_VALIDATE_SCHEMA; - } - - // ********** SessionCustomizers ********** - public ListIterable<String> getSessionCustomizers(){ - return new LiveCloneListIterable<String>(this.sessionCustomizers); - } - - public int getSessionCustomizersSize(){ - return this.sessionCustomizers.size(); - } - - public boolean sessionCustomizerExists(String sessionCustomizerClassName) { - - for (String sessionCustomizer : this.sessionCustomizers) { - if(sessionCustomizer.equals(sessionCustomizerClassName)) { - return true; - } - } - return false; - } - - public String addSessionCustomizer(String newSessionCustomizerClassName){ - - if( ! this.sessionCustomizerExists(newSessionCustomizerClassName)) { - this.addItemToList(newSessionCustomizerClassName, this.sessionCustomizers, SESSION_CUSTOMIZER_LIST); - this.putProperty(SESSION_CUSTOMIZER_PROPERTY, newSessionCustomizerClassName, true); - return newSessionCustomizerClassName; - } - return null; - } - - public void removeSessionCustomizer(String className){ - if (this.removeItemFromList(className, this.sessionCustomizers, SESSION_CUSTOMIZER_LIST)) { - this.removeProperty(SESSION_CUSTOMIZER_PROPERTY, className); - } - } - - private void sessionCustomizersChanged() { - this.synchronizeList(this.buildSessionCustomizers(), this.sessionCustomizers, SESSION_CUSTOMIZER_LIST); - } - - // ********** Weaving ********** - - public Weaving getWeaving() { - return this.weaving; - } - - public void setWeaving(Weaving newWeaving) { - Weaving old = this.weaving; - this.weaving = newWeaving; - this.putProperty(WEAVING_PROPERTY, newWeaving); - this.firePropertyChanged(WEAVING_PROPERTY, old, newWeaving); - } - - private void weavingChanged(String stringValue) { - Weaving newValue = getEnumValueOf(stringValue, Weaving.values()); - Weaving old = this.weaving; - this.weaving = newValue; - this.firePropertyChanged(WEAVING_PROPERTY, old, newValue); - } - - public Weaving getDefaultWeaving() { - return DEFAULT_WEAVING; - } - - // ********** ExceptionHandler ********** - public String getExceptionHandler() { - return this.exceptionHandler; - } - - public void setExceptionHandler(String newExceptionHandler) { - String old = this.exceptionHandler; - this.exceptionHandler = newExceptionHandler; - this.putProperty(EXCEPTION_HANDLER_PROPERTY, newExceptionHandler); - this.firePropertyChanged(EXCEPTION_HANDLER_PROPERTY, old, newExceptionHandler); - } - - private void exceptionHandlerChanged(String newValue) { - String old = this.exceptionHandler; - this.exceptionHandler = newValue; - this.firePropertyChanged(EXCEPTION_HANDLER_PROPERTY, old, newValue); - } - - public String getDefaultExceptionHandler() { - return DEFAULT_EXCEPTION_HANDLER; - } - - // ********** DescriptorCustomizer ********** - - public String getDescriptorCustomizerOf(String entityName) { - CustomizationEntity entity = this.getEntityNamed(entityName); - return (entity == null) ? null : entity.getDescriptorCustomizer(); - } - - public void setDescriptorCustomizerOf(String entityName, String newDescriptorCustomizer) { - CustomizationEntity old = this.setEntityDescriptorCustomizerOf(entityName, newDescriptorCustomizer); - this.putStringValue(ECLIPSELINK_DESCRIPTOR_CUSTOMIZER, entityName, newDescriptorCustomizer, false); - this.firePropertyChanged(DESCRIPTOR_CUSTOMIZER_PROPERTY, old, this.getEntityNamed(entityName)); - } - - private void descriptorCustomizerChanged(String propertyName, String stringValue) { - String entityName = this.extractEntityNameOf(propertyName); - if( ! StringTools.stringIsEmpty(entityName)) { - CustomizationEntity old = this.setEntityDescriptorCustomizerOf(entityName, stringValue); - this.firePropertyChanged(DESCRIPTOR_CUSTOMIZER_PROPERTY, old, this.getEntityNamed(entityName)); - } - } - - public String getDefaultDescriptorCustomizer() { - return DEFAULT_DESCRIPTOR_CUSTOMIZER; - } - - /** - * Returns the old Entity - */ - private CustomizationEntity setEntityDescriptorCustomizerOf(String entityName, String descriptorCustomizerClassName) { - if(( ! this.entityExists(entityName)) && StringTools.stringIsEmpty(descriptorCustomizerClassName)) { - //this is a property that is currently being added, we don't need to deal with it until the value is set - return null; - } - CustomizationEntity entity = (this.entityExists(entityName)) ? - this.getEntityNamed(entityName) : - this.addEntity(entityName); - return this.setEntityDescriptorCustomizerOf(entity, descriptorCustomizerClassName); - } - - /** - * Returns the old Entity - */ - private CustomizationEntity setEntityDescriptorCustomizerOf(CustomizationEntity entity, String descriptorCustomizerClassName) { - if(entity == null) { - throw new IllegalArgumentException(); - } - CustomizationEntity old = entity.clone(); - entity.setDescriptorCustomizer(descriptorCustomizerClassName); - return old; - } - - /** - * Convenience method to update the descriptorCustomizerClassName in entities. - * Returns the old Entity - */ - private CustomizationEntity setEntityDescriptorCustomizerOf(PersistenceUnit.Property descriptorCustomizerProperty) { - String entityName = this.extractEntityNameOf(descriptorCustomizerProperty); - if(StringTools.stringIsEmpty(entityName)) { - return null; - } - return this.setEntityDescriptorCustomizerOf(entityName, descriptorCustomizerProperty.getValue()); - } - - // ********** Profiler ********** - /** - * Returns Profiler or custom profiler class. - * - * @return EclipseLink string value for Profiler enum or custom profiler class - */ - public String getProfiler() { - return this.profiler; - } - - /** - * Sets EclipseLink profiler. - * - * @param newProfiler - Profiler - */ - public void setProfiler(Profiler newProfiler) { - if( newProfiler == null) { - this.setProfiler_((String) null); - return; - } - this.setProfiler_(getPropertyStringValueOf(newProfiler)); - } - - /** - * Sets EclipseLink profiler or custom profiler. - * - * @param newProfiler - - * Can be a EclipseLink profiler literal or - * a fully qualified class name of a custom profiler. - */ - public void setProfiler(String newProfiler) { - if( newProfiler == null) { - this.setProfiler_((String) null); - return; - } - Profiler p = Profiler.getProfilerFor(newProfiler); - if(p == null) { // custom profiler class - this.setProfiler_(newProfiler); - } - else { - this.setProfiler(p); - } - } - - private void setProfiler_(String newProfiler) { - String old = this.profiler; - this.profiler = newProfiler; - this.putProperty(PROFILER_PROPERTY, newProfiler); - this.firePropertyChanged(PROFILER_PROPERTY, old, newProfiler); - } - - private void profilerChanged(String newValue) { - String old = this.profiler; - this.profiler = newValue; - this.firePropertyChanged(PROFILER_PROPERTY, old, newValue); - } - - public String getDefaultProfiler() { - return DEFAULT_PROFILER; - } - - - // ****** convenience methods ******* - - /** - * Set all Entity properties to default. - */ - private void clearEntity(CustomizationEntity entity) { - if(entity.isEmpty()) { - return; - } - String entityName = entity.getName(); - this.setDescriptorCustomizerOf(entityName, null); - } - - /** - * Returns the Entity with the given name. - */ - private CustomizationEntity getEntityNamed(String name) { - for(CustomizationEntity entity: this.entities) { - if(entity.getName().equals(name)) { - return entity; - } - } - return null; - } - - private CustomizationEntity buildEntity(String name) { - return new CustomizationEntity(this, name); - } - - private void removeEntity(CustomizationEntity entity) { - if(entity == null) { - throw new NullPointerException(); - } - this.removeItemFromList(entity, this.entities, ENTITIES_LIST); - } - - /** - * Return whether the Entity exist. - */ - public boolean entityExists(String name) { - for(CustomizationEntity entity: this.entities) { - if(entity.getName().equals(name)) { - return true; - } - } - return false; - } - - // ****** entities list ******* - - public ListIterable<CustomizationEntity> getEntities() { - return new LiveCloneListIterable<CustomizationEntity>(this.entities); - } - - public Iterable<String> getEntityNames() { - return new TransformationIterable<CustomizationEntity, String>(this.getEntities()) { - @Override - protected String transform(CustomizationEntity entity) { - return entity.getName(); - } - }; - } - - public int getEntitiesSize() { - return this.entities.size(); - } - - - // ********** refactoring ************ - - @Override - @SuppressWarnings("unchecked") - public Iterable<ReplaceEdit> createRenameTypeEdits(IType originalType, String newName) { - return new CompositeIterable<ReplaceEdit>( - this.createSessionCustomizerRenameTypeEdits(originalType, newName), - this.createExceptionHandlerRenameTypeEdits(originalType, newName) - ); - } - - protected Iterable<ReplaceEdit> createSessionCustomizerRenameTypeEdits(final IType originalType, final String newName) { - return new CompositeIterable<ReplaceEdit>( - new TransformationIterable<PersistenceUnit.Property, Iterable<ReplaceEdit>>(getPersistenceUnit().getPropertiesNamed(ECLIPSELINK_SESSION_CUSTOMIZER)) { - @Override - protected Iterable<ReplaceEdit> transform(PersistenceUnit.Property property) { - return property.createRenameTypeEdits(originalType, newName); - } - } - ); - } - - protected Iterable<ReplaceEdit> createExceptionHandlerRenameTypeEdits(IType originalType, String newName) { - PersistenceUnit.Property property = getPersistenceUnit().getProperty(ECLIPSELINK_EXCEPTION_HANDLER); - return (property != null) ? - property.createRenameTypeEdits(originalType, newName) : - EmptyIterable.<ReplaceEdit>instance(); - } - - @Override - @SuppressWarnings("unchecked") - public Iterable<ReplaceEdit> createMoveTypeEdits(IType originalType, IPackageFragment newPackage) { - return new CompositeIterable<ReplaceEdit>( - this.createSessionCustomizerMoveTypeEdits(originalType, newPackage), - this.createExceptionHandlerMoveTypeEdits(originalType, newPackage) - ); - } - - protected Iterable<ReplaceEdit> createSessionCustomizerMoveTypeEdits(final IType originalType, final IPackageFragment newPackage) { - return new CompositeIterable<ReplaceEdit>( - new TransformationIterable<PersistenceUnit.Property, Iterable<ReplaceEdit>>(getPersistenceUnit().getPropertiesNamed(ECLIPSELINK_SESSION_CUSTOMIZER)) { - @Override - protected Iterable<ReplaceEdit> transform(PersistenceUnit.Property property) { - return property.createMoveTypeEdits(originalType, newPackage); - } - } - ); - } - - protected Iterable<ReplaceEdit> createExceptionHandlerMoveTypeEdits(IType originalType, IPackageFragment newPackage) { - PersistenceUnit.Property property = getPersistenceUnit().getProperty(ECLIPSELINK_EXCEPTION_HANDLER); - return (property != null) ? - property.createMoveTypeEdits(originalType, newPackage) : - EmptyIterable.<ReplaceEdit>instance(); - } - - @Override - @SuppressWarnings("unchecked") - public Iterable<ReplaceEdit> createRenamePackageEdits(IPackageFragment originalPackage, String newName) { - return new CompositeIterable<ReplaceEdit>( - this.createSessionCustomizerRenamePackageEdits(originalPackage, newName), - this.createExceptionHandlerRenamePackageEdits(originalPackage, newName) - ); - } - - protected Iterable<ReplaceEdit> createSessionCustomizerRenamePackageEdits(final IPackageFragment originalPackage, final String newName) { - return new CompositeIterable<ReplaceEdit>( - new TransformationIterable<PersistenceUnit.Property, Iterable<ReplaceEdit>>(getPersistenceUnit().getPropertiesNamed(ECLIPSELINK_SESSION_CUSTOMIZER)) { - @Override - protected Iterable<ReplaceEdit> transform(PersistenceUnit.Property property) { - return property.createRenamePackageEdits(originalPackage, newName); - } - } - ); - } - - protected Iterable<ReplaceEdit> createExceptionHandlerRenamePackageEdits(IPackageFragment originalPackage, String newName) { - PersistenceUnit.Property property = getPersistenceUnit().getProperty(ECLIPSELINK_EXCEPTION_HANDLER); - return (property != null) ? - property.createRenamePackageEdits(originalPackage, newName) : - EmptyIterable.<ReplaceEdit>instance(); - } -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/persistence/EclipseLinkGeneralProperties.java b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/persistence/EclipseLinkGeneralProperties.java deleted file mode 100644 index a431f95779..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/persistence/EclipseLinkGeneralProperties.java +++ /dev/null @@ -1,95 +0,0 @@ -/******************************************************************************* -* Copyright (c) 2008, 2011 Oracle. All rights reserved. -* This program and the accompanying materials are made available under the -* terms of the Eclipse Public License v1.0, which accompanies this distribution -* and is available at http://www.eclipse.org/legal/epl-v10.html. -* -* Contributors: -* Oracle - initial API and implementation -*******************************************************************************/ -package org.eclipse.jpt.jpa.eclipselink.core.internal.context.persistence; - -import java.util.Map; - -import org.eclipse.jpt.jpa.core.context.persistence.PersistenceUnit; -import org.eclipse.jpt.jpa.eclipselink.core.context.persistence.GeneralProperties; - -/** - * EclipseLinkGeneralProperties - */ -public class EclipseLinkGeneralProperties extends EclipseLinkPersistenceUnitProperties - implements GeneralProperties -{ - // ********** EclipseLink properties ********** - private Boolean excludeEclipselinkOrm; - - // ********** constructors ********** - public EclipseLinkGeneralProperties(PersistenceUnit parent) { - super(parent); - } - - // ********** initialization ********** - /** - * Initializes properties with values from the persistence unit. - */ - @Override - protected void initializeProperties() { - - this.excludeEclipselinkOrm = - this.getBooleanValue(ECLIPSELINK_EXCLUDE_ECLIPSELINK_ORM); - } - - - // ********** behavior ********** - - public void propertyValueChanged(String propertyName, String newValue) { - if (propertyName.equals(ECLIPSELINK_EXCLUDE_ECLIPSELINK_ORM)) { - excludeEclipselinkOrmChanged(newValue); - } - } - - public void propertyRemoved(String propertyName) { - if (propertyName.equals(ECLIPSELINK_EXCLUDE_ECLIPSELINK_ORM)) { - excludeEclipselinkOrmChanged(null); - } - } - - - /** - * Adds property names key/value pairs, where: - * key = EclipseLink property key - * value = property id - */ - @Override - protected void addPropertyNames(Map<String, String> propertyNames) { - propertyNames.put( - ECLIPSELINK_EXCLUDE_ECLIPSELINK_ORM, - EXCLUDE_ECLIPSELINK_ORM_PROPERTY); - } - - - // ********** ExcludeEclipselinkOrm ********** - public Boolean getExcludeEclipselinkOrm() { - return this.excludeEclipselinkOrm; - } - - public void setExcludeEclipselinkOrm(Boolean newExcludeEclipselinkOrm) { - Boolean old = this.excludeEclipselinkOrm; - this.excludeEclipselinkOrm = newExcludeEclipselinkOrm; - this.putProperty(EXCLUDE_ECLIPSELINK_ORM_PROPERTY, newExcludeEclipselinkOrm); - this.firePropertyChanged(EXCLUDE_ECLIPSELINK_ORM_PROPERTY, old, newExcludeEclipselinkOrm); - } - - private void excludeEclipselinkOrmChanged(String stringValue) { - Boolean newValue = getBooleanValueOf(stringValue); - - Boolean old = this.excludeEclipselinkOrm; - this.excludeEclipselinkOrm = newValue; - this.firePropertyChanged(EXCLUDE_ECLIPSELINK_ORM_PROPERTY, old, newValue); - } - - public Boolean getDefaultExcludeEclipselinkOrm() { - return DEFAULT_EXCLUDE_ECLIPSELINK_ORM; - } - -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/persistence/EclipseLinkJarFileRef.java b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/persistence/EclipseLinkJarFileRef.java deleted file mode 100644 index e1cc5b2cdd..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/persistence/EclipseLinkJarFileRef.java +++ /dev/null @@ -1,31 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2009, 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.eclipselink.core.internal.context.persistence; - -import org.eclipse.core.runtime.IPath; -import org.eclipse.jpt.common.utility.internal.ArrayTools; -import org.eclipse.jpt.jpa.core.context.persistence.PersistenceUnit; -import org.eclipse.jpt.jpa.core.internal.context.persistence.AbstractJarFileRef; -import org.eclipse.jpt.jpa.core.resource.persistence.XmlJarFileRef; - -public class EclipseLinkJarFileRef - extends AbstractJarFileRef -{ - public EclipseLinkJarFileRef(PersistenceUnit parent, XmlJarFileRef xmlJarFileRef) { - super(parent, xmlJarFileRef); - } - - @Override - protected IPath[] buildRuntimeJarFilePathWeb(IPath root, IPath jarFilePath) { - IPath[] genericPath = super.buildRuntimeJarFilePathWeb(root, jarFilePath); - return ArrayTools.removeLast(genericPath); - } - -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/persistence/EclipseLinkLogging.java b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/persistence/EclipseLinkLogging.java deleted file mode 100644 index e262cf4b30..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/persistence/EclipseLinkLogging.java +++ /dev/null @@ -1,408 +0,0 @@ -/******************************************************************************* -* Copyright (c) 2008, 2011 Oracle. All rights reserved. -* This program and the accompanying materials are made available under the -* terms of the Eclipse Public License v1.0, which accompanies this distribution -* and is available at http://www.eclipse.org/legal/epl-v10.html. -* -* Contributors: -* Oracle - initial API and implementation -*******************************************************************************/ -package org.eclipse.jpt.jpa.eclipselink.core.internal.context.persistence; - -import java.util.Map; -import org.eclipse.jdt.core.IPackageFragment; -import org.eclipse.jdt.core.IType; -import org.eclipse.jpt.common.utility.internal.StringTools; -import org.eclipse.jpt.common.utility.internal.iterables.EmptyIterable; -import org.eclipse.jpt.jpa.core.context.persistence.PersistenceUnit; -import org.eclipse.jpt.jpa.eclipselink.core.context.persistence.Logger; -import org.eclipse.jpt.jpa.eclipselink.core.context.persistence.Logging; -import org.eclipse.jpt.jpa.eclipselink.core.context.persistence.LoggingLevel; -import org.eclipse.text.edits.ReplaceEdit; - -/** - * EclipseLinkLogging - */ -public class EclipseLinkLogging extends EclipseLinkPersistenceUnitProperties - implements Logging -{ - // ********** EclipseLink properties ********** - private LoggingLevel level; - private Boolean timestamp; - private Boolean thread; - private Boolean session; - private Boolean exceptions; - private String logFileLocation; - private String logger; // storing EclipseLinkStringValue since value can be Logger or custom class - - // ********** constructors ********** - public EclipseLinkLogging(PersistenceUnit parent) { - super(parent); - } - - // ********** initialization ********** - /** - * Initializes properties with values from the persistence unit. - */ - @Override - protected void initializeProperties() { - // TOREVIEW - handle incorrect String in persistence.xml - this.level = - this.getEnumValue(ECLIPSELINK_LEVEL, LoggingLevel.values()); - this.timestamp = - this.getBooleanValue(ECLIPSELINK_TIMESTAMP); - this.thread = - this.getBooleanValue(ECLIPSELINK_THREAD); - this.session = - this.getBooleanValue(ECLIPSELINK_SESSION); - this.exceptions = - this.getBooleanValue(ECLIPSELINK_EXCEPTIONS); - this.logFileLocation = - this.getStringValue(ECLIPSELINK_LOG_FILE_LOCATION); - - this.logger = this.getLoggerProtertyValue(); - } - - /** - * Gets the Logger property from the persistence unit. - */ - private String getLoggerProtertyValue() { - - String value = this.getStringValue(ECLIPSELINK_LOGGER); - if (value == null) { - return null; // no property found - } - Logger standardLogger = this.getEnumValue(ECLIPSELINK_LOGGER, Logger.values()); - return (standardLogger == null) ? value : getPropertyStringValueOf(standardLogger); - } - - // ********** behavior ********** - - public void propertyValueChanged(String propertyName, String newValue) { - if (propertyName.equals(ECLIPSELINK_LEVEL)) { - this.levelChanged(newValue); - } - else if (propertyName.equals(ECLIPSELINK_TIMESTAMP)) { - this.timestampChanged(newValue); - } - else if (propertyName.equals(ECLIPSELINK_THREAD)) { - this.threadChanged(newValue); - } - else if (propertyName.equals(ECLIPSELINK_SESSION)) { - this.sessionChanged(newValue); - } - else if (propertyName.equals(ECLIPSELINK_EXCEPTIONS)) { - this.exceptionsChanged(newValue); - } - else if (propertyName.equals(ECLIPSELINK_LOG_FILE_LOCATION)) { - this.logFileLocationChanged(newValue); - } - else if (propertyName.equals(ECLIPSELINK_LOGGER)) { - this.loggerChanged(newValue); - } - } - - public void propertyRemoved(String propertyName) { - if (propertyName.equals(ECLIPSELINK_LEVEL)) { - this.levelChanged(null); - } - else if (propertyName.equals(ECLIPSELINK_TIMESTAMP)) { - this.timestampChanged(null); - } - else if (propertyName.equals(ECLIPSELINK_THREAD)) { - this.threadChanged(null); - } - else if (propertyName.equals(ECLIPSELINK_SESSION)) { - this.sessionChanged(null); - } - else if (propertyName.equals(ECLIPSELINK_EXCEPTIONS)) { - this.exceptionsChanged(null); - } - else if (propertyName.equals(ECLIPSELINK_LOG_FILE_LOCATION)) { - this.logFileLocationChanged(null); - } - else if (propertyName.equals(ECLIPSELINK_LOGGER)) { - this.loggerChanged(null); - } - } - - /** - * Adds property names key/value pairs, where: - * key = EclipseLink property key - * value = property id - */ - @Override - protected void addPropertyNames(Map<String, String> propertyNames) { - propertyNames.put( - ECLIPSELINK_LEVEL, - LEVEL_PROPERTY); - propertyNames.put( - ECLIPSELINK_TIMESTAMP, - TIMESTAMP_PROPERTY); - propertyNames.put( - ECLIPSELINK_THREAD, - THREAD_PROPERTY); - propertyNames.put( - ECLIPSELINK_SESSION, - SESSION_PROPERTY); - propertyNames.put( - ECLIPSELINK_EXCEPTIONS, - EXCEPTIONS_PROPERTY); - propertyNames.put( - ECLIPSELINK_LOG_FILE_LOCATION, - LOG_FILE_LOCATION_PROPERTY); - propertyNames.put( - ECLIPSELINK_LOGGER, - LOGGER_PROPERTY); - } - - // ********** LoggingLevel ********** - - public LoggingLevel getLevel() { - return this.level; - } - - public void setLevel(LoggingLevel newLevel) { - LoggingLevel old = this.level; - this.level = newLevel; - this.putProperty(LEVEL_PROPERTY, newLevel); - this.firePropertyChanged(LEVEL_PROPERTY, old, newLevel); - } - - private void levelChanged(String stringValue) { - LoggingLevel newValue = getEnumValueOf(stringValue, LoggingLevel.values()); - LoggingLevel old = this.level; - this.level = newValue; - this.firePropertyChanged(LEVEL_PROPERTY, old, newValue); - } - - public LoggingLevel getDefaultLevel() { - return DEFAULT_LEVEL; - } - - // ********** Timestamp ********** - public Boolean getTimestamp() { - return this.timestamp; - } - - public void setTimestamp(Boolean newTimestamp) { - Boolean old = this.timestamp; - this.timestamp = newTimestamp; - this.putProperty(TIMESTAMP_PROPERTY, newTimestamp); - this.firePropertyChanged(TIMESTAMP_PROPERTY, old, newTimestamp); - } - - private void timestampChanged(String stringValue) { - Boolean newValue = getBooleanValueOf(stringValue); - - Boolean old = this.timestamp; - this.timestamp = newValue; - this.firePropertyChanged(TIMESTAMP_PROPERTY, old, newValue); - } - - public Boolean getDefaultTimestamp() { - return DEFAULT_TIMESTAMP; - } - - // ********** Thread ********** - public Boolean getThread() { - return this.thread; - } - - public void setThread(Boolean newThread) { - Boolean old = this.thread; - this.thread = newThread; - this.putProperty(THREAD_PROPERTY, newThread); - this.firePropertyChanged(THREAD_PROPERTY, old, newThread); - } - - private void threadChanged(String stringValue) { - Boolean newValue = getBooleanValueOf(stringValue); - - Boolean old = this.thread; - this.thread = newValue; - this.firePropertyChanged(THREAD_PROPERTY, old, newValue); - } - - public Boolean getDefaultThread() { - return DEFAULT_THREAD; - } - - // ********** Session ********** - public Boolean getSession() { - return this.session; - } - - public void setSession(Boolean newSession) { - Boolean old = this.session; - this.session = newSession; - this.putProperty(SESSION_PROPERTY, newSession); - this.firePropertyChanged(SESSION_PROPERTY, old, newSession); - } - - private void sessionChanged(String stringValue) { - Boolean newValue = getBooleanValueOf(stringValue); - - Boolean old = this.session; - this.session = newValue; - this.firePropertyChanged(SESSION_PROPERTY, old, newValue); - } - - public Boolean getDefaultSession() { - return DEFAULT_SESSION; - } - - // ********** Exceptions ********** - public Boolean getExceptions() { - return this.exceptions; - } - - public void setExceptions(Boolean newExceptions) { - Boolean old = this.exceptions; - this.exceptions = newExceptions; - this.putProperty(EXCEPTIONS_PROPERTY, newExceptions); - this.firePropertyChanged(EXCEPTIONS_PROPERTY, old, newExceptions); - } - - private void exceptionsChanged(String stringValue) { - Boolean newValue = getBooleanValueOf(stringValue); - - Boolean old = this.exceptions; - this.exceptions = newValue; - this.firePropertyChanged(EXCEPTIONS_PROPERTY, old, newValue); - } - - public Boolean getDefaultExceptions() { - return DEFAULT_EXCEPTIONS; - } - - // ********** logFileLocation ********** - public String getLogFileLocation() { - return this.logFileLocation; - } - - public void setLogFileLocation(String newLogFileLocation) { - String old = this.logFileLocation; - this.logFileLocation = (StringTools.stringIsNotEmpty(newLogFileLocation)) ? - newLogFileLocation : - this.getDefaultLogFileLocation(); - this.putProperty(LOG_FILE_LOCATION_PROPERTY, this.logFileLocation); - this.firePropertyChanged(LOG_FILE_LOCATION_PROPERTY, old, this.logFileLocation); - } - - private void logFileLocationChanged(String newValue) { - String old = this.logFileLocation; - this.logFileLocation = newValue; - this.firePropertyChanged(LOG_FILE_LOCATION_PROPERTY, old, newValue); - } - - public String getDefaultLogFileLocation() { - return DEFAULT_LOG_FILE_LOCATION; - } - - // ********** Logger ********** - /** - * Returns Logger or custom logger class. - * - * @return EclipseLink string value for Logger enum or custom logger class - */ - public String getLogger() { - return this.logger; - } - - /** - * Sets EclipseLink logger. - * - * @param newLogger - Logger - */ - public void setLogger(Logger newLogger) { - if( newLogger == null) { - this.setLogger_((String) null); - return; - } - this.setLogger_(getPropertyStringValueOf(newLogger)); - } - - /** - * Sets EclipseLink logger or custom logger. - * - * @param newLogger - - * Can be a EclipseLink logger literal or - * a fully qualified class name of a custom logger. - */ - public void setLogger(String newLogger) { - if( newLogger == null) { - this.setLogger_(null); - return; - } - Logger l = Logger.getLoggerFor(newLogger); - if(l == null) { // custom Logger class - this.setLogger_(newLogger); - } - else { - this.setLogger(l); - } - } - - private void setLogger_(String newLogger) { - String old = this.logger; - this.logger = newLogger; - this.putProperty(LOGGER_PROPERTY, newLogger); - this.firePropertyChanged(LOGGER_PROPERTY, old, newLogger); - } - - private void loggerChanged(String newValue) { - String old = this.logger; - this.logger = newValue; - this.firePropertyChanged(LOGGER_PROPERTY, old, newValue); - } - - public String getDefaultLogger() { - return DEFAULT_LOGGER; - } - - - // ********** refactoring ************ - - @Override - public Iterable<ReplaceEdit> createRenameTypeEdits(IType originalType, String newName) { - return this.createLoggerRenameTypeEdits(originalType, newName); - } - - protected Iterable<ReplaceEdit> createLoggerRenameTypeEdits(IType originalType, String newName) { - //TODO seems like we should have the Property stored in a SessionCustomizer object instead of having to go - //find all of the Properties from the persistence unit. - PersistenceUnit.Property property = getPersistenceUnit().getProperty(ECLIPSELINK_LOGGER); - if (property != null) { - return property.createRenameTypeEdits(originalType, newName); - } - return EmptyIterable.instance(); - } - - @Override - public Iterable<ReplaceEdit> createMoveTypeEdits(IType originalType, IPackageFragment newPackage) { - return this.createLoggerMoveTypeEdits(originalType, newPackage); - } - - protected Iterable<ReplaceEdit> createLoggerMoveTypeEdits(IType originalType, IPackageFragment newPackage) { - PersistenceUnit.Property property = getPersistenceUnit().getProperty(ECLIPSELINK_LOGGER); - if (property != null) { - return property.createMoveTypeEdits(originalType, newPackage); - } - return EmptyIterable.instance(); - } - - @Override - public Iterable<ReplaceEdit> createRenamePackageEdits(IPackageFragment originalPackage, String newName) { - return this.createLoggerRenamePackageEdits(originalPackage, newName); - } - - protected Iterable<ReplaceEdit> createLoggerRenamePackageEdits(IPackageFragment originalPackage, String newName) { - //find all of the Properties from the persistence unit. - PersistenceUnit.Property property = getPersistenceUnit().getProperty(ECLIPSELINK_LOGGER); - if (property != null) { - return property.createRenamePackageEdits(originalPackage, newName); - } - return EmptyIterable.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/context/persistence/EclipseLinkLogging2_0.java b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/persistence/EclipseLinkLogging2_0.java deleted file mode 100644 index f9620744b3..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/persistence/EclipseLinkLogging2_0.java +++ /dev/null @@ -1,328 +0,0 @@ -/******************************************************************************* -* Copyright (c) 2009, 2011 Oracle. All rights reserved. -* This program and the accompanying materials are made available under the -* terms of the Eclipse Public License v1.0, which accompanies this distribution -* and is available at http://www.eclipse.org/legal/epl-v10.html. -* -* Contributors: -* Oracle - initial API and implementation -*******************************************************************************/ -package org.eclipse.jpt.jpa.eclipselink.core.internal.context.persistence; - -import java.util.HashMap; -import java.util.Map; - -import org.eclipse.jpt.jpa.core.jpa2.context.persistence.PersistenceUnit2_0; -import org.eclipse.jpt.jpa.eclipselink.core.context.persistence.Logging2_0; -import org.eclipse.jpt.jpa.eclipselink.core.context.persistence.LoggingLevel; - -/** - * EclipseLinkLogging2_0 - */ -public class EclipseLinkLogging2_0 extends EclipseLinkLogging - implements Logging2_0 -{ - // ********** EclipseLink properties ********** - - /** - * Store Category levels in a map - * key/value pairs, where: - * key = Category property id - * value = value - */ - private Map<String, LoggingLevel> categoryValues; - - private Boolean connection; - - private LoggingLevel categoriesDefaultValue; - - // ********** constructors ********** - public EclipseLinkLogging2_0(PersistenceUnit2_0 parent) { - super(parent); - } - - // ********** initialization ********** - /** - * Initializes properties with values from the persistence unit. - */ - @Override - protected void initializeProperties() { - super.initializeProperties(); - - this.connection = - this.getBooleanValue(ECLIPSELINK_CONNECTION); - - this.categoriesDefaultValue = - this.getEnumValue(ECLIPSELINK_LEVEL, LoggingLevel.values()); - this.initializeCategory(SQL_CATEGORY_LOGGING_PROPERTY); - this.initializeCategory(TRANSACTION_CATEGORY_LOGGING_PROPERTY); - this.initializeCategory(EVENT_CATEGORY_LOGGING_PROPERTY); - this.initializeCategory(CONNECTION_CATEGORY_LOGGING_PROPERTY); - this.initializeCategory(QUERY_CATEGORY_LOGGING_PROPERTY); - this.initializeCategory(CACHE_CATEGORY_LOGGING_PROPERTY); - this.initializeCategory(PROPAGATION_CATEGORY_LOGGING_PROPERTY); - this.initializeCategory(SEQUENCING_CATEGORY_LOGGING_PROPERTY); - this.initializeCategory(EJB_CATEGORY_LOGGING_PROPERTY); - this.initializeCategory(DMS_CATEGORY_LOGGING_PROPERTY); - this.initializeCategory(EJB_OR_METADATA_CATEGORY_LOGGING_PROPERTY); - this.initializeCategory(METAMODEL_CATEGORY_LOGGING_PROPERTY); - this.initializeCategory(WEAVER_CATEGORY_LOGGING_PROPERTY); - this.initializeCategory(PROPERTIES_CATEGORY_LOGGING_PROPERTY); - this.initializeCategory(SERVER_CATEGORY_LOGGING_PROPERTY); - } - - @Override - protected void initialize() { - super.initialize(); - - this.categoryValues = new HashMap<String, LoggingLevel>(); - } - - /** - * Convenience method to set a logging level category value from the value in the persistence unit. - * - * key = Category property id; value = value (LoggingLevel) - * @param categoryId - Category property id - */ - private void initializeCategory(String categoryId) { - String puKey = this.persistenceUnitKeyOf(categoryId); - LoggingLevel puValue = this.getEnumValue(puKey, LoggingLevel.values()); - - this.categoryValues.put(categoryId, puValue); - } - - // ********** behavior ********** - - @Override - public void propertyValueChanged(String propertyName, String newValue) { - super.propertyValueChanged(propertyName, newValue); - - if (propertyName.equals(ECLIPSELINK_CONNECTION)) { - this.connectionChanged(newValue); - } - else if (propertyName.equals(ECLIPSELINK_SQL_CATEGORY_LOGGING_LEVEL)) { - this.categoryLoggingChanged_(ECLIPSELINK_SQL_CATEGORY_LOGGING_LEVEL, newValue); - } - else if (propertyName.equals(ECLIPSELINK_TRANSACTION_CATEGORY_LOGGING_LEVEL)) { - this.categoryLoggingChanged_(ECLIPSELINK_TRANSACTION_CATEGORY_LOGGING_LEVEL, newValue); - } - else if (propertyName.equals(ECLIPSELINK_EVENT_CATEGORY_LOGGING_LEVEL)) { - this.categoryLoggingChanged_(ECLIPSELINK_EVENT_CATEGORY_LOGGING_LEVEL, newValue); - } - else if (propertyName.equals(ECLIPSELINK_CONNECTION_CATEGORY_LOGGING_LEVEL)) { - this.categoryLoggingChanged_(ECLIPSELINK_CONNECTION_CATEGORY_LOGGING_LEVEL, newValue); - } - else if (propertyName.equals(ECLIPSELINK_QUERY_CATEGORY_LOGGING_LEVEL)) { - this.categoryLoggingChanged_(ECLIPSELINK_QUERY_CATEGORY_LOGGING_LEVEL, newValue); - } - else if (propertyName.equals(ECLIPSELINK_CACHE_CATEGORY_LOGGING_LEVEL)) { - this.categoryLoggingChanged_(ECLIPSELINK_CACHE_CATEGORY_LOGGING_LEVEL, newValue); - } - else if (propertyName.equals(ECLIPSELINK_PROPAGATION_CATEGORY_LOGGING_LEVEL)) { - this.categoryLoggingChanged_(ECLIPSELINK_PROPAGATION_CATEGORY_LOGGING_LEVEL, newValue); - } - else if (propertyName.equals(ECLIPSELINK_SEQUENCING_CATEGORY_LOGGING_LEVEL)) { - this.categoryLoggingChanged_(ECLIPSELINK_SEQUENCING_CATEGORY_LOGGING_LEVEL, newValue); - } - else if (propertyName.equals(ECLIPSELINK_EJB_CATEGORY_LOGGING_LEVEL)) { - this.categoryLoggingChanged_(ECLIPSELINK_EJB_CATEGORY_LOGGING_LEVEL, newValue); - } - else if (propertyName.equals(ECLIPSELINK_DMS_CATEGORY_LOGGING_LEVEL)) { - this.categoryLoggingChanged_(ECLIPSELINK_DMS_CATEGORY_LOGGING_LEVEL, newValue); - } - else if (propertyName.equals(ECLIPSELINK_EJB_OR_METADATA_CATEGORY_LOGGING_LEVEL)) { - this.categoryLoggingChanged_(ECLIPSELINK_EJB_OR_METADATA_CATEGORY_LOGGING_LEVEL, newValue); - } - else if (propertyName.equals(ECLIPSELINK_METAMODEL_CATEGORY_LOGGING_LEVEL)) { - this.categoryLoggingChanged_(ECLIPSELINK_METAMODEL_CATEGORY_LOGGING_LEVEL, newValue); - } - else if (propertyName.equals(ECLIPSELINK_WEAVER_CATEGORY_LOGGING_LEVEL)) { - this.categoryLoggingChanged_(ECLIPSELINK_WEAVER_CATEGORY_LOGGING_LEVEL, newValue); - } - else if (propertyName.equals(ECLIPSELINK_PROPERTIES_CATEGORY_LOGGING_LEVEL)) { - this.categoryLoggingChanged_(ECLIPSELINK_PROPERTIES_CATEGORY_LOGGING_LEVEL, newValue); - } - else if (propertyName.equals(ECLIPSELINK_SERVER_CATEGORY_LOGGING_LEVEL)) { - this.categoryLoggingChanged_(ECLIPSELINK_SERVER_CATEGORY_LOGGING_LEVEL, newValue); - } - } - - @Override - public void propertyRemoved(String propertyName) { - super.propertyRemoved(propertyName); - - if (propertyName.equals(ECLIPSELINK_CONNECTION)) { - this.connectionChanged(null); - } - else if (propertyName.equals(ECLIPSELINK_SQL_CATEGORY_LOGGING_LEVEL)) { - this.categoryLoggingChanged_(ECLIPSELINK_SQL_CATEGORY_LOGGING_LEVEL, null); - } - else if (propertyName.equals(ECLIPSELINK_TRANSACTION_CATEGORY_LOGGING_LEVEL)) { - this.categoryLoggingChanged_(ECLIPSELINK_TRANSACTION_CATEGORY_LOGGING_LEVEL, null); - } - else if (propertyName.equals(ECLIPSELINK_EVENT_CATEGORY_LOGGING_LEVEL)) { - this.categoryLoggingChanged_(ECLIPSELINK_EVENT_CATEGORY_LOGGING_LEVEL, null); - } - else if (propertyName.equals(ECLIPSELINK_CONNECTION_CATEGORY_LOGGING_LEVEL)) { - this.categoryLoggingChanged_(ECLIPSELINK_CONNECTION_CATEGORY_LOGGING_LEVEL, null); - } - else if (propertyName.equals(ECLIPSELINK_QUERY_CATEGORY_LOGGING_LEVEL)) { - this.categoryLoggingChanged_(ECLIPSELINK_QUERY_CATEGORY_LOGGING_LEVEL, null); - } - else if (propertyName.equals(ECLIPSELINK_CACHE_CATEGORY_LOGGING_LEVEL)) { - this.categoryLoggingChanged_(ECLIPSELINK_CACHE_CATEGORY_LOGGING_LEVEL, null); - } - else if (propertyName.equals(ECLIPSELINK_PROPAGATION_CATEGORY_LOGGING_LEVEL)) { - this.categoryLoggingChanged_(ECLIPSELINK_PROPAGATION_CATEGORY_LOGGING_LEVEL, null); - } - else if (propertyName.equals(ECLIPSELINK_SEQUENCING_CATEGORY_LOGGING_LEVEL)) { - this.categoryLoggingChanged_(ECLIPSELINK_SEQUENCING_CATEGORY_LOGGING_LEVEL, null); - } - else if (propertyName.equals(ECLIPSELINK_EJB_CATEGORY_LOGGING_LEVEL)) { - this.categoryLoggingChanged_(ECLIPSELINK_EJB_CATEGORY_LOGGING_LEVEL, null); - } - else if (propertyName.equals(ECLIPSELINK_DMS_CATEGORY_LOGGING_LEVEL)) { - this.categoryLoggingChanged_(ECLIPSELINK_DMS_CATEGORY_LOGGING_LEVEL, null); - } - else if (propertyName.equals(ECLIPSELINK_EJB_OR_METADATA_CATEGORY_LOGGING_LEVEL)) { - this.categoryLoggingChanged_(ECLIPSELINK_EJB_OR_METADATA_CATEGORY_LOGGING_LEVEL, null); - } - else if (propertyName.equals(ECLIPSELINK_METAMODEL_CATEGORY_LOGGING_LEVEL)) { - this.categoryLoggingChanged_(ECLIPSELINK_METAMODEL_CATEGORY_LOGGING_LEVEL, null); - } - else if (propertyName.equals(ECLIPSELINK_WEAVER_CATEGORY_LOGGING_LEVEL)) { - this.categoryLoggingChanged_(ECLIPSELINK_WEAVER_CATEGORY_LOGGING_LEVEL, null); - } - else if (propertyName.equals(ECLIPSELINK_PROPERTIES_CATEGORY_LOGGING_LEVEL)) { - this.categoryLoggingChanged_(ECLIPSELINK_PROPERTIES_CATEGORY_LOGGING_LEVEL, null); - } - else if (propertyName.equals(ECLIPSELINK_SERVER_CATEGORY_LOGGING_LEVEL)) { - this.categoryLoggingChanged_(ECLIPSELINK_SERVER_CATEGORY_LOGGING_LEVEL, null); - } - } - - /** - * Adds property names key/value pairs, where: - * key = EclipseLink property key - * value = property id - */ - @Override - protected void addPropertyNames(Map<String, String> propertyNames) { - super.addPropertyNames(propertyNames); - - propertyNames.put( - ECLIPSELINK_CONNECTION, - CONNECTION_PROPERTY); - propertyNames.put( - ECLIPSELINK_SQL_CATEGORY_LOGGING_LEVEL, - SQL_CATEGORY_LOGGING_PROPERTY); - propertyNames.put( - ECLIPSELINK_TRANSACTION_CATEGORY_LOGGING_LEVEL, - TRANSACTION_CATEGORY_LOGGING_PROPERTY); - propertyNames.put( - ECLIPSELINK_EVENT_CATEGORY_LOGGING_LEVEL, - EVENT_CATEGORY_LOGGING_PROPERTY); - propertyNames.put( - ECLIPSELINK_CONNECTION_CATEGORY_LOGGING_LEVEL, - CONNECTION_CATEGORY_LOGGING_PROPERTY); - propertyNames.put( - ECLIPSELINK_QUERY_CATEGORY_LOGGING_LEVEL, - QUERY_CATEGORY_LOGGING_PROPERTY); - propertyNames.put( - ECLIPSELINK_CACHE_CATEGORY_LOGGING_LEVEL, - CACHE_CATEGORY_LOGGING_PROPERTY); - propertyNames.put( - ECLIPSELINK_PROPAGATION_CATEGORY_LOGGING_LEVEL, - PROPAGATION_CATEGORY_LOGGING_PROPERTY); - propertyNames.put( - ECLIPSELINK_SEQUENCING_CATEGORY_LOGGING_LEVEL, - SEQUENCING_CATEGORY_LOGGING_PROPERTY); - propertyNames.put( - ECLIPSELINK_EJB_CATEGORY_LOGGING_LEVEL, - EJB_CATEGORY_LOGGING_PROPERTY); - propertyNames.put( - ECLIPSELINK_DMS_CATEGORY_LOGGING_LEVEL, - DMS_CATEGORY_LOGGING_PROPERTY); - propertyNames.put( - ECLIPSELINK_EJB_OR_METADATA_CATEGORY_LOGGING_LEVEL, - EJB_OR_METADATA_CATEGORY_LOGGING_PROPERTY); - propertyNames.put( - ECLIPSELINK_METAMODEL_CATEGORY_LOGGING_LEVEL, - METAMODEL_CATEGORY_LOGGING_PROPERTY); - propertyNames.put( - ECLIPSELINK_WEAVER_CATEGORY_LOGGING_LEVEL, - WEAVER_CATEGORY_LOGGING_PROPERTY); - propertyNames.put( - ECLIPSELINK_PROPERTIES_CATEGORY_LOGGING_LEVEL, - PROPERTIES_CATEGORY_LOGGING_PROPERTY); - propertyNames.put( - ECLIPSELINK_SERVER_CATEGORY_LOGGING_LEVEL, - SERVER_CATEGORY_LOGGING_PROPERTY); - } - - // ********** Connection ********** - public Boolean getConnection() { - return this.connection; - } - - public void setConnection(Boolean newConnection) { - Boolean old = this.connection; - this.connection = newConnection; - this.putProperty(CONNECTION_PROPERTY, newConnection); - this.firePropertyChanged(CONNECTION_PROPERTY, old, newConnection); - } - - private void connectionChanged(String stringValue) { - Boolean newValue = getBooleanValueOf(stringValue); - - Boolean old = this.connection; - this.connection = newValue; - this.firePropertyChanged(CONNECTION_PROPERTY, old, newValue); - } - - public Boolean getDefaultConnection() { - return DEFAULT_CONNECTION; - } - - // ********** Category Levels ********** - - public LoggingLevel getLevel(String category) { - - return this.categoryValues.get(category); - } - - public void setLevel(String category, LoggingLevel newLevel) { - LoggingLevel old = this.getLevel(category); - this.categoryValues.put(category, newLevel); - this.putProperty(category, newLevel); - this.firePropertyChanged(category, old, newLevel); - } - - private void categoryLoggingChanged_(String eclipselinkKey, String stringValue) { - String category = this.propertyIdOf(eclipselinkKey); - this.categoryLoggingChanged(category, stringValue); - } - - private void categoryLoggingChanged(String category, String stringValue) { - LoggingLevel enumValue = getEnumValueOf(stringValue, LoggingLevel.values()); - LoggingLevel old = this.getLevel(category); - this.categoryValues.put(category, enumValue); - this.firePropertyChanged(category, old, enumValue); - } - - public LoggingLevel getCategoriesDefaultLevel() { - return (this.categoriesDefaultValue == null) ? super.getDefaultLevel() : this.categoriesDefaultValue; - } - - @Override - public void setLevel(LoggingLevel level) { - super.setLevel(level); - this.setDefaultLevel(level); - } - - public void setDefaultLevel(LoggingLevel level) { - LoggingLevel old = this.categoriesDefaultValue; - this.categoriesDefaultValue = level; - this.firePropertyChanged(CATEGORIES_DEFAULT_LOGGING_PROPERTY, old, level); - } -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/persistence/EclipseLinkOptions.java b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/persistence/EclipseLinkOptions.java deleted file mode 100644 index 6f99ed37f3..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/persistence/EclipseLinkOptions.java +++ /dev/null @@ -1,443 +0,0 @@ -/******************************************************************************* -* Copyright (c) 2008, 2011 Oracle. All rights reserved. -* This program and the accompanying materials are made available under the -* terms of the Eclipse Public License v1.0, which accompanies this distribution -* and is available at http://www.eclipse.org/legal/epl-v10.html. -* -* Contributors: -* Oracle - initial API and implementation -*******************************************************************************/ -package org.eclipse.jpt.jpa.eclipselink.core.internal.context.persistence; - -import java.util.Map; -import org.eclipse.jdt.core.IPackageFragment; -import org.eclipse.jdt.core.IType; -import org.eclipse.jpt.common.utility.internal.iterables.EmptyIterable; -import org.eclipse.jpt.jpa.core.context.persistence.PersistenceUnit; -import org.eclipse.jpt.jpa.eclipselink.core.context.persistence.Options; -import org.eclipse.jpt.jpa.eclipselink.core.context.persistence.TargetDatabase; -import org.eclipse.jpt.jpa.eclipselink.core.context.persistence.TargetServer; -import org.eclipse.text.edits.ReplaceEdit; - -/** - * EclipseLinkOptions - */ -public class EclipseLinkOptions extends EclipseLinkPersistenceUnitProperties - implements Options -{ - // ********** EclipseLink properties ********** - private String sessionName; - private String sessionsXml; - private Boolean includeDescriptorQueries; - private String targetDatabase; // storing EclipseLinkStringValue since value can be TargetDatabase or custom class - private String targetServer; // storing EclipseLinkStringValue since value can be TargetServer or custom class - private String eventListener; - private Boolean temporalMutable; - - - // ********** constructors ********** - public EclipseLinkOptions(PersistenceUnit parent) { - super(parent); - } - - // ********** initialization ********** - /** - * Initializes properties with values from the persistence unit. - */ - @Override - protected void initializeProperties() { - // TOREVIEW - handle incorrect String in persistence.xml - this.sessionName = - this.getStringValue(ECLIPSELINK_SESSION_NAME); - this.sessionsXml = - this.getStringValue(ECLIPSELINK_SESSIONS_XML); - this.includeDescriptorQueries = - this.getBooleanValue(ECLIPSELINK_SESSION_INCLUDE_DESCRIPTOR_QUERIES); - this.targetDatabase = this.getTargetDatabaseFromPersistenceXml(); - this.targetServer = this.getTargetServerFromPersistenceXml(); - this.eventListener = - this.getStringValue(ECLIPSELINK_SESSION_EVENT_LISTENER); - this.temporalMutable = - this.getBooleanValue(ECLIPSELINK_TEMPORAL_MUTABLE); - } - - protected String getTargetDatabaseFromPersistenceXml() { - - String value = this.getStringValue(ECLIPSELINK_TARGET_DATABASE); - if (value == null) { - return null; - } - TargetDatabase standardTargetDatabase = this.getEnumValue(ECLIPSELINK_TARGET_DATABASE, TargetDatabase.values()); - return (standardTargetDatabase == null) ? value : getPropertyStringValueOf(standardTargetDatabase); - } - - protected String getTargetServerFromPersistenceXml() { - - String value = this.getStringValue(ECLIPSELINK_TARGET_SERVER); - if (value == null) { - return null; - } - TargetServer standardTargetServer = this.getEnumValue(ECLIPSELINK_TARGET_SERVER, TargetServer.values()); - return (standardTargetServer == null) ? value : getPropertyStringValueOf(standardTargetServer); - } - - // ********** behavior ********** - - public void propertyValueChanged(String propertyName, String newValue) { - if (propertyName.equals(ECLIPSELINK_SESSION_NAME)) { - this.sessionNameChanged(newValue); - } - else if (propertyName.equals(ECLIPSELINK_SESSIONS_XML)) { - this.sessionsXmlChanged(newValue); - } - else if (propertyName.equals(ECLIPSELINK_TARGET_DATABASE)) { - this.targetDatabaseChanged(newValue); - } - else if (propertyName.equals(ECLIPSELINK_TARGET_SERVER)) { - this.targetServerChanged(newValue); - } - else if (propertyName.equals(ECLIPSELINK_SESSION_INCLUDE_DESCRIPTOR_QUERIES)) { - this.includeDescriptorQueriesChanged(newValue); - } - else if (propertyName.equals(ECLIPSELINK_SESSION_EVENT_LISTENER)) { - this.eventListenerChanged(newValue); - } - else if (propertyName.equals(ECLIPSELINK_TEMPORAL_MUTABLE)) { - this.temporalMutableChanged(newValue); - } - } - - public void propertyRemoved(String propertyName) { - if (propertyName.equals(ECLIPSELINK_SESSION_NAME)) { - this.sessionNameChanged(null); - } - else if (propertyName.equals(ECLIPSELINK_SESSIONS_XML)) { - this.sessionsXmlChanged(null); - } - else if (propertyName.equals(ECLIPSELINK_TARGET_DATABASE)) { - this.targetDatabaseChanged(null); - } - else if (propertyName.equals(ECLIPSELINK_TARGET_SERVER)) { - this.targetServerChanged(null); - } - else if (propertyName.equals(ECLIPSELINK_SESSION_INCLUDE_DESCRIPTOR_QUERIES)) { - this.includeDescriptorQueriesChanged(null); - } - else if (propertyName.equals(ECLIPSELINK_SESSION_EVENT_LISTENER)) { - this.eventListenerChanged(null); - } - else if (propertyName.equals(ECLIPSELINK_TEMPORAL_MUTABLE)) { - this.temporalMutableChanged(null); - } - } - - /** - * Adds property names key/value pairs, where: - * key = EclipseLink property key - * value = property id - */ - @Override - protected void addPropertyNames(Map<String, String> propertyNames) { - propertyNames.put( - ECLIPSELINK_SESSION_NAME, - SESSION_NAME_PROPERTY); - propertyNames.put( - ECLIPSELINK_SESSIONS_XML, - SESSIONS_XML_PROPERTY); - propertyNames.put( - ECLIPSELINK_SESSION_INCLUDE_DESCRIPTOR_QUERIES, - SESSION_INCLUDE_DESCRIPTOR_QUERIES_PROPERTY); - propertyNames.put( - ECLIPSELINK_TARGET_DATABASE, - TARGET_DATABASE_PROPERTY); - propertyNames.put( - ECLIPSELINK_TARGET_SERVER, - TARGET_SERVER_PROPERTY); - propertyNames.put( - ECLIPSELINK_SESSION_EVENT_LISTENER, - SESSION_EVENT_LISTENER_PROPERTY); - propertyNames.put( - ECLIPSELINK_TEMPORAL_MUTABLE, - TEMPORAL_MUTABLE_PROPERTY); - } - - - // ********** SessionName ********** - public String getSessionName() { - return this.sessionName; - } - - public void setSessionName(String newSessionName) { - String old = this.sessionName; - this.sessionName = newSessionName; - this.putProperty(SESSION_NAME_PROPERTY, newSessionName); - this.firePropertyChanged(SESSION_NAME_PROPERTY, old, newSessionName); - } - - private void sessionNameChanged(String newValue) { - String old = this.sessionName; - this.sessionName = newValue; - this.firePropertyChanged(SESSION_NAME_PROPERTY, old, newValue); - } - - public String getDefaultSessionName() { - return DEFAULT_SESSION_NAME; - } - - // ********** SessionsXml ********** - public String getSessionsXml() { - return this.sessionsXml; - } - - public void setSessionsXml(String newSessionsXml) { - String old = this.sessionsXml; - this.sessionsXml = newSessionsXml; - this.putProperty(SESSIONS_XML_PROPERTY, newSessionsXml); - this.firePropertyChanged(SESSIONS_XML_PROPERTY, old, newSessionsXml); - } - - private void sessionsXmlChanged(String newValue) { - String old = this.sessionsXml; - this.sessionsXml = newValue; - this.firePropertyChanged(SESSIONS_XML_PROPERTY, old, newValue); - } - - public String getDefaultSessionsXml() { - return DEFAULT_SESSIONS_XML; - } - - // ********** IncludeDescriptorQueries ********** - public Boolean getIncludeDescriptorQueries() { - return this.includeDescriptorQueries; - } - - public void setIncludeDescriptorQueries(Boolean newIncludeDescriptorQueries) { - Boolean old = this.includeDescriptorQueries; - this.includeDescriptorQueries = newIncludeDescriptorQueries; - this.putProperty(SESSION_INCLUDE_DESCRIPTOR_QUERIES_PROPERTY, newIncludeDescriptorQueries); - this.firePropertyChanged(SESSION_INCLUDE_DESCRIPTOR_QUERIES_PROPERTY, old, newIncludeDescriptorQueries); - } - - private void includeDescriptorQueriesChanged(String stringValue) { - Boolean newValue = getBooleanValueOf(stringValue); - - Boolean old = this.includeDescriptorQueries; - this.includeDescriptorQueries = newValue; - this.firePropertyChanged(SESSION_INCLUDE_DESCRIPTOR_QUERIES_PROPERTY, old, newValue); - } - - public Boolean getDefaultIncludeDescriptorQueries() { - return DEFAULT_SESSION_INCLUDE_DESCRIPTOR_QUERIES; - } - - // ********** TargetDatabase ********** - /** - * Returns TargetDatabase or custom targetDatabase class. - * - * @return EclipseLink string value for TargetDatabase enum or custom targetDatabase class - */ - public String getTargetDatabase() { - return this.targetDatabase; - } - - /** - * Sets EclipseLink targetDatabase. - * - * @param newTargetDatabase - TargetDatabase - */ - public void setTargetDatabase(TargetDatabase newTargetDatabase) { - if( newTargetDatabase == null) { - this.setTargetDatabase_((String) null); - return; - } - this.setTargetDatabase_(getPropertyStringValueOf(newTargetDatabase)); - } - - /** - * Sets EclipseLink targetDatabase or custom targetDatabase. - * - * @param newTargetDatabase - - * Can be a EclipseLink TargetDatabase literal or - * a fully qualified class name of a custom targetDatabase. - */ - public void setTargetDatabase(String newTargetDatabase) { - if( newTargetDatabase == null) { - this.setTargetDatabase_((String) null); - return; - } - TargetDatabase customTargetDatabase = TargetDatabase.getTargetDatabaseFor(newTargetDatabase); - if(customTargetDatabase == null) { // custom TargetDatabase class - this.setTargetDatabase_(newTargetDatabase); - } - else { - this.setTargetDatabase(customTargetDatabase); - } - } - - private void setTargetDatabase_(String newTargetDatabase) { - String old = this.targetDatabase; - this.targetDatabase = newTargetDatabase; - this.putProperty(TARGET_DATABASE_PROPERTY, newTargetDatabase); - this.firePropertyChanged(TARGET_DATABASE_PROPERTY, old, newTargetDatabase); - } - - private void targetDatabaseChanged(String newValue) { - String old = this.targetDatabase; - this.targetDatabase = newValue; - this.firePropertyChanged(TARGET_DATABASE_PROPERTY, old, newValue); - } - - public String getDefaultTargetDatabase() { - return DEFAULT_TARGET_DATABASE; - } - - // ********** TargetServer ********** - /** - * Returns TargetServer or custom targetServer class. - * - * @return EclipseLink string value for TargetServer enum or custom targetServer class - */ - public String getTargetServer() { - return this.targetServer; - } - - /** - * Sets EclipseLink targetServer. - * - * @param newTargetServer - TargetServer - */ - public void setTargetServer(TargetServer newTargetServer) { - if( newTargetServer == null) { - this.setTargetServer_((String) null); - return; - } - this.setTargetServer_(getPropertyStringValueOf(newTargetServer)); - } - - /** - * Sets EclipseLink targetServer or custom targetServer. - * - * @param newTargetServer - - * Can be a EclipseLink TargetServer literal or - * a fully qualified class name of a custom targetServer. - */ - public void setTargetServer(String newTargetServer) { - if( newTargetServer == null) { - this.setTargetServer_((String) null); - return; - } - TargetServer customTargetServer = TargetServer.getTargetServerFor(newTargetServer); - if(customTargetServer == null) { // custom TargetServer class - this.setTargetServer_(newTargetServer); - } - else { - this.setTargetServer(customTargetServer); - } - } - - private void setTargetServer_(String newTargetServer) { - String old = this.targetServer; - this.targetServer = newTargetServer; - this.putProperty(TARGET_SERVER_PROPERTY, newTargetServer); - this.firePropertyChanged(TARGET_SERVER_PROPERTY, old, newTargetServer); - } - - private void targetServerChanged(String newValue) { - String old = this.targetServer; - this.targetServer = newValue; - this.firePropertyChanged(TARGET_SERVER_PROPERTY, old, newValue); - } - - public String getDefaultTargetServer() { - return DEFAULT_TARGET_SERVER; - } - - // ********** EventListener ********** - public String getEventListener() { - return this.eventListener; - } - - public void setEventListener(String newEventListener) { - String old = this.eventListener; - this.eventListener = newEventListener; - this.putProperty(SESSION_EVENT_LISTENER_PROPERTY, newEventListener); - this.firePropertyChanged(SESSION_EVENT_LISTENER_PROPERTY, old, newEventListener); - } - - private void eventListenerChanged(String newValue) { - String old = this.eventListener; - this.eventListener = newValue; - this.firePropertyChanged(SESSION_EVENT_LISTENER_PROPERTY, old, newValue); - } - - public String getDefaultEventListener() { - return DEFAULT_SESSION_EVENT_LISTENER; - } - - // ********** TemporalMutable ********** - - public Boolean getTemporalMutable() { - return this.temporalMutable; - } - - public void setTemporalMutable(Boolean newTemporalMutable) { - Boolean old = this.temporalMutable; - this.temporalMutable = newTemporalMutable; - this.putProperty(TEMPORAL_MUTABLE_PROPERTY, newTemporalMutable); - this.firePropertyChanged(TEMPORAL_MUTABLE_PROPERTY, old, newTemporalMutable); - } - - private void temporalMutableChanged(String stringValue) { - Boolean newValue = getBooleanValueOf(stringValue); - - Boolean old = this.temporalMutable; - this.temporalMutable = newValue; - this.firePropertyChanged(TEMPORAL_MUTABLE_PROPERTY, old, newValue); - } - - public Boolean getDefaultTemporalMutable() { - return DEFAULT_TEMPORAL_MUTABLE; - } - - - // ********** refactoring ************ - - @Override - public Iterable<ReplaceEdit> createRenameTypeEdits(IType originalType, String newName) { - return this.createEventListenerRenameTypeEdits(originalType, newName); - } - - protected Iterable<ReplaceEdit> createEventListenerRenameTypeEdits(IType originalType, String newName) { - PersistenceUnit.Property property = getPersistenceUnit().getProperty(ECLIPSELINK_SESSION_EVENT_LISTENER); - if (property != null) { - return property.createRenameTypeEdits(originalType, newName); - } - return EmptyIterable.instance(); - } - - @Override - public Iterable<ReplaceEdit> createMoveTypeEdits(IType originalType, IPackageFragment newPackage) { - return this.createEventListenerMoveTypeEdits(originalType, newPackage); - } - - protected Iterable<ReplaceEdit> createEventListenerMoveTypeEdits(IType originalType, IPackageFragment newPackage) { - PersistenceUnit.Property property = getPersistenceUnit().getProperty(ECLIPSELINK_SESSION_EVENT_LISTENER); - if (property != null) { - return property.createMoveTypeEdits(originalType, newPackage); - } - return EmptyIterable.instance(); - } - - @Override - public Iterable<ReplaceEdit> createRenamePackageEdits(IPackageFragment originalPackage, String newName) { - return this.createEventListenerRenamePackageEdits(originalPackage, newName); - } - - protected Iterable<ReplaceEdit> createEventListenerRenamePackageEdits(IPackageFragment originalPackage, String newName) { - PersistenceUnit.Property property = getPersistenceUnit().getProperty(ECLIPSELINK_SESSION_EVENT_LISTENER); - if (property != null) { - return property.createRenamePackageEdits(originalPackage, newName); - } - return EmptyIterable.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/context/persistence/EclipseLinkOptions2_0.java b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/persistence/EclipseLinkOptions2_0.java deleted file mode 100644 index 179b04a8c0..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/persistence/EclipseLinkOptions2_0.java +++ /dev/null @@ -1,345 +0,0 @@ -/******************************************************************************* -* Copyright (c) 2009, 2011 Oracle. All rights reserved. -* This program and the accompanying materials are made available under the -* terms of the Eclipse Public License v1.0, which accompanies this distribution -* and is available at http://www.eclipse.org/legal/epl-v10.html. -* -* Contributors: -* Oracle - initial API and implementation -*******************************************************************************/ -package org.eclipse.jpt.jpa.eclipselink.core.internal.context.persistence; - -import java.util.List; -import java.util.Map; -import org.eclipse.jpt.common.utility.internal.iterables.ListIterable; -import org.eclipse.jpt.common.utility.internal.iterables.LiveCloneListIterable; -import org.eclipse.jpt.jpa.core.jpa2.context.persistence.PersistenceUnit2_0; -import org.eclipse.jpt.jpa.eclipselink.core.context.persistence.Options2_0; - -/** - * EclipseLinkOptions2_0 - */ -public class EclipseLinkOptions2_0 extends EclipseLinkOptions - implements Options2_0 -{ - // ********** GenericConnection properties ********** - private Integer lockTimeout; - private Integer queryTimeout; - private List<String> validationGroupPrePersists; - private List<String> validationGroupPreUpdates; - private List<String> validationGroupPreRemoves; - - // ********** constructors ********** - public EclipseLinkOptions2_0(PersistenceUnit2_0 parent) { - super(parent); - } - - // ********** initialization ********** - /** - * Initializes properties with values from the persistence unit. - */ - @Override - protected void initializeProperties() { - super.initializeProperties(); - - this.lockTimeout = - this.getIntegerValue(PERSISTENCE_LOCK_TIMEOUT); - this.queryTimeout = - this.getIntegerValue(PERSISTENCE_QUERY_TIMEOUT); - - // ValidationMode is initialized with the persistence unit element - this.validationGroupPrePersists = this.getCompositeValue(PERSISTENCE_VALIDATION_GROUP_PRE_PERSIST); - this.validationGroupPreUpdates = this.getCompositeValue(PERSISTENCE_VALIDATION_GROUP_PRE_UPDATE); - this.validationGroupPreRemoves = this.getCompositeValue(PERSISTENCE_VALIDATION_GROUP_PRE_REMOVE); - } - - // ********** behavior ********** - - @Override - public void propertyValueChanged(String propertyName, String newValue) { - super.propertyValueChanged(propertyName, newValue); - - if (propertyName.equals(PERSISTENCE_LOCK_TIMEOUT)) { - this.lockTimeoutChanged(newValue); - } - else if (propertyName.equals(PERSISTENCE_QUERY_TIMEOUT)) { - this.queryTimeoutChanged(newValue); - } - else if (propertyName.equals(PERSISTENCE_VALIDATION_GROUP_PRE_PERSIST)) { - this.validationGroupPrePersistsChanged(); - } - else if (propertyName.equals(PERSISTENCE_VALIDATION_GROUP_PRE_UPDATE)) { - this.validationGroupPreUpdatesChanged(); - } - else if (propertyName.equals(PERSISTENCE_VALIDATION_GROUP_PRE_REMOVE)) { - this.validationGroupPreRemovesChanged(); - } - } - - @Override - public void propertyRemoved(String propertyName) { - super.propertyRemoved(propertyName); - - if (propertyName.equals(PERSISTENCE_LOCK_TIMEOUT)) { - this.lockTimeoutChanged(null); - } - else if (propertyName.equals(PERSISTENCE_QUERY_TIMEOUT)) { - this.queryTimeoutChanged(null); - } - else if (propertyName.equals(PERSISTENCE_VALIDATION_GROUP_PRE_PERSIST)) { - this.validationGroupPrePersistsChanged(); - } - else if (propertyName.equals(PERSISTENCE_VALIDATION_GROUP_PRE_UPDATE)) { - this.validationGroupPreUpdatesChanged(); - } - else if (propertyName.equals(PERSISTENCE_VALIDATION_GROUP_PRE_REMOVE)) { - this.validationGroupPreRemovesChanged(); - } - } - - /** - * Adds property names key/value pairs, where: - * key = PU property key - * value = property id - */ - @Override - protected void addPropertyNames(Map<String, String> propertyNames) { - super.addPropertyNames(propertyNames); - - propertyNames.put( - PERSISTENCE_LOCK_TIMEOUT, - LOCK_TIMEOUT_PROPERTY); - propertyNames.put( - PERSISTENCE_QUERY_TIMEOUT, - QUERY_TIMEOUT_PROPERTY); - propertyNames.put( - PERSISTENCE_VALIDATION_GROUP_PRE_PERSIST, - VALIDATION_GROUP_PRE_PERSIST_PROPERTY); - propertyNames.put( - PERSISTENCE_VALIDATION_GROUP_PRE_UPDATE, - VALIDATION_GROUP_PRE_UPDATE_PROPERTY); - propertyNames.put( - PERSISTENCE_VALIDATION_GROUP_PRE_REMOVE, - VALIDATION_GROUP_PRE_REMOVE_PROPERTY); - } - - @Override - public PersistenceUnit2_0 getPersistenceUnit() { - return (PersistenceUnit2_0) super.getPersistenceUnit(); - } - - // ********** LockTimeout ********** - public Integer getLockTimeout() { - return this.lockTimeout; - } - - public void setLockTimeout(Integer newLockTimeout) { - Integer old = this.lockTimeout; - this.lockTimeout = newLockTimeout; - this.putProperty(LOCK_TIMEOUT_PROPERTY, newLockTimeout); - this.firePropertyChanged(LOCK_TIMEOUT_PROPERTY, old, newLockTimeout); - } - - private void lockTimeoutChanged(String stringValue) { - Integer newValue = getIntegerValueOf(stringValue); - - Integer old = this.lockTimeout; - this.lockTimeout = newValue; - this.firePropertyChanged(LOCK_TIMEOUT_PROPERTY, old, newValue); - } - - public Integer getDefaultLockTimeout() { - return DEFAULT_LOCK_TIMEOUT; - } - - // ********** QueryTimeout ********** - public Integer getQueryTimeout() { - return this.queryTimeout; - } - - public void setQueryTimeout(Integer newQueryTimeout) { - Integer old = this.queryTimeout; - this.queryTimeout = newQueryTimeout; - this.putProperty(QUERY_TIMEOUT_PROPERTY, newQueryTimeout); - this.firePropertyChanged(QUERY_TIMEOUT_PROPERTY, old, newQueryTimeout); - } - - private void queryTimeoutChanged(String stringValue) { - Integer newValue = getIntegerValueOf(stringValue); - - Integer old = this.queryTimeout; - this.queryTimeout = newValue; - this.firePropertyChanged(QUERY_TIMEOUT_PROPERTY, old, newValue); - } - - public Integer getDefaultQueryTimeout() { - return DEFAULT_QUERY_TIMEOUT; - } - - - // ********** ValidationGroupPrePersists ********** - - public ListIterable<String> getValidationGroupPrePersists(){ - return new LiveCloneListIterable<String>(this.validationGroupPrePersists); - } - - public int getValidationGroupPrePersistsSize(){ - return this.validationGroupPrePersists.size(); - } - - public boolean validationGroupPrePersistExists(String validationGroupPrePersistClassName) { - - for (String validationGroupPrePersist : this.validationGroupPrePersists) { - if(validationGroupPrePersist.equals(validationGroupPrePersistClassName)) { - return true; - } - } - return false; - } - - public String addValidationGroupPrePersist(String newPrePersistClassName){ - - if( ! this.validationGroupPrePersistExists(newPrePersistClassName)) { - this.validationGroupPrePersists.add(newPrePersistClassName); - this.putPropertyCompositeValue(VALIDATION_GROUP_PRE_PERSIST_PROPERTY, newPrePersistClassName); - this.fireListChanged(VALIDATION_GROUP_PRE_PERSIST_LIST, this.validationGroupPrePersists); - return newPrePersistClassName; - } - return null; - } - - public void removeValidationGroupPrePersist(String className){ - - if(this.removeValidationGroupPrePersist_(className) != null) { - this.removePropertyCompositeValue(VALIDATION_GROUP_PRE_PERSIST_PROPERTY, className); - this.fireListChanged(VALIDATION_GROUP_PRE_PERSIST_LIST, this.validationGroupPrePersists); - } - } - - private String removeValidationGroupPrePersist_(String className){ - - for (String validationGroupPrePersist : this.getValidationGroupPrePersists()) { - if(validationGroupPrePersist.equals(className)) { - this.validationGroupPrePersists.remove(validationGroupPrePersist); - return validationGroupPrePersist; - } - } - return null; - } - - private void validationGroupPrePersistsChanged() { - this.validationGroupPrePersists = this.getCompositeValue(PERSISTENCE_VALIDATION_GROUP_PRE_PERSIST); - this.fireListChanged(VALIDATION_GROUP_PRE_PERSIST_LIST, this.validationGroupPrePersists); - } - - // ********** ValidationGroupPreUpdates ********** - - public ListIterable<String> getValidationGroupPreUpdates(){ - return new LiveCloneListIterable<String>(this.validationGroupPreUpdates); - } - - public int getValidationGroupPreUpdatesSize(){ - return this.validationGroupPreUpdates.size(); - } - - public boolean validationGroupPreUpdateExists(String validationGroupPreUpdateClassName) { - - for (String validationGroupPreUpdate : this.validationGroupPreUpdates) { - if(validationGroupPreUpdate.equals(validationGroupPreUpdateClassName)) { - return true; - } - } - return false; - } - - public String addValidationGroupPreUpdate(String newPreUpdateClassName){ - - if( ! this.validationGroupPreUpdateExists(newPreUpdateClassName)) { - this.validationGroupPreUpdates.add(newPreUpdateClassName); - this.putPropertyCompositeValue(VALIDATION_GROUP_PRE_UPDATE_PROPERTY, newPreUpdateClassName); - this.fireListChanged(VALIDATION_GROUP_PRE_UPDATE_LIST, this.validationGroupPreUpdates); - return newPreUpdateClassName; - } - return null; - } - - public void removeValidationGroupPreUpdate(String className){ - - if(this.removeValidationGroupPreUpdate_(className) != null) { - this.removePropertyCompositeValue(VALIDATION_GROUP_PRE_UPDATE_PROPERTY, className); - this.fireListChanged(VALIDATION_GROUP_PRE_UPDATE_LIST, this.validationGroupPreUpdates); - } - } - - private String removeValidationGroupPreUpdate_(String className){ - - for(String validationGroupPreUpdate : this.getValidationGroupPreUpdates()) { - if(validationGroupPreUpdate.equals(className)) { - this.validationGroupPreUpdates.remove(validationGroupPreUpdate); - return validationGroupPreUpdate; - } - } - return null; - } - - private void validationGroupPreUpdatesChanged() { - this.validationGroupPreUpdates = this.getCompositeValue(PERSISTENCE_VALIDATION_GROUP_PRE_UPDATE); - this.fireListChanged(VALIDATION_GROUP_PRE_UPDATE_LIST, this.validationGroupPreUpdates); - } - - // ********** ValidationGroupPreRemoves ********** - - public ListIterable<String> getValidationGroupPreRemoves(){ - return new LiveCloneListIterable<String>(this.validationGroupPreRemoves); - } - - public int getValidationGroupPreRemovesSize(){ - return this.validationGroupPreRemoves.size(); - } - - public boolean validationGroupPreRemoveExists(String validationGroupPreRemoveClassName) { - - for (String validationGroupPreRemove : this.validationGroupPreRemoves) { - if(validationGroupPreRemove.equals(validationGroupPreRemoveClassName)) { - return true; - } - } - return false; - } - - public String addValidationGroupPreRemove(String newPreRemoveClassName){ - - if( ! this.validationGroupPreRemoveExists(newPreRemoveClassName)) { - this.validationGroupPreRemoves.add(newPreRemoveClassName); - this.putPropertyCompositeValue(VALIDATION_GROUP_PRE_REMOVE_PROPERTY, newPreRemoveClassName); - this.fireListChanged(VALIDATION_GROUP_PRE_REMOVE_LIST, this.validationGroupPreRemoves); - return newPreRemoveClassName; - } - return null; - } - - public void removeValidationGroupPreRemove(String className){ - - if(this.removeValidationGroupPreRemove_(className) != null) { - this.removePropertyCompositeValue(VALIDATION_GROUP_PRE_REMOVE_PROPERTY, className); - this.fireListChanged(VALIDATION_GROUP_PRE_REMOVE_LIST, this.validationGroupPreRemoves); - } - } - - private String removeValidationGroupPreRemove_(String className){ - - for(String validationGroupPreRemove : this.getValidationGroupPreRemoves()) { - if(validationGroupPreRemove.equals(className)) { - this.validationGroupPreRemoves.remove(validationGroupPreRemove); - return validationGroupPreRemove; - } - } - return null; - } - - private void validationGroupPreRemovesChanged() { - this.validationGroupPreRemoves = this.getCompositeValue(PERSISTENCE_VALIDATION_GROUP_PRE_REMOVE); - this.fireListChanged(VALIDATION_GROUP_PRE_REMOVE_LIST, this.validationGroupPreRemoves); - } - -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/persistence/EclipseLinkPersistenceUnitProperties.java b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/persistence/EclipseLinkPersistenceUnitProperties.java deleted file mode 100644 index 1888f71619..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/persistence/EclipseLinkPersistenceUnitProperties.java +++ /dev/null @@ -1,55 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2008, 2011 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - *******************************************************************************/ -package org.eclipse.jpt.jpa.eclipselink.core.internal.context.persistence; - -import java.util.Set; -import org.eclipse.jpt.common.utility.internal.CollectionTools; -import org.eclipse.jpt.jpa.core.context.persistence.PersistenceUnit; -import org.eclipse.jpt.jpa.core.internal.context.persistence.AbstractPersistenceUnitProperties; - -/** - * EclipseLinkPersistenceUnitProperties - * - * Listens to the propertyListAdapter - */ -public abstract class EclipseLinkPersistenceUnitProperties extends AbstractPersistenceUnitProperties -{ - // ********** constructors ********** - protected EclipseLinkPersistenceUnitProperties(PersistenceUnit parent) { - super(parent); - } - - // ******** Convenience methods ******** - - protected Set<PersistenceUnit.Property> getPropertiesSetWithPrefix(String keyPrefix) { - return CollectionTools.set(this.getPersistenceUnit().getPropertiesWithNamePrefix(keyPrefix)); - } - - /** - * Extracts the entityName of the specified property name. If the property name - * has no suffix, return an empty string. - */ - protected String extractEntityNameOf(PersistenceUnit.Property property) { - return extractEntityNameOf(property.getName()); - } - - /** - * Extracts the entityName of the specified string. If the string - * has no suffix, return an empty string. - */ - protected String extractEntityNameOf(String propertyName) { - int index = propertyName.lastIndexOf('.'); - if (index == -1) { - return ""; //$NON-NLS-1$ - } - return propertyName.substring(index + 1); - } - -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/persistence/EclipseLinkPersistenceXmlContextNodeFactory.java b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/persistence/EclipseLinkPersistenceXmlContextNodeFactory.java deleted file mode 100644 index dccd625f54..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/persistence/EclipseLinkPersistenceXmlContextNodeFactory.java +++ /dev/null @@ -1,48 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2009, 2011 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.eclipselink.core.internal.context.persistence; - -import org.eclipse.jpt.jpa.core.context.persistence.JarFileRef; -import org.eclipse.jpt.jpa.core.context.persistence.Persistence; -import org.eclipse.jpt.jpa.core.context.persistence.PersistenceUnit; -import org.eclipse.jpt.jpa.core.context.persistence.PersistenceUnitProperties; -import org.eclipse.jpt.jpa.core.internal.context.persistence.AbstractPersistenceXmlContextNodeFactory; -import org.eclipse.jpt.jpa.core.resource.persistence.XmlJarFileRef; -import org.eclipse.jpt.jpa.core.resource.persistence.XmlPersistenceUnit; -import org.eclipse.jpt.jpa.eclipselink.core.context.persistence.EclipseLinkPersistenceUnit; - - -public class EclipseLinkPersistenceXmlContextNodeFactory - extends AbstractPersistenceXmlContextNodeFactory - implements org.eclipse.jpt.jpa.eclipselink.core.context.persistence.EclipseLinkPersistenceXmlContextNodeFactory -{ - - @Override - public PersistenceUnit buildPersistenceUnit(Persistence parent, XmlPersistenceUnit xmlPersistenceUnit) { - return new EclipseLinkPersistenceUnit(parent, xmlPersistenceUnit); - } - - @Override - public JarFileRef buildJarFileRef(PersistenceUnit parent, XmlJarFileRef xmlJarFileRef) { - return new EclipseLinkJarFileRef(parent, xmlJarFileRef); - } - - public PersistenceUnitProperties buildConnection(PersistenceUnit parent) { - return new EclipseLinkConnection(parent); - } - - public PersistenceUnitProperties buildOptions(PersistenceUnit parent) { - return new EclipseLinkOptions(parent); - } - - public PersistenceUnitProperties buildLogging(PersistenceUnit parent) { - return new EclipseLinkLogging(parent); - } -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/persistence/EclipseLinkPersistenceXmlDefinition.java b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/persistence/EclipseLinkPersistenceXmlDefinition.java deleted file mode 100644 index e522115f3a..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/persistence/EclipseLinkPersistenceXmlDefinition.java +++ /dev/null @@ -1,53 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2008, 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.eclipselink.core.internal.context.persistence; - -import org.eclipse.emf.ecore.EFactory; -import org.eclipse.jpt.common.core.JptResourceType; -import org.eclipse.jpt.jpa.core.JptJpaCorePlugin; -import org.eclipse.jpt.jpa.core.context.persistence.PersistenceXmlContextNodeFactory; -import org.eclipse.jpt.jpa.core.context.persistence.PersistenceXmlDefinition; -import org.eclipse.jpt.jpa.core.internal.context.persistence.AbstractPersistenceXmlDefinition; -import org.eclipse.jpt.jpa.core.resource.persistence.PersistenceFactory; - -public class EclipseLinkPersistenceXmlDefinition - extends AbstractPersistenceXmlDefinition -{ - // singleton - private static final PersistenceXmlDefinition INSTANCE = new EclipseLinkPersistenceXmlDefinition(); - - /** - * Return the singleton - */ - public static PersistenceXmlDefinition instance() { - return INSTANCE; - } - - - /** - * Enforce singleton usage - */ - private EclipseLinkPersistenceXmlDefinition() { - super(); - } - - public JptResourceType getResourceType() { - return JptJpaCorePlugin.PERSISTENCE_XML_1_0_RESOURCE_TYPE; - } - - public EFactory getResourceNodeFactory() { - return PersistenceFactory.eINSTANCE; - } - - @Override - protected PersistenceXmlContextNodeFactory buildContextNodeFactory() { - return new EclipseLinkPersistenceXmlContextNodeFactory(); - } -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/persistence/EclipseLinkSchemaGeneration.java b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/persistence/EclipseLinkSchemaGeneration.java deleted file mode 100644 index df33932fc6..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/persistence/EclipseLinkSchemaGeneration.java +++ /dev/null @@ -1,231 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2008, 2011 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - *******************************************************************************/ -package org.eclipse.jpt.jpa.eclipselink.core.internal.context.persistence; - -import java.util.Map; -import org.eclipse.jpt.common.utility.internal.StringTools; -import org.eclipse.jpt.jpa.core.context.persistence.PersistenceUnit; -import org.eclipse.jpt.jpa.eclipselink.core.context.persistence.DdlGenerationType; -import org.eclipse.jpt.jpa.eclipselink.core.context.persistence.OutputMode; -import org.eclipse.jpt.jpa.eclipselink.core.context.persistence.SchemaGeneration; - -/** - * EclipseLinkSchemaGeneration encapsulates EclipseLink SchemaGeneration - * properties. - */ -public class EclipseLinkSchemaGeneration - extends EclipseLinkPersistenceUnitProperties implements SchemaGeneration -{ - // ********** EclipseLink properties ********** - - private OutputMode outputMode; - private DdlGenerationType ddlGenerationType; - private String createFileName; - private String dropFileName; - private String applicationLocation; - - // ********** constructors/initialization ********** - - public EclipseLinkSchemaGeneration(PersistenceUnit parent) { - super(parent); - } - - /** - * Initializes properties with values from the persistence unit. - */ - @Override - protected void initializeProperties() { - this.outputMode = - this.getEnumValue(ECLIPSELINK_DDL_GENERATION_OUTPUT_MODE, OutputMode.values()); - this.ddlGenerationType = - this.getEnumValue(ECLIPSELINK_DDL_GENERATION_TYPE, DdlGenerationType.values()); - this.createFileName = - this.getStringValue(ECLIPSELINK_CREATE_FILE_NAME); - this.dropFileName = - this.getStringValue(ECLIPSELINK_DROP_FILE_NAME); - this.applicationLocation = - this.getStringValue(ECLIPSELINK_APPLICATION_LOCATION); - } - - /** - * Adds property names key/value pairs, where: key = EclipseLink property - * key; value = property id - */ - @Override - protected void addPropertyNames(Map<String, String> propertyNames) { - propertyNames.put( - ECLIPSELINK_DDL_GENERATION_OUTPUT_MODE, - OUTPUT_MODE_PROPERTY); - propertyNames.put( - ECLIPSELINK_DDL_GENERATION_TYPE, - DDL_GENERATION_TYPE_PROPERTY); - propertyNames.put( - ECLIPSELINK_CREATE_FILE_NAME, - CREATE_FILE_NAME_PROPERTY); - propertyNames.put( - ECLIPSELINK_DROP_FILE_NAME, - DROP_FILE_NAME_PROPERTY); - propertyNames.put( - ECLIPSELINK_APPLICATION_LOCATION, - APPLICATION_LOCATION_PROPERTY); - } - - // ********** behavior ********** - - public void propertyValueChanged(String propertyName, String newValue) { - if (propertyName.equals(ECLIPSELINK_DDL_GENERATION_OUTPUT_MODE)) { - this.outputModeChanged(newValue); - } - else if (propertyName.equals(ECLIPSELINK_DDL_GENERATION_TYPE)) { - this.ddlGenerationTypeChanged(newValue); - } - else if (propertyName.equals(ECLIPSELINK_CREATE_FILE_NAME)) { - this.createFileNameChanged(newValue); - } - else if (propertyName.equals(ECLIPSELINK_DROP_FILE_NAME)) { - this.dropFileNameChanged(newValue); - } - else if (propertyName.equals(ECLIPSELINK_APPLICATION_LOCATION)) { - this.applicationLocationChanged(newValue); - } - } - - public void propertyRemoved(String propertyName) { - if (propertyName.equals(ECLIPSELINK_DDL_GENERATION_OUTPUT_MODE)) { - this.outputModeChanged(null); - } - else if (propertyName.equals(ECLIPSELINK_DDL_GENERATION_TYPE)) { - this.ddlGenerationTypeChanged(null); - } - else if (propertyName.equals(ECLIPSELINK_CREATE_FILE_NAME)) { - this.createFileNameChanged(null); - } - else if (propertyName.equals(ECLIPSELINK_DROP_FILE_NAME)) { - this.dropFileNameChanged(null); - } - else if (propertyName.equals(ECLIPSELINK_APPLICATION_LOCATION)) { - this.applicationLocationChanged(null); - } - } - - // ********** DdlGenerationType ********** - public DdlGenerationType getDdlGenerationType() { - return this.ddlGenerationType; - } - - public void setDdlGenerationType(DdlGenerationType newDdlGenType) { - DdlGenerationType old = this.ddlGenerationType; - this.ddlGenerationType = newDdlGenType; - this.putProperty(DDL_GENERATION_TYPE_PROPERTY, newDdlGenType); - this.firePropertyChanged(DDL_GENERATION_TYPE_PROPERTY, old, newDdlGenType); - } - - private void ddlGenerationTypeChanged(String stringValue) { - DdlGenerationType newValue = getEnumValueOf(stringValue, DdlGenerationType.values()); - DdlGenerationType old = this.ddlGenerationType; - this.ddlGenerationType = newValue; - this.firePropertyChanged(DDL_GENERATION_TYPE_PROPERTY, old, newValue); - } - - public DdlGenerationType getDefaultDdlGenerationType() { - return DEFAULT_SCHEMA_GENERATION_DDL_GENERATION_TYPE; - } - - // ********** OutputMode ********** - public OutputMode getOutputMode() { - return this.outputMode; - } - - public void setOutputMode(OutputMode newOutputMode) { - OutputMode old = this.outputMode; - this.outputMode = newOutputMode; - this.putProperty(OUTPUT_MODE_PROPERTY, newOutputMode); - this.firePropertyChanged(OUTPUT_MODE_PROPERTY, old, newOutputMode); - } - - private void outputModeChanged(String stringValue) { - OutputMode newValue = getEnumValueOf(stringValue, OutputMode.values()); - OutputMode old = this.outputMode; - this.outputMode = newValue; - this.firePropertyChanged(OUTPUT_MODE_PROPERTY, old, newValue); - } - - public OutputMode getDefaultOutputMode() { - return DEFAULT_SCHEMA_GENERATION_OUTPUT_MODE; - } - - // ********** CreateFileName ********** - public String getCreateFileName() { - return this.createFileName; - } - - public void setCreateFileName(String newCreateFileName) { - String old = this.createFileName; - this.createFileName = newCreateFileName; - this.putProperty(CREATE_FILE_NAME_PROPERTY, newCreateFileName); - this.firePropertyChanged(CREATE_FILE_NAME_PROPERTY, old, newCreateFileName); - } - - private void createFileNameChanged(String newValue) { - String old = this.createFileName; - this.createFileName = newValue; - this.firePropertyChanged(CREATE_FILE_NAME_PROPERTY, old, newValue); - } - - public String getDefaultCreateFileName() { - return DEFAULT_SCHEMA_GENERATION_CREATE_FILE_NAME; - } - - // ********** dropFileName ********** - public String getDropFileName() { - return this.dropFileName; - } - - public void setDropFileName(String newDropFileName) { - String old = this.dropFileName; - this.dropFileName = newDropFileName; - this.putProperty(DROP_FILE_NAME_PROPERTY, newDropFileName); - this.firePropertyChanged(DROP_FILE_NAME_PROPERTY, old, newDropFileName); - } - - private void dropFileNameChanged(String newValue) { - String old = this.dropFileName; - this.dropFileName = newValue; - this.firePropertyChanged(DROP_FILE_NAME_PROPERTY, old, newValue); - } - - public String getDefaultDropFileName() { - return DEFAULT_SCHEMA_GENERATION_DROP_FILE_NAME; - } - - // ********** applicationLocation ********** - public String getApplicationLocation() { - return this.applicationLocation; - } - - public void setApplicationLocation(String newApplicationLocation) { - String old = this.applicationLocation; - this.applicationLocation = (StringTools.stringIsNotEmpty(newApplicationLocation)) ? - newApplicationLocation : - this.getDefaultApplicationLocation(); - this.putProperty(APPLICATION_LOCATION_PROPERTY, this.applicationLocation); - this.firePropertyChanged(APPLICATION_LOCATION_PROPERTY, old, this.applicationLocation); - } - - private void applicationLocationChanged(String newValue) { - String old = this.applicationLocation; - this.applicationLocation = newValue; - this.firePropertyChanged(APPLICATION_LOCATION_PROPERTY, old, newValue); - } - - public String getDefaultApplicationLocation() { - return DEFAULT_SCHEMA_GENERATION_APPLICATION_LOCATION; - } -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/ddlgen/AbstractEclipseLinkDDLGenerator.java b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/ddlgen/AbstractEclipseLinkDDLGenerator.java deleted file mode 100644 index 41965323a5..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/ddlgen/AbstractEclipseLinkDDLGenerator.java +++ /dev/null @@ -1,467 +0,0 @@ -/******************************************************************************* -* Copyright (c) 2008, 2012 Oracle. All rights reserved. -* This program and the accompanying materials are made available under the -* terms of the Eclipse Public License v1.0, which accompanies this distribution -* and is available at http://www.eclipse.org/legal/epl-v10.html. -* -* Contributors: -* Oracle - initial API and implementation -*******************************************************************************/ -package org.eclipse.jpt.jpa.eclipselink.core.internal.ddlgen; - -import java.io.File; -import java.io.FileOutputStream; -import java.io.IOException; -import java.io.OutputStream; -import java.net.URL; -import java.util.ArrayList; -import java.util.Collection; -import java.util.HashSet; -import java.util.List; -import java.util.Properties; - -import org.eclipse.core.resources.IProject; -import org.eclipse.core.runtime.CoreException; -import org.eclipse.core.runtime.FileLocator; -import org.eclipse.core.runtime.IPath; -import org.eclipse.core.runtime.IProgressMonitor; -import org.eclipse.core.runtime.IStatus; -import org.eclipse.core.runtime.Path; -import org.eclipse.core.runtime.Platform; -import org.eclipse.core.runtime.Status; -import org.eclipse.core.runtime.SubMonitor; -import org.eclipse.core.runtime.jobs.Job; -import org.eclipse.jdt.core.JavaCore; -import org.eclipse.jdt.launching.IJavaLaunchConfigurationConstants; -import org.eclipse.jdt.launching.IRuntimeClasspathEntry; -import org.eclipse.jpt.common.core.internal.gen.AbstractJptGenerator; -import org.eclipse.jpt.jpa.core.JpaPlatform; -import org.eclipse.jpt.jpa.core.JpaProject; -import org.eclipse.jpt.jpa.core.context.persistence.PersistenceXmlEnumValue; -import org.eclipse.jpt.jpa.core.internal.JptCoreMessages; -import org.eclipse.jpt.jpa.core.resource.xml.JpaXmlResource; -import org.eclipse.jpt.jpa.db.ConnectionProfile; -import org.eclipse.jpt.jpa.eclipselink.core.JptJpaEclipseLinkCorePlugin; -import org.eclipse.jpt.jpa.eclipselink.core.context.persistence.Connection; -import org.eclipse.jpt.jpa.eclipselink.core.context.persistence.Customization; -import org.eclipse.jpt.jpa.eclipselink.core.context.persistence.DdlGenerationType; -import org.eclipse.jpt.jpa.eclipselink.core.context.persistence.Logging; -import org.eclipse.jpt.jpa.eclipselink.core.context.persistence.LoggingLevel; -import org.eclipse.jpt.jpa.eclipselink.core.context.persistence.OutputMode; -import org.eclipse.jpt.jpa.eclipselink.core.context.persistence.SchemaGeneration; -import org.eclipse.osgi.util.ManifestElement; -import org.eclipse.wst.validation.ValidationFramework; -import org.osgi.framework.Bundle; -import org.osgi.framework.BundleException; - -public abstract class AbstractEclipseLinkDDLGenerator extends AbstractJptGenerator -{ - public static final String LAUNCH_CONFIG_NAME = "Dali EclipseLink Table Generation"; //$NON-NLS-1$ - public static final String DDL_GEN_PACKAGE_NAME = "org.eclipse.jpt.jpa.eclipselink.core.ddlgen"; //$NON-NLS-1$ - public static final String ECLIPSELINK_DDL_GEN_CLASS = DDL_GEN_PACKAGE_NAME + ".Main"; //$NON-NLS-1$ - public static final String ECLIPSELINK_DDL_GEN_JAR_PREFIX = DDL_GEN_PACKAGE_NAME + "_"; //$NON-NLS-1$ - public static final String BUNDLE_CLASSPATH = "Bundle-ClassPath"; //$NON-NLS-1$ - public static final String PROPERTIES_FILE_NAME = "login.properties"; //$NON-NLS-1$ - public static final String TRUE = "true"; //$NON-NLS-1$ - public static final String FALSE = "false"; //$NON-NLS-1$ - public static final String NONE = "NONE"; //$NON-NLS-1$ - private static final String DYNAMIC_PROGRAM_ARGUMENT = "-dynamic"; //$NON-NLS-1$ - - protected final String puName; - protected final JpaProject jpaProject; - protected final OutputMode outputMode; - - // ********** constructors ********** - - protected AbstractEclipseLinkDDLGenerator(String puName, JpaProject jpaProject, OutputMode outputMode) { - super(JavaCore.create(jpaProject.getProject())); - this.puName = puName; - this.jpaProject = jpaProject; - this.outputMode = outputMode; - } - - // ********** overrides ********** - - @Override - protected String getLaunchConfigName() { - return LAUNCH_CONFIG_NAME; - } - - @Override - protected String getMainType() { - return ECLIPSELINK_DDL_GEN_CLASS; - } - - @Override - protected String getBootstrapJarPrefix() { - return ECLIPSELINK_DDL_GEN_JAR_PREFIX; - } - - @Override - protected void preGenerate(IProgressMonitor monitor) { - SubMonitor sm = SubMonitor.convert(monitor, 2); - //disconnect since the runtime provider will need to connect to generate the tables - ConnectionProfile cp = this.getConnectionProfile(); - if (cp != null) { - cp.disconnect(); - sm.worked(1); - } - sm.setWorkRemaining(1); - this.saveLoginProperties(); - sm.worked(1); - } - - @Override - protected void postGenerate() { - super.postGenerate(); - this.reconnect(); - this.validateProject(); - } - - // ********** Setting Launch Configuration ********** - - @Override - protected void specifyProgramArguments() { - StringBuffer programArguments = new StringBuffer(); - this.appendProgramArguments(programArguments); - this.launchConfig.setAttribute(IJavaLaunchConfigurationConstants.ATTR_PROGRAM_ARGUMENTS, programArguments.toString()); - } - - // ********** Main arguments ********** - - protected void appendProgramArguments(StringBuffer programArguments) { - this.appendPuNameArgument(programArguments); - this.appendPropertiesFileArgument(programArguments); - this.appendDebugArgument(programArguments); - this.appendDynamicArgument(programArguments); - } - - private void appendPuNameArgument(StringBuffer sb) { - sb.append(" -pu \""); //$NON-NLS-1$ - sb.append(this.puName); - sb.append("\""); //$NON-NLS-1$ - } - - private void appendPropertiesFileArgument(StringBuffer sb) { - sb.append(" -p \""); //$NON-NLS-1$ - sb.append(this.projectLocation).append("/").append(PROPERTIES_FILE_NAME).append("\""); //$NON-NLS-1$ //$NON-NLS-2$ - } - - protected void appendDynamicArgument(StringBuffer sb) { - if (JptJpaEclipseLinkCorePlugin.nodeIsEclipseLinkVersionCompatible(this.jpaProject, JptJpaEclipseLinkCorePlugin.ECLIPSELINK_PLATFORM_VERSION_2_1)) { - sb.append(' ').append(DYNAMIC_PROGRAM_ARGUMENT); - } - } - - @Override - protected List<String> buildClasspath() throws CoreException { - List<String> classpath = new ArrayList<String>(); - // DDL_GEN jar - classpath.add(this.getBootstrapJarClasspathEntry().getMemento()); - // Default Project classpath - classpath.add(this.getDefaultProjectClasspathEntry().getMemento()); - // Osgi Bundles - classpath.addAll(this.getPersistenceOsgiBundlesMemento()); - // JDBC jar - classpath.add(this.getJdbcJarClasspathEntry().getMemento()); - // System Library - classpath.add(this.getSystemLibraryClasspathEntry().getMemento()); - // meta-inf - if(this.metaInfIsNotOnClasspath()) { - classpath.add(this.getMetaInfClasspathEntry().getMemento()); - } - return classpath; - } - - // ********** behavior ********** - - //reconnect since we disconnected in preGenerate(); - //ensure the project is fully updated before validating - bug 277236 - protected void reconnect() { - ConnectionProfile cp = this.getConnectionProfile(); - if (cp != null) { - cp.connect(); - } - } - - protected void validateProject() { - new ValidateJob(this.jpaProject.getProject()).schedule(); - } - - // ********** ClasspathEntry ********** - - private IRuntimeClasspathEntry getJdbcJarClasspathEntry() { - return getArchiveClasspathEntry(this.buildJdbcJarPath()); - } - - private IRuntimeClasspathEntry getBundleClasspathEntry(String bundleId) { - IPath persistClasspath = this.getBundleClasspath(bundleId); - IRuntimeClasspathEntry bundleEntry = getArchiveClasspathEntry(persistClasspath); - - return bundleEntry; - } - - private IRuntimeClasspathEntry getMetaInfClasspathEntry() { - return getVariableRuntimeClasspathEntry(this.getMetaInfPath()); - } - - // ********** EclipseLink properties ********** - - protected void buildConnectionProperties(Properties properties) { - this.putProperty(properties, - Connection.ECLIPSELINK_BIND_PARAMETERS, - FALSE); - } - - private void buildLoggingProperties(Properties properties) { - this.putProperty(properties, - Logging.ECLIPSELINK_LEVEL, - LoggingLevel.fine); - this.putProperty(properties, - Logging.ECLIPSELINK_TIMESTAMP, - FALSE); - this.putProperty(properties, - Logging.ECLIPSELINK_THREAD, - FALSE); - this.putProperty(properties, - Logging.ECLIPSELINK_SESSION, - FALSE); - this.putProperty(properties, - Logging.ECLIPSELINK_EXCEPTIONS, - TRUE); - } - - protected void buildCustomizationProperties(Properties properties) { - this.putProperty(properties, - Customization.ECLIPSELINK_THROW_EXCEPTIONS, - TRUE); - } - - protected void putProperty(Properties properties, String key, String value) { - properties.put(key, (value == null) ? "" : value); //$NON-NLS-1$ - } - - protected void putProperty(Properties properties, String key, PersistenceXmlEnumValue value) { - this.putProperty(properties, key, this.getPropertyStringValueOf(value)); - } - - /** - * Returns the Property string value of the given property value. - */ - protected String getPropertyStringValueOf(PersistenceXmlEnumValue value) { - if(value == null) { - return null; - } - return value.getPropertyValue(); - } - - protected void buildAllProperties(Properties properties) { - this.buildConnectionProperties(properties); - this.buildConnectionPoolingProperties(properties); - this.buildLoggingProperties(properties); - this.buildCustomizationProperties(properties); - this.buildDDLModeProperties(properties); - this.buildProjectLocationProperty(properties); - } - - // ********** private methods ********** - - private void buildProjectLocationProperty(Properties properties) { - this.putProperty(properties, - SchemaGeneration.ECLIPSELINK_APPLICATION_LOCATION, - this.projectLocation); - } - - private void buildDDLModeProperties(Properties properties) { - this.putProperty(properties, - SchemaGeneration.ECLIPSELINK_DDL_GENERATION_OUTPUT_MODE, - this.outputMode); - - this.putProperty(properties, - SchemaGeneration.ECLIPSELINK_DDL_GENERATION_TYPE, - DdlGenerationType.drop_and_create_tables); - - this.putProperty(properties, - SchemaGeneration.ECLIPSELINK_CREATE_FILE_NAME, - SchemaGeneration.DEFAULT_SCHEMA_GENERATION_CREATE_FILE_NAME); - this.putProperty(properties, - SchemaGeneration.ECLIPSELINK_DROP_FILE_NAME, - SchemaGeneration.DEFAULT_SCHEMA_GENERATION_DROP_FILE_NAME); - } - - private void buildConnectionPoolingProperties(Properties properties) { - this.putProperty(properties, - Connection.ECLIPSELINK_READ_CONNECTIONS_SHARED, - TRUE); - } - - private void saveLoginProperties() { - String propertiesFile = this.projectLocation + "/" + PROPERTIES_FILE_NAME; //$NON-NLS-1$ - - Properties elProperties = new Properties(); - - this.buildAllProperties(elProperties); - FileOutputStream stream = null; - try { - File file = new File(propertiesFile); - if (!file.exists() && ! file.createNewFile()) { - throw new RuntimeException("createNewFile() failed: " + file); //$NON-NLS-1$ - } - stream = new FileOutputStream(file); - elProperties.store(stream, null); - } - catch (Exception e) { - String message = "Error saving: " + propertiesFile; //$NON-NLS-1$ - throw new RuntimeException(message, e); - } - finally { - this.closeStream(stream); - } - } - - private void closeStream(OutputStream stream) { - if (stream != null) { - try { - stream.close(); - } - catch (IOException e) { - throw new RuntimeException(e); - } - } - } - - private IPath getMetaInfPath() { - JpaXmlResource persistenceXmlResource = this.jpaProject.getPersistenceXmlResource(); - IPath persistenceXmlPath = persistenceXmlResource.getFile().getLocation(); - return persistenceXmlPath.removeLastSegments(2); - } - - private boolean metaInfIsNotOnClasspath() { - JpaXmlResource persistenceXmlResource = this.jpaProject.getPersistenceXmlResource(); - return ! this.jpaProject.getJavaProject().isOnClasspath(persistenceXmlResource.getFile()); - } - - /** - * Performs validation after tables have been generated - */ - /* CU private */ class ValidateJob - extends Job - { - private final IProject[] projects; - - ValidateJob(IProject project) { - super(JptCoreMessages.VALIDATE_JOB); - this.projects = new IProject[] {project}; - } - - @Override - protected IStatus run(IProgressMonitor monitor) { - try { - ValidationFramework.getDefault().validate(this.projects, true, false, monitor); - } catch (CoreException ex) { - throw new RuntimeException(ex); - } - return Status.OK_STATUS; - } - } - - private IPath buildJdbcJarPath() { - return new Path(this.getJpaProjectConnectionDriverJarList()); - } - - private String getJpaProjectConnectionDriverJarList() { - ConnectionProfile cp = this.getConnectionProfile(); - return (cp == null) ? "" : cp.getDriverJarList(); //$NON-NLS-1$ - } - - - // ********** Queries ********** - - protected JpaPlatform getPlatform() { - return this.jpaProject.getJpaPlatform(); - } - - protected ConnectionProfile getConnectionProfile() { - return this.jpaProject.getConnectionProfile(); - } - - - // ********** Bundles ********* - - private Collection<String> getPersistenceOsgiBundlesMemento() throws CoreException { - - Collection<String> result = new HashSet<String>(); - if (javaxPersistenceBundleExists()) { - result.add(this.getBundleClasspathEntry(JAVAX_PERSISTENCE_BUNDLE).getMemento()); - result.add(this.getBundleClasspathEntry(ORG_ECLIPSE_PERSISTENCE_CORE_BUNDLE).getMemento()); - result.add(this.getBundleClasspathEntry(ORG_ECLIPSE_PERSISTENCE_ASM_BUNDLE).getMemento()); - result.add(this.getBundleClasspathEntry(ORG_ECLIPSE_PERSISTENCE_ANTLR_BUNDLE).getMemento()); - result.add(this.getBundleClasspathEntry(ORG_ECLIPSE_PERSISTENCE_JPA_BUNDLE).getMemento()); - } - return result; - } - - private IPath getBundleClasspath(String pluginID) { - Bundle bundle = Platform.getBundle(pluginID); - if (bundle == null) { - throw new RuntimeException(pluginID + " cannot be retrieved from the Platform"); //$NON-NLS-1$ - } - return this.getClassPath(bundle); - } - - private IPath getClassPath(Bundle bundle) { - String path = bundle.getHeaders().get(BUNDLE_CLASSPATH); - if (path == null) { - path = "."; //$NON-NLS-1$ - } - ManifestElement[] elements = null; - try { - elements = ManifestElement.parseHeader(BUNDLE_CLASSPATH, path); - } - catch (BundleException e) { - throw new RuntimeException("Error parsing bundle header: " + bundle, e); //$NON-NLS-1$ - } - if (elements != null) { - for (int i = 0; i < elements.length; ++i) { - ManifestElement element = elements[i]; - String value = element.getValue(); - if (".".equals(value)) { //$NON-NLS-1$ - value = "/"; //$NON-NLS-1$ - } - URL url = bundle.getEntry(value); - if (url != null) { - try { - URL resolvedURL = FileLocator.resolve(url); - String filestring = FileLocator.toFileURL(resolvedURL).getFile(); - if (filestring.startsWith("file:")) { //$NON-NLS-1$ - filestring = filestring.substring(filestring.indexOf(':') + 1); - } - if (filestring.endsWith("!/")) { //$NON-NLS-1$ - filestring = filestring.substring(0, filestring.lastIndexOf('!')); - } - File file = new File(filestring); - String filePath = file.getCanonicalPath(); - return new Path(filePath); - } - catch (IOException e) { - throw new RuntimeException("Error locating bundle: " + bundle, e); //$NON-NLS-1$ - } - } - } - } - return null; - } - - private boolean javaxPersistenceBundleExists() { - return Platform.getBundle(JAVAX_PERSISTENCE_BUNDLE) != null; - } - - // ********** constants ********** - - private static final String JAVAX_PERSISTENCE_BUNDLE = "javax.persistence"; //$NON-NLS-1$ - private static final String ORG_ECLIPSE_PERSISTENCE_CORE_BUNDLE = "org.eclipse.persistence.core"; //$NON-NLS-1$ - private static final String ORG_ECLIPSE_PERSISTENCE_ASM_BUNDLE = "org.eclipse.persistence.asm"; //$NON-NLS-1$ - private static final String ORG_ECLIPSE_PERSISTENCE_ANTLR_BUNDLE = "org.eclipse.persistence.antlr"; //$NON-NLS-1$ - private static final String ORG_ECLIPSE_PERSISTENCE_JPA_BUNDLE = "org.eclipse.persistence.jpa"; //$NON-NLS-1$ - -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/ddlgen/EclipseLink2_0DDLGenerator.java b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/ddlgen/EclipseLink2_0DDLGenerator.java deleted file mode 100644 index 3fc9c1f91f..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/ddlgen/EclipseLink2_0DDLGenerator.java +++ /dev/null @@ -1,85 +0,0 @@ -/******************************************************************************* -* Copyright (c) 2009, 2011 Oracle. All rights reserved. -* This program and the accompanying materials are made available under the -* terms of the Eclipse Public License v1.0, which accompanies this distribution -* and is available at http://www.eclipse.org/legal/epl-v10.html. -* -* Contributors: -* Oracle - initial API and implementation -*******************************************************************************/ -package org.eclipse.jpt.jpa.eclipselink.core.internal.ddlgen; - -import java.util.Properties; -import org.eclipse.core.runtime.IProgressMonitor; -import org.eclipse.jpt.jpa.core.JpaProject; -import org.eclipse.jpt.jpa.core.jpa2.context.persistence.connection.JpaConnection2_0; -import org.eclipse.jpt.jpa.db.ConnectionProfile; -import org.eclipse.jpt.jpa.eclipselink.core.context.persistence.Customization; -import org.eclipse.jpt.jpa.eclipselink.core.context.persistence.OutputMode; - -/** - * EclipseLink2_0DLLGenerator launches the EclipseLink DDL generator in a separate VM. - * For this it will create a Java Configuration named "Dali EclipseLink Table Generation" - * in the target workspace (note: the configuration will be overridden at each run). - * It will than launch the configuration created with the login information from - * the current Dali project, and passes it to EclipseLink. - * - * Pre-req in PDE environment: - * org.eclipse.jpt.jpa.eclipselink.core.ddlgen.jar in ECLIPSE_HOME/plugins - */ -public class EclipseLink2_0DDLGenerator extends AbstractEclipseLinkDDLGenerator -{ - static final String VALIDATION_MODE_PROPERTY = "javax.persistence.validation.mode"; //$NON-NLS-1$ - - // ********** constructors ********** - - public static void generate(String puName, JpaProject project, OutputMode outputMode, IProgressMonitor monitor) { - if (puName == null || puName.length() == 0 || project == null) { - throw new NullPointerException(); - } - new EclipseLink2_0DDLGenerator(puName, project, outputMode).generate(monitor); - } - - private EclipseLink2_0DDLGenerator(String puName, JpaProject jpaProject, OutputMode outputMode) { - super(puName, jpaProject, outputMode); - } - - // ********** EclipseLink properties ********** - - @Override - protected void buildAllProperties(Properties properties) { - super.buildAllProperties(properties); - - this.putProperty(properties, - VALIDATION_MODE_PROPERTY, - NONE); - } - - @Override - protected void buildCustomizationProperties(Properties properties) { - super.buildCustomizationProperties(properties); - - this.putProperty(properties, - Customization.ECLIPSELINK_WEAVING, - FALSE); - } - - @Override - protected void buildConnectionProperties(Properties properties) { - super.buildConnectionProperties(properties); - ConnectionProfile cp = this.getConnectionProfile(); - - this.putProperty(properties, - JpaConnection2_0.PERSISTENCE_JDBC_DRIVER, - (cp == null) ? "" : cp.getDriverClassName()); //$NON-NLS-1$ - this.putProperty(properties, - JpaConnection2_0.PERSISTENCE_JDBC_URL, - (cp == null) ? "" : cp.getURL()); //$NON-NLS-1$ - this.putProperty(properties, - JpaConnection2_0.PERSISTENCE_JDBC_USER, - (cp == null) ? "" : cp.getUserName()); //$NON-NLS-1$ - this.putProperty(properties, - JpaConnection2_0.PERSISTENCE_JDBC_PASSWORD, - (cp == null) ? "" : cp.getUserPassword()); //$NON-NLS-1$ - } -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/ddlgen/EclipseLinkDDLGenerator.java b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/ddlgen/EclipseLinkDDLGenerator.java deleted file mode 100644 index 8fa4666e07..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/ddlgen/EclipseLinkDDLGenerator.java +++ /dev/null @@ -1,63 +0,0 @@ -/******************************************************************************* -* Copyright (c) 2008, 2011 Oracle. All rights reserved. -* This program and the accompanying materials are made available under the -* terms of the Eclipse Public License v1.0, which accompanies this distribution -* and is available at http://www.eclipse.org/legal/epl-v10.html. -* -* Contributors: -* Oracle - initial API and implementation -*******************************************************************************/ -package org.eclipse.jpt.jpa.eclipselink.core.internal.ddlgen; - -import java.util.Properties; -import org.eclipse.core.runtime.IProgressMonitor; -import org.eclipse.jpt.jpa.core.JpaProject; -import org.eclipse.jpt.jpa.db.ConnectionProfile; -import org.eclipse.jpt.jpa.eclipselink.core.context.persistence.Connection; -import org.eclipse.jpt.jpa.eclipselink.core.context.persistence.OutputMode; - -/** - * EclipseLinkDLLGenerator launches the EclipseLink DDL generator in a separate VM. - * For this it will create a Java Configuration named "Dali EclipseLink Table Generation" - * in the target workspace (note: the configuration will be overridden at each run). - * It will than launch the configuration created with the login information from - * the current Dali project, and passes it to EclipseLink. - * - * Pre-req in PDE environment: - * org.eclipse.jpt.jpa.eclipselink.core.ddlgen.jar in ECLIPSE_HOME/plugins - */ -public class EclipseLinkDDLGenerator extends AbstractEclipseLinkDDLGenerator -{ - - // ********** constructors ********** - - public static void generate(String puName, JpaProject project, OutputMode outputMode, IProgressMonitor monitor) { - if (puName == null || puName.length() == 0 || project == null) { - throw new NullPointerException(); - } - new EclipseLinkDDLGenerator(puName, project, outputMode).generate(monitor); - } - - private EclipseLinkDDLGenerator(String puName, JpaProject jpaProject, OutputMode outputMode) { - super(puName, jpaProject, outputMode); - } - - @Override - protected void buildConnectionProperties(Properties properties) { - super.buildConnectionProperties(properties); - ConnectionProfile cp = this.getConnectionProfile(); - - this.putProperty(properties, - Connection.ECLIPSELINK_DRIVER, - (cp == null) ? "" : cp.getDriverClassName()); //$NON-NLS-1$ - this.putProperty(properties, - Connection.ECLIPSELINK_URL, - (cp == null) ? "" : cp.getURL()); //$NON-NLS-1$ - this.putProperty(properties, - Connection.ECLIPSELINK_USER, - (cp == null) ? "" : cp.getUserName()); //$NON-NLS-1$ - this.putProperty(properties, - Connection.ECLIPSELINK_PASSWORD, - (cp == null) ? "" : cp.getUserPassword()); //$NON-NLS-1$ - } -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/libval/EclipseLinkEclipseLinkBundlesLibraryValidator.java b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/libval/EclipseLinkEclipseLinkBundlesLibraryValidator.java deleted file mode 100644 index 451eaf1435..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/libval/EclipseLinkEclipseLinkBundlesLibraryValidator.java +++ /dev/null @@ -1,145 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010, 2011 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Oracle - initial API and implementation - *******************************************************************************/ -package org.eclipse.jpt.jpa.eclipselink.core.internal.libval; - -import java.util.HashMap; -import java.util.Map; -import org.eclipse.core.runtime.IStatus; -import org.eclipse.jpt.common.core.libprov.JptLibraryProviderInstallOperationConfig; -import org.eclipse.jpt.jpa.core.internal.libprov.JpaOsgiBundlesLibraryProviderInstallOperationConfig; -import org.eclipse.jpt.jpa.core.internal.libval.AbstractOsgiBundlesLibraryValidator; -import org.eclipse.jpt.jpa.core.platform.JpaPlatformDescription; -import org.eclipse.jpt.jpa.eclipselink.core.platform.EclipseLinkPlatform; -import org.eclipse.osgi.service.resolver.VersionRange; - -public class EclipseLinkEclipseLinkBundlesLibraryValidator - extends AbstractOsgiBundlesLibraryValidator { - - public IStatus validate(JptLibraryProviderInstallOperationConfig config) { - JpaOsgiBundlesLibraryProviderInstallOperationConfig jpaConfig - = (JpaOsgiBundlesLibraryProviderInstallOperationConfig) config; - Map<String, VersionRange[]> bundleVersionRanges = new HashMap<String, VersionRange[]>(); - JpaPlatformDescription platform = jpaConfig.getJpaPlatform(); - if (EclipseLinkPlatform.VERSION_1_0.equals(platform)) { - bundleVersionRanges.put( - "org.eclipse.persistence.core", //$NON-NLS-1$ - new VersionRange[] {new VersionRange("[1.0, 3.0)")}); //$NON-NLS-1$ - bundleVersionRanges.put( - "org.eclipse.persistence.jpa", //$NON-NLS-1$ - new VersionRange[] {new VersionRange("[1.0, 3.0)")}); //$NON-NLS-1$ - bundleVersionRanges.put( - "org.eclipse.persistence.asm", //$NON-NLS-1$ - new VersionRange[] {new VersionRange("[1.0, 3.0)")}); //$NON-NLS-1$ - bundleVersionRanges.put( - "org.eclipse.persistence.antlr", //$NON-NLS-1$ - new VersionRange[] {new VersionRange("[1.0, 3.0)")}); //$NON-NLS-1$ - } - else if (EclipseLinkPlatform.VERSION_1_1.equals(platform)) { - bundleVersionRanges.put( - "org.eclipse.persistence.core", //$NON-NLS-1$ - new VersionRange[] {new VersionRange("[1.1, 3.0)")}); //$NON-NLS-1$ - bundleVersionRanges.put( - "org.eclipse.persistence.jpa", //$NON-NLS-1$ - new VersionRange[] {new VersionRange("[1.1, 3.0)")}); //$NON-NLS-1$ - bundleVersionRanges.put( - "org.eclipse.persistence.asm", //$NON-NLS-1$ - new VersionRange[] {new VersionRange("[1.1, 3.0)")}); //$NON-NLS-1$ - bundleVersionRanges.put( - "org.eclipse.persistence.antlr", //$NON-NLS-1$ - new VersionRange[] {new VersionRange("[1.1, 3.0)")}); //$NON-NLS-1$ - } - else if (EclipseLinkPlatform.VERSION_1_2.equals(platform)) { - bundleVersionRanges.put( - "org.eclipse.persistence.core", //$NON-NLS-1$ - new VersionRange[] {new VersionRange("[1.2, 3.0)")}); //$NON-NLS-1$ - bundleVersionRanges.put( - "org.eclipse.persistence.jpa", //$NON-NLS-1$ - new VersionRange[] {new VersionRange("[1.2, 3.0)")}); //$NON-NLS-1$ - bundleVersionRanges.put( - "org.eclipse.persistence.asm", //$NON-NLS-1$ - new VersionRange[] {new VersionRange("[1.2, 3.0)")}); //$NON-NLS-1$ - bundleVersionRanges.put( - "org.eclipse.persistence.antlr", //$NON-NLS-1$ - new VersionRange[] {new VersionRange("[1.2, 3.0)")}); //$NON-NLS-1$ - } - else if (EclipseLinkPlatform.VERSION_2_0.equals(platform)) { - bundleVersionRanges.put( - "org.eclipse.persistence.core", //$NON-NLS-1$ - new VersionRange[] {new VersionRange("[2.0, 3.0)")}); //$NON-NLS-1$ - bundleVersionRanges.put( - "org.eclipse.persistence.jpa", //$NON-NLS-1$ - new VersionRange[] {new VersionRange("[2.0, 3.0)")}); //$NON-NLS-1$ - bundleVersionRanges.put( - "org.eclipse.persistence.asm", //$NON-NLS-1$ - new VersionRange[] {new VersionRange("[2.0, 3.0)")}); //$NON-NLS-1$ - bundleVersionRanges.put( - "org.eclipse.persistence.antlr", //$NON-NLS-1$ - new VersionRange[] {new VersionRange("[2.0, 3.0)")}); //$NON-NLS-1$ - } - else if (EclipseLinkPlatform.VERSION_2_1.equals(platform)) { - bundleVersionRanges.put( - "org.eclipse.persistence.core", //$NON-NLS-1$ - new VersionRange[] {new VersionRange("[2.1, 3.0)")}); //$NON-NLS-1$ - bundleVersionRanges.put( - "org.eclipse.persistence.jpa", //$NON-NLS-1$ - new VersionRange[] {new VersionRange("[2.1, 3.0)")}); //$NON-NLS-1$ - bundleVersionRanges.put( - "org.eclipse.persistence.asm", //$NON-NLS-1$ - new VersionRange[] {new VersionRange("[2.1, 3.0)")}); //$NON-NLS-1$ - bundleVersionRanges.put( - "org.eclipse.persistence.antlr", //$NON-NLS-1$ - new VersionRange[] {new VersionRange("[2.1, 3.0)")}); //$NON-NLS-1$ - } - else if (EclipseLinkPlatform.VERSION_2_2.equals(platform)) { - bundleVersionRanges.put( - "org.eclipse.persistence.core", //$NON-NLS-1$ - new VersionRange[] {new VersionRange("[2.2, 3.0)")}); //$NON-NLS-1$ - bundleVersionRanges.put( - "org.eclipse.persistence.jpa", //$NON-NLS-1$ - new VersionRange[] {new VersionRange("[2.2, 3.0)")}); //$NON-NLS-1$ - bundleVersionRanges.put( - "org.eclipse.persistence.asm", //$NON-NLS-1$ - new VersionRange[] {new VersionRange("[2.2, 3.0)")}); //$NON-NLS-1$ - bundleVersionRanges.put( - "org.eclipse.persistence.antlr", //$NON-NLS-1$ - new VersionRange[] {new VersionRange("[2.2, 3.0)")}); //$NON-NLS-1$ - } - else if (EclipseLinkPlatform.VERSION_2_3.equals(platform)) { - bundleVersionRanges.put( - "org.eclipse.persistence.core", //$NON-NLS-1$ - new VersionRange[] {new VersionRange("[2.3, 3.0)")}); //$NON-NLS-1$ - bundleVersionRanges.put( - "org.eclipse.persistence.jpa", //$NON-NLS-1$ - new VersionRange[] {new VersionRange("[2.3, 3.0)")}); //$NON-NLS-1$ - bundleVersionRanges.put( - "org.eclipse.persistence.asm", //$NON-NLS-1$ - new VersionRange[] {new VersionRange("[2.3, 3.0)")}); //$NON-NLS-1$ - bundleVersionRanges.put( - "org.eclipse.persistence.antlr", //$NON-NLS-1$ - new VersionRange[] {new VersionRange("[2.3, 3.0)")}); //$NON-NLS-1$ - } - else if (EclipseLinkPlatform.VERSION_2_4.equals(platform)) { - bundleVersionRanges.put( - "org.eclipse.persistence.core", //$NON-NLS-1$ - new VersionRange[] {new VersionRange("[2.4, 3.0)")}); //$NON-NLS-1$ - bundleVersionRanges.put( - "org.eclipse.persistence.jpa", //$NON-NLS-1$ - new VersionRange[] {new VersionRange("[2.4, 3.0)")}); //$NON-NLS-1$ - bundleVersionRanges.put( - "org.eclipse.persistence.asm", //$NON-NLS-1$ - new VersionRange[] {new VersionRange("[2.4, 3.0)")}); //$NON-NLS-1$ - bundleVersionRanges.put( - "org.eclipse.persistence.antlr", //$NON-NLS-1$ - new VersionRange[] {new VersionRange("[2.4, 3.0)")}); //$NON-NLS-1$ - } - - return validate(jpaConfig, bundleVersionRanges); - } -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/libval/EclipseLinkUserLibraryValidator.java b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/libval/EclipseLinkUserLibraryValidator.java deleted file mode 100644 index edfdad3057..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/libval/EclipseLinkUserLibraryValidator.java +++ /dev/null @@ -1,66 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010, 2011 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Oracle - initial API and implementation - *******************************************************************************/ -package org.eclipse.jpt.jpa.eclipselink.core.internal.libval; - -import java.util.HashSet; -import java.util.Set; -import org.eclipse.core.runtime.IStatus; -import org.eclipse.jpt.common.core.libprov.JptLibraryProviderInstallOperationConfig; -import org.eclipse.jpt.common.core.libval.LibraryValidator; -import org.eclipse.jpt.common.eclipselink.core.internal.libval.EclipseLinkLibValUtil; -import org.eclipse.jpt.jpa.core.internal.libprov.JpaUserLibraryProviderInstallOperationConfig; -import org.eclipse.jpt.jpa.core.platform.JpaPlatformDescription; -import org.eclipse.jpt.jpa.eclipselink.core.platform.EclipseLinkPlatform; -import org.eclipse.osgi.service.resolver.VersionRange; - -/** - * Library validator for EclipseLink user libraries. - * - * In order to validate that the correct eclipselink.jar is present in the user library, the version - * class which appears in standard EclipseLink libraries will be examined and compared against the - * union of calculated version ranges, depending on the platform specified in the config. - */ -public class EclipseLinkUserLibraryValidator - implements LibraryValidator { - - public IStatus validate(JptLibraryProviderInstallOperationConfig config) { - JpaUserLibraryProviderInstallOperationConfig jpaConfig - = (JpaUserLibraryProviderInstallOperationConfig) config; - JpaPlatformDescription platform = jpaConfig.getJpaPlatform(); - Set<VersionRange> versionRanges = new HashSet<VersionRange>(); - - if (EclipseLinkPlatform.VERSION_1_0.equals(platform)) { - versionRanges.add(new VersionRange("[1.0, 3.0)")); //$NON-NLS-1$ - } - else if (EclipseLinkPlatform.VERSION_1_1.equals(platform)) { - versionRanges.add(new VersionRange("[1.1, 3.0)")); //$NON-NLS-1$ - } - else if (EclipseLinkPlatform.VERSION_1_2.equals(platform)) { - versionRanges.add(new VersionRange("[1.2, 3.0)")); //$NON-NLS-1$ - } - else if (EclipseLinkPlatform.VERSION_2_0.equals(platform)) { - versionRanges.add(new VersionRange("[2.0, 3.0)")); //$NON-NLS-1$ - } - else if (EclipseLinkPlatform.VERSION_2_1.equals(platform)) { - versionRanges.add(new VersionRange("[2.1, 3.0)")); //$NON-NLS-1$ - } - else if (EclipseLinkPlatform.VERSION_2_2.equals(platform)) { - versionRanges.add(new VersionRange("[2.2, 3.0)")); //$NON-NLS-1$ - } - else if (EclipseLinkPlatform.VERSION_2_3.equals(platform)) { - versionRanges.add(new VersionRange("[2.3, 3.0)")); //$NON-NLS-1$ - } - else if (EclipseLinkPlatform.VERSION_2_4.equals(platform)) { - versionRanges.add(new VersionRange("[2.4, 3.0)")); //$NON-NLS-1$ - } - - return EclipseLinkLibValUtil.validate(jpaConfig.resolve(), versionRanges); - } -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/operations/EclipseLinkOrmFileCreationDataModelProvider.java b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/operations/EclipseLinkOrmFileCreationDataModelProvider.java deleted file mode 100644 index 2d6b3e56eb..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/operations/EclipseLinkOrmFileCreationDataModelProvider.java +++ /dev/null @@ -1,91 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2008, 2012 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.eclipselink.core.internal.operations; - -import org.eclipse.jpt.jpa.core.JpaProject; -import org.eclipse.jpt.jpa.core.JptJpaCorePlugin; -import org.eclipse.jpt.jpa.core.internal.operations.OrmFileCreationDataModelProvider; -import org.eclipse.jpt.jpa.core.platform.JpaPlatformDescription; -import org.eclipse.jpt.jpa.eclipselink.core.JptJpaEclipseLinkCorePlugin; -import org.eclipse.jpt.jpa.eclipselink.core.platform.EclipseLinkPlatform; -import org.eclipse.jpt.jpa.eclipselink.core.resource.orm.EclipseLink; -import org.eclipse.jpt.jpa.eclipselink.core.resource.orm.v1_1.EclipseLink1_1; -import org.eclipse.jpt.jpa.eclipselink.core.resource.orm.v1_2.EclipseLink1_2; -import org.eclipse.jpt.jpa.eclipselink.core.resource.orm.v2_0.EclipseLink2_0; -import org.eclipse.jpt.jpa.eclipselink.core.resource.orm.v2_1.EclipseLink2_1; -import org.eclipse.jpt.jpa.eclipselink.core.resource.orm.v2_2.EclipseLink2_2; -import org.eclipse.jpt.jpa.eclipselink.core.resource.orm.v2_3.EclipseLink2_3; -import org.eclipse.jpt.jpa.eclipselink.core.resource.orm.v2_4.EclipseLink2_4; -import org.eclipse.wst.common.frameworks.datamodel.IDataModelOperation; - -public class EclipseLinkOrmFileCreationDataModelProvider - extends OrmFileCreationDataModelProvider -{ - /** - * required default constructor - */ - public EclipseLinkOrmFileCreationDataModelProvider() { - super(); - } - - - @Override - public IDataModelOperation getDefaultOperation() { - return new EclipseLinkOrmFileCreationOperation(getDataModel()); - } - - @Override - protected String getDefaultFileName() { - return JptJpaEclipseLinkCorePlugin.DEFAULT_ECLIPSELINK_ORM_XML_RUNTIME_PATH.lastSegment(); - } - - @Override - protected String getDefaultVersion() { - JpaProject jpaProject = this.getJpaProject(); - if (jpaProject == null) { - return null; - } - try { - return jpaProject.getJpaPlatform().getMostRecentSupportedResourceType( - JptJpaEclipseLinkCorePlugin.ECLIPSELINK_ORM_XML_CONTENT_TYPE).getVersion(); - } - catch (IllegalArgumentException iae) { - // eclipselink content not supported for project - return null; - } - } - - @Override - protected boolean fileVersionSupported(String fileVersion) { - return fileVersion.equals(EclipseLink.SCHEMA_VERSION) - || fileVersion.equals(EclipseLink1_1.SCHEMA_VERSION) - || fileVersion.equals(EclipseLink1_2.SCHEMA_VERSION) - || fileVersion.equals(EclipseLink2_0.SCHEMA_VERSION) - || fileVersion.equals(EclipseLink2_1.SCHEMA_VERSION) - || fileVersion.equals(EclipseLink2_2.SCHEMA_VERSION) - || fileVersion.equals(EclipseLink2_3.SCHEMA_VERSION) - || fileVersion.equals(EclipseLink2_4.SCHEMA_VERSION); - } - - @Override - protected boolean fileVersionSupportedForFacetVersion(String fileVersion, String jpaFacetVersion) { - // assume that platform has been policed for facet version already - return true; - } - - @Override - protected boolean isSupportedPlatformId(String id) { - JpaPlatformDescription platform = JptJpaCorePlugin.getJpaPlatformManager().getJpaPlatform(id); - if (platform == null) { - return false; - } - return EclipseLinkPlatform.GROUP.equals(platform.getGroup()); - } -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/operations/EclipseLinkOrmFileCreationOperation.java b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/operations/EclipseLinkOrmFileCreationOperation.java deleted file mode 100644 index 06573a32b5..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/operations/EclipseLinkOrmFileCreationOperation.java +++ /dev/null @@ -1,29 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2008, 2009 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - *******************************************************************************/ -package org.eclipse.jpt.jpa.eclipselink.core.internal.operations; - -import org.eclipse.core.resources.IFile; -import org.eclipse.jpt.jpa.core.internal.operations.OrmFileCreationOperation; -import org.eclipse.jpt.jpa.core.resource.AbstractXmlResourceProvider; -import org.eclipse.jpt.jpa.eclipselink.core.internal.resource.orm.EclipseLinkOrmXmlResourceProvider; -import org.eclipse.wst.common.frameworks.datamodel.IDataModel; - -public class EclipseLinkOrmFileCreationOperation extends OrmFileCreationOperation -{ - public EclipseLinkOrmFileCreationOperation(IDataModel dataModel) { - super(dataModel); - } - - - @Override - protected AbstractXmlResourceProvider getXmlResourceProvider(IFile file) { - return EclipseLinkOrmXmlResourceProvider.getXmlResourceProvider(file); - } -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/resource/java/EclipseLinkArray2_3AnnotationDefinition.java b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/resource/java/EclipseLinkArray2_3AnnotationDefinition.java deleted file mode 100644 index 7761ba94c3..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/resource/java/EclipseLinkArray2_3AnnotationDefinition.java +++ /dev/null @@ -1,59 +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, 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.eclipselink.core.internal.resource.java; - -import org.eclipse.jdt.core.IAnnotation; -import org.eclipse.jpt.common.core.resource.java.Annotation; -import org.eclipse.jpt.common.core.resource.java.AnnotationDefinition; -import org.eclipse.jpt.common.core.resource.java.JavaResourceAnnotatedElement; -import org.eclipse.jpt.common.core.utility.jdt.AnnotatedElement; -import org.eclipse.jpt.jpa.eclipselink.core.internal.resource.java.binary.BinaryEclipseLinkArrayAnnotation; -import org.eclipse.jpt.jpa.eclipselink.core.internal.resource.java.source.SourceEclipseLinkArrayAnnotation; -import org.eclipse.jpt.jpa.eclipselink.core.resource.java.EclipseLinkArrayAnnotation2_3; - -/** - * org.eclipse.persistence.annotations.Array - */ -public class EclipseLinkArray2_3AnnotationDefinition - implements AnnotationDefinition -{ - // singleton - private static final AnnotationDefinition INSTANCE = new EclipseLinkArray2_3AnnotationDefinition(); - - /** - * Return the singleton. - */ - public static AnnotationDefinition instance() { - return INSTANCE; - } - - /** - * Ensure single instance. - */ - private EclipseLinkArray2_3AnnotationDefinition() { - super(); - } - - public Annotation buildAnnotation(JavaResourceAnnotatedElement parent, AnnotatedElement annotatedElement) { - return new SourceEclipseLinkArrayAnnotation(parent, annotatedElement); - } - - public Annotation buildNullAnnotation(JavaResourceAnnotatedElement parent) { - throw new UnsupportedOperationException(); - } - - public Annotation buildAnnotation(JavaResourceAnnotatedElement parent, IAnnotation jdtAnnotation) { - return new BinaryEclipseLinkArrayAnnotation(parent, jdtAnnotation); - } - - public String getAnnotationName() { - return EclipseLinkArrayAnnotation2_3.ANNOTATION_NAME; - } -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/resource/java/EclipseLinkBasicCollectionAnnotationDefinition.java b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/resource/java/EclipseLinkBasicCollectionAnnotationDefinition.java deleted file mode 100644 index ad504bf147..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/resource/java/EclipseLinkBasicCollectionAnnotationDefinition.java +++ /dev/null @@ -1,59 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2009, 2011 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.eclipselink.core.internal.resource.java; - -import org.eclipse.jdt.core.IAnnotation; -import org.eclipse.jpt.common.core.resource.java.Annotation; -import org.eclipse.jpt.common.core.resource.java.AnnotationDefinition; -import org.eclipse.jpt.common.core.resource.java.JavaResourceAnnotatedElement; -import org.eclipse.jpt.common.core.utility.jdt.AnnotatedElement; -import org.eclipse.jpt.jpa.eclipselink.core.internal.resource.java.binary.BinaryEclipseLinkBasicCollectionAnnotation; -import org.eclipse.jpt.jpa.eclipselink.core.internal.resource.java.source.SourceEclipseLinkBasicCollectionAnnotation; -import org.eclipse.jpt.jpa.eclipselink.core.resource.java.EclipseLinkBasicCollectionAnnotation; - -/** - * org.eclipse.persistence.annotations.BasicCollection - */ -public class EclipseLinkBasicCollectionAnnotationDefinition - implements AnnotationDefinition -{ - // singleton - private static final AnnotationDefinition INSTANCE = new EclipseLinkBasicCollectionAnnotationDefinition(); - - /** - * Return the singleton. - */ - public static AnnotationDefinition instance() { - return INSTANCE; - } - - /** - * Ensure single instance. - */ - private EclipseLinkBasicCollectionAnnotationDefinition() { - super(); - } - - public Annotation buildAnnotation(JavaResourceAnnotatedElement parent, AnnotatedElement annotatedElement) { - return new SourceEclipseLinkBasicCollectionAnnotation(parent, annotatedElement); - } - - public Annotation buildNullAnnotation(JavaResourceAnnotatedElement parent) { - throw new UnsupportedOperationException(); - } - - public Annotation buildAnnotation(JavaResourceAnnotatedElement parent, IAnnotation jdtAnnotation) { - return new BinaryEclipseLinkBasicCollectionAnnotation(parent, jdtAnnotation); - } - - public String getAnnotationName() { - return EclipseLinkBasicCollectionAnnotation.ANNOTATION_NAME; - } -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/resource/java/EclipseLinkBasicMapAnnotationDefinition.java b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/resource/java/EclipseLinkBasicMapAnnotationDefinition.java deleted file mode 100644 index 24edc251d5..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/resource/java/EclipseLinkBasicMapAnnotationDefinition.java +++ /dev/null @@ -1,59 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2009, 2011 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.eclipselink.core.internal.resource.java; - -import org.eclipse.jdt.core.IAnnotation; -import org.eclipse.jpt.common.core.resource.java.Annotation; -import org.eclipse.jpt.common.core.resource.java.AnnotationDefinition; -import org.eclipse.jpt.common.core.resource.java.JavaResourceAnnotatedElement; -import org.eclipse.jpt.common.core.utility.jdt.AnnotatedElement; -import org.eclipse.jpt.jpa.eclipselink.core.internal.resource.java.binary.BinaryEclipseLinkBasicMapAnnotation; -import org.eclipse.jpt.jpa.eclipselink.core.internal.resource.java.source.SourceEclipseLinkBasicMapAnnotation; -import org.eclipse.jpt.jpa.eclipselink.core.resource.java.EclipseLinkBasicMapAnnotation; - -/** - * org.eclipse.persistence.annotations.BasicMap - */ -public class EclipseLinkBasicMapAnnotationDefinition - implements AnnotationDefinition -{ - // singleton - private static final AnnotationDefinition INSTANCE = new EclipseLinkBasicMapAnnotationDefinition(); - - /** - * Return the singleton. - */ - public static AnnotationDefinition instance() { - return INSTANCE; - } - - /** - * Ensure single instance. - */ - private EclipseLinkBasicMapAnnotationDefinition() { - super(); - } - - public Annotation buildAnnotation(JavaResourceAnnotatedElement parent, AnnotatedElement annotatedElement) { - return new SourceEclipseLinkBasicMapAnnotation(parent, annotatedElement); - } - - public Annotation buildNullAnnotation(JavaResourceAnnotatedElement parent) { - throw new UnsupportedOperationException(); - } - - public Annotation buildAnnotation(JavaResourceAnnotatedElement parent, IAnnotation jdtAnnotation) { - return new BinaryEclipseLinkBasicMapAnnotation(parent, jdtAnnotation); - } - - public String getAnnotationName() { - return EclipseLinkBasicMapAnnotation.ANNOTATION_NAME; - } -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/resource/java/EclipseLinkCacheAnnotationDefinition.java b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/resource/java/EclipseLinkCacheAnnotationDefinition.java deleted file mode 100644 index 8932478ef8..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/resource/java/EclipseLinkCacheAnnotationDefinition.java +++ /dev/null @@ -1,59 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2009, 2011 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.eclipselink.core.internal.resource.java; - -import org.eclipse.jdt.core.IAnnotation; -import org.eclipse.jpt.common.core.resource.java.Annotation; -import org.eclipse.jpt.common.core.resource.java.AnnotationDefinition; -import org.eclipse.jpt.common.core.resource.java.JavaResourceAnnotatedElement; -import org.eclipse.jpt.common.core.utility.jdt.AnnotatedElement; -import org.eclipse.jpt.jpa.eclipselink.core.internal.resource.java.binary.BinaryEclipseLinkCacheAnnotation; -import org.eclipse.jpt.jpa.eclipselink.core.internal.resource.java.source.SourceEclipseLinkCacheAnnotation; -import org.eclipse.jpt.jpa.eclipselink.core.resource.java.EclipseLinkCacheAnnotation; - -/** - * org.eclipse.persistence.annotations.Cache - */ -public class EclipseLinkCacheAnnotationDefinition - implements AnnotationDefinition -{ - // singleton - private static final AnnotationDefinition INSTANCE = new EclipseLinkCacheAnnotationDefinition(); - - /** - * Return the singleton. - */ - public static AnnotationDefinition instance() { - return INSTANCE; - } - - /** - * Ensure single instance. - */ - private EclipseLinkCacheAnnotationDefinition() { - super(); - } - - public Annotation buildAnnotation(JavaResourceAnnotatedElement parent, AnnotatedElement annotatedElement) { - return new SourceEclipseLinkCacheAnnotation(parent, annotatedElement); - } - - public Annotation buildNullAnnotation(JavaResourceAnnotatedElement parent) { - return new NullEclipseLinkCacheAnnotation(parent); - } - - public Annotation buildAnnotation(JavaResourceAnnotatedElement parent, IAnnotation jdtAnnotation) { - return new BinaryEclipseLinkCacheAnnotation(parent, jdtAnnotation); - } - - public String getAnnotationName() { - return EclipseLinkCacheAnnotation.ANNOTATION_NAME; - } -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/resource/java/EclipseLinkChangeTrackingAnnotationDefinition.java b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/resource/java/EclipseLinkChangeTrackingAnnotationDefinition.java deleted file mode 100644 index 6e9f5ed41a..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/resource/java/EclipseLinkChangeTrackingAnnotationDefinition.java +++ /dev/null @@ -1,59 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2009, 2011 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.eclipselink.core.internal.resource.java; - -import org.eclipse.jdt.core.IAnnotation; -import org.eclipse.jpt.common.core.resource.java.Annotation; -import org.eclipse.jpt.common.core.resource.java.AnnotationDefinition; -import org.eclipse.jpt.common.core.resource.java.JavaResourceAnnotatedElement; -import org.eclipse.jpt.common.core.utility.jdt.AnnotatedElement; -import org.eclipse.jpt.jpa.eclipselink.core.internal.resource.java.binary.BinaryEclipseLinkChangeTrackingAnnotation; -import org.eclipse.jpt.jpa.eclipselink.core.internal.resource.java.source.SourceEclipseLinkChangeTrackingAnnotation; -import org.eclipse.jpt.jpa.eclipselink.core.resource.java.EclipseLinkChangeTrackingAnnotation; - -/** - * org.eclipse.persistence.annotations.ChangeTracking - */ -public class EclipseLinkChangeTrackingAnnotationDefinition - implements AnnotationDefinition -{ - // singleton - private static final AnnotationDefinition INSTANCE = new EclipseLinkChangeTrackingAnnotationDefinition(); - - /** - * Return the singleton. - */ - public static AnnotationDefinition instance() { - return INSTANCE; - } - - /** - * Ensure single instance. - */ - private EclipseLinkChangeTrackingAnnotationDefinition() { - super(); - } - - public Annotation buildAnnotation(JavaResourceAnnotatedElement parent, AnnotatedElement annotatedElement) { - return new SourceEclipseLinkChangeTrackingAnnotation(parent, annotatedElement); - } - - public Annotation buildNullAnnotation(JavaResourceAnnotatedElement parent) { - throw new UnsupportedOperationException(); - } - - public Annotation buildAnnotation(JavaResourceAnnotatedElement parent, IAnnotation jdtAnnotation) { - return new BinaryEclipseLinkChangeTrackingAnnotation(parent, jdtAnnotation); - } - - public String getAnnotationName() { - return EclipseLinkChangeTrackingAnnotation.ANNOTATION_NAME; - } -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/resource/java/EclipseLinkClassExtractor2_1AnnotationDefinition.java b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/resource/java/EclipseLinkClassExtractor2_1AnnotationDefinition.java deleted file mode 100644 index 78e87d2be3..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/resource/java/EclipseLinkClassExtractor2_1AnnotationDefinition.java +++ /dev/null @@ -1,59 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010, 2011 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.eclipselink.core.internal.resource.java; - -import org.eclipse.jdt.core.IAnnotation; -import org.eclipse.jpt.common.core.resource.java.Annotation; -import org.eclipse.jpt.common.core.resource.java.AnnotationDefinition; -import org.eclipse.jpt.common.core.resource.java.JavaResourceAnnotatedElement; -import org.eclipse.jpt.common.core.utility.jdt.AnnotatedElement; -import org.eclipse.jpt.jpa.eclipselink.core.internal.resource.java.binary.BinaryEclipseLinkClassExtractorAnnotation2_1; -import org.eclipse.jpt.jpa.eclipselink.core.internal.resource.java.source.SourceEclipseLinkClassExtractorAnnotation2_1; -import org.eclipse.jpt.jpa.eclipselink.core.resource.java.EclipseLinkClassExtractorAnnotation2_1; - -/** - * org.eclipse.persistence.annotations.ClassExtractor - */ -public class EclipseLinkClassExtractor2_1AnnotationDefinition - implements AnnotationDefinition -{ - // singleton - private static final AnnotationDefinition INSTANCE = new EclipseLinkClassExtractor2_1AnnotationDefinition(); - - /** - * Return the singleton. - */ - public static AnnotationDefinition instance() { - return INSTANCE; - } - - /** - * Ensure single instance. - */ - private EclipseLinkClassExtractor2_1AnnotationDefinition() { - super(); - } - - public Annotation buildAnnotation(JavaResourceAnnotatedElement parent, AnnotatedElement annotatedElement) { - return new SourceEclipseLinkClassExtractorAnnotation2_1(parent, annotatedElement); - } - - public Annotation buildNullAnnotation(JavaResourceAnnotatedElement parent) { - throw new UnsupportedOperationException(); - } - - public Annotation buildAnnotation(JavaResourceAnnotatedElement parent, IAnnotation jdtAnnotation) { - return new BinaryEclipseLinkClassExtractorAnnotation2_1(parent, jdtAnnotation); - } - - public String getAnnotationName() { - return EclipseLinkClassExtractorAnnotation2_1.ANNOTATION_NAME; - } -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/resource/java/EclipseLinkConvertAnnotationDefinition.java b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/resource/java/EclipseLinkConvertAnnotationDefinition.java deleted file mode 100644 index 3ff2c2a540..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/resource/java/EclipseLinkConvertAnnotationDefinition.java +++ /dev/null @@ -1,59 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2009, 2011 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.eclipselink.core.internal.resource.java; - -import org.eclipse.jdt.core.IAnnotation; -import org.eclipse.jpt.common.core.resource.java.Annotation; -import org.eclipse.jpt.common.core.resource.java.AnnotationDefinition; -import org.eclipse.jpt.common.core.resource.java.JavaResourceAnnotatedElement; -import org.eclipse.jpt.common.core.utility.jdt.AnnotatedElement; -import org.eclipse.jpt.jpa.eclipselink.core.internal.resource.java.binary.BinaryEclipseLinkConvertAnnotation; -import org.eclipse.jpt.jpa.eclipselink.core.internal.resource.java.source.SourceEclipseLinkConvertAnnotation; -import org.eclipse.jpt.jpa.eclipselink.core.resource.java.EclipseLinkConvertAnnotation; - -/** - * org.eclipse.persistence.annotations.Convert - */ -public class EclipseLinkConvertAnnotationDefinition - implements AnnotationDefinition -{ - // singleton - private static final AnnotationDefinition INSTANCE = new EclipseLinkConvertAnnotationDefinition(); - - /** - * Return the singleton. - */ - public static AnnotationDefinition instance() { - return INSTANCE; - } - - /** - * Ensure single instance. - */ - private EclipseLinkConvertAnnotationDefinition() { - super(); - } - - public Annotation buildAnnotation(JavaResourceAnnotatedElement parent, AnnotatedElement annotatedElement) { - return new SourceEclipseLinkConvertAnnotation(parent, annotatedElement); - } - - public Annotation buildNullAnnotation(JavaResourceAnnotatedElement parent) { - throw new UnsupportedOperationException(); - } - - public Annotation buildAnnotation(JavaResourceAnnotatedElement parent, IAnnotation jdtAnnotation) { - return new BinaryEclipseLinkConvertAnnotation(parent, jdtAnnotation); - } - - public String getAnnotationName() { - return EclipseLinkConvertAnnotation.ANNOTATION_NAME; - } -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/resource/java/EclipseLinkConverterAnnotationDefinition.java b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/resource/java/EclipseLinkConverterAnnotationDefinition.java deleted file mode 100644 index 6999bd36c0..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/resource/java/EclipseLinkConverterAnnotationDefinition.java +++ /dev/null @@ -1,64 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2009, 2011 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.eclipselink.core.internal.resource.java; - -import org.eclipse.jdt.core.IAnnotation; -import org.eclipse.jpt.common.core.resource.java.JavaResourceAnnotatedElement; -import org.eclipse.jpt.common.core.resource.java.NestableAnnotation; -import org.eclipse.jpt.common.core.resource.java.NestableAnnotationDefinition; -import org.eclipse.jpt.common.core.utility.jdt.AnnotatedElement; -import org.eclipse.jpt.jpa.eclipselink.core.internal.resource.java.binary.BinaryEclipseLinkConverterAnnotation; -import org.eclipse.jpt.jpa.eclipselink.core.internal.resource.java.source.SourceEclipseLinkConverterAnnotation; -import org.eclipse.jpt.jpa.eclipselink.core.resource.java.EclipseLink; - -/** - * org.eclipse.persistence.annotations.Converter - */ -public class EclipseLinkConverterAnnotationDefinition - implements NestableAnnotationDefinition -{ - // singleton - private static final NestableAnnotationDefinition INSTANCE = new EclipseLinkConverterAnnotationDefinition(); - - /** - * Return the singleton. - */ - public static NestableAnnotationDefinition instance() { - return INSTANCE; - } - - /** - * Ensure single instance. - */ - private EclipseLinkConverterAnnotationDefinition() { - super(); - } - - - public NestableAnnotation buildAnnotation(JavaResourceAnnotatedElement parent, AnnotatedElement annotatedElement, int index) { - return SourceEclipseLinkConverterAnnotation.buildSourceConverterAnnotation(parent, annotatedElement, index); - } - - public NestableAnnotation buildAnnotation(JavaResourceAnnotatedElement parent, IAnnotation jdtAnnotation, int index) { - return new BinaryEclipseLinkConverterAnnotation(parent, jdtAnnotation); - } - - public String getNestableAnnotationName() { - return EclipseLink.CONVERTER; - } - - public String getContainerAnnotationName() { - return EclipseLink.CONVERTERS; - } - - public String getElementName() { - return EclipseLink.CONVERTERS__VALUE; - } -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/resource/java/EclipseLinkConverters2_2AnnotationDefinition.java b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/resource/java/EclipseLinkConverters2_2AnnotationDefinition.java deleted file mode 100644 index f41706e871..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/resource/java/EclipseLinkConverters2_2AnnotationDefinition.java +++ /dev/null @@ -1,60 +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, 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.eclipselink.core.internal.resource.java; - -import org.eclipse.jdt.core.IAnnotation; -import org.eclipse.jpt.common.core.internal.resource.java.binary.BinaryNamedAnnotation; -import org.eclipse.jpt.common.core.internal.resource.java.source.SourceNamedAnnotation; -import org.eclipse.jpt.common.core.resource.java.Annotation; -import org.eclipse.jpt.common.core.resource.java.AnnotationDefinition; -import org.eclipse.jpt.common.core.resource.java.JavaResourceAnnotatedElement; -import org.eclipse.jpt.common.core.utility.jdt.AnnotatedElement; -import org.eclipse.jpt.jpa.eclipselink.core.resource.java.EclipseLink; - -/** - * org.eclipse.persistence.annotations.TypeConverters - */ -public final class EclipseLinkConverters2_2AnnotationDefinition - implements AnnotationDefinition -{ - // singleton - private static final AnnotationDefinition INSTANCE = new EclipseLinkConverters2_2AnnotationDefinition(); - - /** - * Return the singleton. - */ - public static AnnotationDefinition instance() { - return INSTANCE; - } - - /** - * Ensure single instance. - */ - private EclipseLinkConverters2_2AnnotationDefinition() { - super(); - } - - public Annotation buildAnnotation(JavaResourceAnnotatedElement parent, AnnotatedElement annotatedElement) { - return new SourceNamedAnnotation(parent, annotatedElement, getAnnotationName()); - } - - public Annotation buildNullAnnotation(JavaResourceAnnotatedElement parent) { - throw new UnsupportedOperationException(); - } - - public Annotation buildAnnotation(JavaResourceAnnotatedElement parent, IAnnotation jdtAnnotation) { - return new BinaryNamedAnnotation(parent, jdtAnnotation, getAnnotationName()); - } - - public String getAnnotationName() { - return EclipseLink.CONVERTERS; - } - -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/resource/java/EclipseLinkCustomizerAnnotationDefinition.java b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/resource/java/EclipseLinkCustomizerAnnotationDefinition.java deleted file mode 100644 index d90ab00882..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/resource/java/EclipseLinkCustomizerAnnotationDefinition.java +++ /dev/null @@ -1,59 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2009, 2011 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.eclipselink.core.internal.resource.java; - -import org.eclipse.jdt.core.IAnnotation; -import org.eclipse.jpt.common.core.resource.java.Annotation; -import org.eclipse.jpt.common.core.resource.java.AnnotationDefinition; -import org.eclipse.jpt.common.core.resource.java.JavaResourceAnnotatedElement; -import org.eclipse.jpt.common.core.utility.jdt.AnnotatedElement; -import org.eclipse.jpt.jpa.eclipselink.core.internal.resource.java.binary.BinaryEclipseLinkCustomizerAnnotation; -import org.eclipse.jpt.jpa.eclipselink.core.internal.resource.java.source.SourceEclipseLinkCustomizerAnnotation; -import org.eclipse.jpt.jpa.eclipselink.core.resource.java.EclipseLinkCustomizerAnnotation; - -/** - * org.eclipse.persistence.annotations.Customizer - */ -public class EclipseLinkCustomizerAnnotationDefinition - implements AnnotationDefinition -{ - // singleton - private static final AnnotationDefinition INSTANCE = new EclipseLinkCustomizerAnnotationDefinition(); - - /** - * Return the singleton. - */ - public static AnnotationDefinition instance() { - return INSTANCE; - } - - /** - * Ensure single instance. - */ - private EclipseLinkCustomizerAnnotationDefinition() { - super(); - } - - public Annotation buildAnnotation(JavaResourceAnnotatedElement parent, AnnotatedElement annotatedElement) { - return new SourceEclipseLinkCustomizerAnnotation(parent, annotatedElement); - } - - public Annotation buildNullAnnotation(JavaResourceAnnotatedElement parent) { - throw new UnsupportedOperationException(); - } - - public Annotation buildAnnotation(JavaResourceAnnotatedElement parent, IAnnotation jdtAnnotation) { - return new BinaryEclipseLinkCustomizerAnnotation(parent, jdtAnnotation); - } - - public String getAnnotationName() { - return EclipseLinkCustomizerAnnotation.ANNOTATION_NAME; - } -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/resource/java/EclipseLinkExistenceCheckingAnnotationDefinition.java b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/resource/java/EclipseLinkExistenceCheckingAnnotationDefinition.java deleted file mode 100644 index 5a46c5fd4f..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/resource/java/EclipseLinkExistenceCheckingAnnotationDefinition.java +++ /dev/null @@ -1,59 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2009, 2011 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.eclipselink.core.internal.resource.java; - -import org.eclipse.jdt.core.IAnnotation; -import org.eclipse.jpt.common.core.resource.java.Annotation; -import org.eclipse.jpt.common.core.resource.java.AnnotationDefinition; -import org.eclipse.jpt.common.core.resource.java.JavaResourceAnnotatedElement; -import org.eclipse.jpt.common.core.utility.jdt.AnnotatedElement; -import org.eclipse.jpt.jpa.eclipselink.core.internal.resource.java.binary.BinaryEclipseLinkExistenceCheckingAnnotation; -import org.eclipse.jpt.jpa.eclipselink.core.internal.resource.java.source.SourceEclipseLinkExistenceCheckingAnnotation; -import org.eclipse.jpt.jpa.eclipselink.core.resource.java.EclipseLinkExistenceCheckingAnnotation; - -/** - * org.eclipse.persistence.annotations.ExistenceChecking - */ -public class EclipseLinkExistenceCheckingAnnotationDefinition - implements AnnotationDefinition -{ - // singleton - private static final AnnotationDefinition INSTANCE = new EclipseLinkExistenceCheckingAnnotationDefinition(); - - /** - * Return the singleton. - */ - public static AnnotationDefinition instance() { - return INSTANCE; - } - - /** - * Ensure single instance. - */ - private EclipseLinkExistenceCheckingAnnotationDefinition() { - super(); - } - - public Annotation buildAnnotation(JavaResourceAnnotatedElement parent, AnnotatedElement annotatedElement) { - return new SourceEclipseLinkExistenceCheckingAnnotation(parent, annotatedElement); - } - - public Annotation buildNullAnnotation(JavaResourceAnnotatedElement parent) { - throw new UnsupportedOperationException(); - } - - public Annotation buildAnnotation(JavaResourceAnnotatedElement parent, IAnnotation jdtAnnotation) { - return new BinaryEclipseLinkExistenceCheckingAnnotation(parent, jdtAnnotation); - } - - public String getAnnotationName() { - return EclipseLinkExistenceCheckingAnnotation.ANNOTATION_NAME; - } -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/resource/java/EclipseLinkJoinFetchAnnotationDefinition.java b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/resource/java/EclipseLinkJoinFetchAnnotationDefinition.java deleted file mode 100644 index b9965fd207..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/resource/java/EclipseLinkJoinFetchAnnotationDefinition.java +++ /dev/null @@ -1,59 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2009, 2011 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.eclipselink.core.internal.resource.java; - -import org.eclipse.jdt.core.IAnnotation; -import org.eclipse.jpt.common.core.resource.java.Annotation; -import org.eclipse.jpt.common.core.resource.java.AnnotationDefinition; -import org.eclipse.jpt.common.core.resource.java.JavaResourceAnnotatedElement; -import org.eclipse.jpt.common.core.utility.jdt.AnnotatedElement; -import org.eclipse.jpt.jpa.eclipselink.core.internal.resource.java.binary.BinaryEclipseLinkJoinFetchAnnotation; -import org.eclipse.jpt.jpa.eclipselink.core.internal.resource.java.source.SourceEclipseLinkJoinFetchAnnotation; -import org.eclipse.jpt.jpa.eclipselink.core.resource.java.EclipseLinkJoinFetchAnnotation; - -/** - * org.eclipse.persistence.annotations.JoinFetch - */ -public class EclipseLinkJoinFetchAnnotationDefinition - implements AnnotationDefinition -{ - // singleton - private static final AnnotationDefinition INSTANCE = new EclipseLinkJoinFetchAnnotationDefinition(); - - /** - * Return the singleton. - */ - public static AnnotationDefinition instance() { - return INSTANCE; - } - - /** - * Ensure single instance. - */ - private EclipseLinkJoinFetchAnnotationDefinition() { - super(); - } - - public Annotation buildAnnotation(JavaResourceAnnotatedElement parent, AnnotatedElement annotatedElement) { - return new SourceEclipseLinkJoinFetchAnnotation(parent, annotatedElement); - } - - public Annotation buildNullAnnotation(JavaResourceAnnotatedElement parent) { - return new NullEclipseLinkJoinFetchAnnotation(parent); - } - - public Annotation buildAnnotation(JavaResourceAnnotatedElement parent, IAnnotation jdtAnnotation) { - return new BinaryEclipseLinkJoinFetchAnnotation(parent, jdtAnnotation); - } - - public String getAnnotationName() { - return EclipseLinkJoinFetchAnnotation.ANNOTATION_NAME; - } -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/resource/java/EclipseLinkMapKeyConvert2_0AnnotationDefinition.java b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/resource/java/EclipseLinkMapKeyConvert2_0AnnotationDefinition.java deleted file mode 100644 index 6ea716b774..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/resource/java/EclipseLinkMapKeyConvert2_0AnnotationDefinition.java +++ /dev/null @@ -1,59 +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, 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.eclipselink.core.internal.resource.java; - -import org.eclipse.jdt.core.IAnnotation; -import org.eclipse.jpt.common.core.resource.java.Annotation; -import org.eclipse.jpt.common.core.resource.java.AnnotationDefinition; -import org.eclipse.jpt.common.core.resource.java.JavaResourceAnnotatedElement; -import org.eclipse.jpt.common.core.utility.jdt.AnnotatedElement; -import org.eclipse.jpt.jpa.eclipselink.core.internal.resource.java.binary.BinaryEclipseLinkMapKeyConvertAnnotation2_0; -import org.eclipse.jpt.jpa.eclipselink.core.internal.resource.java.source.SourceEclipseLinkMapKeyConvertAnnotation2_0; -import org.eclipse.jpt.jpa.eclipselink.core.resource.java.EclipseLinkMapKeyConvertAnnotation2_0; - -/** - * org.eclipse.persistence.annotations.MapKeyConvert - */ -public class EclipseLinkMapKeyConvert2_0AnnotationDefinition - implements AnnotationDefinition -{ - // singleton - private static final AnnotationDefinition INSTANCE = new EclipseLinkMapKeyConvert2_0AnnotationDefinition(); - - /** - * Return the singleton. - */ - public static AnnotationDefinition instance() { - return INSTANCE; - } - - /** - * Ensure single instance. - */ - private EclipseLinkMapKeyConvert2_0AnnotationDefinition() { - super(); - } - - public Annotation buildAnnotation(JavaResourceAnnotatedElement parent, AnnotatedElement annotatedElement) { - return new SourceEclipseLinkMapKeyConvertAnnotation2_0(parent, annotatedElement); - } - - public Annotation buildNullAnnotation(JavaResourceAnnotatedElement parent) { - throw new UnsupportedOperationException(); - } - - public Annotation buildAnnotation(JavaResourceAnnotatedElement parent, IAnnotation jdtAnnotation) { - return new BinaryEclipseLinkMapKeyConvertAnnotation2_0(parent, jdtAnnotation); - } - - public String getAnnotationName() { - return EclipseLinkMapKeyConvertAnnotation2_0.ANNOTATION_NAME; - } -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/resource/java/EclipseLinkMultitenant2_3AnnotationDefinition.java b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/resource/java/EclipseLinkMultitenant2_3AnnotationDefinition.java deleted file mode 100644 index 2407058445..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/resource/java/EclipseLinkMultitenant2_3AnnotationDefinition.java +++ /dev/null @@ -1,61 +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 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.eclipselink.core.internal.resource.java; - -import org.eclipse.jdt.core.IAnnotation; -import org.eclipse.jpt.common.core.resource.java.Annotation; -import org.eclipse.jpt.common.core.resource.java.AnnotationDefinition; -import org.eclipse.jpt.common.core.resource.java.JavaResourceAnnotatedElement; -import org.eclipse.jpt.common.core.utility.jdt.AnnotatedElement; -import org.eclipse.jpt.jpa.eclipselink.core.internal.resource.java.binary.BinaryEclipseLinkMultitenantAnnotation2_3; -import org.eclipse.jpt.jpa.eclipselink.core.internal.resource.java.source.SourceEclipseLinkMultitenantAnnotation2_3; -import org.eclipse.jpt.jpa.eclipselink.core.resource.java.EclipseLinkMultitenantAnnotation2_3; - -public class EclipseLinkMultitenant2_3AnnotationDefinition - implements AnnotationDefinition -{ - // singleton - private static final AnnotationDefinition INSTANCE - = new EclipseLinkMultitenant2_3AnnotationDefinition(); - - - /** - * Return the singleton - */ - public static AnnotationDefinition instance() { - return INSTANCE; - } - - - /** - * Enforce singleton usage - */ - private EclipseLinkMultitenant2_3AnnotationDefinition() { - super(); - } - - - public Annotation buildAnnotation(JavaResourceAnnotatedElement parent, AnnotatedElement annotatedElement) { - return new SourceEclipseLinkMultitenantAnnotation2_3(parent, annotatedElement); - } - - public Annotation buildNullAnnotation(JavaResourceAnnotatedElement parent) { - return new NullEclipseLinkMultitenantAnnotation2_3(parent); - } - - public Annotation buildAnnotation(JavaResourceAnnotatedElement parent, IAnnotation jdtAnnotation) { - return new BinaryEclipseLinkMultitenantAnnotation2_3(parent, jdtAnnotation); - } - - public String getAnnotationName() { - return EclipseLinkMultitenantAnnotation2_3.ANNOTATION_NAME; - } -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/resource/java/EclipseLinkMutableAnnotationDefinition.java b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/resource/java/EclipseLinkMutableAnnotationDefinition.java deleted file mode 100644 index 448bcf6502..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/resource/java/EclipseLinkMutableAnnotationDefinition.java +++ /dev/null @@ -1,59 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2009, 2011 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.eclipselink.core.internal.resource.java; - -import org.eclipse.jdt.core.IAnnotation; -import org.eclipse.jpt.common.core.resource.java.Annotation; -import org.eclipse.jpt.common.core.resource.java.AnnotationDefinition; -import org.eclipse.jpt.common.core.resource.java.JavaResourceAnnotatedElement; -import org.eclipse.jpt.common.core.utility.jdt.AnnotatedElement; -import org.eclipse.jpt.jpa.eclipselink.core.internal.resource.java.binary.BinaryEclipseLinkMutableAnnotation; -import org.eclipse.jpt.jpa.eclipselink.core.internal.resource.java.source.SourceEclipseLinkMutableAnnotation; -import org.eclipse.jpt.jpa.eclipselink.core.resource.java.EclipseLinkMutableAnnotation; - -/** - * org.eclipse.persistence.annotations.Mutable - */ -public class EclipseLinkMutableAnnotationDefinition - implements AnnotationDefinition -{ - // singleton - private static final AnnotationDefinition INSTANCE = new EclipseLinkMutableAnnotationDefinition(); - - /** - * Return the singleton. - */ - public static AnnotationDefinition instance() { - return INSTANCE; - } - - /** - * Ensure single instance. - */ - private EclipseLinkMutableAnnotationDefinition() { - super(); - } - - public Annotation buildAnnotation(JavaResourceAnnotatedElement parent, AnnotatedElement annotatedElement) { - return new SourceEclipseLinkMutableAnnotation(parent, annotatedElement); - } - - public Annotation buildNullAnnotation(JavaResourceAnnotatedElement parent) { - throw new UnsupportedOperationException(); - } - - public Annotation buildAnnotation(JavaResourceAnnotatedElement parent, IAnnotation jdtAnnotation) { - return new BinaryEclipseLinkMutableAnnotation(parent, jdtAnnotation); - } - - public String getAnnotationName() { - return EclipseLinkMutableAnnotation.ANNOTATION_NAME; - } -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/resource/java/EclipseLinkObjectTypeConverterAnnotationDefinition.java b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/resource/java/EclipseLinkObjectTypeConverterAnnotationDefinition.java deleted file mode 100644 index 0ee4683e1d..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/resource/java/EclipseLinkObjectTypeConverterAnnotationDefinition.java +++ /dev/null @@ -1,63 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2009, 2011 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.eclipselink.core.internal.resource.java; - -import org.eclipse.jdt.core.IAnnotation; -import org.eclipse.jpt.common.core.resource.java.JavaResourceAnnotatedElement; -import org.eclipse.jpt.common.core.resource.java.NestableAnnotation; -import org.eclipse.jpt.common.core.resource.java.NestableAnnotationDefinition; -import org.eclipse.jpt.common.core.utility.jdt.AnnotatedElement; -import org.eclipse.jpt.jpa.eclipselink.core.internal.resource.java.binary.BinaryEclipseLinkObjectTypeConverterAnnotation; -import org.eclipse.jpt.jpa.eclipselink.core.internal.resource.java.source.SourceEclipseLinkObjectTypeConverterAnnotation; -import org.eclipse.jpt.jpa.eclipselink.core.resource.java.EclipseLink; - -/** - * org.eclipse.persistence.annotations.ObjectTypeConverter - */ -public class EclipseLinkObjectTypeConverterAnnotationDefinition - implements NestableAnnotationDefinition -{ - // singleton - private static final NestableAnnotationDefinition INSTANCE = new EclipseLinkObjectTypeConverterAnnotationDefinition(); - - /** - * Return the singleton. - */ - public static NestableAnnotationDefinition instance() { - return INSTANCE; - } - - /** - * Ensure single instance. - */ - private EclipseLinkObjectTypeConverterAnnotationDefinition() { - super(); - } - - public NestableAnnotation buildAnnotation(JavaResourceAnnotatedElement parent, AnnotatedElement annotatedElement, int index) { - return SourceEclipseLinkObjectTypeConverterAnnotation.buildSourceObjectTypeConverterAnnotation(parent, annotatedElement, index); - } - - public NestableAnnotation buildAnnotation(JavaResourceAnnotatedElement parent, IAnnotation jdtAnnotation, int index) { - return new BinaryEclipseLinkObjectTypeConverterAnnotation(parent, jdtAnnotation); - } - - public String getNestableAnnotationName() { - return EclipseLink.OBJECT_TYPE_CONVERTER; - } - - public String getContainerAnnotationName() { - return EclipseLink.OBJECT_TYPE_CONVERTERS; - } - - public String getElementName() { - return EclipseLink.OBJECT_TYPE_CONVERTERS__VALUE; - } -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/resource/java/EclipseLinkObjectTypeConverters2_2AnnotationDefinition.java b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/resource/java/EclipseLinkObjectTypeConverters2_2AnnotationDefinition.java deleted file mode 100644 index 6da2049235..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/resource/java/EclipseLinkObjectTypeConverters2_2AnnotationDefinition.java +++ /dev/null @@ -1,60 +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, 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.eclipselink.core.internal.resource.java; - -import org.eclipse.jdt.core.IAnnotation; -import org.eclipse.jpt.common.core.internal.resource.java.binary.BinaryNamedAnnotation; -import org.eclipse.jpt.common.core.internal.resource.java.source.SourceNamedAnnotation; -import org.eclipse.jpt.common.core.resource.java.Annotation; -import org.eclipse.jpt.common.core.resource.java.AnnotationDefinition; -import org.eclipse.jpt.common.core.resource.java.JavaResourceAnnotatedElement; -import org.eclipse.jpt.common.core.utility.jdt.AnnotatedElement; -import org.eclipse.jpt.jpa.eclipselink.core.resource.java.EclipseLink; - -/** - * org.eclipse.persistence.annotations.TypeConverters - */ -public final class EclipseLinkObjectTypeConverters2_2AnnotationDefinition - implements AnnotationDefinition -{ - // singleton - private static final AnnotationDefinition INSTANCE = new EclipseLinkObjectTypeConverters2_2AnnotationDefinition(); - - /** - * Return the singleton. - */ - public static AnnotationDefinition instance() { - return INSTANCE; - } - - /** - * Ensure single instance. - */ - private EclipseLinkObjectTypeConverters2_2AnnotationDefinition() { - super(); - } - - public Annotation buildAnnotation(JavaResourceAnnotatedElement parent, AnnotatedElement annotatedElement) { - return new SourceNamedAnnotation(parent, annotatedElement, getAnnotationName()); - } - - public Annotation buildNullAnnotation(JavaResourceAnnotatedElement parent) { - throw new UnsupportedOperationException(); - } - - public Annotation buildAnnotation(JavaResourceAnnotatedElement parent, IAnnotation jdtAnnotation) { - return new BinaryNamedAnnotation(parent, jdtAnnotation, getAnnotationName()); - } - - public String getAnnotationName() { - return EclipseLink.OBJECT_TYPE_CONVERTERS; - } - -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/resource/java/EclipseLinkPrimaryKeyAnnotationDefinition.java b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/resource/java/EclipseLinkPrimaryKeyAnnotationDefinition.java deleted file mode 100644 index 73e41c3798..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/resource/java/EclipseLinkPrimaryKeyAnnotationDefinition.java +++ /dev/null @@ -1,61 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010, 2011 Oracle. - * All rights reserved. This program and the accompanying materials are - * made available under the terms of the Eclipse Public License v1.0 which - * accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Oracle - initial API and implementation - *******************************************************************************/ -package org.eclipse.jpt.jpa.eclipselink.core.internal.resource.java; - -import org.eclipse.jdt.core.IAnnotation; -import org.eclipse.jpt.common.core.resource.java.Annotation; -import org.eclipse.jpt.common.core.resource.java.AnnotationDefinition; -import org.eclipse.jpt.common.core.resource.java.JavaResourceAnnotatedElement; -import org.eclipse.jpt.common.core.utility.jdt.AnnotatedElement; -import org.eclipse.jpt.jpa.eclipselink.core.internal.resource.java.binary.BinaryEclipseLinkPrimaryKeyAnnotation; -import org.eclipse.jpt.jpa.eclipselink.core.internal.resource.java.source.SourceEclipseLinkPrimaryKeyAnnotation; -import org.eclipse.jpt.jpa.eclipselink.core.resource.java.EclipseLinkPrimaryKeyAnnotation; - -public class EclipseLinkPrimaryKeyAnnotationDefinition - implements AnnotationDefinition -{ - // singleton - private static final AnnotationDefinition INSTANCE - = new EclipseLinkPrimaryKeyAnnotationDefinition(); - - - /** - * Return the singleton - */ - public static AnnotationDefinition instance() { - return INSTANCE; - } - - - /** - * Enforce singleton usage - */ - private EclipseLinkPrimaryKeyAnnotationDefinition() { - super(); - } - - - public Annotation buildAnnotation(JavaResourceAnnotatedElement parent, AnnotatedElement annotatedElement) { - return new SourceEclipseLinkPrimaryKeyAnnotation(parent, annotatedElement); - } - - public Annotation buildNullAnnotation(JavaResourceAnnotatedElement parent) { - throw new UnsupportedOperationException(); - } - - public Annotation buildAnnotation(JavaResourceAnnotatedElement parent, IAnnotation jdtAnnotation) { - return new BinaryEclipseLinkPrimaryKeyAnnotation(parent, jdtAnnotation); - } - - public String getAnnotationName() { - return EclipseLinkPrimaryKeyAnnotation.ANNOTATION_NAME; - } -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/resource/java/EclipseLinkPrivateOwnedAnnotationDefinition.java b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/resource/java/EclipseLinkPrivateOwnedAnnotationDefinition.java deleted file mode 100644 index cd6847e3bb..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/resource/java/EclipseLinkPrivateOwnedAnnotationDefinition.java +++ /dev/null @@ -1,59 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2009, 2011 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.eclipselink.core.internal.resource.java; - -import org.eclipse.jdt.core.IAnnotation; -import org.eclipse.jpt.common.core.resource.java.Annotation; -import org.eclipse.jpt.common.core.resource.java.AnnotationDefinition; -import org.eclipse.jpt.common.core.resource.java.JavaResourceAnnotatedElement; -import org.eclipse.jpt.common.core.utility.jdt.AnnotatedElement; -import org.eclipse.jpt.jpa.eclipselink.core.internal.resource.java.binary.BinaryEclipseLinkPrivateOwnedAnnotation; -import org.eclipse.jpt.jpa.eclipselink.core.internal.resource.java.source.SourceEclipseLinkPrivateOwnedAnnotation; -import org.eclipse.jpt.jpa.eclipselink.core.resource.java.EclipseLinkPrivateOwnedAnnotation; - -/** - * org.eclipse.persistence.annotations.PrivateOwned - */ -public class EclipseLinkPrivateOwnedAnnotationDefinition - implements AnnotationDefinition -{ - // singleton - private static final AnnotationDefinition INSTANCE = new EclipseLinkPrivateOwnedAnnotationDefinition(); - - /** - * Return the singleton. - */ - public static AnnotationDefinition instance() { - return INSTANCE; - } - - /** - * Ensure single instance. - */ - private EclipseLinkPrivateOwnedAnnotationDefinition() { - super(); - } - - public Annotation buildAnnotation(JavaResourceAnnotatedElement parent, AnnotatedElement annotatedElement) { - return new SourceEclipseLinkPrivateOwnedAnnotation(parent, annotatedElement); - } - - public Annotation buildNullAnnotation(JavaResourceAnnotatedElement parent) { - throw new UnsupportedOperationException(); - } - - public Annotation buildAnnotation(JavaResourceAnnotatedElement parent, IAnnotation jdtAnnotation) { - return new BinaryEclipseLinkPrivateOwnedAnnotation(parent, jdtAnnotation); - } - - public String getAnnotationName() { - return EclipseLinkPrivateOwnedAnnotation.ANNOTATION_NAME; - } -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/resource/java/EclipseLinkReadOnlyAnnotationDefinition.java b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/resource/java/EclipseLinkReadOnlyAnnotationDefinition.java deleted file mode 100644 index 402a0c5fb5..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/resource/java/EclipseLinkReadOnlyAnnotationDefinition.java +++ /dev/null @@ -1,59 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2009, 2011 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.eclipselink.core.internal.resource.java; - -import org.eclipse.jdt.core.IAnnotation; -import org.eclipse.jpt.common.core.resource.java.Annotation; -import org.eclipse.jpt.common.core.resource.java.AnnotationDefinition; -import org.eclipse.jpt.common.core.resource.java.JavaResourceAnnotatedElement; -import org.eclipse.jpt.common.core.utility.jdt.AnnotatedElement; -import org.eclipse.jpt.jpa.eclipselink.core.internal.resource.java.binary.BinaryEclipseLinkReadOnlyAnnotation; -import org.eclipse.jpt.jpa.eclipselink.core.internal.resource.java.source.SourceEclipseLinkReadOnlyAnnotation; -import org.eclipse.jpt.jpa.eclipselink.core.resource.java.EclipseLinkReadOnlyAnnotation; - -/** - * org.eclipse.persistence.annotations.ReadOnly - */ -public class EclipseLinkReadOnlyAnnotationDefinition - implements AnnotationDefinition -{ - // singleton - private static final AnnotationDefinition INSTANCE = new EclipseLinkReadOnlyAnnotationDefinition(); - - /** - * Return the singleton. - */ - public static AnnotationDefinition instance() { - return INSTANCE; - } - - /** - * Ensure single instance. - */ - private EclipseLinkReadOnlyAnnotationDefinition() { - super(); - } - - public Annotation buildAnnotation(JavaResourceAnnotatedElement parent, AnnotatedElement annotatedElement) { - return new SourceEclipseLinkReadOnlyAnnotation(parent, annotatedElement); - } - - public Annotation buildNullAnnotation(JavaResourceAnnotatedElement parent) { - throw new UnsupportedOperationException(); - } - - public Annotation buildAnnotation(JavaResourceAnnotatedElement parent, IAnnotation jdtAnnotation) { - return new BinaryEclipseLinkReadOnlyAnnotation(parent, jdtAnnotation); - } - - public String getAnnotationName() { - return EclipseLinkReadOnlyAnnotation.ANNOTATION_NAME; - } -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/resource/java/EclipseLinkReadTransformerAnnotationDefinition.java b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/resource/java/EclipseLinkReadTransformerAnnotationDefinition.java deleted file mode 100644 index 94ff51b4a7..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/resource/java/EclipseLinkReadTransformerAnnotationDefinition.java +++ /dev/null @@ -1,59 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2009, 2011 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.eclipselink.core.internal.resource.java; - -import org.eclipse.jdt.core.IAnnotation; -import org.eclipse.jpt.common.core.resource.java.Annotation; -import org.eclipse.jpt.common.core.resource.java.AnnotationDefinition; -import org.eclipse.jpt.common.core.resource.java.JavaResourceAnnotatedElement; -import org.eclipse.jpt.common.core.utility.jdt.AnnotatedElement; -import org.eclipse.jpt.jpa.eclipselink.core.internal.resource.java.binary.BinaryEclipseLinkReadTransformerAnnotation; -import org.eclipse.jpt.jpa.eclipselink.core.internal.resource.java.source.SourceEclipseLinkReadTransformerAnnotation; -import org.eclipse.jpt.jpa.eclipselink.core.resource.java.EclipseLinkReadTransformerAnnotation; - -/** - * org.eclipse.persistence.annotations.ReadTransformer - */ -public class EclipseLinkReadTransformerAnnotationDefinition - implements AnnotationDefinition -{ - // singleton - private static final AnnotationDefinition INSTANCE = new EclipseLinkReadTransformerAnnotationDefinition(); - - /** - * Return the singleton. - */ - public static AnnotationDefinition instance() { - return INSTANCE; - } - - /** - * Ensure single instance. - */ - private EclipseLinkReadTransformerAnnotationDefinition() { - super(); - } - - public Annotation buildAnnotation(JavaResourceAnnotatedElement parent, AnnotatedElement annotatedElement) { - return new SourceEclipseLinkReadTransformerAnnotation(parent, annotatedElement); - } - - public Annotation buildNullAnnotation(JavaResourceAnnotatedElement parent) { - throw new UnsupportedOperationException(); - } - - public Annotation buildAnnotation(JavaResourceAnnotatedElement parent, IAnnotation jdtAnnotation) { - return new BinaryEclipseLinkReadTransformerAnnotation(parent, jdtAnnotation); - } - - public String getAnnotationName() { - return EclipseLinkReadTransformerAnnotation.ANNOTATION_NAME; - } -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/resource/java/EclipseLinkStructConverterAnnotationDefinition.java b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/resource/java/EclipseLinkStructConverterAnnotationDefinition.java deleted file mode 100644 index 2628b04df7..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/resource/java/EclipseLinkStructConverterAnnotationDefinition.java +++ /dev/null @@ -1,63 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2009, 2011 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.eclipselink.core.internal.resource.java; - -import org.eclipse.jdt.core.IAnnotation; -import org.eclipse.jpt.common.core.resource.java.JavaResourceAnnotatedElement; -import org.eclipse.jpt.common.core.resource.java.NestableAnnotation; -import org.eclipse.jpt.common.core.resource.java.NestableAnnotationDefinition; -import org.eclipse.jpt.common.core.utility.jdt.AnnotatedElement; -import org.eclipse.jpt.jpa.eclipselink.core.internal.resource.java.binary.BinaryEclipseLinkStructConverterAnnotation; -import org.eclipse.jpt.jpa.eclipselink.core.internal.resource.java.source.SourceEclipseLinkStructConverterAnnotation; -import org.eclipse.jpt.jpa.eclipselink.core.resource.java.EclipseLink; - -/** - * org.eclipse.persistence.annotations.StructConverter - */ -public class EclipseLinkStructConverterAnnotationDefinition - implements NestableAnnotationDefinition -{ - // singleton - private static final NestableAnnotationDefinition INSTANCE = new EclipseLinkStructConverterAnnotationDefinition(); - - /** - * Return the singleton. - */ - public static NestableAnnotationDefinition instance() { - return INSTANCE; - } - - /** - * Ensure single instance. - */ - private EclipseLinkStructConverterAnnotationDefinition() { - super(); - } - - public NestableAnnotation buildAnnotation(JavaResourceAnnotatedElement parent, AnnotatedElement annotatedElement, int index) { - return SourceEclipseLinkStructConverterAnnotation.buildSourceStructConverterAnnotation(parent, annotatedElement, index); - } - - public NestableAnnotation buildAnnotation(JavaResourceAnnotatedElement parent, IAnnotation jdtAnnotation, int index) { - return new BinaryEclipseLinkStructConverterAnnotation(parent, jdtAnnotation); - } - - public String getNestableAnnotationName() { - return EclipseLink.STRUCT_CONVERTER; - } - - public String getContainerAnnotationName() { - return EclipseLink.STRUCT_CONVERTERS; - } - - public String getElementName() { - return EclipseLink.STRUCT_CONVERTERS__VALUE; - } -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/resource/java/EclipseLinkStructConverters2_2AnnotationDefinition.java b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/resource/java/EclipseLinkStructConverters2_2AnnotationDefinition.java deleted file mode 100644 index 5034450bc3..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/resource/java/EclipseLinkStructConverters2_2AnnotationDefinition.java +++ /dev/null @@ -1,60 +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, 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.eclipselink.core.internal.resource.java; - -import org.eclipse.jdt.core.IAnnotation; -import org.eclipse.jpt.common.core.internal.resource.java.binary.BinaryNamedAnnotation; -import org.eclipse.jpt.common.core.internal.resource.java.source.SourceNamedAnnotation; -import org.eclipse.jpt.common.core.resource.java.Annotation; -import org.eclipse.jpt.common.core.resource.java.AnnotationDefinition; -import org.eclipse.jpt.common.core.resource.java.JavaResourceAnnotatedElement; -import org.eclipse.jpt.common.core.utility.jdt.AnnotatedElement; -import org.eclipse.jpt.jpa.eclipselink.core.resource.java.EclipseLink; - -/** - * org.eclipse.persistence.annotations.TypeConverters - */ -public final class EclipseLinkStructConverters2_2AnnotationDefinition - implements AnnotationDefinition -{ - // singleton - private static final AnnotationDefinition INSTANCE = new EclipseLinkStructConverters2_2AnnotationDefinition(); - - /** - * Return the singleton. - */ - public static AnnotationDefinition instance() { - return INSTANCE; - } - - /** - * Ensure single instance. - */ - private EclipseLinkStructConverters2_2AnnotationDefinition() { - super(); - } - - public Annotation buildAnnotation(JavaResourceAnnotatedElement parent, AnnotatedElement annotatedElement) { - return new SourceNamedAnnotation(parent, annotatedElement, getAnnotationName()); - } - - public Annotation buildNullAnnotation(JavaResourceAnnotatedElement parent) { - throw new UnsupportedOperationException(); - } - - public Annotation buildAnnotation(JavaResourceAnnotatedElement parent, IAnnotation jdtAnnotation) { - return new BinaryNamedAnnotation(parent, jdtAnnotation, getAnnotationName()); - } - - public String getAnnotationName() { - return EclipseLink.STRUCT_CONVERTERS; - } - -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/resource/java/EclipseLinkStructure2_3AnnotationDefinition.java b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/resource/java/EclipseLinkStructure2_3AnnotationDefinition.java deleted file mode 100644 index 93e9dcb6d5..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/resource/java/EclipseLinkStructure2_3AnnotationDefinition.java +++ /dev/null @@ -1,59 +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, 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.eclipselink.core.internal.resource.java; - -import org.eclipse.jdt.core.IAnnotation; -import org.eclipse.jpt.common.core.resource.java.Annotation; -import org.eclipse.jpt.common.core.resource.java.AnnotationDefinition; -import org.eclipse.jpt.common.core.resource.java.JavaResourceAnnotatedElement; -import org.eclipse.jpt.common.core.utility.jdt.AnnotatedElement; -import org.eclipse.jpt.jpa.eclipselink.core.internal.resource.java.binary.BinaryEclipseLinkStructureAnnotation; -import org.eclipse.jpt.jpa.eclipselink.core.internal.resource.java.source.SourceEclipseLinkStructureAnnotation; -import org.eclipse.jpt.jpa.eclipselink.core.resource.java.EclipseLinkStructureAnnotation2_3; - -/** - * org.eclipse.persistence.annotations.Sructure - */ -public class EclipseLinkStructure2_3AnnotationDefinition - implements AnnotationDefinition -{ - // singleton - private static final AnnotationDefinition INSTANCE = new EclipseLinkStructure2_3AnnotationDefinition(); - - /** - * Return the singleton. - */ - public static AnnotationDefinition instance() { - return INSTANCE; - } - - /** - * Ensure single instance. - */ - private EclipseLinkStructure2_3AnnotationDefinition() { - super(); - } - - public Annotation buildAnnotation(JavaResourceAnnotatedElement parent, AnnotatedElement annotatedElement) { - return new SourceEclipseLinkStructureAnnotation(parent, annotatedElement); - } - - public Annotation buildNullAnnotation(JavaResourceAnnotatedElement parent) { - throw new UnsupportedOperationException(); - } - - public Annotation buildAnnotation(JavaResourceAnnotatedElement parent, IAnnotation jdtAnnotation) { - return new BinaryEclipseLinkStructureAnnotation(parent, jdtAnnotation); - } - - public String getAnnotationName() { - return EclipseLinkStructureAnnotation2_3.ANNOTATION_NAME; - } -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/resource/java/EclipseLinkTenantDiscriminatorColumn2_3AnnotationDefinition.java b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/resource/java/EclipseLinkTenantDiscriminatorColumn2_3AnnotationDefinition.java deleted file mode 100644 index 404489cd64..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/resource/java/EclipseLinkTenantDiscriminatorColumn2_3AnnotationDefinition.java +++ /dev/null @@ -1,65 +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 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.eclipselink.core.internal.resource.java; - -import org.eclipse.jdt.core.IAnnotation; -import org.eclipse.jpt.common.core.resource.java.JavaResourceAnnotatedElement; -import org.eclipse.jpt.common.core.resource.java.NestableAnnotation; -import org.eclipse.jpt.common.core.resource.java.NestableAnnotationDefinition; -import org.eclipse.jpt.common.core.utility.jdt.AnnotatedElement; -import org.eclipse.jpt.jpa.eclipselink.core.internal.resource.java.binary.BinaryEclipseLinkTenantDiscriminatorColumnAnnotation2_3; -import org.eclipse.jpt.jpa.eclipselink.core.internal.resource.java.source.SourceEclipseLinkTenantDiscriminatorColumnAnnotation2_3; -import org.eclipse.jpt.jpa.eclipselink.core.resource.java.EclipseLink; -import org.eclipse.jpt.jpa.eclipselink.core.resource.java.EclipseLinkTenantDiscriminatorColumnAnnotation2_3; - -public class EclipseLinkTenantDiscriminatorColumn2_3AnnotationDefinition - implements NestableAnnotationDefinition -{ - // singleton - private static final NestableAnnotationDefinition INSTANCE - = new EclipseLinkTenantDiscriminatorColumn2_3AnnotationDefinition(); - - - /** - * Return the singleton - */ - public static NestableAnnotationDefinition instance() { - return INSTANCE; - } - - - /** - * Enforce singleton usage - */ - private EclipseLinkTenantDiscriminatorColumn2_3AnnotationDefinition() { - super(); - } - - public NestableAnnotation buildAnnotation(JavaResourceAnnotatedElement parent, AnnotatedElement annotatedElement, int index) { - return SourceEclipseLinkTenantDiscriminatorColumnAnnotation2_3.buildSourceTenantDiscriminatorColumnAnnotation(parent, annotatedElement, index); - } - - public NestableAnnotation buildAnnotation(JavaResourceAnnotatedElement parent, IAnnotation jdtAnnotation, int index) { - return new BinaryEclipseLinkTenantDiscriminatorColumnAnnotation2_3(parent, jdtAnnotation); - } - - public String getNestableAnnotationName() { - return EclipseLinkTenantDiscriminatorColumnAnnotation2_3.ANNOTATION_NAME; - } - - public String getContainerAnnotationName() { - return EclipseLink.TENANT_DISCRIMINATOR_COLUMNS; - } - - public String getElementName() { - return EclipseLink.TENANT_DISCRIMINATOR_COLUMNS__VALUE; - } -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/resource/java/EclipseLinkTenantDiscriminatorColumns2_3AnnotationDefinition.java b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/resource/java/EclipseLinkTenantDiscriminatorColumns2_3AnnotationDefinition.java deleted file mode 100644 index 38f9023a61..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/resource/java/EclipseLinkTenantDiscriminatorColumns2_3AnnotationDefinition.java +++ /dev/null @@ -1,57 +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, 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.eclipselink.core.internal.resource.java; - -import org.eclipse.jdt.core.IAnnotation; -import org.eclipse.jpt.common.core.internal.resource.java.binary.BinaryNamedAnnotation; -import org.eclipse.jpt.common.core.internal.resource.java.source.SourceNamedAnnotation; -import org.eclipse.jpt.common.core.resource.java.Annotation; -import org.eclipse.jpt.common.core.resource.java.AnnotationDefinition; -import org.eclipse.jpt.common.core.resource.java.JavaResourceAnnotatedElement; -import org.eclipse.jpt.common.core.utility.jdt.AnnotatedElement; -import org.eclipse.jpt.jpa.eclipselink.core.resource.java.EclipseLink; - -public final class EclipseLinkTenantDiscriminatorColumns2_3AnnotationDefinition - implements AnnotationDefinition -{ - // singleton - private static final AnnotationDefinition INSTANCE = new EclipseLinkTenantDiscriminatorColumns2_3AnnotationDefinition(); - - /** - * Return the singleton. - */ - public static AnnotationDefinition instance() { - return INSTANCE; - } - - /** - * Ensure single instance. - */ - private EclipseLinkTenantDiscriminatorColumns2_3AnnotationDefinition() { - super(); - } - - public Annotation buildAnnotation(JavaResourceAnnotatedElement parent, AnnotatedElement annotatedElement) { - return new SourceNamedAnnotation(parent, annotatedElement, getAnnotationName()); - } - - public Annotation buildNullAnnotation(JavaResourceAnnotatedElement parent) { - throw new UnsupportedOperationException(); - } - - public Annotation buildAnnotation(JavaResourceAnnotatedElement parent, IAnnotation jdtAnnotation) { - return new BinaryNamedAnnotation(parent, jdtAnnotation, getAnnotationName()); - } - - public String getAnnotationName() { - return EclipseLink.TENANT_DISCRIMINATOR_COLUMNS; - } - -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/resource/java/EclipseLinkTransformationAnnotationDefinition.java b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/resource/java/EclipseLinkTransformationAnnotationDefinition.java deleted file mode 100644 index 0d27fb0462..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/resource/java/EclipseLinkTransformationAnnotationDefinition.java +++ /dev/null @@ -1,59 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2009, 2011 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.eclipselink.core.internal.resource.java; - -import org.eclipse.jdt.core.IAnnotation; -import org.eclipse.jpt.common.core.resource.java.Annotation; -import org.eclipse.jpt.common.core.resource.java.AnnotationDefinition; -import org.eclipse.jpt.common.core.resource.java.JavaResourceAnnotatedElement; -import org.eclipse.jpt.common.core.utility.jdt.AnnotatedElement; -import org.eclipse.jpt.jpa.eclipselink.core.internal.resource.java.binary.BinaryEclipseLinkTransformationAnnotation; -import org.eclipse.jpt.jpa.eclipselink.core.internal.resource.java.source.SourceEclipseLinkTransformationAnnotation; -import org.eclipse.jpt.jpa.eclipselink.core.resource.java.EclipseLinkTransformationAnnotation; - -/** - * org.eclipse.persistence.annotations.Transformation - */ -public class EclipseLinkTransformationAnnotationDefinition - implements AnnotationDefinition -{ - // singleton - private static final AnnotationDefinition INSTANCE = new EclipseLinkTransformationAnnotationDefinition(); - - /** - * Return the singleton. - */ - public static AnnotationDefinition instance() { - return INSTANCE; - } - - /** - * Ensure single instance. - */ - private EclipseLinkTransformationAnnotationDefinition() { - super(); - } - - public Annotation buildAnnotation(JavaResourceAnnotatedElement parent, AnnotatedElement annotatedElement) { - return new SourceEclipseLinkTransformationAnnotation(parent, annotatedElement); - } - - public Annotation buildNullAnnotation(JavaResourceAnnotatedElement parent) { - return new NullEclipseLinkTransformationAnnotation(parent); - } - - public Annotation buildAnnotation(JavaResourceAnnotatedElement parent, IAnnotation jdtAnnotation) { - return new BinaryEclipseLinkTransformationAnnotation(parent, jdtAnnotation); - } - - public String getAnnotationName() { - return EclipseLinkTransformationAnnotation.ANNOTATION_NAME; - } -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/resource/java/EclipseLinkTypeConverterAnnotationDefinition.java b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/resource/java/EclipseLinkTypeConverterAnnotationDefinition.java deleted file mode 100644 index 7ce8601795..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/resource/java/EclipseLinkTypeConverterAnnotationDefinition.java +++ /dev/null @@ -1,63 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2009, 2011 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.eclipselink.core.internal.resource.java; - -import org.eclipse.jdt.core.IAnnotation; -import org.eclipse.jpt.common.core.resource.java.JavaResourceAnnotatedElement; -import org.eclipse.jpt.common.core.resource.java.NestableAnnotation; -import org.eclipse.jpt.common.core.resource.java.NestableAnnotationDefinition; -import org.eclipse.jpt.common.core.utility.jdt.AnnotatedElement; -import org.eclipse.jpt.jpa.eclipselink.core.internal.resource.java.binary.BinaryEclipseLinkTypeConverterAnnotation; -import org.eclipse.jpt.jpa.eclipselink.core.internal.resource.java.source.SourceEclipseLinkTypeConverterAnnotation; -import org.eclipse.jpt.jpa.eclipselink.core.resource.java.EclipseLink; - -/** - * org.eclipse.persistence.annotations.TypeConverter - */ -public class EclipseLinkTypeConverterAnnotationDefinition - implements NestableAnnotationDefinition -{ - // singleton - private static final NestableAnnotationDefinition INSTANCE = new EclipseLinkTypeConverterAnnotationDefinition(); - - /** - * Return the singleton. - */ - public static NestableAnnotationDefinition instance() { - return INSTANCE; - } - - /** - * Ensure single instance. - */ - private EclipseLinkTypeConverterAnnotationDefinition() { - super(); - } - - public NestableAnnotation buildAnnotation(JavaResourceAnnotatedElement parent, AnnotatedElement annotatedElement, int index) { - return SourceEclipseLinkTypeConverterAnnotation.buildSourceTypeConverterAnnotation(parent, annotatedElement, index); - } - - public NestableAnnotation buildAnnotation(JavaResourceAnnotatedElement parent, IAnnotation jdtAnnotation, int index) { - return new BinaryEclipseLinkTypeConverterAnnotation(parent, jdtAnnotation); - } - - public String getNestableAnnotationName() { - return EclipseLink.TYPE_CONVERTER; - } - - public String getContainerAnnotationName() { - return EclipseLink.TYPE_CONVERTERS; - } - - public String getElementName() { - return EclipseLink.TYPE_CONVERTERS__VALUE; - } -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/resource/java/EclipseLinkTypeConverters2_2AnnotationDefinition.java b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/resource/java/EclipseLinkTypeConverters2_2AnnotationDefinition.java deleted file mode 100644 index 554eb04bac..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/resource/java/EclipseLinkTypeConverters2_2AnnotationDefinition.java +++ /dev/null @@ -1,60 +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, 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.eclipselink.core.internal.resource.java; - -import org.eclipse.jdt.core.IAnnotation; -import org.eclipse.jpt.common.core.internal.resource.java.binary.BinaryNamedAnnotation; -import org.eclipse.jpt.common.core.internal.resource.java.source.SourceNamedAnnotation; -import org.eclipse.jpt.common.core.resource.java.Annotation; -import org.eclipse.jpt.common.core.resource.java.AnnotationDefinition; -import org.eclipse.jpt.common.core.resource.java.JavaResourceAnnotatedElement; -import org.eclipse.jpt.common.core.utility.jdt.AnnotatedElement; -import org.eclipse.jpt.jpa.eclipselink.core.resource.java.EclipseLink; - -/** - * org.eclipse.persistence.annotations.TypeConverters - */ -public final class EclipseLinkTypeConverters2_2AnnotationDefinition - implements AnnotationDefinition -{ - // singleton - private static final AnnotationDefinition INSTANCE = new EclipseLinkTypeConverters2_2AnnotationDefinition(); - - /** - * Return the singleton. - */ - public static AnnotationDefinition instance() { - return INSTANCE; - } - - /** - * Ensure single instance. - */ - private EclipseLinkTypeConverters2_2AnnotationDefinition() { - super(); - } - - public Annotation buildAnnotation(JavaResourceAnnotatedElement parent, AnnotatedElement annotatedElement) { - return new SourceNamedAnnotation(parent, annotatedElement, getAnnotationName()); - } - - public Annotation buildNullAnnotation(JavaResourceAnnotatedElement parent) { - throw new UnsupportedOperationException(); - } - - public Annotation buildAnnotation(JavaResourceAnnotatedElement parent, IAnnotation jdtAnnotation) { - return new BinaryNamedAnnotation(parent, jdtAnnotation, getAnnotationName()); - } - - public String getAnnotationName() { - return EclipseLink.TYPE_CONVERTERS; - } - -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/resource/java/EclipseLinkVariableOneToOneAnnotationDefinition.java b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/resource/java/EclipseLinkVariableOneToOneAnnotationDefinition.java deleted file mode 100644 index bd2b0d5fff..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/resource/java/EclipseLinkVariableOneToOneAnnotationDefinition.java +++ /dev/null @@ -1,59 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2009, 2011 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.eclipselink.core.internal.resource.java; - -import org.eclipse.jdt.core.IAnnotation; -import org.eclipse.jpt.common.core.resource.java.Annotation; -import org.eclipse.jpt.common.core.resource.java.AnnotationDefinition; -import org.eclipse.jpt.common.core.resource.java.JavaResourceAnnotatedElement; -import org.eclipse.jpt.common.core.utility.jdt.AnnotatedElement; -import org.eclipse.jpt.jpa.eclipselink.core.internal.resource.java.binary.BinaryEclipseLinkVariableOneToOneAnnotation; -import org.eclipse.jpt.jpa.eclipselink.core.internal.resource.java.source.SourceEclipseLinkVariableOneToOneAnnotation; -import org.eclipse.jpt.jpa.eclipselink.core.resource.java.EclipseLinkVariableOneToOneAnnotation; - -/** - * org.eclipse.persistence.annotations.VariableOneToOne - */ -public class EclipseLinkVariableOneToOneAnnotationDefinition - implements AnnotationDefinition -{ - // singleton - private static final AnnotationDefinition INSTANCE = new EclipseLinkVariableOneToOneAnnotationDefinition(); - - /** - * Return the singleton. - */ - public static AnnotationDefinition instance() { - return INSTANCE; - } - - /** - * Ensure single instance. - */ - private EclipseLinkVariableOneToOneAnnotationDefinition() { - super(); - } - - public Annotation buildAnnotation(JavaResourceAnnotatedElement parent, AnnotatedElement annotatedElement) { - return new SourceEclipseLinkVariableOneToOneAnnotation(parent, annotatedElement); - } - - public Annotation buildNullAnnotation(JavaResourceAnnotatedElement parent) { - throw new UnsupportedOperationException(); - } - - public Annotation buildAnnotation(JavaResourceAnnotatedElement parent, IAnnotation jdtAnnotation) { - return new BinaryEclipseLinkVariableOneToOneAnnotation(parent, jdtAnnotation); - } - - public String getAnnotationName() { - return EclipseLinkVariableOneToOneAnnotation.ANNOTATION_NAME; - } -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/resource/java/EclipseLinkWriteTransformerAnnotationDefinition.java b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/resource/java/EclipseLinkWriteTransformerAnnotationDefinition.java deleted file mode 100644 index 13773e428b..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/resource/java/EclipseLinkWriteTransformerAnnotationDefinition.java +++ /dev/null @@ -1,59 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2009, 2011 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.eclipselink.core.internal.resource.java; - -import org.eclipse.jdt.core.IAnnotation; -import org.eclipse.jpt.common.core.resource.java.Annotation; -import org.eclipse.jpt.common.core.resource.java.AnnotationDefinition; -import org.eclipse.jpt.common.core.resource.java.JavaResourceAnnotatedElement; -import org.eclipse.jpt.common.core.utility.jdt.AnnotatedElement; -import org.eclipse.jpt.jpa.eclipselink.core.internal.resource.java.binary.BinaryEclipseLinkWriteTransformerAnnotation; -import org.eclipse.jpt.jpa.eclipselink.core.internal.resource.java.source.SourceEclipseLinkWriteTransformerAnnotation; -import org.eclipse.jpt.jpa.eclipselink.core.resource.java.EclipseLinkWriteTransformerAnnotation; - -/** - * org.eclipse.persistence.annotations.WriteTransformer - */ -public class EclipseLinkWriteTransformerAnnotationDefinition - implements AnnotationDefinition -{ - // singleton - private static final AnnotationDefinition INSTANCE = new EclipseLinkWriteTransformerAnnotationDefinition(); - - /** - * Return the singleton. - */ - public static AnnotationDefinition instance() { - return INSTANCE; - } - - /** - * Ensure single instance. - */ - private EclipseLinkWriteTransformerAnnotationDefinition() { - super(); - } - - public Annotation buildAnnotation(JavaResourceAnnotatedElement parent, AnnotatedElement annotatedElement) { - return new SourceEclipseLinkWriteTransformerAnnotation(parent, annotatedElement); - } - - public Annotation buildNullAnnotation(JavaResourceAnnotatedElement parent) { - throw new UnsupportedOperationException(); - } - - public Annotation buildAnnotation(JavaResourceAnnotatedElement parent, IAnnotation jdtAnnotation) { - return new BinaryEclipseLinkWriteTransformerAnnotation(parent, jdtAnnotation); - } - - public String getAnnotationName() { - return EclipseLinkWriteTransformerAnnotation.ANNOTATION_NAME; - } -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/resource/java/NullEclipseLinkCacheAnnotation.java b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/resource/java/NullEclipseLinkCacheAnnotation.java deleted file mode 100644 index 2ad0557a48..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/resource/java/NullEclipseLinkCacheAnnotation.java +++ /dev/null @@ -1,188 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2008, 2012 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.eclipselink.core.internal.resource.java; - -import org.eclipse.jpt.common.core.internal.resource.java.NullAnnotation; -import org.eclipse.jpt.common.core.resource.java.JavaResourceAnnotatedElement; -import org.eclipse.jpt.common.core.utility.TextRange; -import org.eclipse.jpt.jpa.eclipselink.core.resource.java.CacheCoordinationType; -import org.eclipse.jpt.jpa.eclipselink.core.resource.java.CacheIsolationType2_2; -import org.eclipse.jpt.jpa.eclipselink.core.resource.java.CacheType; -import org.eclipse.jpt.jpa.eclipselink.core.resource.java.EclipseLinkCacheAnnotation; -import org.eclipse.jpt.jpa.eclipselink.core.resource.java.EclipseLinkTimeOfDayAnnotation; - -/** - * <code>org.eclipse.persistence.annotations.Cache</code> - */ -public final class NullEclipseLinkCacheAnnotation - extends NullAnnotation<EclipseLinkCacheAnnotation> - implements EclipseLinkCacheAnnotation -{ - protected NullEclipseLinkCacheAnnotation(JavaResourceAnnotatedElement parent) { - super(parent); - } - - public String getAnnotationName() { - return ANNOTATION_NAME; - } - - // ***** type - public CacheType getType() { - return null; - } - - public void setType(CacheType type) { - if (type != null) { - this.addAnnotation().setType(type); - } - } - - public TextRange getTypeTextRange() { - return null; - } - - // ***** size - public Integer getSize() { - return null; - } - - public void setSize(Integer size) { - if (size != null) { - this.addAnnotation().setSize(size); - } - } - - public TextRange getSizeTextRange() { - return null; - } - - // ***** shared - public Boolean getShared() { - return null; - } - - public void setShared(Boolean shared) { - if (shared != null) { - this.addAnnotation().setShared(shared); - } - } - - public TextRange getSharedTextRange() { - return null; - } - - // ***** always refresh - public Boolean getAlwaysRefresh() { - return null; - } - - public void setAlwaysRefresh(Boolean alwaysRefresh) { - if (alwaysRefresh != null) { - this.addAnnotation().setAlwaysRefresh(alwaysRefresh); - } - } - - public TextRange getAlwaysRefreshTextRange() { - return null; - } - - // ***** refresh only if newer - public Boolean getRefreshOnlyIfNewer() { - return null; - } - - public void setRefreshOnlyIfNewer(Boolean refreshOnlyIfNewer) { - if (refreshOnlyIfNewer != null) { - this.addAnnotation().setRefreshOnlyIfNewer(refreshOnlyIfNewer); - } - } - - public TextRange getRefreshOnlyIfNewerTextRange() { - return null; - } - - // ***** disable hits - public Boolean getDisableHits() { - return null; - } - - public void setDisableHits(Boolean disableHits) { - if (disableHits != null) { - this.addAnnotation().setDisableHits(disableHits); - } - } - - public TextRange getDisableHitsTextRange() { - return null; - } - - // ***** coordination type - public CacheCoordinationType getCoordinationType() { - return null; - } - - public void setCoordinationType(CacheCoordinationType coordinationType) { - if (coordinationType != null) { - this.addAnnotation().setCoordinationType(coordinationType); - } - } - - public TextRange getCoordinationTypeTextRange() { - return null; - } - - // ***** expiry - public Integer getExpiry() { - return null; - } - - public void setExpiry(Integer expiry) { - if (expiry != null) { - this.addAnnotation().setExpiry(expiry); - } - } - - public TextRange getExpiryTextRange() { - return null; - } - - // ***** expiry time of day - public EclipseLinkTimeOfDayAnnotation getExpiryTimeOfDay() { - return null; - } - - public EclipseLinkTimeOfDayAnnotation addExpiryTimeOfDay() { - return this.addAnnotation().addExpiryTimeOfDay(); - } - - public void removeExpiryTimeOfDay() { - // do nothing - } - - public TextRange getExpiryTimeOfDayTextRange() { - return null; - } - - - // ***** isolation - public CacheIsolationType2_2 getIsolation() { - return null; - } - - public void setIsolation(CacheIsolationType2_2 isolation) { - if (isolation != null) { - this.addAnnotation().setIsolation(isolation); - } - } - - public TextRange getIsolationTextRange() { - return null; - } -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/resource/java/NullEclipseLinkJoinFetchAnnotation.java b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/resource/java/NullEclipseLinkJoinFetchAnnotation.java deleted file mode 100644 index a74b6451ae..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/resource/java/NullEclipseLinkJoinFetchAnnotation.java +++ /dev/null @@ -1,47 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2008, 2012 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.eclipselink.core.internal.resource.java; - -import org.eclipse.jpt.common.core.internal.resource.java.NullAnnotation; -import org.eclipse.jpt.common.core.resource.java.JavaResourceAnnotatedElement; -import org.eclipse.jpt.common.core.utility.TextRange; -import org.eclipse.jpt.jpa.eclipselink.core.resource.java.EclipseLinkJoinFetchAnnotation; -import org.eclipse.jpt.jpa.eclipselink.core.resource.java.JoinFetchType; - -/** - * <code>org.eclipse.persistence.annotations.JoinFetch</code> - */ -public final class NullEclipseLinkJoinFetchAnnotation - extends NullAnnotation<EclipseLinkJoinFetchAnnotation> - implements EclipseLinkJoinFetchAnnotation -{ - protected NullEclipseLinkJoinFetchAnnotation(JavaResourceAnnotatedElement parent) { - super(parent); - } - - public String getAnnotationName() { - return ANNOTATION_NAME; - } - - // ***** value - public JoinFetchType getValue() { - return null; - } - - public void setValue(JoinFetchType value) { - if (value != null) { - this.addAnnotation().setValue(value); - } - } - - public TextRange getValueTextRange() { - return null; - } -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/resource/java/NullEclipseLinkMultitenantAnnotation2_3.java b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/resource/java/NullEclipseLinkMultitenantAnnotation2_3.java deleted file mode 100644 index 479ae5fe50..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/resource/java/NullEclipseLinkMultitenantAnnotation2_3.java +++ /dev/null @@ -1,68 +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, 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.eclipselink.core.internal.resource.java; - -import org.eclipse.jdt.core.dom.CompilationUnit; -import org.eclipse.jpt.common.core.internal.resource.java.NullAnnotation; -import org.eclipse.jpt.common.core.resource.java.JavaResourceAnnotatedElement; -import org.eclipse.jpt.common.core.utility.TextRange; -import org.eclipse.jpt.jpa.eclipselink.core.resource.java.EclipseLinkMultitenantAnnotation2_3; -import org.eclipse.jpt.jpa.eclipselink.core.resource.java.MultitenantType2_3; - -/** - * <code>org.eclipse.persistence.annotations.Multitenant</code> - */ -public final class NullEclipseLinkMultitenantAnnotation2_3 - extends NullAnnotation<EclipseLinkMultitenantAnnotation2_3> - implements EclipseLinkMultitenantAnnotation2_3 -{ - protected NullEclipseLinkMultitenantAnnotation2_3(JavaResourceAnnotatedElement parent) { - super(parent); - } - - public String getAnnotationName() { - return ANNOTATION_NAME; - } - - public boolean isSpecified() { - return false; - } - - // ***** type - public MultitenantType2_3 getValue() { - return null; - } - - public void setValue(MultitenantType2_3 value) { - if (value != null) { - this.addAnnotation().setValue(value); - } - } - - public TextRange getValueTextRange(CompilationUnit astRoot) { - return null; - } - - // ***** include criteria - public Boolean getIncludeCriteria() { - return null; - } - - public void setIncludeCriteria(Boolean includeCriteria) { - if (includeCriteria != null) { - this.addAnnotation().setIncludeCriteria(includeCriteria); - } - } - - public TextRange getIncludeCriteriaTextRange(CompilationUnit astRoot) { - return null; - } - -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/resource/java/NullEclipseLinkTenantDiscriminatorColumnAnnotation2_3.java b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/resource/java/NullEclipseLinkTenantDiscriminatorColumnAnnotation2_3.java deleted file mode 100644 index 2243813b9d..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/resource/java/NullEclipseLinkTenantDiscriminatorColumnAnnotation2_3.java +++ /dev/null @@ -1,80 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2011, 2012 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.eclipselink.core.internal.resource.java; - -import org.eclipse.jpt.common.core.resource.java.JavaResourceAnnotatedElement; -import org.eclipse.jpt.common.core.utility.TextRange; -import org.eclipse.jpt.jpa.core.internal.resource.java.NullBaseDiscriminatorColumnAnnotation; -import org.eclipse.jpt.jpa.eclipselink.core.resource.java.EclipseLinkTenantDiscriminatorColumnAnnotation2_3; - -/** - * <code>org.eclipse.persistence.annotations.TenantDiscriminatorColumn</code> - */ -public final class NullEclipseLinkTenantDiscriminatorColumnAnnotation2_3 - extends NullBaseDiscriminatorColumnAnnotation<EclipseLinkTenantDiscriminatorColumnAnnotation2_3> - implements EclipseLinkTenantDiscriminatorColumnAnnotation2_3 -{ - public NullEclipseLinkTenantDiscriminatorColumnAnnotation2_3(JavaResourceAnnotatedElement parent) { - super(parent); - } - - public String getAnnotationName() { - return EclipseLinkTenantDiscriminatorColumnAnnotation2_3.ANNOTATION_NAME; - } - - // ***** context property - public String getContextProperty() { - return null; - } - - public void setContextProperty(String contextProperty) { - if (contextProperty != null) { - this.addAnnotation().setContextProperty(contextProperty); - } - } - - public TextRange getContextPropertyTextRange() { - return null; - } - - // ***** table - public String getTable() { - return null; - } - - public void setTable(String table) { - if (table != null) { - this.addAnnotation().setTable(table); - } - } - - public TextRange getTableTextRange() { - return null; - } - - public boolean tableTouches(int pos) { - return false; - } - - // ***** primary key - public Boolean getPrimaryKey() { - return null; - } - - public void setPrimaryKey(Boolean primaryKey) { - if (primaryKey != null) { - this.addAnnotation().setPrimaryKey(primaryKey); - } - } - - public TextRange getPrimaryKeyTextRange() { - return null; - } -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/resource/java/NullEclipseLinkTransformationAnnotation.java b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/resource/java/NullEclipseLinkTransformationAnnotation.java deleted file mode 100644 index e2af29cedf..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/resource/java/NullEclipseLinkTransformationAnnotation.java +++ /dev/null @@ -1,62 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2008, 2012 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.eclipselink.core.internal.resource.java; - -import org.eclipse.jpt.common.core.internal.resource.java.NullAnnotation; -import org.eclipse.jpt.common.core.resource.java.JavaResourceAnnotatedElement; -import org.eclipse.jpt.common.core.utility.TextRange; -import org.eclipse.jpt.jpa.core.resource.java.FetchType; -import org.eclipse.jpt.jpa.eclipselink.core.resource.java.EclipseLinkTransformationAnnotation; - -/** - * <code>org.eclipse.persistence.annotations.Transformation</code> - */ -public final class NullEclipseLinkTransformationAnnotation - extends NullAnnotation<EclipseLinkTransformationAnnotation> - implements EclipseLinkTransformationAnnotation -{ - protected NullEclipseLinkTransformationAnnotation(JavaResourceAnnotatedElement parent) { - super(parent); - } - - public String getAnnotationName() { - return ANNOTATION_NAME; - } - - // ***** fetch - public FetchType getFetch() { - return null; - } - - public void setFetch(FetchType fetch) { - if (fetch != null) { - this.addAnnotation().setFetch(fetch); - } - } - - public TextRange getFetchTextRange() { - return null; - } - - // ***** optional - public Boolean getOptional() { - return null; - } - - public void setOptional(Boolean optional) { - if (optional != null) { - this.addAnnotation().setOptional(optional); - } - } - - public TextRange getOptionalTextRange() { - return null; - } -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/resource/java/NullEclipseLinkWriteTransformerColumnAnnotation.java b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/resource/java/NullEclipseLinkWriteTransformerColumnAnnotation.java deleted file mode 100644 index c508768725..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/resource/java/NullEclipseLinkWriteTransformerColumnAnnotation.java +++ /dev/null @@ -1,34 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2007, 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.eclipselink.core.internal.resource.java; - -import org.eclipse.jpt.jpa.core.internal.resource.java.NullColumnAnnotation; -import org.eclipse.jpt.jpa.core.resource.java.ColumnAnnotation; -import org.eclipse.jpt.jpa.eclipselink.core.resource.java.EclipseLinkWriteTransformerAnnotation; - -/** - * <code>javax.persistence.Column</code> - */ -public final class NullEclipseLinkWriteTransformerColumnAnnotation - extends NullColumnAnnotation -{ - public NullEclipseLinkWriteTransformerColumnAnnotation(EclipseLinkWriteTransformerAnnotation parent) { - super(parent); - } - - private EclipseLinkWriteTransformerAnnotation getWriteTransformerAnnotation() { - return (EclipseLinkWriteTransformerAnnotation) this.parent; - } - - @Override - protected ColumnAnnotation addAnnotation() { - return this.getWriteTransformerAnnotation().addColumn(); - } -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/resource/java/binary/BinaryEclipseLinkArrayAnnotation.java b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/resource/java/binary/BinaryEclipseLinkArrayAnnotation.java deleted file mode 100644 index 756b0efe19..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/resource/java/binary/BinaryEclipseLinkArrayAnnotation.java +++ /dev/null @@ -1,32 +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, 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.eclipselink.core.internal.resource.java.binary; - -import org.eclipse.jdt.core.IAnnotation; -import org.eclipse.jpt.common.core.internal.resource.java.binary.BinaryAnnotation; -import org.eclipse.jpt.common.core.resource.java.JavaResourceAnnotatedElement; -import org.eclipse.jpt.jpa.eclipselink.core.resource.java.EclipseLinkArrayAnnotation2_3; - -/** - * org.eclipse.persistence.annotations.Array - */ -public final class BinaryEclipseLinkArrayAnnotation - extends BinaryAnnotation - implements EclipseLinkArrayAnnotation2_3 -{ - public BinaryEclipseLinkArrayAnnotation(JavaResourceAnnotatedElement parent, IAnnotation jdtAnnotation) { - super(parent, jdtAnnotation); - } - - public String getAnnotationName() { - return ANNOTATION_NAME; - } - -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/resource/java/binary/BinaryEclipseLinkBaseConvertAnnotation.java b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/resource/java/binary/BinaryEclipseLinkBaseConvertAnnotation.java deleted file mode 100644 index 95ccb577ed..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/resource/java/binary/BinaryEclipseLinkBaseConvertAnnotation.java +++ /dev/null @@ -1,72 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2009, 2012 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.eclipselink.core.internal.resource.java.binary; - -import org.eclipse.jdt.core.IAnnotation; -import org.eclipse.jpt.common.core.internal.resource.java.binary.BinaryAnnotation; -import org.eclipse.jpt.common.core.resource.java.JavaResourceAnnotatedElement; -import org.eclipse.jpt.common.core.utility.TextRange; -import org.eclipse.jpt.jpa.eclipselink.core.resource.java.EclipseLinkBaseConvertAnnotation; - -/** - * <code><ul> - * <li>org.eclipse.persistence.annotations.Convert - * <li>org.eclipse.persistence.annotations.MapKeyConvert - * </ul></code> - */ -public abstract class BinaryEclipseLinkBaseConvertAnnotation - extends BinaryAnnotation - implements EclipseLinkBaseConvertAnnotation -{ - private String value; - - protected BinaryEclipseLinkBaseConvertAnnotation(JavaResourceAnnotatedElement parent, IAnnotation jdtAnnotation) { - super(parent, jdtAnnotation); - this.value = this.buildValue(); - } - - @Override - public void update() { - super.update(); - this.setValue_(this.buildValue()); - } - - - // ********** ConvertAnnotation implementation ********** - - // ***** value - public String getValue() { - return this.value; - } - - public void setValue(String value) { - throw new UnsupportedOperationException(); - } - - private void setValue_(String value) { - String old = this.value; - this.value = value; - this.firePropertyChanged(VALUE_PROPERTY, old, value); - } - - private String buildValue() { - return (String) this.getJdtMemberValue(this.getValueElementName()); - } - - protected abstract String getValueElementName(); - - public TextRange getValueTextRange() { - throw new UnsupportedOperationException(); - } - - public boolean valueTouches(int pos) { - throw new UnsupportedOperationException(); - } -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/resource/java/binary/BinaryEclipseLinkBaseTypeConverterAnnotation.java b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/resource/java/binary/BinaryEclipseLinkBaseTypeConverterAnnotation.java deleted file mode 100644 index 43439c8899..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/resource/java/binary/BinaryEclipseLinkBaseTypeConverterAnnotation.java +++ /dev/null @@ -1,106 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2009, 2012 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.eclipselink.core.internal.resource.java.binary; - -import org.eclipse.jdt.core.IAnnotation; -import org.eclipse.jpt.common.core.resource.java.JavaResourceAnnotatedElement; -import org.eclipse.jpt.common.core.utility.TextRange; -import org.eclipse.jpt.jpa.eclipselink.core.resource.java.EclipseLinkBaseTypeConverterAnnotation; - -/** - * <code> - * <ul> - * <li>org.eclipse.persistence.annotations.TypeConverter - * <li>org.eclipse.persistence.annotations.ObjectTypeConverter - * </ul> - * </code> - */ -abstract class BinaryEclipseLinkBaseTypeConverterAnnotation - extends BinaryEclipseLinkNamedConverterAnnotation - implements EclipseLinkBaseTypeConverterAnnotation -{ - String dataType; - String objectType; - - - BinaryEclipseLinkBaseTypeConverterAnnotation(JavaResourceAnnotatedElement parent, IAnnotation jdtAnnotation) { - super(parent, jdtAnnotation); - this.dataType = this.buildDataType(); - this.objectType = this.buildObjectType(); - } - - @Override - public void update() { - super.update(); - this.setDataType_(this.buildDataType()); - this.setObjectType_(this.buildObjectType()); - } - - - // ********** ObjectTypeConverterAnnotation implementation ********** - - // ***** data type - public String getDataType() { - return this.dataType; - } - - public void setDataType(String dataType) { - throw new UnsupportedOperationException(); - } - - private void setDataType_(String dataType) { - String old = this.dataType; - this.dataType = dataType; - this.firePropertyChanged(DATA_TYPE_PROPERTY, old, dataType); - } - - public String getFullyQualifiedDataType() { - return this.dataType; - } - - private String buildDataType() { - return (String) this.getJdtMemberValue(this.getDataTypeElementName()); - } - - public TextRange getDataTypeTextRange() { - throw new UnsupportedOperationException(); - } - - abstract String getDataTypeElementName(); - - // ***** object type - public String getObjectType() { - return this.objectType; - } - - public void setObjectType(String objectType) { - throw new UnsupportedOperationException(); - } - - private void setObjectType_(String objectType) { - String old = this.objectType; - this.objectType = objectType; - this.firePropertyChanged(OBJECT_TYPE_PROPERTY, old, objectType); - } - - public String getFullyQualifiedObjectType() { - return this.objectType; - } - - private String buildObjectType() { - return (String) this.getJdtMemberValue(this.getObjectTypeElementName()); - } - - public TextRange getObjectTypeTextRange() { - throw new UnsupportedOperationException(); - } - - abstract String getObjectTypeElementName(); -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/resource/java/binary/BinaryEclipseLinkBasicCollectionAnnotation.java b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/resource/java/binary/BinaryEclipseLinkBasicCollectionAnnotation.java deleted file mode 100644 index b3db1a0770..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/resource/java/binary/BinaryEclipseLinkBasicCollectionAnnotation.java +++ /dev/null @@ -1,32 +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, 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.eclipselink.core.internal.resource.java.binary; - -import org.eclipse.jdt.core.IAnnotation; -import org.eclipse.jpt.common.core.internal.resource.java.binary.BinaryAnnotation; -import org.eclipse.jpt.common.core.resource.java.JavaResourceAnnotatedElement; -import org.eclipse.jpt.jpa.eclipselink.core.resource.java.EclipseLinkBasicCollectionAnnotation; - -/** - * org.eclipse.persistence.annotations.BasicCollection - */ -public final class BinaryEclipseLinkBasicCollectionAnnotation - extends BinaryAnnotation - implements EclipseLinkBasicCollectionAnnotation -{ - public BinaryEclipseLinkBasicCollectionAnnotation(JavaResourceAnnotatedElement parent, IAnnotation jdtAnnotation) { - super(parent, jdtAnnotation); - } - - public String getAnnotationName() { - return ANNOTATION_NAME; - } - -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/resource/java/binary/BinaryEclipseLinkBasicMapAnnotation.java b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/resource/java/binary/BinaryEclipseLinkBasicMapAnnotation.java deleted file mode 100644 index 90a6124b89..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/resource/java/binary/BinaryEclipseLinkBasicMapAnnotation.java +++ /dev/null @@ -1,32 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2009, 2011 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.eclipselink.core.internal.resource.java.binary; - -import org.eclipse.jdt.core.IAnnotation; -import org.eclipse.jpt.common.core.internal.resource.java.binary.BinaryAnnotation; -import org.eclipse.jpt.common.core.resource.java.JavaResourceAnnotatedElement; -import org.eclipse.jpt.jpa.eclipselink.core.resource.java.EclipseLinkBasicMapAnnotation; - -/** - * org.eclipse.persistence.annotations.BasicMap - */ -public final class BinaryEclipseLinkBasicMapAnnotation - extends BinaryAnnotation - implements EclipseLinkBasicMapAnnotation -{ - public BinaryEclipseLinkBasicMapAnnotation(JavaResourceAnnotatedElement parent, IAnnotation jdtAnnotation) { - super(parent, jdtAnnotation); - } - - public String getAnnotationName() { - return ANNOTATION_NAME; - } - -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/resource/java/binary/BinaryEclipseLinkCacheAnnotation.java b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/resource/java/binary/BinaryEclipseLinkCacheAnnotation.java deleted file mode 100644 index 0153aaaab8..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/resource/java/binary/BinaryEclipseLinkCacheAnnotation.java +++ /dev/null @@ -1,336 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2009, 2012 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.eclipselink.core.internal.resource.java.binary; - -import org.eclipse.jdt.core.IAnnotation; -import org.eclipse.jpt.common.core.internal.resource.java.binary.BinaryAnnotation; -import org.eclipse.jpt.common.core.resource.java.JavaResourceAnnotatedElement; -import org.eclipse.jpt.common.core.utility.TextRange; -import org.eclipse.jpt.jpa.eclipselink.core.resource.java.CacheCoordinationType; -import org.eclipse.jpt.jpa.eclipselink.core.resource.java.CacheIsolationType2_2; -import org.eclipse.jpt.jpa.eclipselink.core.resource.java.CacheType; -import org.eclipse.jpt.jpa.eclipselink.core.resource.java.EclipseLink; -import org.eclipse.jpt.jpa.eclipselink.core.resource.java.EclipseLinkCacheAnnotation; -import org.eclipse.jpt.jpa.eclipselink.core.resource.java.EclipseLinkTimeOfDayAnnotation; - -/** - * <code>org.eclipse.persistence.annotations.Cache</code> - */ -public final class BinaryEclipseLinkCacheAnnotation - extends BinaryAnnotation - implements EclipseLinkCacheAnnotation -{ - private CacheType type; - private Integer size; - private Boolean shared; - private Integer expiry; - private EclipseLinkTimeOfDayAnnotation expiryTimeOfDay; - private Boolean alwaysRefresh; - private Boolean refreshOnlyIfNewer; - private Boolean disableHits; - private CacheCoordinationType coordinationType; - private CacheIsolationType2_2 isolation; - - - public BinaryEclipseLinkCacheAnnotation(JavaResourceAnnotatedElement parent, IAnnotation jdtAnnotation) { - super(parent, jdtAnnotation); - this.type = this.buildType(); - this.size = this.buildSize(); - this.shared = this.buildShared(); - this.expiry = this.buildExpiry(); - this.expiryTimeOfDay = this.buildExpiryTimeOfDay(); - this.alwaysRefresh = this.buildAlwaysRefresh(); - this.refreshOnlyIfNewer = this.buildRefreshOnlyIfNewer(); - this.disableHits = this.buildDisableHits(); - this.coordinationType = this.buildCoordinationType(); - this.isolation = this.buildIsolation(); - } - - public String getAnnotationName() { - return ANNOTATION_NAME; - } - - // TODO - @Override - public void update() { - super.update(); - this.setType_(this.buildType()); - this.setSize_(this.buildSize()); - this.setShared_(this.buildShared()); - this.setExpiry_(this.buildExpiry()); - this.updateExpiryTimeOfDay(); - this.setAlwaysRefresh_(this.buildAlwaysRefresh()); - this.setRefreshOnlyIfNewer_(this.buildRefreshOnlyIfNewer()); - this.setDisableHits_(this.buildDisableHits()); - this.setCoordinationType_(this.buildCoordinationType()); - this.setIsolation_(this.buildIsolation()); - } - - - // ********** CacheAnnotation implementation ********** - - // ***** type - public CacheType getType() { - return this.type; - } - - public void setType(CacheType type) { - throw new UnsupportedOperationException(); - } - - private void setType_(CacheType type) { - CacheType old = this.type; - this.type = type; - this.firePropertyChanged(TYPE_PROPERTY, old, type); - } - - private CacheType buildType() { - return CacheType.fromJavaAnnotationValue(this.getJdtMemberValue(EclipseLink.CACHE__TYPE)); - } - - public TextRange getTypeTextRange() { - throw new UnsupportedOperationException(); - } - - // ***** size - public Integer getSize() { - return this.size; - } - - public void setSize(Integer size) { - throw new UnsupportedOperationException(); - } - - private void setSize_(Integer size) { - Integer old = this.size; - this.size = size; - this.firePropertyChanged(SIZE_PROPERTY, old, size); - } - - private Integer buildSize() { - return (Integer) this.getJdtMemberValue(EclipseLink.CACHE__SIZE); - } - - public TextRange getSizeTextRange() { - throw new UnsupportedOperationException(); - } - - // ***** shared - public Boolean getShared() { - return this.shared; - } - - public void setShared(Boolean shared) { - throw new UnsupportedOperationException(); - } - - private void setShared_(Boolean shared) { - Boolean old = this.shared; - this.shared = shared; - this.firePropertyChanged(SHARED_PROPERTY, old, shared); - } - - private Boolean buildShared() { - return (Boolean) this.getJdtMemberValue(EclipseLink.CACHE__SHARED); - } - - public TextRange getSharedTextRange() { - throw new UnsupportedOperationException(); - } - - // ***** expiry - public Integer getExpiry() { - return this.expiry; - } - - public void setExpiry(Integer expiry) { - throw new UnsupportedOperationException(); - } - - private void setExpiry_(Integer expiry) { - Integer old = this.expiry; - this.expiry = expiry; - this.firePropertyChanged(EXPIRY_PROPERTY, old, expiry); - } - - private Integer buildExpiry() { - return (Integer) this.getJdtMemberValue(EclipseLink.CACHE__EXPIRY); - } - - public TextRange getExpiryTextRange() { - throw new UnsupportedOperationException(); - } - - // ***** expiry time of day - public EclipseLinkTimeOfDayAnnotation getExpiryTimeOfDay() { - return this.expiryTimeOfDay; - } - - public EclipseLinkTimeOfDayAnnotation addExpiryTimeOfDay() { - throw new UnsupportedOperationException(); - } - - public void removeExpiryTimeOfDay() { - throw new UnsupportedOperationException(); - } - - private EclipseLinkTimeOfDayAnnotation buildExpiryTimeOfDay() { - IAnnotation jdtTimeOfDay = this.getJdtExpiryTimeOfDay(); - return (jdtTimeOfDay == null) ? null : this.buildTimeOfDay(jdtTimeOfDay); - } - - private EclipseLinkTimeOfDayAnnotation buildTimeOfDay(IAnnotation jdtTimeOfDay) { - return new BinaryEclipseLinkTimeOfDayAnnotation(this, jdtTimeOfDay); - } - - private IAnnotation getJdtExpiryTimeOfDay() { - return (IAnnotation) this.getJdtMemberValue(EclipseLink.CACHE__EXPIRY_TIME_OF_DAY); - } - - private void setExpiryTimeOfDay(EclipseLinkTimeOfDayAnnotation expiryTimeOfDay) { - EclipseLinkTimeOfDayAnnotation old = this.expiryTimeOfDay; - this.expiryTimeOfDay = expiryTimeOfDay; - this.firePropertyChanged(EXPIRY_TIME_OF_DAY_PROPERTY, old, expiryTimeOfDay); - } - - // TODO - private void updateExpiryTimeOfDay() { - throw new UnsupportedOperationException(); -// IAnnotation jdtTimeOfDay = this.getJdtExpiryTimeOfDay(); -// if (jdtTimeOfDay == null) { -// this.setExpiryTimeOfDay(null); -// } else { -// if (this.expiryTimeOfDay == null) { -// this.setExpiryTimeOfDay(this.buildTimeOfDay(jdtTimeOfDay)); -// } else { -// this.expiryTimeOfDay.update(jdtTimeOfDay); -// } -// } - } - - public TextRange getExpiryTimeOfDayTextRange() { - throw new UnsupportedOperationException(); - } - - // ***** always refresh - public Boolean getAlwaysRefresh() { - return this.alwaysRefresh; - } - - public void setAlwaysRefresh(Boolean alwaysRefresh) { - throw new UnsupportedOperationException(); - } - - private void setAlwaysRefresh_(Boolean alwaysRefresh) { - Boolean old = this.alwaysRefresh; - this.alwaysRefresh = alwaysRefresh; - this.firePropertyChanged(ALWAYS_REFRESH_PROPERTY, old, alwaysRefresh); - } - - private Boolean buildAlwaysRefresh() { - return (Boolean) this.getJdtMemberValue(EclipseLink.CACHE__ALWAYS_REFRESH); - } - - public TextRange getAlwaysRefreshTextRange() { - throw new UnsupportedOperationException(); - } - - // ***** refresh only if newer - public Boolean getRefreshOnlyIfNewer() { - return this.refreshOnlyIfNewer; - } - - public void setRefreshOnlyIfNewer(Boolean refreshOnlyIfNewer) { - throw new UnsupportedOperationException(); - } - - private void setRefreshOnlyIfNewer_(Boolean refreshOnlyIfNewer) { - Boolean old = this.refreshOnlyIfNewer; - this.refreshOnlyIfNewer = refreshOnlyIfNewer; - this.firePropertyChanged(REFRESH_ONLY_IF_NEWER_PROPERTY, old, refreshOnlyIfNewer); - } - - private Boolean buildRefreshOnlyIfNewer() { - return (Boolean) this.getJdtMemberValue(EclipseLink.CACHE__REFRESH_ONLY_IF_NEWER); - } - - public TextRange getRefreshOnlyIfNewerTextRange() { - throw new UnsupportedOperationException(); - } - - // ***** disable hits - public Boolean getDisableHits() { - return this.disableHits; - } - - public void setDisableHits(Boolean disableHits) { - throw new UnsupportedOperationException(); - } - - private void setDisableHits_(Boolean disableHits) { - Boolean old = this.disableHits; - this.disableHits = disableHits; - this.firePropertyChanged(DISABLE_HITS_PROPERTY, old, disableHits); - } - - private Boolean buildDisableHits() { - return (Boolean) this.getJdtMemberValue(EclipseLink.CACHE__DISABLE_HITS); - } - - public TextRange getDisableHitsTextRange() { - throw new UnsupportedOperationException(); - } - - // ***** coordination type - public CacheCoordinationType getCoordinationType() { - return this.coordinationType; - } - - public void setCoordinationType(CacheCoordinationType coordinationType) { - throw new UnsupportedOperationException(); - } - - private void setCoordinationType_(CacheCoordinationType coordinationType) { - CacheCoordinationType old = this.coordinationType; - this.coordinationType = coordinationType; - this.firePropertyChanged(TYPE_PROPERTY, old, coordinationType); - } - - private CacheCoordinationType buildCoordinationType() { - return CacheCoordinationType.fromJavaAnnotationValue(this.getJdtMemberValue(EclipseLink.CACHE__COORDINATION_TYPE)); - } - - public TextRange getCoordinationTypeTextRange() { - throw new UnsupportedOperationException(); - } - - // ***** isolation - public CacheIsolationType2_2 getIsolation() { - return this.isolation; - } - - public void setIsolation(CacheIsolationType2_2 isolation) { - throw new UnsupportedOperationException(); - } - - private void setIsolation_(CacheIsolationType2_2 isolation) { - CacheIsolationType2_2 old = this.isolation; - this.isolation = isolation; - this.firePropertyChanged(ISOLATION_PROPERTY, old, isolation); - } - - private CacheIsolationType2_2 buildIsolation() { - return CacheIsolationType2_2.fromJavaAnnotationValue(this.getJdtMemberValue(EclipseLink.CACHE__ISOLATION)); - } - - public TextRange getIsolationTextRange() { - throw new UnsupportedOperationException(); - } -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/resource/java/binary/BinaryEclipseLinkChangeTrackingAnnotation.java b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/resource/java/binary/BinaryEclipseLinkChangeTrackingAnnotation.java deleted file mode 100644 index aa4110e45f..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/resource/java/binary/BinaryEclipseLinkChangeTrackingAnnotation.java +++ /dev/null @@ -1,71 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2009, 2012 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.eclipselink.core.internal.resource.java.binary; - -import org.eclipse.jdt.core.IAnnotation; -import org.eclipse.jpt.common.core.internal.resource.java.binary.BinaryAnnotation; -import org.eclipse.jpt.common.core.resource.java.JavaResourceAnnotatedElement; -import org.eclipse.jpt.common.core.utility.TextRange; -import org.eclipse.jpt.jpa.eclipselink.core.resource.java.ChangeTrackingType; -import org.eclipse.jpt.jpa.eclipselink.core.resource.java.EclipseLink; -import org.eclipse.jpt.jpa.eclipselink.core.resource.java.EclipseLinkChangeTrackingAnnotation; - -/** - * <code>org.eclipse.persistence.annotations.ChangeTracking</code> - */ -public final class BinaryEclipseLinkChangeTrackingAnnotation - extends BinaryAnnotation - implements EclipseLinkChangeTrackingAnnotation -{ - private ChangeTrackingType value; - - - public BinaryEclipseLinkChangeTrackingAnnotation(JavaResourceAnnotatedElement parent, IAnnotation jdtAnnotation) { - super(parent, jdtAnnotation); - this.value = this.buildValue(); - } - - public String getAnnotationName() { - return ANNOTATION_NAME; - } - - // TODO - @Override - public void update() { - super.update(); - this.setValue_(this.buildValue()); - } - - - // ********** ChangeTrackingAnnotation implementation ********** - - // ***** value - public ChangeTrackingType getValue() { - return this.value; - } - - public void setValue(ChangeTrackingType value) { - throw new UnsupportedOperationException(); - } - - private void setValue_(ChangeTrackingType value) { - ChangeTrackingType old = this.value; - this.value = value; - this.firePropertyChanged(VALUE_PROPERTY, old, value); - } - - private ChangeTrackingType buildValue() { - return ChangeTrackingType.fromJavaAnnotationValue(this.getJdtMemberValue(EclipseLink.CHANGE_TRACKING__VALUE)); - } - - public TextRange getValueTextRange() { - throw new UnsupportedOperationException(); - } -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/resource/java/binary/BinaryEclipseLinkClassExtractorAnnotation2_1.java b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/resource/java/binary/BinaryEclipseLinkClassExtractorAnnotation2_1.java deleted file mode 100644 index a7860cb76b..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/resource/java/binary/BinaryEclipseLinkClassExtractorAnnotation2_1.java +++ /dev/null @@ -1,78 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010, 2011 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.eclipselink.core.internal.resource.java.binary; - -import org.eclipse.jdt.core.IAnnotation; -import org.eclipse.jdt.core.dom.CompilationUnit; -import org.eclipse.jpt.common.core.internal.resource.java.binary.BinaryAnnotation; -import org.eclipse.jpt.common.core.resource.java.JavaResourceAnnotatedElement; -import org.eclipse.jpt.common.core.utility.TextRange; -import org.eclipse.jpt.jpa.eclipselink.core.resource.java.EclipseLink; -import org.eclipse.jpt.jpa.eclipselink.core.resource.java.EclipseLinkClassExtractorAnnotation2_1; - -/** - * org.eclipse.persistence.annotations.ClassExtractor - */ -public final class BinaryEclipseLinkClassExtractorAnnotation2_1 - extends BinaryAnnotation - implements EclipseLinkClassExtractorAnnotation2_1 -{ - private String value; - - - public BinaryEclipseLinkClassExtractorAnnotation2_1(JavaResourceAnnotatedElement parent, IAnnotation jdtAnnotation) { - super(parent, jdtAnnotation); - this.value = this.buildValue(); - } - - public String getAnnotationName() { - return ANNOTATION_NAME; - } - - @Override - public void update() { - super.update(); - this.setValue_(this.buildValue()); - } - - - // ********** EclipseLinkClassExtractorAnnotation2_1 implementation ********** - - // ***** value - public String getValue() { - return this.value; - } - - public void setValue(String value) { - throw new UnsupportedOperationException(); - } - - private void setValue_(String value) { - String old = this.value; - this.value = value; - this.firePropertyChanged(VALUE_PROPERTY, old, value); - } - - private String buildValue() { - return (String) this.getJdtMemberValue(EclipseLink.CLASS_EXTRACTOR__VALUE); - } - - public TextRange getValueTextRange(CompilationUnit astRoot) { - throw new UnsupportedOperationException(); - } - - // ***** fully-qualified class name - /** - * binary is already fully-qualified - */ - public String getFullyQualifiedClassName() { - return this.value; - } -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/resource/java/binary/BinaryEclipseLinkConversionValueAnnotation.java b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/resource/java/binary/BinaryEclipseLinkConversionValueAnnotation.java deleted file mode 100644 index bf71ec9b6c..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/resource/java/binary/BinaryEclipseLinkConversionValueAnnotation.java +++ /dev/null @@ -1,95 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2009, 2012 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.eclipselink.core.internal.resource.java.binary; - -import org.eclipse.jdt.core.IAnnotation; -import org.eclipse.jpt.common.core.internal.resource.java.binary.BinaryAnnotation; -import org.eclipse.jpt.common.core.resource.java.JavaResourceNode; -import org.eclipse.jpt.common.core.utility.TextRange; -import org.eclipse.jpt.jpa.eclipselink.core.resource.java.EclipseLink; -import org.eclipse.jpt.jpa.eclipselink.core.resource.java.EclipseLinkConversionValueAnnotation; - -/** - * <code>org.eclipse.persistence.annotations.ConversionValue</code> - */ -final class BinaryEclipseLinkConversionValueAnnotation - extends BinaryAnnotation - implements EclipseLinkConversionValueAnnotation -{ - private String dataValue; - private String objectValue; - - - BinaryEclipseLinkConversionValueAnnotation(JavaResourceNode parent, IAnnotation jdtAnnotation) { - super(parent, jdtAnnotation); - this.dataValue = this.buildDataValue(); - this.objectValue = this.buildObjectValue(); - } - - public String getAnnotationName() { - return ANNOTATION_NAME; - } - - @Override - public void update() { - super.update(); - this.setDataValue_(this.buildDataValue()); - this.setObjectValue_(this.buildObjectValue()); - } - - - // ********** ConversionValueAnnotation implementation ********** - - // ***** data value - public String getDataValue() { - return this.dataValue; - } - - public void setDataValue(String dataValue) { - throw new UnsupportedOperationException(); - } - - private void setDataValue_(String dataValue) { - String old = this.dataValue; - this.dataValue = dataValue; - this.firePropertyChanged(DATA_VALUE_PROPERTY, old, dataValue); - } - - private String buildDataValue() { - return (String) this.getJdtMemberValue(EclipseLink.CONVERSION_VALUE__DATA_VALUE); - } - - public TextRange getDataValueTextRange() { - throw new UnsupportedOperationException(); - } - - // ***** object value - public String getObjectValue() { - return this.objectValue; - } - - public void setObjectValue(String objectValue) { - throw new UnsupportedOperationException(); - } - - private void setObjectValue_(String objectValue) { - String old = this.objectValue; - this.objectValue = objectValue; - this.firePropertyChanged(OBJECT_VALUE_PROPERTY, old, objectValue); - } - - private String buildObjectValue() { - return (String) this.getJdtMemberValue(EclipseLink.CONVERSION_VALUE__OBJECT_VALUE); - } - - public TextRange getObjectValueTextRange() { - throw new UnsupportedOperationException(); - } -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/resource/java/binary/BinaryEclipseLinkConvertAnnotation.java b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/resource/java/binary/BinaryEclipseLinkConvertAnnotation.java deleted file mode 100644 index 68b2c9e5bf..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/resource/java/binary/BinaryEclipseLinkConvertAnnotation.java +++ /dev/null @@ -1,36 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2009, 2012 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.eclipselink.core.internal.resource.java.binary; - -import org.eclipse.jdt.core.IAnnotation; -import org.eclipse.jpt.common.core.resource.java.JavaResourceAnnotatedElement; -import org.eclipse.jpt.jpa.eclipselink.core.resource.java.EclipseLink; -import org.eclipse.jpt.jpa.eclipselink.core.resource.java.EclipseLinkConvertAnnotation; - -/** - * <code>org.eclipse.persistence.annotations.Convert</code> - */ -public final class BinaryEclipseLinkConvertAnnotation - extends BinaryEclipseLinkBaseConvertAnnotation - implements EclipseLinkConvertAnnotation -{ - public BinaryEclipseLinkConvertAnnotation(JavaResourceAnnotatedElement parent, IAnnotation jdtAnnotation) { - super(parent, jdtAnnotation); - } - - public String getAnnotationName() { - return ANNOTATION_NAME; - } - - @Override - protected String getValueElementName() { - return EclipseLink.CONVERT__VALUE; - } -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/resource/java/binary/BinaryEclipseLinkConverterAnnotation.java b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/resource/java/binary/BinaryEclipseLinkConverterAnnotation.java deleted file mode 100644 index ead46df6a2..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/resource/java/binary/BinaryEclipseLinkConverterAnnotation.java +++ /dev/null @@ -1,84 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2009, 2012 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.eclipselink.core.internal.resource.java.binary; - -import org.eclipse.jdt.core.IAnnotation; -import org.eclipse.jdt.core.dom.CompilationUnit; -import org.eclipse.jpt.common.core.resource.java.JavaResourceAnnotatedElement; -import org.eclipse.jpt.common.core.utility.TextRange; -import org.eclipse.jpt.jpa.eclipselink.core.resource.java.EclipseLink; -import org.eclipse.jpt.jpa.eclipselink.core.resource.java.EclipseLinkConverterAnnotation; - -/** - * <code>org.eclipse.persistence.annotations.Converter</code> - */ -public final class BinaryEclipseLinkConverterAnnotation - extends BinaryEclipseLinkNamedConverterAnnotation - implements EclipseLinkConverterAnnotation -{ - private String converterClass; - - - public BinaryEclipseLinkConverterAnnotation(JavaResourceAnnotatedElement parent, IAnnotation jdtAnnotation) { - super(parent, jdtAnnotation); - this.converterClass = this.buildConverterClass(); - } - - public String getAnnotationName() { - return ANNOTATION_NAME; - } - - @Override - public void update() { - super.update(); - this.setConverterClass_(this.buildConverterClass()); - } - - - // ********** BinaryNamedConverterAnnotation implementation ********** - - @Override - String getNameElementName() { - return EclipseLink.CONVERTER__NAME; - } - - // ********** ConverterAnnotation implementation ********** - - // ***** converter class - public String getConverterClass() { - return this.converterClass; - } - - public void setConverterClass(String converterClass) { - throw new UnsupportedOperationException(); - } - - private void setConverterClass_(String converterClass) { - String old = this.converterClass; - this.converterClass = converterClass; - this.firePropertyChanged(CONVERTER_CLASS_PROPERTY, old, converterClass); - } - - public String getFullyQualifiedConverterClassName() { - return this.converterClass; - } - - private String buildConverterClass() { - return (String) this.getJdtMemberValue(EclipseLink.CONVERTER__CONVERTER_CLASS); - } - - public TextRange getConverterClassTextRange() { - throw new UnsupportedOperationException(); - } - - public boolean converterClassImplementsInterface(String interfaceName, CompilationUnit astRoot) { - throw new UnsupportedOperationException(); - } -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/resource/java/binary/BinaryEclipseLinkCustomizerAnnotation.java b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/resource/java/binary/BinaryEclipseLinkCustomizerAnnotation.java deleted file mode 100644 index ee0e7da1b7..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/resource/java/binary/BinaryEclipseLinkCustomizerAnnotation.java +++ /dev/null @@ -1,79 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2009, 2012 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.eclipselink.core.internal.resource.java.binary; - -import org.eclipse.jdt.core.IAnnotation; -import org.eclipse.jdt.core.dom.CompilationUnit; -import org.eclipse.jpt.common.core.internal.resource.java.binary.BinaryAnnotation; -import org.eclipse.jpt.common.core.resource.java.JavaResourceAnnotatedElement; -import org.eclipse.jpt.common.core.utility.TextRange; -import org.eclipse.jpt.jpa.eclipselink.core.resource.java.EclipseLink; -import org.eclipse.jpt.jpa.eclipselink.core.resource.java.EclipseLinkCustomizerAnnotation; - -/** - * <code>org.eclipse.persistence.annotations.Customizer</code> - */ -public final class BinaryEclipseLinkCustomizerAnnotation - extends BinaryAnnotation - implements EclipseLinkCustomizerAnnotation -{ - private String value; - - - public BinaryEclipseLinkCustomizerAnnotation(JavaResourceAnnotatedElement parent, IAnnotation jdtAnnotation) { - super(parent, jdtAnnotation); - this.value = this.buildValue(); - } - - public String getAnnotationName() { - return ANNOTATION_NAME; - } - - @Override - public void update() { - super.update(); - this.setValue_(this.buildValue()); - } - - - // ********** CustomizerAnnotation implementation ********** - - // ***** value - public String getValue() { - return this.value; - } - - public void setValue(String value) { - throw new UnsupportedOperationException(); - } - - private void setValue_(String value) { - String old = this.value; - this.value = value; - this.firePropertyChanged(VALUE_PROPERTY, old, value); - } - - // ***** fully-qualified customizer class name - public String getFullyQualifiedCustomizerClassName() { - return this.value; - } - - private String buildValue() { - return (String) this.getJdtMemberValue(EclipseLink.CUSTOMIZER__VALUE); - } - - public TextRange getValueTextRange() { - throw new UnsupportedOperationException(); - } - - public boolean customizerClassImplementsInterface(String interfaceName, CompilationUnit astRoot) { - throw new UnsupportedOperationException(); - } -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/resource/java/binary/BinaryEclipseLinkExistenceCheckingAnnotation.java b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/resource/java/binary/BinaryEclipseLinkExistenceCheckingAnnotation.java deleted file mode 100644 index 349b1ac850..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/resource/java/binary/BinaryEclipseLinkExistenceCheckingAnnotation.java +++ /dev/null @@ -1,70 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2009, 2012 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.eclipselink.core.internal.resource.java.binary; - -import org.eclipse.jdt.core.IAnnotation; -import org.eclipse.jpt.common.core.internal.resource.java.binary.BinaryAnnotation; -import org.eclipse.jpt.common.core.resource.java.JavaResourceAnnotatedElement; -import org.eclipse.jpt.common.core.utility.TextRange; -import org.eclipse.jpt.jpa.eclipselink.core.resource.java.EclipseLink; -import org.eclipse.jpt.jpa.eclipselink.core.resource.java.EclipseLinkExistenceCheckingAnnotation; -import org.eclipse.jpt.jpa.eclipselink.core.resource.java.ExistenceType; - -/** - * <code>org.eclipse.persistence.annotations.ExistenceChecking</code> - */ -public final class BinaryEclipseLinkExistenceCheckingAnnotation - extends BinaryAnnotation - implements EclipseLinkExistenceCheckingAnnotation -{ - private ExistenceType value; - - - public BinaryEclipseLinkExistenceCheckingAnnotation(JavaResourceAnnotatedElement parent, IAnnotation jdtAnnotation) { - super(parent, jdtAnnotation); - this.value = this.buildValue(); - } - - public String getAnnotationName() { - return ANNOTATION_NAME; - } - - @Override - public void update() { - super.update(); - this.setValue_(this.buildValue()); - } - - - // ********** ExistenceCheckingAnnotation implementation ********** - - // ***** value - public ExistenceType getValue() { - return this.value; - } - - public void setValue(ExistenceType value) { - throw new UnsupportedOperationException(); - } - - private void setValue_(ExistenceType value) { - ExistenceType old = this.value; - this.value = value; - this.firePropertyChanged(VALUE_PROPERTY, old, value); - } - - private ExistenceType buildValue() { - return ExistenceType.fromJavaAnnotationValue(this.getJdtMemberValue(EclipseLink.EXISTENCE_CHECKING__VALUE)); - } - - public TextRange getValueTextRange() { - throw new UnsupportedOperationException(); - } -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/resource/java/binary/BinaryEclipseLinkJoinFetchAnnotation.java b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/resource/java/binary/BinaryEclipseLinkJoinFetchAnnotation.java deleted file mode 100644 index ab16b17e97..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/resource/java/binary/BinaryEclipseLinkJoinFetchAnnotation.java +++ /dev/null @@ -1,70 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2009, 2012 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.eclipselink.core.internal.resource.java.binary; - -import org.eclipse.jdt.core.IAnnotation; -import org.eclipse.jpt.common.core.internal.resource.java.binary.BinaryAnnotation; -import org.eclipse.jpt.common.core.resource.java.JavaResourceAnnotatedElement; -import org.eclipse.jpt.common.core.utility.TextRange; -import org.eclipse.jpt.jpa.eclipselink.core.resource.java.EclipseLink; -import org.eclipse.jpt.jpa.eclipselink.core.resource.java.EclipseLinkJoinFetchAnnotation; -import org.eclipse.jpt.jpa.eclipselink.core.resource.java.JoinFetchType; - -/** - * <code>org.eclipse.persistence.annotations.JoinFetch</code> - */ -public final class BinaryEclipseLinkJoinFetchAnnotation - extends BinaryAnnotation - implements EclipseLinkJoinFetchAnnotation -{ - private JoinFetchType value; - - - public BinaryEclipseLinkJoinFetchAnnotation(JavaResourceAnnotatedElement parent, IAnnotation jdtAnnotation) { - super(parent, jdtAnnotation); - this.value = this.buildValue(); - } - - public String getAnnotationName() { - return ANNOTATION_NAME; - } - - @Override - public void update() { - super.update(); - this.setValue_(this.buildValue()); - } - - - // ********** BinaryJoinFetchAnnotation implementation ********** - - // ***** value - public JoinFetchType getValue() { - return this.value; - } - - public void setValue(JoinFetchType value) { - throw new UnsupportedOperationException(); - } - - private void setValue_(JoinFetchType value) { - JoinFetchType old = this.value; - this.value = value; - this.firePropertyChanged(VALUE_PROPERTY, old, value); - } - - private JoinFetchType buildValue() { - return JoinFetchType.fromJavaAnnotationValue(this.getJdtMemberValue(EclipseLink.JOIN_FETCH__VALUE)); - } - - public TextRange getValueTextRange() { - throw new UnsupportedOperationException(); - } -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/resource/java/binary/BinaryEclipseLinkMapKeyConvertAnnotation2_0.java b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/resource/java/binary/BinaryEclipseLinkMapKeyConvertAnnotation2_0.java deleted file mode 100644 index 80102d72ca..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/resource/java/binary/BinaryEclipseLinkMapKeyConvertAnnotation2_0.java +++ /dev/null @@ -1,37 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2011, 2012 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.eclipselink.core.internal.resource.java.binary; - -import org.eclipse.jdt.core.IAnnotation; -import org.eclipse.jpt.common.core.resource.java.JavaResourceAnnotatedElement; -import org.eclipse.jpt.jpa.eclipselink.core.resource.java.EclipseLink; -import org.eclipse.jpt.jpa.eclipselink.core.resource.java.EclipseLinkMapKeyConvertAnnotation2_0; - -/** - * <code>org.eclipse.persistence.annotations.MapKeyConvert</code> - */ -public final class BinaryEclipseLinkMapKeyConvertAnnotation2_0 - extends BinaryEclipseLinkBaseConvertAnnotation - implements EclipseLinkMapKeyConvertAnnotation2_0 -{ - - public BinaryEclipseLinkMapKeyConvertAnnotation2_0(JavaResourceAnnotatedElement parent, IAnnotation jdtAnnotation) { - super(parent, jdtAnnotation); - } - - public String getAnnotationName() { - return EclipseLinkMapKeyConvertAnnotation2_0.ANNOTATION_NAME; - } - - @Override - protected String getValueElementName() { - return EclipseLink.MAP_KEY_CONVERT__VALUE; - } -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/resource/java/binary/BinaryEclipseLinkMultitenantAnnotation2_3.java b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/resource/java/binary/BinaryEclipseLinkMultitenantAnnotation2_3.java deleted file mode 100644 index 089e362413..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/resource/java/binary/BinaryEclipseLinkMultitenantAnnotation2_3.java +++ /dev/null @@ -1,103 +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 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.eclipselink.core.internal.resource.java.binary; - -import org.eclipse.jdt.core.IAnnotation; -import org.eclipse.jdt.core.dom.CompilationUnit; -import org.eclipse.jpt.common.core.internal.resource.java.binary.BinaryAnnotation; -import org.eclipse.jpt.common.core.resource.java.JavaResourceAnnotatedElement; -import org.eclipse.jpt.common.core.utility.TextRange; -import org.eclipse.jpt.jpa.eclipselink.core.resource.java.EclipseLink; -import org.eclipse.jpt.jpa.eclipselink.core.resource.java.EclipseLinkMultitenantAnnotation2_3; -import org.eclipse.jpt.jpa.eclipselink.core.resource.java.MultitenantType2_3; - -/** - * org.eclipse.persistence.annotations.Multitenant - */ -public class BinaryEclipseLinkMultitenantAnnotation2_3 - extends BinaryAnnotation - implements EclipseLinkMultitenantAnnotation2_3 -{ - private MultitenantType2_3 value; - private Boolean includeCriteria; // added in EclipseLink 2.4 - - - public BinaryEclipseLinkMultitenantAnnotation2_3(JavaResourceAnnotatedElement parent, IAnnotation jdtAnnotation) { - super(parent, jdtAnnotation); - this.value = this.buildValue(); - this.includeCriteria = this.buildIncludeCriteria(); - } - - public String getAnnotationName() { - return ANNOTATION_NAME; - } - - @Override - public void update() { - super.update(); - this.setValue_(this.buildValue()); - this.setIncludeCriteria_(this.buildIncludeCriteria()); - } - - - // ********** EclipseLinkMultitenantAnnotation implementation ********** - - public boolean isSpecified() { - return true; - } - - // ***** value - public MultitenantType2_3 getValue() { - return this.value; - } - - public void setValue(MultitenantType2_3 value) { - throw new UnsupportedOperationException(); - } - - private void setValue_(MultitenantType2_3 value) { - MultitenantType2_3 old = this.value; - this.value = value; - this.firePropertyChanged(VALUE_PROPERTY, old, value); - } - - private MultitenantType2_3 buildValue() { - return MultitenantType2_3.fromJavaAnnotationValue(this.getJdtMemberValue(EclipseLink.JOIN_FETCH__VALUE)); - } - - public TextRange getValueTextRange(CompilationUnit astRoot) { - throw new UnsupportedOperationException(); - } - - // ***** include criteria - public Boolean getIncludeCriteria() { - return this.includeCriteria; - } - - public void setIncludeCriteria(Boolean includeCriteria) { - throw new UnsupportedOperationException(); - } - - private void setIncludeCriteria_(Boolean includeCriteria) { - Boolean old = this.includeCriteria; - this.includeCriteria = includeCriteria; - this.firePropertyChanged(INCLUDE_CRITERIA_PROPERTY, old, includeCriteria); - } - - private Boolean buildIncludeCriteria() { - return (Boolean) this.getJdtMemberValue(EclipseLink.MULTITENANT__INCLUDE_CRITERIA); - } - - public TextRange getIncludeCriteriaTextRange(CompilationUnit astRoot) { - throw new UnsupportedOperationException(); - } - -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/resource/java/binary/BinaryEclipseLinkMutableAnnotation.java b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/resource/java/binary/BinaryEclipseLinkMutableAnnotation.java deleted file mode 100644 index 03bfe2b3d1..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/resource/java/binary/BinaryEclipseLinkMutableAnnotation.java +++ /dev/null @@ -1,69 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2009, 2012 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.eclipselink.core.internal.resource.java.binary; - -import org.eclipse.jdt.core.IAnnotation; -import org.eclipse.jpt.common.core.internal.resource.java.binary.BinaryAnnotation; -import org.eclipse.jpt.common.core.resource.java.JavaResourceAnnotatedElement; -import org.eclipse.jpt.common.core.utility.TextRange; -import org.eclipse.jpt.jpa.eclipselink.core.resource.java.EclipseLink; -import org.eclipse.jpt.jpa.eclipselink.core.resource.java.EclipseLinkMutableAnnotation; - -/** - * <code>org.eclipse.persistence.annotations.Mutable</code> - */ -public final class BinaryEclipseLinkMutableAnnotation - extends BinaryAnnotation - implements EclipseLinkMutableAnnotation -{ - private Boolean value; - - - public BinaryEclipseLinkMutableAnnotation(JavaResourceAnnotatedElement parent, IAnnotation jdtAnnotation) { - super(parent, jdtAnnotation); - this.value = this.buildValue(); - } - - public String getAnnotationName() { - return ANNOTATION_NAME; - } - - @Override - public void update() { - super.update(); - this.setValue_(this.buildValue()); - } - - - // ********** MutableAnnotation implementation ********** - - // ***** value - public Boolean getValue() { - return this.value; - } - - public void setValue(Boolean value) { - throw new UnsupportedOperationException(); - } - - private void setValue_(Boolean value) { - Boolean old = this.value; - this.value = value; - this.firePropertyChanged(VALUE_PROPERTY, old, value); - } - - private Boolean buildValue() { - return (Boolean) this.getJdtMemberValue(EclipseLink.MUTABLE__VALUE); - } - - public TextRange getValueTextRange() { - throw new UnsupportedOperationException(); - } -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/resource/java/binary/BinaryEclipseLinkNamedConverterAnnotation.java b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/resource/java/binary/BinaryEclipseLinkNamedConverterAnnotation.java deleted file mode 100644 index 908a6e0265..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/resource/java/binary/BinaryEclipseLinkNamedConverterAnnotation.java +++ /dev/null @@ -1,77 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2009, 2012 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.eclipselink.core.internal.resource.java.binary; - -import org.eclipse.jdt.core.IAnnotation; -import org.eclipse.jpt.common.core.internal.resource.java.binary.BinaryAnnotation; -import org.eclipse.jpt.common.core.resource.java.JavaResourceAnnotatedElement; -import org.eclipse.jpt.common.core.utility.TextRange; -import org.eclipse.jpt.jpa.eclipselink.core.resource.java.EclipseLinkNamedConverterAnnotation; - -/** - * <code> - * <ul> - * <li>org.eclipse.persistence.annotations.Converter - * <li>org.eclipse.persistence.annotations.StructConverter - * <li>org.eclipse.persistence.annotations.TypeConverter - * <li>org.eclipse.persistence.annotations.ObjectTypeConverter - * </ul> - * </code> - */ -abstract class BinaryEclipseLinkNamedConverterAnnotation - extends BinaryAnnotation - implements EclipseLinkNamedConverterAnnotation -{ - String name; - - BinaryEclipseLinkNamedConverterAnnotation(JavaResourceAnnotatedElement parent, IAnnotation jdtAnnotation) { - super(parent, jdtAnnotation); - this.name = this.buildName(); - } - - @Override - public void update() { - super.update(); - this.setName_(this.buildName()); - } - - @Override - public void toString(StringBuilder sb) { - sb.append(this.name); - } - - - // ********** NamedConverterAnnotation implementation ********** - - // ***** name - public String getName() { - return this.name; - } - - public void setName(String name) { - throw new UnsupportedOperationException(); - } - - private void setName_(String name) { - String old = this.name; - this.name = name; - this.firePropertyChanged(NAME_PROPERTY, old, name); - } - - private String buildName() { - return (String) this.getJdtMemberValue(this.getNameElementName()); - } - - public TextRange getNameTextRange() { - throw new UnsupportedOperationException(); - } - - abstract String getNameElementName(); -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/resource/java/binary/BinaryEclipseLinkObjectTypeConverterAnnotation.java b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/resource/java/binary/BinaryEclipseLinkObjectTypeConverterAnnotation.java deleted file mode 100644 index 56f7b6a48f..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/resource/java/binary/BinaryEclipseLinkObjectTypeConverterAnnotation.java +++ /dev/null @@ -1,133 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2009, 2012 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.eclipselink.core.internal.resource.java.binary; - -import java.util.Vector; -import org.eclipse.jdt.core.IAnnotation; -import org.eclipse.jpt.common.core.resource.java.JavaResourceAnnotatedElement; -import org.eclipse.jpt.common.core.utility.TextRange; -import org.eclipse.jpt.common.utility.internal.iterables.ListIterable; -import org.eclipse.jpt.common.utility.internal.iterables.LiveCloneListIterable; -import org.eclipse.jpt.jpa.eclipselink.core.resource.java.EclipseLink; -import org.eclipse.jpt.jpa.eclipselink.core.resource.java.EclipseLinkConversionValueAnnotation; -import org.eclipse.jpt.jpa.eclipselink.core.resource.java.EclipseLinkObjectTypeConverterAnnotation; - -/** - * <code>org.eclipse.persistence.annotations.ObjectTypeConverter</code> - */ -public final class BinaryEclipseLinkObjectTypeConverterAnnotation - extends BinaryEclipseLinkBaseTypeConverterAnnotation - implements EclipseLinkObjectTypeConverterAnnotation -{ - private String defaultObjectValue; - private final Vector<EclipseLinkConversionValueAnnotation> conversionValues; - - - public BinaryEclipseLinkObjectTypeConverterAnnotation(JavaResourceAnnotatedElement parent, IAnnotation jdtAnnotation) { - super(parent, jdtAnnotation); - this.defaultObjectValue = this.buildDefaultObjectValue(); - this.conversionValues = this.buildConversionValues(); - } - - public String getAnnotationName() { - return ANNOTATION_NAME; - } - - @Override - public void update() { - super.update(); - this.setDefaultObjectValue_(this.buildDefaultObjectValue()); - this.updateConversionValues(); - } - - - // ********** BinaryNamedConverterAnnotation implementation ********** - - @Override - String getNameElementName() { - return EclipseLink.OBJECT_TYPE_CONVERTER__NAME; - } - - // ********** BinaryBaseTypeConverterAnnotation implementation ********** - - @Override - String getDataTypeElementName() { - return EclipseLink.OBJECT_TYPE_CONVERTER__DATA_TYPE; - } - - @Override - String getObjectTypeElementName() { - return EclipseLink.OBJECT_TYPE_CONVERTER__OBJECT_TYPE; - } - - // ********** ObjectTypeConverterAnnotation implementation ********** - - // ***** default object value - public String getDefaultObjectValue() { - return this.defaultObjectValue; - } - - public void setDefaultObjectValue(String defaultObjectValue) { - throw new UnsupportedOperationException(); - } - - private void setDefaultObjectValue_(String defaultObjectValue) { - String old = this.defaultObjectValue; - this.defaultObjectValue = defaultObjectValue; - this.firePropertyChanged(DEFAULT_OBJECT_VALUE_PROPERTY, old, defaultObjectValue); - } - - private String buildDefaultObjectValue() { - return (String) this.getJdtMemberValue(EclipseLink.OBJECT_TYPE_CONVERTER__DEFAULT_OBJECT_VALUE); - } - - public TextRange getDefaultObjectValueTextRange() { - throw new UnsupportedOperationException(); - } - - // ***** conversion values - public ListIterable<EclipseLinkConversionValueAnnotation> getConversionValues() { - return new LiveCloneListIterable<EclipseLinkConversionValueAnnotation>(this.conversionValues); - } - - public int getConversionValuesSize() { - return this.conversionValues.size(); - } - - public EclipseLinkConversionValueAnnotation conversionValueAt(int index) { - return this.conversionValues.get(index); - } - - public EclipseLinkConversionValueAnnotation addConversionValue(int index) { - throw new UnsupportedOperationException(); - } - - public void moveConversionValue(int targetIndex, int sourceIndex) { - throw new UnsupportedOperationException(); - } - - public void removeConversionValue(int index) { - throw new UnsupportedOperationException(); - } - - private Vector<EclipseLinkConversionValueAnnotation> buildConversionValues() { - Object[] jdtConversionValues = this.getJdtMemberValues(EclipseLink.OBJECT_TYPE_CONVERTER__CONVERSION_VALUES); - Vector<EclipseLinkConversionValueAnnotation> result = new Vector<EclipseLinkConversionValueAnnotation>(jdtConversionValues.length); - for (Object jdtConversionValue : jdtConversionValues) { - result.add(new BinaryEclipseLinkConversionValueAnnotation(this, (IAnnotation) jdtConversionValue)); - } - return result; - } - - // TODO - private void updateConversionValues() { - throw new UnsupportedOperationException(); - } -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/resource/java/binary/BinaryEclipseLinkPrimaryKeyAnnotation.java b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/resource/java/binary/BinaryEclipseLinkPrimaryKeyAnnotation.java deleted file mode 100644 index b9826b04b4..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/resource/java/binary/BinaryEclipseLinkPrimaryKeyAnnotation.java +++ /dev/null @@ -1,33 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010, 2011 Oracle. - * All rights reserved. This program and the accompanying materials are - * made available under the terms of the Eclipse Public License v1.0 which - * accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Oracle - initial API and implementation - *******************************************************************************/ -package org.eclipse.jpt.jpa.eclipselink.core.internal.resource.java.binary; - -import org.eclipse.jdt.core.IAnnotation; -import org.eclipse.jpt.common.core.internal.resource.java.binary.BinaryAnnotation; -import org.eclipse.jpt.common.core.resource.java.JavaResourceAnnotatedElement; -import org.eclipse.jpt.jpa.eclipselink.core.resource.java.EclipseLinkPrimaryKeyAnnotation; - -/** - * org.eclipse.persistence.annotations.PrimaryKey - */ -public class BinaryEclipseLinkPrimaryKeyAnnotation - extends BinaryAnnotation - implements EclipseLinkPrimaryKeyAnnotation -{ - public BinaryEclipseLinkPrimaryKeyAnnotation(JavaResourceAnnotatedElement parent, IAnnotation jdtAnnotation) { - super(parent, jdtAnnotation); - } - - - public String getAnnotationName() { - return ANNOTATION_NAME; - } -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/resource/java/binary/BinaryEclipseLinkPrivateOwnedAnnotation.java b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/resource/java/binary/BinaryEclipseLinkPrivateOwnedAnnotation.java deleted file mode 100644 index a565257393..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/resource/java/binary/BinaryEclipseLinkPrivateOwnedAnnotation.java +++ /dev/null @@ -1,33 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2009, 2011 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.eclipselink.core.internal.resource.java.binary; - -import org.eclipse.jdt.core.IAnnotation; -import org.eclipse.jpt.common.core.internal.resource.java.binary.BinaryAnnotation; -import org.eclipse.jpt.common.core.resource.java.JavaResourceAnnotatedElement; -import org.eclipse.jpt.jpa.eclipselink.core.resource.java.EclipseLinkPrivateOwnedAnnotation; - -/** - * org.eclipse.persistence.annotations.PrivateOwned - */ -public final class BinaryEclipseLinkPrivateOwnedAnnotation - extends BinaryAnnotation - implements EclipseLinkPrivateOwnedAnnotation -{ - - public BinaryEclipseLinkPrivateOwnedAnnotation(JavaResourceAnnotatedElement parent, IAnnotation jdtAnnotation) { - super(parent, jdtAnnotation); - } - - public String getAnnotationName() { - return ANNOTATION_NAME; - } - -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/resource/java/binary/BinaryEclipseLinkReadOnlyAnnotation.java b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/resource/java/binary/BinaryEclipseLinkReadOnlyAnnotation.java deleted file mode 100644 index cfcd2aa3e6..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/resource/java/binary/BinaryEclipseLinkReadOnlyAnnotation.java +++ /dev/null @@ -1,33 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2009, 2011 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.eclipselink.core.internal.resource.java.binary; - -import org.eclipse.jdt.core.IAnnotation; -import org.eclipse.jpt.common.core.internal.resource.java.binary.BinaryAnnotation; -import org.eclipse.jpt.common.core.resource.java.JavaResourceAnnotatedElement; -import org.eclipse.jpt.jpa.eclipselink.core.resource.java.EclipseLinkReadOnlyAnnotation; - -/** - * org.eclipse.persistence.annotations.ReadOnly - */ -public final class BinaryEclipseLinkReadOnlyAnnotation - extends BinaryAnnotation - implements EclipseLinkReadOnlyAnnotation -{ - - public BinaryEclipseLinkReadOnlyAnnotation(JavaResourceAnnotatedElement parent, IAnnotation jdtAnnotation) { - super(parent, jdtAnnotation); - } - - public String getAnnotationName() { - return ANNOTATION_NAME; - } - -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/resource/java/binary/BinaryEclipseLinkReadTransformerAnnotation.java b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/resource/java/binary/BinaryEclipseLinkReadTransformerAnnotation.java deleted file mode 100644 index 5c6c594cde..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/resource/java/binary/BinaryEclipseLinkReadTransformerAnnotation.java +++ /dev/null @@ -1,46 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2009, 2011 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.eclipselink.core.internal.resource.java.binary; - -import org.eclipse.jdt.core.IAnnotation; -import org.eclipse.jpt.common.core.resource.java.JavaResourceAnnotatedElement; -import org.eclipse.jpt.jpa.eclipselink.core.resource.java.EclipseLink; -import org.eclipse.jpt.jpa.eclipselink.core.resource.java.EclipseLinkReadTransformerAnnotation; - -/** - * org.eclipse.persistence.annotations.ReadTransformer - */ -public final class BinaryEclipseLinkReadTransformerAnnotation - extends BinaryEclipseLinkTransformerAnnotation - implements EclipseLinkReadTransformerAnnotation -{ - - public BinaryEclipseLinkReadTransformerAnnotation(JavaResourceAnnotatedElement parent, IAnnotation jdtAnnotation) { - super(parent, jdtAnnotation); - } - - public String getAnnotationName() { - return ANNOTATION_NAME; - } - - - // ********** BinaryTransformerAnnotation implementation ********** - - @Override - String getTransformerClassElementName() { - return EclipseLink.READ_TRANSFORMER__TRANSFORMER_CLASS; - } - - @Override - String getMethodElementName() { - return EclipseLink.READ_TRANSFORMER__METHOD; - } - -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/resource/java/binary/BinaryEclipseLinkStructConverterAnnotation.java b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/resource/java/binary/BinaryEclipseLinkStructConverterAnnotation.java deleted file mode 100644 index f2b838c6b9..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/resource/java/binary/BinaryEclipseLinkStructConverterAnnotation.java +++ /dev/null @@ -1,76 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2009, 2012 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.eclipselink.core.internal.resource.java.binary; - -import org.eclipse.jdt.core.IAnnotation; -import org.eclipse.jpt.common.core.resource.java.JavaResourceAnnotatedElement; -import org.eclipse.jpt.common.core.utility.TextRange; -import org.eclipse.jpt.jpa.eclipselink.core.resource.java.EclipseLink; -import org.eclipse.jpt.jpa.eclipselink.core.resource.java.EclipseLinkStructConverterAnnotation; - -/** - * <code>org.eclipse.persistence.annotations.StructConverter</code> - */ -public final class BinaryEclipseLinkStructConverterAnnotation - extends BinaryEclipseLinkNamedConverterAnnotation - implements EclipseLinkStructConverterAnnotation -{ - private String converter; - - - public BinaryEclipseLinkStructConverterAnnotation(JavaResourceAnnotatedElement parent, IAnnotation jdtAnnotation) { - super(parent, jdtAnnotation); - this.converter = this.buildConverter(); - } - - public String getAnnotationName() { - return ANNOTATION_NAME; - } - - @Override - public void update() { - super.update(); - this.setConverter_(this.buildConverter()); - } - - - // ********** BinaryNamedConverterAnnotation implementation ********** - - @Override - String getNameElementName() { - return EclipseLink.STRUCT_CONVERTER__NAME; - } - - - // ********** StructConverterAnnotation implementation ********** - - // ***** converter - public String getConverter() { - return this.converter; - } - - public void setConverter(String converter) { - throw new UnsupportedOperationException(); - } - - private void setConverter_(String converter) { - String old = this.converter; - this.converter = converter; - this.firePropertyChanged(CONVERTER_PROPERTY, old, converter); - } - - private String buildConverter() { - return (String) this.getJdtMemberValue(EclipseLink.STRUCT_CONVERTER__CONVERTER); - } - - public TextRange getConverterTextRange() { - throw new UnsupportedOperationException(); - } -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/resource/java/binary/BinaryEclipseLinkStructureAnnotation.java b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/resource/java/binary/BinaryEclipseLinkStructureAnnotation.java deleted file mode 100644 index ce41440fe8..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/resource/java/binary/BinaryEclipseLinkStructureAnnotation.java +++ /dev/null @@ -1,32 +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, 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.eclipselink.core.internal.resource.java.binary; - -import org.eclipse.jdt.core.IAnnotation; -import org.eclipse.jpt.common.core.internal.resource.java.binary.BinaryAnnotation; -import org.eclipse.jpt.common.core.resource.java.JavaResourceAnnotatedElement; -import org.eclipse.jpt.jpa.eclipselink.core.resource.java.EclipseLinkStructureAnnotation2_3; - -/** - * org.eclipse.persistence.annotations.Structure - */ -public final class BinaryEclipseLinkStructureAnnotation - extends BinaryAnnotation - implements EclipseLinkStructureAnnotation2_3 -{ - public BinaryEclipseLinkStructureAnnotation(JavaResourceAnnotatedElement parent, IAnnotation jdtAnnotation) { - super(parent, jdtAnnotation); - } - - public String getAnnotationName() { - return ANNOTATION_NAME; - } - -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/resource/java/binary/BinaryEclipseLinkTenantDiscriminatorColumnAnnotation2_3.java b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/resource/java/binary/BinaryEclipseLinkTenantDiscriminatorColumnAnnotation2_3.java deleted file mode 100644 index 7fb00008d3..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/resource/java/binary/BinaryEclipseLinkTenantDiscriminatorColumnAnnotation2_3.java +++ /dev/null @@ -1,148 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2011, 2012 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.eclipselink.core.internal.resource.java.binary; - -import org.eclipse.jdt.core.IAnnotation; -import org.eclipse.jpt.common.core.resource.java.JavaResourceAnnotatedElement; -import org.eclipse.jpt.common.core.utility.TextRange; -import org.eclipse.jpt.jpa.core.internal.resource.java.binary.BinaryBaseDiscriminatorColumnAnnotation; -import org.eclipse.jpt.jpa.eclipselink.core.resource.java.EclipseLink; -import org.eclipse.jpt.jpa.eclipselink.core.resource.java.EclipseLinkTenantDiscriminatorColumnAnnotation2_3; - -/** - * <code>org.eclipse.persistence.annotations.TenantDiscriminatorColumn</code> - */ -public final class BinaryEclipseLinkTenantDiscriminatorColumnAnnotation2_3 - extends BinaryBaseDiscriminatorColumnAnnotation - implements EclipseLinkTenantDiscriminatorColumnAnnotation2_3 -{ - private String contextProperty; - private String table; - private Boolean primaryKey; - - public BinaryEclipseLinkTenantDiscriminatorColumnAnnotation2_3(JavaResourceAnnotatedElement parent, IAnnotation jdtAnnotation) { - super(parent, jdtAnnotation); - this.contextProperty = this.buildContextProperty(); - this.table = this.buildTable(); - this.primaryKey = this.buildPrimaryKey(); - } - - public String getAnnotationName() { - return EclipseLinkTenantDiscriminatorColumnAnnotation2_3.ANNOTATION_NAME; - } - - @Override - public void update() { - super.update(); - this.setContextProperty_(this.buildContextProperty()); - this.setTable_(this.buildTable()); - this.setPrimaryKey_(this.buildPrimaryKey()); - } - - // ********** BinaryBaseDiscriminatorColumnAnnotation implementation ********** - - @Override - protected String getDiscriminatorTypeElementName() { - return EclipseLink.TENANT_DISCRIMINATOR_COLUMN__DISCRIMINATOR_TYPE; - } - - @Override - protected String getLengthElementName() { - return EclipseLink.TENANT_DISCRIMINATOR_COLUMN__LENGTH; - } - - // ********** BinaryNamedColumnAnnotation implementation ********** - - @Override - protected String getNameElementName() { - return EclipseLink.TENANT_DISCRIMINATOR_COLUMN__NAME; - } - - @Override - protected String getColumnDefinitionElementName() { - return EclipseLink.TENANT_DISCRIMINATOR_COLUMN__COLUMN_DEFINITION; - } - - - //************* EclipseLinkTenantDiscriminatorColumnAnnotation implementation ************* - - // ***** contextProperty - public String getContextProperty() { - return this.contextProperty; - } - - public void setContextProperty(String contextProperty) { - throw new UnsupportedOperationException(); - } - - private void setContextProperty_(String contextProperty) { - String old = this.contextProperty; - this.contextProperty = contextProperty; - this.firePropertyChanged(CONTEXT_PROPERTY_PROPERTY, old, contextProperty); - } - - private String buildContextProperty() { - return (String) this.getJdtMemberValue(EclipseLink.TENANT_DISCRIMINATOR_COLUMN__CONTEXT_PROPERTY); - } - - public TextRange getContextPropertyTextRange() { - throw new UnsupportedOperationException(); - } - - // ***** table - public String getTable() { - return this.table; - } - - public void setTable(String table) { - throw new UnsupportedOperationException(); - } - - private void setTable_(String table) { - String old = this.table; - this.table = table; - this.firePropertyChanged(TABLE_PROPERTY, old, table); - } - - private String buildTable() { - return (String) this.getJdtMemberValue(EclipseLink.TENANT_DISCRIMINATOR_COLUMN__TABLE); - } - - public TextRange getTableTextRange() { - throw new UnsupportedOperationException(); - } - - public boolean tableTouches(int pos) { - throw new UnsupportedOperationException(); - } - - // ***** primaryKey - public Boolean getPrimaryKey() { - return this.primaryKey; - } - - public void setPrimaryKey(Boolean primaryKey) { - throw new UnsupportedOperationException(); - } - - private void setPrimaryKey_(Boolean primaryKey) { - Boolean old = this.primaryKey; - this.primaryKey = primaryKey; - this.firePropertyChanged(PRIMARY_KEY_PROPERTY, old, primaryKey); - } - - private Boolean buildPrimaryKey() { - return (Boolean) this.getJdtMemberValue(EclipseLink.TENANT_DISCRIMINATOR_COLUMN__PRIMARY_KEY); - } - - public TextRange getPrimaryKeyTextRange() { - throw new UnsupportedOperationException(); - } -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/resource/java/binary/BinaryEclipseLinkTimeOfDayAnnotation.java b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/resource/java/binary/BinaryEclipseLinkTimeOfDayAnnotation.java deleted file mode 100644 index 5fce850a9a..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/resource/java/binary/BinaryEclipseLinkTimeOfDayAnnotation.java +++ /dev/null @@ -1,147 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2009, 2012 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.eclipselink.core.internal.resource.java.binary; - -import org.eclipse.jdt.core.IAnnotation; -import org.eclipse.jpt.common.core.internal.resource.java.binary.BinaryAnnotation; -import org.eclipse.jpt.common.core.resource.java.JavaResourceNode; -import org.eclipse.jpt.common.core.utility.TextRange; -import org.eclipse.jpt.jpa.eclipselink.core.resource.java.EclipseLink; -import org.eclipse.jpt.jpa.eclipselink.core.resource.java.EclipseLinkTimeOfDayAnnotation; - -/** - * <code>org.eclipse.persistence.annotations.TimeOfDay</code> - */ -public final class BinaryEclipseLinkTimeOfDayAnnotation - extends BinaryAnnotation - implements EclipseLinkTimeOfDayAnnotation -{ - private Integer hour; - private Integer minute; - private Integer second; - private Integer millisecond; - - - public BinaryEclipseLinkTimeOfDayAnnotation(JavaResourceNode parent, IAnnotation jdtAnnotation) { - super(parent, jdtAnnotation); - this.hour = this.buildHour(); - this.minute = this.buildMinute(); - this.second = this.buildSecond(); - this.millisecond = this.buildMillisecond(); - } - - public String getAnnotationName() { - return ANNOTATION_NAME; - } - - @Override - public void update() { - super.update(); - this.setHour_(this.buildHour()); - this.setMinute_(this.buildMinute()); - this.setSecond_(this.buildSecond()); - this.setMillisecond_(this.buildMillisecond()); - } - - - // ********** TimeOfDayAnnotation implementation ********** - - // ***** hour - public Integer getHour() { - return this.hour; - } - - public void setHour(Integer hour) { - throw new UnsupportedOperationException(); - } - - private void setHour_(Integer hour) { - Integer old = this.hour; - this.hour = hour; - this.firePropertyChanged(HOUR_PROPERTY, old, hour); - } - - private Integer buildHour() { - return (Integer) this.getJdtMemberValue(EclipseLink.TIME_OF_DAY__HOUR); - } - - public TextRange getHourTextRange() { - throw new UnsupportedOperationException(); - } - - // ***** minute - public Integer getMinute() { - return this.minute; - } - - public void setMinute(Integer newMinute) { - throw new UnsupportedOperationException(); - } - - private void setMinute_(Integer newMinute) { - Integer oldMinute = this.minute; - this.minute = newMinute; - this.firePropertyChanged(MINUTE_PROPERTY, oldMinute, newMinute); - } - - private Integer buildMinute() { - return (Integer) this.getJdtMemberValue(EclipseLink.TIME_OF_DAY__MINUTE); - } - - public TextRange getMinuteTextRange() { - throw new UnsupportedOperationException(); - } - - // ***** second - public Integer getSecond() { - return this.second; - } - - public void setSecond(Integer newSecond) { - throw new UnsupportedOperationException(); - } - - private void setSecond_(Integer newSecond) { - Integer oldSecond = this.second; - this.second = newSecond; - this.firePropertyChanged(SECOND_PROPERTY, oldSecond, newSecond); - } - - private Integer buildSecond() { - return (Integer) this.getJdtMemberValue(EclipseLink.TIME_OF_DAY__SECOND); - } - - public TextRange getSecondTextRange() { - throw new UnsupportedOperationException(); - } - - // ***** millisecond - public Integer getMillisecond() { - return this.millisecond; - } - - public void setMillisecond(Integer newMillisecond) { - throw new UnsupportedOperationException(); - } - - private void setMillisecond_(Integer newMillisecond) { - Integer oldMillisecond = this.millisecond; - this.millisecond = newMillisecond; - this.firePropertyChanged(MILLISECOND_PROPERTY, oldMillisecond, newMillisecond); - } - - private Integer buildMillisecond() { - return (Integer) this.getJdtMemberValue(EclipseLink.TIME_OF_DAY__MILLISECOND); - } - - public TextRange getMillisecondTextRange() { - throw new UnsupportedOperationException(); - } -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/resource/java/binary/BinaryEclipseLinkTransformationAnnotation.java b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/resource/java/binary/BinaryEclipseLinkTransformationAnnotation.java deleted file mode 100644 index 1a155f1887..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/resource/java/binary/BinaryEclipseLinkTransformationAnnotation.java +++ /dev/null @@ -1,96 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2009, 2012 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.eclipselink.core.internal.resource.java.binary; - -import org.eclipse.jdt.core.IAnnotation; -import org.eclipse.jpt.common.core.internal.resource.java.binary.BinaryAnnotation; -import org.eclipse.jpt.common.core.resource.java.JavaResourceAnnotatedElement; -import org.eclipse.jpt.common.core.utility.TextRange; -import org.eclipse.jpt.jpa.core.resource.java.FetchType; -import org.eclipse.jpt.jpa.eclipselink.core.resource.java.EclipseLink; -import org.eclipse.jpt.jpa.eclipselink.core.resource.java.EclipseLinkTransformationAnnotation; - -/** - * <code>org.eclipse.persistence.annotations.Transformation</code> - */ -public class BinaryEclipseLinkTransformationAnnotation - extends BinaryAnnotation - implements EclipseLinkTransformationAnnotation -{ - private FetchType fetch; - private Boolean optional; - - - public BinaryEclipseLinkTransformationAnnotation(JavaResourceAnnotatedElement parent, IAnnotation jdtAnnotation) { - super(parent, jdtAnnotation); - this.fetch = this.buildFetch(); - this.optional = this.buildOptional(); - } - - public String getAnnotationName() { - return ANNOTATION_NAME; - } - - @Override - public void update() { - super.update(); - this.setFetch_(this.buildFetch()); - this.setOptional_(this.buildOptional()); - } - - - // ********** TransformationAnnotation implementation ********** - - // ***** fetch - public FetchType getFetch() { - return this.fetch; - } - - public void setFetch(FetchType fetch) { - throw new UnsupportedOperationException(); - } - - private void setFetch_(FetchType fetch) { - FetchType old = this.fetch; - this.fetch = fetch; - this.firePropertyChanged(FETCH_PROPERTY, old, fetch); - } - - private FetchType buildFetch() { - return FetchType.fromJavaAnnotationValue(this.getJdtMemberValue(EclipseLink.TRANSFORMATION__FETCH)); - } - - public TextRange getFetchTextRange() { - throw new UnsupportedOperationException(); - } - - // ***** optional - public Boolean getOptional() { - return this.optional; - } - - public void setOptional(Boolean optional) { - throw new UnsupportedOperationException(); - } - - private void setOptional_(Boolean optional) { - Boolean old = this.optional; - this.optional = optional; - this.firePropertyChanged(OPTIONAL_PROPERTY, old, optional); - } - - private Boolean buildOptional() { - return (Boolean) this.getJdtMemberValue(EclipseLink.TRANSFORMATION__OPTIONAL); - } - - public TextRange getOptionalTextRange() { - throw new UnsupportedOperationException(); - } -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/resource/java/binary/BinaryEclipseLinkTransformerAnnotation.java b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/resource/java/binary/BinaryEclipseLinkTransformerAnnotation.java deleted file mode 100644 index 99c86996c9..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/resource/java/binary/BinaryEclipseLinkTransformerAnnotation.java +++ /dev/null @@ -1,97 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2009, 2012 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.eclipselink.core.internal.resource.java.binary; - -import org.eclipse.jdt.core.IAnnotation; -import org.eclipse.jpt.common.core.internal.resource.java.binary.BinaryAnnotation; -import org.eclipse.jpt.common.core.resource.java.JavaResourceAnnotatedElement; -import org.eclipse.jpt.common.core.utility.TextRange; -import org.eclipse.jpt.jpa.eclipselink.core.resource.java.EclipseLinkTransformerAnnotation; - -/** - * <code><ul> - * <li>org.eclipse.persistence.annotations.ReadTransformer - * <li>org.eclipse.persistence.annotations.WriteTransformer - * </ul></code> - */ -abstract class BinaryEclipseLinkTransformerAnnotation - extends BinaryAnnotation - implements EclipseLinkTransformerAnnotation -{ - private String transformerClass; - private String method; - - - BinaryEclipseLinkTransformerAnnotation(JavaResourceAnnotatedElement parent, IAnnotation jdtAnnotation) { - super(parent, jdtAnnotation); - this.transformerClass = this.buildTransformerClass(); - this.method = this.buildMethod(); - } - - @Override - public void update() { - super.update(); - this.setTransformerClass_(this.buildTransformerClass()); - this.setMethod_(this.buildMethod()); - } - - - // ********** TransformerAnnotation implementation ********** - - // ***** transformer class - public String getTransformerClass() { - return this.transformerClass; - } - - public void setTransformerClass(String transformerClass) { - throw new UnsupportedOperationException(); - } - - private void setTransformerClass_(String transformerClass) { - String old = this.transformerClass; - this.transformerClass = transformerClass; - this.firePropertyChanged(TRANSFORMER_CLASS_PROPERTY, old, transformerClass); - } - - private String buildTransformerClass() { - return (String) this.getJdtMemberValue(this.getTransformerClassElementName()); - } - - public TextRange getTransformerClassTextRange() { - throw new UnsupportedOperationException(); - } - - abstract String getTransformerClassElementName(); - - // ***** method - public String getMethod() { - return this.method; - } - - public void setMethod(String method) { - throw new UnsupportedOperationException(); - } - - private void setMethod_(String method) { - String old = this.method; - this.method = method; - this.firePropertyChanged(METHOD_PROPERTY, old, method); - } - - private String buildMethod() { - return (String) this.getJdtMemberValue(this.getMethodElementName()); - } - - public TextRange getMethodTextRange() { - throw new UnsupportedOperationException(); - } - - abstract String getMethodElementName(); -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/resource/java/binary/BinaryEclipseLinkTypeConverterAnnotation.java b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/resource/java/binary/BinaryEclipseLinkTypeConverterAnnotation.java deleted file mode 100644 index 006fd8f7b5..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/resource/java/binary/BinaryEclipseLinkTypeConverterAnnotation.java +++ /dev/null @@ -1,52 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2009, 2012 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.eclipselink.core.internal.resource.java.binary; - -import org.eclipse.jdt.core.IAnnotation; -import org.eclipse.jpt.common.core.resource.java.JavaResourceAnnotatedElement; -import org.eclipse.jpt.jpa.eclipselink.core.resource.java.EclipseLink; -import org.eclipse.jpt.jpa.eclipselink.core.resource.java.EclipseLinkTypeConverterAnnotation; - -/** - * <code>org.eclipse.persistence.annotations.TypeConverter</code> - */ -public final class BinaryEclipseLinkTypeConverterAnnotation - extends BinaryEclipseLinkBaseTypeConverterAnnotation - implements EclipseLinkTypeConverterAnnotation -{ - public BinaryEclipseLinkTypeConverterAnnotation(JavaResourceAnnotatedElement parent, IAnnotation jdtAnnotation) { - super(parent, jdtAnnotation); - } - - public String getAnnotationName() { - return ANNOTATION_NAME; - } - - - // ********** BinaryNamedConverterAnnotation implementation ********** - - @Override - String getNameElementName() { - return EclipseLink.TYPE_CONVERTER__NAME; - } - - - // ********** BinaryBaseTypeConverterAnnotation implementation ********** - - @Override - String getDataTypeElementName() { - return EclipseLink.TYPE_CONVERTER__DATA_TYPE; - } - - @Override - String getObjectTypeElementName() { - return EclipseLink.TYPE_CONVERTER__OBJECT_TYPE; - } -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/resource/java/binary/BinaryEclipseLinkVariableOneToOneAnnotation.java b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/resource/java/binary/BinaryEclipseLinkVariableOneToOneAnnotation.java deleted file mode 100644 index 1fcd8aeabb..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/resource/java/binary/BinaryEclipseLinkVariableOneToOneAnnotation.java +++ /dev/null @@ -1,32 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2009, 2011 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.eclipselink.core.internal.resource.java.binary; - -import org.eclipse.jdt.core.IAnnotation; -import org.eclipse.jpt.common.core.internal.resource.java.binary.BinaryAnnotation; -import org.eclipse.jpt.common.core.resource.java.JavaResourceAnnotatedElement; -import org.eclipse.jpt.jpa.eclipselink.core.resource.java.EclipseLinkVariableOneToOneAnnotation; - -/** - * org.eclipse.persistence.annotations.VariableOneToOne - */ -public class BinaryEclipseLinkVariableOneToOneAnnotation - extends BinaryAnnotation - implements EclipseLinkVariableOneToOneAnnotation -{ - public BinaryEclipseLinkVariableOneToOneAnnotation(JavaResourceAnnotatedElement parent, IAnnotation jdtAnnotation) { - super(parent, jdtAnnotation); - } - - public String getAnnotationName() { - return ANNOTATION_NAME; - } - -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/resource/java/binary/BinaryEclipseLinkWriteTransformerAnnotation.java b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/resource/java/binary/BinaryEclipseLinkWriteTransformerAnnotation.java deleted file mode 100644 index ae32e241ff..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/resource/java/binary/BinaryEclipseLinkWriteTransformerAnnotation.java +++ /dev/null @@ -1,122 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2009, 2012 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.eclipselink.core.internal.resource.java.binary; - -import org.eclipse.jdt.core.IAnnotation; -import org.eclipse.jpt.common.core.resource.java.JavaResourceAnnotatedElement; -import org.eclipse.jpt.common.core.utility.TextRange; -import org.eclipse.jpt.jpa.core.internal.resource.java.binary.BinaryColumnAnnotation; -import org.eclipse.jpt.jpa.core.resource.java.ColumnAnnotation; -import org.eclipse.jpt.jpa.eclipselink.core.internal.resource.java.NullEclipseLinkWriteTransformerColumnAnnotation; -import org.eclipse.jpt.jpa.eclipselink.core.resource.java.EclipseLink; -import org.eclipse.jpt.jpa.eclipselink.core.resource.java.EclipseLinkWriteTransformerAnnotation; - -/** - * <code>org.eclipse.persistence.annotations.ReadTransformer</code> - */ -public class BinaryEclipseLinkWriteTransformerAnnotation - extends BinaryEclipseLinkTransformerAnnotation - implements EclipseLinkWriteTransformerAnnotation -{ - private ColumnAnnotation column; - private final ColumnAnnotation nullColumn; - - - public BinaryEclipseLinkWriteTransformerAnnotation(JavaResourceAnnotatedElement parent, IAnnotation jdtAnnotation) { - super(parent, jdtAnnotation); - this.column = this.buildColumn(); - this.nullColumn = this.buildNullColumn(); - } - - public String getAnnotationName() { - return ANNOTATION_NAME; - } - - @Override - public void update() { - super.update(); - this.updateColumn(); - } - - - // ********** BinaryTransformerAnnotation implementation ********** - - @Override - String getTransformerClassElementName() { - return EclipseLink.WRITE_TRANSFORMER__TRANSFORMER_CLASS; - } - - @Override - String getMethodElementName() { - return EclipseLink.WRITE_TRANSFORMER__METHOD; - } - - - // ********** WriteTransformerAnnotation implementation ********** - - // ***** column - public ColumnAnnotation getColumn() { - return this.column; - } - - public ColumnAnnotation getNonNullColumn() { - return (this.column != null) ? this.column : this.nullColumn; - } - - public ColumnAnnotation addColumn() { - throw new UnsupportedOperationException(); - } - - public void removeColumn() { - throw new UnsupportedOperationException(); - } - - public TextRange getColumnTextRange() { - throw new UnsupportedOperationException(); - } - - private ColumnAnnotation buildColumn() { - IAnnotation jdtColumn = this.getJdtColumn(); - return (jdtColumn == null) ? null : this.buildColumn(jdtColumn); - } - - private ColumnAnnotation buildNullColumn() { - return new NullEclipseLinkWriteTransformerColumnAnnotation(this); - } - - private ColumnAnnotation buildColumn(IAnnotation jdtColumn) { - return new BinaryColumnAnnotation(this, jdtColumn); - } - - private IAnnotation getJdtColumn() { - return (IAnnotation) this.getJdtMemberValue(EclipseLink.WRITE_TRANSFORMER__COLUMN); - } - - private void setColumn(ColumnAnnotation column) { - ColumnAnnotation old = this.column; - this.column = column; - this.firePropertyChanged(COLUMN_PROPERTY, old, column); - } - - // TODO - private void updateColumn() { - throw new UnsupportedOperationException(); -// IAnnotation jdtColumn = this.getJdtColumn(); -// if (jdtColumn == null) { -// this.setColumn(null); -// } else { -// if (this.column == null) { -// this.setColumn(this.buildColumn(jdtColumn)); -// } else { -// this.column.update(jdtColumn); -// } -// } - } -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/resource/java/source/SourceEclipseLinkArrayAnnotation.java b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/resource/java/source/SourceEclipseLinkArrayAnnotation.java deleted file mode 100644 index 8e23744381..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/resource/java/source/SourceEclipseLinkArrayAnnotation.java +++ /dev/null @@ -1,45 +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, 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.eclipselink.core.internal.resource.java.source; - -import org.eclipse.jdt.core.dom.CompilationUnit; -import org.eclipse.jpt.common.core.internal.resource.java.source.SourceAnnotation; -import org.eclipse.jpt.common.core.internal.utility.jdt.SimpleDeclarationAnnotationAdapter; -import org.eclipse.jpt.common.core.resource.java.JavaResourceAnnotatedElement; -import org.eclipse.jpt.common.core.utility.jdt.AnnotatedElement; -import org.eclipse.jpt.common.core.utility.jdt.DeclarationAnnotationAdapter; -import org.eclipse.jpt.jpa.eclipselink.core.resource.java.EclipseLinkArrayAnnotation2_3; - -/** - * org.eclipse.persistence.annotations.Array - */ -public final class SourceEclipseLinkArrayAnnotation - extends SourceAnnotation - implements EclipseLinkArrayAnnotation2_3 -{ - private static final DeclarationAnnotationAdapter DECLARATION_ANNOTATION_ADAPTER = new SimpleDeclarationAnnotationAdapter(ANNOTATION_NAME); - - - public SourceEclipseLinkArrayAnnotation(JavaResourceAnnotatedElement parent, AnnotatedElement element) { - super(parent, element, DECLARATION_ANNOTATION_ADAPTER); - } - - public String getAnnotationName() { - return ANNOTATION_NAME; - } - - public void initialize(CompilationUnit astRoot) { - // do nothing - } - - public void synchronizeWith(CompilationUnit astRoot) { - // do nothing - } -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/resource/java/source/SourceEclipseLinkBaseConvertAnnotation.java b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/resource/java/source/SourceEclipseLinkBaseConvertAnnotation.java deleted file mode 100644 index 2d8193383d..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/resource/java/source/SourceEclipseLinkBaseConvertAnnotation.java +++ /dev/null @@ -1,111 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2008, 2012 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.eclipselink.core.internal.resource.java.source; - -import org.eclipse.jdt.core.dom.CompilationUnit; -import org.eclipse.jpt.common.core.internal.resource.java.source.SourceAnnotation; -import org.eclipse.jpt.common.core.internal.utility.jdt.AnnotatedElementAnnotationElementAdapter; -import org.eclipse.jpt.common.core.internal.utility.jdt.ConversionDeclarationAnnotationElementAdapter; -import org.eclipse.jpt.common.core.internal.utility.jdt.StringExpressionConverter; -import org.eclipse.jpt.common.core.resource.java.JavaResourceAnnotatedElement; -import org.eclipse.jpt.common.core.utility.TextRange; -import org.eclipse.jpt.common.core.utility.jdt.AnnotatedElement; -import org.eclipse.jpt.common.core.utility.jdt.AnnotationElementAdapter; -import org.eclipse.jpt.common.core.utility.jdt.DeclarationAnnotationAdapter; -import org.eclipse.jpt.common.core.utility.jdt.DeclarationAnnotationElementAdapter; -import org.eclipse.jpt.jpa.eclipselink.core.resource.java.EclipseLinkBaseConvertAnnotation; - -/** - * <code><ul> - * <li>org.eclipse.persistence.annotations.Convert - * <li>org.eclipse.persistence.annotations.MapKeyConvert - * </ul></code> - */ -public abstract class SourceEclipseLinkBaseConvertAnnotation - extends SourceAnnotation - implements EclipseLinkBaseConvertAnnotation -{ - private final DeclarationAnnotationElementAdapter<String> valueDeclarationAdapter; - private final AnnotationElementAdapter<String> valueAdapter; - private String value; - private TextRange valueTextRange; - - - protected SourceEclipseLinkBaseConvertAnnotation(JavaResourceAnnotatedElement parent, AnnotatedElement element, DeclarationAnnotationAdapter daa) { - super(parent, element, daa); - this.valueDeclarationAdapter = this.buildValueDeclarationAdapter(); - this.valueAdapter = new AnnotatedElementAnnotationElementAdapter<String>(element, this.valueDeclarationAdapter); - } - - public void initialize(CompilationUnit astRoot) { - this.value = this.buildValue(astRoot); - this.valueTextRange = this.buildValueTextRange(astRoot); - } - - public void synchronizeWith(CompilationUnit astRoot) { - this.syncValue(this.buildValue(astRoot)); - this.valueTextRange = this.buildValueTextRange(astRoot); - } - - @Override - public boolean isUnset() { - return super.isUnset() && - (this.value == null); - } - - @Override - public void toString(StringBuilder sb) { - sb.append(this.value); - } - - - // ********** ConvertAnnotation implementation ********** - - // ***** value - - public String getValue() { - return this.value; - } - - public void setValue(String value) { - if (this.attributeValueHasChanged(this.value, value)) { - this.value = value; - this.valueAdapter.setValue(value); - } - } - - private void syncValue(String astValue) { - String old = this.value; - this.value = astValue; - this.firePropertyChanged(VALUE_PROPERTY, old, astValue); - } - - private String buildValue(CompilationUnit astRoot) { - return this.valueAdapter.getValue(astRoot); - } - - public TextRange getValueTextRange() { - return this.valueTextRange; - } - - private TextRange buildValueTextRange(CompilationUnit astRoot) { - return this.getElementTextRange(this.valueDeclarationAdapter, astRoot); - } - - public boolean valueTouches(int pos) { - return this.textRangeTouches(this.valueTextRange, pos); - } - - private DeclarationAnnotationElementAdapter<String> buildValueDeclarationAdapter() { - return new ConversionDeclarationAnnotationElementAdapter<String>(this.daa, this.getValueElementName(), StringExpressionConverter.instance()); - } - - protected abstract String getValueElementName(); -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/resource/java/source/SourceEclipseLinkBaseTypeConverterAnnotation.java b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/resource/java/source/SourceEclipseLinkBaseTypeConverterAnnotation.java deleted file mode 100644 index 60c30de8e4..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/resource/java/source/SourceEclipseLinkBaseTypeConverterAnnotation.java +++ /dev/null @@ -1,226 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2008, 2012 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.eclipselink.core.internal.resource.java.source; - -import org.eclipse.jdt.core.dom.CompilationUnit; -import org.eclipse.jpt.common.core.internal.utility.jdt.ASTTools; -import org.eclipse.jpt.common.core.internal.utility.jdt.AnnotatedElementAnnotationElementAdapter; -import org.eclipse.jpt.common.core.internal.utility.jdt.ConversionDeclarationAnnotationElementAdapter; -import org.eclipse.jpt.common.core.internal.utility.jdt.TypeStringExpressionConverter; -import org.eclipse.jpt.common.core.resource.java.JavaResourceAnnotatedElement; -import org.eclipse.jpt.common.core.utility.TextRange; -import org.eclipse.jpt.common.core.utility.jdt.AnnotatedElement; -import org.eclipse.jpt.common.core.utility.jdt.AnnotationElementAdapter; -import org.eclipse.jpt.common.core.utility.jdt.DeclarationAnnotationElementAdapter; -import org.eclipse.jpt.common.core.utility.jdt.IndexedAnnotationAdapter; -import org.eclipse.jpt.common.core.utility.jdt.IndexedDeclarationAnnotationAdapter; -import org.eclipse.jpt.jpa.eclipselink.core.resource.java.EclipseLinkBaseTypeConverterAnnotation; - -/** - * <code> - * <ul> - * <li>org.eclipse.persistence.annotations.TypeConverter - * <li>org.eclipse.persistence.annotations.ObjectTypeConverter - * </ul> - * </code> - */ -abstract class SourceEclipseLinkBaseTypeConverterAnnotation - extends SourceEclipseLinkNamedConverterAnnotation - implements EclipseLinkBaseTypeConverterAnnotation -{ - final DeclarationAnnotationElementAdapter<String> dataTypeDeclarationAdapter; - final AnnotationElementAdapter<String> dataTypeAdapter; - String dataType; - TextRange dataTypeTextRange; - - /** - * @see org.eclipse.jpt.jpa.core.internal.resource.java.source.SourceIdClassAnnotation#fullyQualifiedClassName - */ - String fullyQualifiedDataType; - // we need a flag since the f-q name can be null - boolean fqDataTypeStale = true; - - final DeclarationAnnotationElementAdapter<String> objectTypeDeclarationAdapter; - final AnnotationElementAdapter<String> objectTypeAdapter; - String objectType; - TextRange objectTypeTextRange; - - /** - * @see org.eclipse.jpt.jpa.core.internal.resource.java.source.SourceIdClassAnnotation#fullyQualifiedClassName - */ - String fullyQualifiedObjectType; - // we need a flag since the f-q name can be null - boolean fqObjectTypeStale = true; - - - SourceEclipseLinkBaseTypeConverterAnnotation( - JavaResourceAnnotatedElement parent, - AnnotatedElement element, - IndexedDeclarationAnnotationAdapter daa, - IndexedAnnotationAdapter annotationAdapter) { - super(parent, element, daa, annotationAdapter); - this.dataTypeDeclarationAdapter = this.buildTypeAdapter(this.getDataTypeElementName()); - this.dataTypeAdapter = new AnnotatedElementAnnotationElementAdapter<String>(this.annotatedElement, this.dataTypeDeclarationAdapter); - - this.objectTypeDeclarationAdapter = this.buildTypeAdapter(this.getObjectTypeElementName()); - this.objectTypeAdapter = new AnnotatedElementAnnotationElementAdapter<String>(this.annotatedElement, this.objectTypeDeclarationAdapter); - } - - private DeclarationAnnotationElementAdapter<String> buildTypeAdapter(String elementName) { - // false = do not remove annotation when empty - return new ConversionDeclarationAnnotationElementAdapter<String>(this.daa, elementName, TypeStringExpressionConverter.instance()); - } - - @Override - public void initialize(CompilationUnit astRoot) { - super.initialize(astRoot); - - this.dataType = this.buildDataType(astRoot); - this.dataTypeTextRange = this.buildDataTypeTextRange(astRoot); - - this.objectType = this.buildObjectType(astRoot); - this.objectTypeTextRange = this.buildObjectTypeTextRange(astRoot); - } - - @Override - public void synchronizeWith(CompilationUnit astRoot) { - super.synchronizeWith(astRoot); - - this.syncDataType(this.buildDataType(astRoot)); - this.dataTypeTextRange = this.buildDataTypeTextRange(astRoot); - - this.syncObjectType(this.buildObjectType(astRoot)); - this.objectTypeTextRange = this.buildObjectTypeTextRange(astRoot); - } - - @Override - public boolean isUnset() { - return super.isUnset() && - (this.dataType == null) && - (this.objectType == null); - } - - - // ********** BaseTypeConverterAnnotation implementation ********** - - // ***** data type - public String getDataType() { - return this.dataType; - } - - public void setDataType(String dataType) { - if (this.attributeValueHasChanged(this.dataType, dataType)) { - this.dataType = dataType; - this.fqDataTypeStale = true; - this.dataTypeAdapter.setValue(dataType); - } - } - - private void syncDataType(String astDataType) { - if (this.attributeValueHasChanged(this.dataType, astDataType)) { - this.syncDataType_(astDataType); - } - } - - private void syncDataType_(String astDataType) { - String old = this.dataType; - this.dataType = astDataType; - this.fqDataTypeStale = true; - this.firePropertyChanged(DATA_TYPE_PROPERTY, old, astDataType); - } - - private String buildDataType(CompilationUnit astRoot) { - return this.dataTypeAdapter.getValue(astRoot); - } - - public TextRange getDataTypeTextRange() { - return this.dataTypeTextRange; - } - - private TextRange buildDataTypeTextRange(CompilationUnit astRoot) { - return this.getElementTextRange(this.dataTypeDeclarationAdapter, astRoot); - } - - abstract String getDataTypeElementName(); - - // ***** fully-qualified data type - public String getFullyQualifiedDataType() { - if (this.fqDataTypeStale) { - this.fullyQualifiedDataType = this.buildFullyQualifiedDataType(); - this.fqDataTypeStale = false; - } - return this.fullyQualifiedDataType; - } - - private String buildFullyQualifiedDataType() { - return (this.dataType == null) ? null : this.buildFullyQualifiedDataType_(); - } - - private String buildFullyQualifiedDataType_() { - return ASTTools.resolveFullyQualifiedName(this.dataTypeAdapter.getExpression(this.buildASTRoot())); - } - - // ***** object type - public String getObjectType() { - return this.objectType; - } - - public void setObjectType(String objectType) { - if (this.attributeValueHasChanged(this.objectType, objectType)) { - this.objectType = objectType; - this.fqObjectTypeStale = true; - this.objectTypeAdapter.setValue(objectType); - } - } - - private void syncObjectType(String astObjectType) { - if (this.attributeValueHasChanged(this.objectType, astObjectType)) { - this.syncObjectType_(astObjectType); - } - } - - private void syncObjectType_(String astObjectType) { - String old = this.objectType; - this.objectType = astObjectType; - this.fqObjectTypeStale = true; - this.firePropertyChanged(OBJECT_TYPE_PROPERTY, old, astObjectType); - } - - private String buildObjectType(CompilationUnit astRoot) { - return this.objectTypeAdapter.getValue(astRoot); - } - - public TextRange getObjectTypeTextRange() { - return this.objectTypeTextRange; - } - - private TextRange buildObjectTypeTextRange(CompilationUnit astRoot) { - return this.getElementTextRange(this.objectTypeDeclarationAdapter, astRoot); - } - - abstract String getObjectTypeElementName(); - - // ***** fully-qualified object type - public String getFullyQualifiedObjectType() { - if (this.fqObjectTypeStale) { - this.fullyQualifiedObjectType = this.buildFullyQualifiedObjectType(); - this.fqObjectTypeStale = false; - } - return this.fullyQualifiedObjectType; - } - - private String buildFullyQualifiedObjectType() { - return (this.objectType == null) ? null : this.buildFullyQualifiedObjectType_(); - } - - private String buildFullyQualifiedObjectType_() { - return ASTTools.resolveFullyQualifiedName(this.objectTypeAdapter.getExpression(this.buildASTRoot())); - } -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/resource/java/source/SourceEclipseLinkBasicCollectionAnnotation.java b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/resource/java/source/SourceEclipseLinkBasicCollectionAnnotation.java deleted file mode 100644 index e38edd3c39..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/resource/java/source/SourceEclipseLinkBasicCollectionAnnotation.java +++ /dev/null @@ -1,46 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2008, 2011 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.eclipselink.core.internal.resource.java.source; - -import org.eclipse.jdt.core.dom.CompilationUnit; -import org.eclipse.jpt.common.core.internal.resource.java.source.SourceAnnotation; -import org.eclipse.jpt.common.core.internal.utility.jdt.SimpleDeclarationAnnotationAdapter; -import org.eclipse.jpt.common.core.resource.java.JavaResourceAnnotatedElement; -import org.eclipse.jpt.common.core.utility.jdt.AnnotatedElement; -import org.eclipse.jpt.common.core.utility.jdt.DeclarationAnnotationAdapter; -import org.eclipse.jpt.jpa.eclipselink.core.resource.java.EclipseLinkBasicCollectionAnnotation; - -/** - * org.eclipse.persistence.annotations.BasicCollection - */ -public final class SourceEclipseLinkBasicCollectionAnnotation - extends SourceAnnotation - implements EclipseLinkBasicCollectionAnnotation -{ - private static final DeclarationAnnotationAdapter DECLARATION_ANNOTATION_ADAPTER = new SimpleDeclarationAnnotationAdapter(ANNOTATION_NAME); - - - public SourceEclipseLinkBasicCollectionAnnotation(JavaResourceAnnotatedElement parent, AnnotatedElement element) { - super(parent, element, DECLARATION_ANNOTATION_ADAPTER); - } - - public String getAnnotationName() { - return ANNOTATION_NAME; - } - - public void initialize(CompilationUnit astRoot) { - // do nothing - } - - public void synchronizeWith(CompilationUnit astRoot) { - // do nothing - } - -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/resource/java/source/SourceEclipseLinkBasicMapAnnotation.java b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/resource/java/source/SourceEclipseLinkBasicMapAnnotation.java deleted file mode 100644 index 5e40d37aa8..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/resource/java/source/SourceEclipseLinkBasicMapAnnotation.java +++ /dev/null @@ -1,46 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2008, 2011 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.eclipselink.core.internal.resource.java.source; - -import org.eclipse.jdt.core.dom.CompilationUnit; -import org.eclipse.jpt.common.core.internal.resource.java.source.SourceAnnotation; -import org.eclipse.jpt.common.core.internal.utility.jdt.SimpleDeclarationAnnotationAdapter; -import org.eclipse.jpt.common.core.resource.java.JavaResourceAnnotatedElement; -import org.eclipse.jpt.common.core.utility.jdt.AnnotatedElement; -import org.eclipse.jpt.common.core.utility.jdt.DeclarationAnnotationAdapter; -import org.eclipse.jpt.jpa.eclipselink.core.resource.java.EclipseLinkBasicMapAnnotation; - -/** - * org.eclipse.persistence.annotations.BasicMap - */ -public final class SourceEclipseLinkBasicMapAnnotation - extends SourceAnnotation - implements EclipseLinkBasicMapAnnotation -{ - private static final DeclarationAnnotationAdapter DECLARATION_ANNOTATION_ADAPTER = new SimpleDeclarationAnnotationAdapter(ANNOTATION_NAME); - - - public SourceEclipseLinkBasicMapAnnotation(JavaResourceAnnotatedElement parent, AnnotatedElement element) { - super(parent, element, DECLARATION_ANNOTATION_ADAPTER); - } - - public String getAnnotationName() { - return ANNOTATION_NAME; - } - - public void initialize(CompilationUnit astRoot) { - // do nothing - } - - public void synchronizeWith(CompilationUnit astRoot) { - // do nothing - } - -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/resource/java/source/SourceEclipseLinkCacheAnnotation.java b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/resource/java/source/SourceEclipseLinkCacheAnnotation.java deleted file mode 100644 index fbb6d17075..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/resource/java/source/SourceEclipseLinkCacheAnnotation.java +++ /dev/null @@ -1,575 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2008, 2012 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.eclipselink.core.internal.resource.java.source; - -import org.eclipse.jdt.core.dom.CompilationUnit; -import org.eclipse.jpt.common.core.internal.resource.java.source.SourceAnnotation; -import org.eclipse.jpt.common.core.internal.utility.jdt.AnnotatedElementAnnotationElementAdapter; -import org.eclipse.jpt.common.core.internal.utility.jdt.BooleanExpressionConverter; -import org.eclipse.jpt.common.core.internal.utility.jdt.ConversionDeclarationAnnotationElementAdapter; -import org.eclipse.jpt.common.core.internal.utility.jdt.ElementAnnotationAdapter; -import org.eclipse.jpt.common.core.internal.utility.jdt.EnumDeclarationAnnotationElementAdapter; -import org.eclipse.jpt.common.core.internal.utility.jdt.NestedDeclarationAnnotationAdapter; -import org.eclipse.jpt.common.core.internal.utility.jdt.NumberIntegerExpressionConverter; -import org.eclipse.jpt.common.core.internal.utility.jdt.SimpleDeclarationAnnotationAdapter; -import org.eclipse.jpt.common.core.resource.java.JavaResourceAnnotatedElement; -import org.eclipse.jpt.common.core.utility.TextRange; -import org.eclipse.jpt.common.core.utility.jdt.AnnotatedElement; -import org.eclipse.jpt.common.core.utility.jdt.AnnotationElementAdapter; -import org.eclipse.jpt.common.core.utility.jdt.DeclarationAnnotationAdapter; -import org.eclipse.jpt.common.core.utility.jdt.DeclarationAnnotationElementAdapter; -import org.eclipse.jpt.jpa.eclipselink.core.resource.java.CacheCoordinationType; -import org.eclipse.jpt.jpa.eclipselink.core.resource.java.CacheIsolationType2_2; -import org.eclipse.jpt.jpa.eclipselink.core.resource.java.CacheType; -import org.eclipse.jpt.jpa.eclipselink.core.resource.java.EclipseLink; -import org.eclipse.jpt.jpa.eclipselink.core.resource.java.EclipseLinkCacheAnnotation; -import org.eclipse.jpt.jpa.eclipselink.core.resource.java.EclipseLinkTimeOfDayAnnotation; - -/** - * <code>org.eclipse.persistence.annotations.Cache</code> - */ -public final class SourceEclipseLinkCacheAnnotation - extends SourceAnnotation - implements EclipseLinkCacheAnnotation -{ - private static final DeclarationAnnotationAdapter DECLARATION_ANNOTATION_ADAPTER = new SimpleDeclarationAnnotationAdapter(ANNOTATION_NAME); - - private static final DeclarationAnnotationElementAdapter<String> TYPE_ADAPTER = buildTypeAdapter(); - private final AnnotationElementAdapter<String> typeAdapter; - private CacheType type; - private TextRange typeTextRange; - - private static final DeclarationAnnotationElementAdapter<Integer> SIZE_ADAPTER = buildSizeAdapter(); - private final AnnotationElementAdapter<Integer> sizeAdapter; - private Integer size; - private TextRange sizeTextRange; - - private static final DeclarationAnnotationElementAdapter<Boolean> SHARED_ADAPTER = buildSharedAdapter(); - private final AnnotationElementAdapter<Boolean> sharedAdapter; - private Boolean shared; - private TextRange sharedTextRange; - - private static final DeclarationAnnotationElementAdapter<Boolean> ALWAYS_REFRESH_ADAPTER = buildAlwaysRefreshAdapter(); - private final AnnotationElementAdapter<Boolean> alwaysRefreshAdapter; - private Boolean alwaysRefresh; - private TextRange alwaysRefreshTextRange; - - private static final DeclarationAnnotationElementAdapter<Boolean> REFRESH_ONLY_IF_NEWER_ADAPTER = buildRefreshOnlyIfNewerAdapter(); - private final AnnotationElementAdapter<Boolean> refreshOnlyIfNewerAdapter; - private Boolean refreshOnlyIfNewer; - private TextRange refreshOnlyIfNewerTextRange; - - private static final DeclarationAnnotationElementAdapter<Boolean> DISABLE_HITS_ADAPTER = buildDisableHitsAdapter(); - private final AnnotationElementAdapter<Boolean> disableHitsAdapter; - private Boolean disableHits; - private TextRange disableHitsTextRange; - - private static final DeclarationAnnotationElementAdapter<String> COORDINATION_TYPE_ADAPTER = buildCoordinationTypeAdapter(); - private final AnnotationElementAdapter<String> coordinationTypeAdapter; - private CacheCoordinationType coordinationType; - private TextRange coordinationTypeTextRange; - - private static final DeclarationAnnotationElementAdapter<Integer> EXPIRY_ADAPTER = buildExpiryAdapter(); - private final AnnotationElementAdapter<Integer> expiryAdapter; - private Integer expiry; - private TextRange expiryTextRange; - - private static final NestedDeclarationAnnotationAdapter EXPIRY_TIME_OF_DAY_ADAPTER = buildExpiryTimeOfDayAdapter(); - private final ElementAnnotationAdapter expiryTimeOfDayAdapter; - private EclipseLinkTimeOfDayAnnotation expiryTimeOfDay; - private TextRange expiryTimeOfDayTextRange; - - private static final DeclarationAnnotationElementAdapter<String> ISOLATION_ADAPTER = buildIsolationAdapter(); - private final AnnotationElementAdapter<String> isolationAdapter; - private CacheIsolationType2_2 isolation; - private TextRange isolationTextRange; - - - public SourceEclipseLinkCacheAnnotation(JavaResourceAnnotatedElement parent, AnnotatedElement element) { - super(parent, element, DECLARATION_ANNOTATION_ADAPTER); - this.typeAdapter = new AnnotatedElementAnnotationElementAdapter<String>(element, TYPE_ADAPTER); - this.sizeAdapter = new AnnotatedElementAnnotationElementAdapter<Integer>(element, SIZE_ADAPTER); - this.sharedAdapter = new AnnotatedElementAnnotationElementAdapter<Boolean>(element, SHARED_ADAPTER); - this.alwaysRefreshAdapter = new AnnotatedElementAnnotationElementAdapter<Boolean>(element, ALWAYS_REFRESH_ADAPTER); - this.refreshOnlyIfNewerAdapter = new AnnotatedElementAnnotationElementAdapter<Boolean>(element, REFRESH_ONLY_IF_NEWER_ADAPTER); - this.disableHitsAdapter = new AnnotatedElementAnnotationElementAdapter<Boolean>(element, DISABLE_HITS_ADAPTER); - this.coordinationTypeAdapter = new AnnotatedElementAnnotationElementAdapter<String>(element, COORDINATION_TYPE_ADAPTER); - this.expiryAdapter = new AnnotatedElementAnnotationElementAdapter<Integer>(element, EXPIRY_ADAPTER); - this.expiryTimeOfDayAdapter = new ElementAnnotationAdapter(element, EXPIRY_TIME_OF_DAY_ADAPTER); - this.isolationAdapter = new AnnotatedElementAnnotationElementAdapter<String>(element, ISOLATION_ADAPTER); - } - - public String getAnnotationName() { - return ANNOTATION_NAME; - } - - public void initialize(CompilationUnit astRoot) { - this.type = this.buildType(astRoot); - this.typeTextRange = this.buildTypeTextRange(astRoot); - - this.size = this.buildSize(astRoot); - this.sizeTextRange = this.buildSizeTextRange(astRoot); - - this.shared = this.buildShared(astRoot); - this.sharedTextRange = this.buildSharedTextRange(astRoot); - - this.alwaysRefresh = this.buildAlwaysRefresh(astRoot); - this.alwaysRefreshTextRange = this.buildAlwaysRefreshTextRange(astRoot); - - this.refreshOnlyIfNewer = this.buildRefreshOnlyIfNewer(astRoot); - this.refreshOnlyIfNewerTextRange = this.buildRefreshOnlyIfNewerTextRange(astRoot); - - this.disableHits = this.buildDisableHits(astRoot); - this.disableHitsTextRange = this.buildDisableHitsTextRange(astRoot); - - this.coordinationType = this.buildCoordinationType(astRoot); - this.coordinationTypeTextRange = this.buildCoordinationTypeTextRange(astRoot); - - this.expiry = this.buildExpiry(astRoot); - this.expiryTextRange = this.buildExpiryTextRange(astRoot); - - this.initializeExpiryTimeOfDay(astRoot); - this.expiryTimeOfDayTextRange = this.buildExpiryTimeOfDayTextRange(astRoot); - - this.isolation = this.buildIsolation(astRoot); - this.isolationTextRange = this.buildIsolationTextRange(astRoot); - } - - private void initializeExpiryTimeOfDay(CompilationUnit astRoot) { - if (this.expiryTimeOfDayAdapter.getAnnotation(astRoot) != null) { - this.expiryTimeOfDay = this.buildExpiryTimeOfDay(); - this.expiryTimeOfDay.initialize(astRoot); - } - } - - public void synchronizeWith(CompilationUnit astRoot) { - this.syncType(this.buildType(astRoot)); - this.typeTextRange = this.buildTypeTextRange(astRoot); - - this.syncSize(this.buildSize(astRoot)); - this.sizeTextRange = this.buildSizeTextRange(astRoot); - - this.syncShared(this.buildShared(astRoot)); - this.sharedTextRange = this.buildSharedTextRange(astRoot); - - this.syncAlwaysRefresh(this.buildAlwaysRefresh(astRoot)); - this.alwaysRefreshTextRange = this.buildAlwaysRefreshTextRange(astRoot); - - this.syncRefreshOnlyIfNewer(this.buildRefreshOnlyIfNewer(astRoot)); - this.refreshOnlyIfNewerTextRange = this.buildRefreshOnlyIfNewerTextRange(astRoot); - - this.syncDisableHits(this.buildDisableHits(astRoot)); - this.disableHitsTextRange = this.buildDisableHitsTextRange(astRoot); - - this.syncCoordinationType(this.buildCoordinationType(astRoot)); - this.coordinationTypeTextRange = this.buildCoordinationTypeTextRange(astRoot); - - this.syncExpiry(this.buildExpiry(astRoot)); - this.expiryTextRange = this.buildExpiryTextRange(astRoot); - - this.syncExpiryTimeOfDay(astRoot); - this.expiryTimeOfDayTextRange = this.buildExpiryTimeOfDayTextRange(astRoot); - - this.syncIsolation(this.buildIsolation(astRoot)); - this.isolationTextRange = this.buildIsolationTextRange(astRoot); - } - - @Override - public boolean isUnset() { - return super.isUnset() && - (this.type == null) && - (this.size == null) && - (this.shared == null) && - (this.alwaysRefresh == null) && - (this.refreshOnlyIfNewer == null) && - (this.disableHits == null) && - (this.coordinationType == null) && - (this.expiry == null) && - (this.expiryTimeOfDay == null) && - (this.isolation == null); - } - - @Override - public void toString(StringBuilder sb) { - sb.append(this.type); - } - - - // ********** CacheAnnotation implementation ********** - - // ***** type - public CacheType getType() { - return this.type; - } - - public void setType(CacheType type) { - if (this.attributeValueHasChanged(this.type, type)) { - this.type = type; - this.typeAdapter.setValue(CacheType.toJavaAnnotationValue(type)); - } - } - - private void syncType(CacheType astType) { - CacheType old = this.type; - this.type = astType; - this.firePropertyChanged(TYPE_PROPERTY, old, astType); - } - - private CacheType buildType(CompilationUnit astRoot) { - return CacheType.fromJavaAnnotationValue(this.typeAdapter.getValue(astRoot)); - } - - public TextRange getTypeTextRange() { - return this.typeTextRange; - } - - private TextRange buildTypeTextRange(CompilationUnit astRoot) { - return this.getElementTextRange(TYPE_ADAPTER, astRoot); - } - - // ***** size - public Integer getSize() { - return this.size; - } - - public void setSize(Integer size) { - if (this.attributeValueHasChanged(this.size, size)) { - this.size = size; - this.sizeAdapter.setValue(size); - } - } - - private void syncSize(Integer astSize) { - Integer old = this.size; - this.size = astSize; - this.firePropertyChanged(SIZE_PROPERTY, old, astSize); - } - - private Integer buildSize(CompilationUnit astRoot) { - return this.sizeAdapter.getValue(astRoot); - } - - public TextRange getSizeTextRange() { - return this.sizeTextRange; - } - - private TextRange buildSizeTextRange(CompilationUnit astRoot) { - return this.getElementTextRange(SIZE_ADAPTER, astRoot); - } - - // ***** shared - public Boolean getShared() { - return this.shared; - } - - public void setShared(Boolean shared) { - if (this.attributeValueHasChanged(this.shared, shared)) { - this.shared = shared; - this.sharedAdapter.setValue(shared); - } - } - - private void syncShared(Boolean astShared) { - Boolean old = this.shared; - this.shared = astShared; - this.firePropertyChanged(SHARED_PROPERTY, old, astShared); - } - - private Boolean buildShared(CompilationUnit astRoot) { - return this.sharedAdapter.getValue(astRoot); - } - - public TextRange getSharedTextRange() { - return this.sharedTextRange; - } - - private TextRange buildSharedTextRange(CompilationUnit astRoot) { - return this.getElementTextRange(SHARED_ADAPTER, astRoot); - } - - // ***** always refresh - public Boolean getAlwaysRefresh() { - return this.alwaysRefresh; - } - - public void setAlwaysRefresh(Boolean alwaysRefresh) { - if (this.attributeValueHasChanged(this.alwaysRefresh, alwaysRefresh)) { - this.alwaysRefresh = alwaysRefresh; - this.alwaysRefreshAdapter.setValue(alwaysRefresh); - } - } - - private void syncAlwaysRefresh(Boolean astAlwaysRefresh) { - Boolean old = this.alwaysRefresh; - this.alwaysRefresh = astAlwaysRefresh; - this.firePropertyChanged(ALWAYS_REFRESH_PROPERTY, old, astAlwaysRefresh); - } - - private Boolean buildAlwaysRefresh(CompilationUnit astRoot) { - return this.alwaysRefreshAdapter.getValue(astRoot); - } - - public TextRange getAlwaysRefreshTextRange() { - return this.alwaysRefreshTextRange; - } - - private TextRange buildAlwaysRefreshTextRange(CompilationUnit astRoot) { - return this.getElementTextRange(ALWAYS_REFRESH_ADAPTER, astRoot); - } - - // ***** refresh only if newer - public Boolean getRefreshOnlyIfNewer() { - return this.refreshOnlyIfNewer; - } - - public void setRefreshOnlyIfNewer(Boolean refreshOnlyIfNewer) { - if (this.attributeValueHasChanged(this.refreshOnlyIfNewer, refreshOnlyIfNewer)) { - this.refreshOnlyIfNewer = refreshOnlyIfNewer; - this.refreshOnlyIfNewerAdapter.setValue(refreshOnlyIfNewer); - } - } - - private void syncRefreshOnlyIfNewer(Boolean astRefreshOnlyIfNewer) { - Boolean old = this.refreshOnlyIfNewer; - this.refreshOnlyIfNewer = astRefreshOnlyIfNewer; - this.firePropertyChanged(REFRESH_ONLY_IF_NEWER_PROPERTY, old, astRefreshOnlyIfNewer); - } - - private Boolean buildRefreshOnlyIfNewer(CompilationUnit astRoot) { - return this.refreshOnlyIfNewerAdapter.getValue(astRoot); - } - - public TextRange getRefreshOnlyIfNewerTextRange() { - return this.refreshOnlyIfNewerTextRange; - } - - private TextRange buildRefreshOnlyIfNewerTextRange(CompilationUnit astRoot) { - return this.getElementTextRange(REFRESH_ONLY_IF_NEWER_ADAPTER, astRoot); - } - - // ***** disable hits - public Boolean getDisableHits() { - return this.disableHits; - } - - public void setDisableHits(Boolean disableHits) { - if (this.attributeValueHasChanged(this.disableHits, disableHits)) { - this.disableHits = disableHits; - this.disableHitsAdapter.setValue(disableHits); - } - } - - private void syncDisableHits(Boolean astDisableHits) { - Boolean old = this.disableHits; - this.disableHits = astDisableHits; - this.firePropertyChanged(DISABLE_HITS_PROPERTY, old, astDisableHits); - } - - private Boolean buildDisableHits(CompilationUnit astRoot) { - return this.disableHitsAdapter.getValue(astRoot); - } - - public TextRange getDisableHitsTextRange() { - return this.disableHitsTextRange; - } - - private TextRange buildDisableHitsTextRange(CompilationUnit astRoot) { - return this.getElementTextRange(DISABLE_HITS_ADAPTER, astRoot); - } - - // ***** coordination type - public CacheCoordinationType getCoordinationType() { - return this.coordinationType; - } - - public void setCoordinationType(CacheCoordinationType coordinationType) { - if (this.attributeValueHasChanged(this.coordinationType, coordinationType)) { - this.coordinationType = coordinationType; - this.coordinationTypeAdapter.setValue(CacheCoordinationType.toJavaAnnotationValue(coordinationType)); - } - } - - private void syncCoordinationType(CacheCoordinationType astCoordinationType) { - CacheCoordinationType old = this.coordinationType; - this.coordinationType = astCoordinationType; - this.firePropertyChanged(TYPE_PROPERTY, old, astCoordinationType); - } - - private CacheCoordinationType buildCoordinationType(CompilationUnit astRoot) { - return CacheCoordinationType.fromJavaAnnotationValue(this.coordinationTypeAdapter.getValue(astRoot)); - } - - public TextRange getCoordinationTypeTextRange() { - return this.coordinationTypeTextRange; - } - - private TextRange buildCoordinationTypeTextRange(CompilationUnit astRoot) { - return this.getElementTextRange(COORDINATION_TYPE_ADAPTER, astRoot); - } - - // ***** expiry - public Integer getExpiry() { - return this.expiry; - } - - public void setExpiry(Integer expiry) { - if (this.attributeValueHasChanged(this.expiry, expiry)) { - this.expiry = expiry; - this.expiryAdapter.setValue(expiry); - } - } - - private void syncExpiry(Integer astExpiry) { - Integer old = this.expiry; - this.expiry = astExpiry; - this.firePropertyChanged(EXPIRY_PROPERTY, old, astExpiry); - } - - private Integer buildExpiry(CompilationUnit astRoot) { - return this.expiryAdapter.getValue(astRoot); - } - - public TextRange getExpiryTextRange() { - return this.expiryTextRange; - } - - private TextRange buildExpiryTextRange(CompilationUnit astRoot) { - return this.getElementTextRange(EXPIRY_ADAPTER, astRoot); - } - - // ***** expiry time of day - public EclipseLinkTimeOfDayAnnotation getExpiryTimeOfDay() { - return this.expiryTimeOfDay; - } - - public EclipseLinkTimeOfDayAnnotation addExpiryTimeOfDay() { - if (this.expiryTimeOfDay != null) { - throw new IllegalStateException("'expiryTimeOfDay' element already exists: " + this.expiryTimeOfDay); //$NON-NLS-1$ - } - this.expiryTimeOfDay = this.buildExpiryTimeOfDay(); - this.expiryTimeOfDay.newAnnotation(); - return this.expiryTimeOfDay; - } - - public void removeExpiryTimeOfDay() { - if (this.expiryTimeOfDay == null) { - throw new IllegalStateException("'expiryTimeOfDay' element does not exist"); //$NON-NLS-1$ - } - EclipseLinkTimeOfDayAnnotation old = this.expiryTimeOfDay; - this.expiryTimeOfDay = null; - old.removeAnnotation(); - } - - private EclipseLinkTimeOfDayAnnotation buildExpiryTimeOfDay() { - return new SourceEclipseLinkTimeOfDayAnnotation(this, this.annotatedElement, EXPIRY_TIME_OF_DAY_ADAPTER); - } - - private void syncExpiryTimeOfDay(CompilationUnit astRoot) { - if (this.expiryTimeOfDayAdapter.getAnnotation(astRoot) == null) { - this.syncExpiryTimeOfDay_(null); - } else { - if (this.expiryTimeOfDay == null) { - EclipseLinkTimeOfDayAnnotation tod = this.buildExpiryTimeOfDay(); - tod.initialize(astRoot); - this.syncExpiryTimeOfDay_(tod); - } else { - this.expiryTimeOfDay.synchronizeWith(astRoot); - } - } - } - - private void syncExpiryTimeOfDay_(EclipseLinkTimeOfDayAnnotation astExpiryTimeOfDay) { - EclipseLinkTimeOfDayAnnotation old = this.expiryTimeOfDay; - this.expiryTimeOfDay = astExpiryTimeOfDay; - this.firePropertyChanged(EXPIRY_TIME_OF_DAY_PROPERTY, old, astExpiryTimeOfDay); - } - - public TextRange getExpiryTimeOfDayTextRange() { - return this.expiryTimeOfDayTextRange; - } - - private TextRange buildExpiryTimeOfDayTextRange(CompilationUnit astRoot) { - return this.buildTextRange(this.expiryTimeOfDayAdapter.getAstNode(astRoot)); - } - - // ***** isolation - public CacheIsolationType2_2 getIsolation() { - return this.isolation; - } - - public void setIsolation(CacheIsolationType2_2 isolation) { - if (this.attributeValueHasChanged(this.isolation, isolation)) { - this.isolation = isolation; - this.isolationAdapter.setValue(CacheIsolationType2_2.toJavaAnnotationValue(isolation)); - } - } - - private void syncIsolation(CacheIsolationType2_2 astIsolation) { - CacheIsolationType2_2 old = this.isolation; - this.isolation = astIsolation; - this.firePropertyChanged(ISOLATION_PROPERTY, old, astIsolation); - } - - private CacheIsolationType2_2 buildIsolation(CompilationUnit astRoot) { - return CacheIsolationType2_2.fromJavaAnnotationValue(this.isolationAdapter.getValue(astRoot)); - } - - public TextRange getIsolationTextRange() { - return this.isolationTextRange; - } - - private TextRange buildIsolationTextRange(CompilationUnit astRoot) { - return this.getElementTextRange(ISOLATION_ADAPTER, astRoot); - } - - - // ********** static methods ********** - - private static DeclarationAnnotationElementAdapter<String> buildTypeAdapter() { - return new EnumDeclarationAnnotationElementAdapter(DECLARATION_ANNOTATION_ADAPTER, EclipseLink.CACHE__TYPE); - } - - private static DeclarationAnnotationElementAdapter<Integer> buildSizeAdapter() { - return new ConversionDeclarationAnnotationElementAdapter<Integer>(DECLARATION_ANNOTATION_ADAPTER, EclipseLink.CACHE__SIZE, NumberIntegerExpressionConverter.instance()); - } - - private static DeclarationAnnotationElementAdapter<Boolean> buildSharedAdapter() { - return new ConversionDeclarationAnnotationElementAdapter<Boolean>(DECLARATION_ANNOTATION_ADAPTER, EclipseLink.CACHE__SHARED, BooleanExpressionConverter.instance()); - } - - private static DeclarationAnnotationElementAdapter<Integer> buildExpiryAdapter() { - return new ConversionDeclarationAnnotationElementAdapter<Integer>(DECLARATION_ANNOTATION_ADAPTER, EclipseLink.CACHE__EXPIRY, NumberIntegerExpressionConverter.instance()); - } - - private static DeclarationAnnotationElementAdapter<Boolean> buildAlwaysRefreshAdapter() { - return new ConversionDeclarationAnnotationElementAdapter<Boolean>(DECLARATION_ANNOTATION_ADAPTER, EclipseLink.CACHE__ALWAYS_REFRESH, BooleanExpressionConverter.instance()); - } - - private static DeclarationAnnotationElementAdapter<Boolean> buildRefreshOnlyIfNewerAdapter() { - return new ConversionDeclarationAnnotationElementAdapter<Boolean>(DECLARATION_ANNOTATION_ADAPTER, EclipseLink.CACHE__REFRESH_ONLY_IF_NEWER, BooleanExpressionConverter.instance()); - } - - private static DeclarationAnnotationElementAdapter<Boolean> buildDisableHitsAdapter() { - return new ConversionDeclarationAnnotationElementAdapter<Boolean>(DECLARATION_ANNOTATION_ADAPTER, EclipseLink.CACHE__DISABLE_HITS, BooleanExpressionConverter.instance()); - } - - private static DeclarationAnnotationElementAdapter<String> buildCoordinationTypeAdapter() { - return new EnumDeclarationAnnotationElementAdapter(DECLARATION_ANNOTATION_ADAPTER, EclipseLink.CACHE__COORDINATION_TYPE); - } - - private static NestedDeclarationAnnotationAdapter buildExpiryTimeOfDayAdapter() { - return new NestedDeclarationAnnotationAdapter(DECLARATION_ANNOTATION_ADAPTER, EclipseLink.CACHE__EXPIRY_TIME_OF_DAY, EclipseLink.TIME_OF_DAY); - } - - private static DeclarationAnnotationElementAdapter<String> buildIsolationAdapter() { - return new EnumDeclarationAnnotationElementAdapter(DECLARATION_ANNOTATION_ADAPTER, EclipseLink.CACHE__ISOLATION); - } - -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/resource/java/source/SourceEclipseLinkChangeTrackingAnnotation.java b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/resource/java/source/SourceEclipseLinkChangeTrackingAnnotation.java deleted file mode 100644 index b028ec3d64..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/resource/java/source/SourceEclipseLinkChangeTrackingAnnotation.java +++ /dev/null @@ -1,112 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2008, 2012 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.eclipselink.core.internal.resource.java.source; - -import org.eclipse.jdt.core.dom.CompilationUnit; -import org.eclipse.jpt.common.core.internal.resource.java.source.SourceAnnotation; -import org.eclipse.jpt.common.core.internal.utility.jdt.AnnotatedElementAnnotationElementAdapter; -import org.eclipse.jpt.common.core.internal.utility.jdt.EnumDeclarationAnnotationElementAdapter; -import org.eclipse.jpt.common.core.internal.utility.jdt.SimpleDeclarationAnnotationAdapter; -import org.eclipse.jpt.common.core.resource.java.JavaResourceAnnotatedElement; -import org.eclipse.jpt.common.core.utility.TextRange; -import org.eclipse.jpt.common.core.utility.jdt.AnnotatedElement; -import org.eclipse.jpt.common.core.utility.jdt.AnnotationElementAdapter; -import org.eclipse.jpt.common.core.utility.jdt.DeclarationAnnotationAdapter; -import org.eclipse.jpt.common.core.utility.jdt.DeclarationAnnotationElementAdapter; -import org.eclipse.jpt.jpa.eclipselink.core.resource.java.ChangeTrackingType; -import org.eclipse.jpt.jpa.eclipselink.core.resource.java.EclipseLink; -import org.eclipse.jpt.jpa.eclipselink.core.resource.java.EclipseLinkChangeTrackingAnnotation; - -/** - * <code>org.eclipse.persistence.annotations.ChangeTracking</code> - */ -public final class SourceEclipseLinkChangeTrackingAnnotation - extends SourceAnnotation - implements EclipseLinkChangeTrackingAnnotation -{ - private static final DeclarationAnnotationAdapter DECLARATION_ANNOTATION_ADAPTER = new SimpleDeclarationAnnotationAdapter(ANNOTATION_NAME); - - private static final DeclarationAnnotationElementAdapter<String> VALUE_ADAPTER = buildValueAdapter(); - private final AnnotationElementAdapter<String> valueAdapter; - private ChangeTrackingType value; - private TextRange valueTextRange; - - - public SourceEclipseLinkChangeTrackingAnnotation(JavaResourceAnnotatedElement parent, AnnotatedElement element) { - super(parent, element, DECLARATION_ANNOTATION_ADAPTER); - this.valueAdapter = new AnnotatedElementAnnotationElementAdapter<String>(element, VALUE_ADAPTER); - } - - public String getAnnotationName() { - return ANNOTATION_NAME; - } - - public void initialize(CompilationUnit astRoot) { - this.value = this.buildValue(astRoot); - this.valueTextRange = this.buildValueTextRange(astRoot); - } - - public void synchronizeWith(CompilationUnit astRoot) { - this.syncValue(this.buildValue(astRoot)); - this.valueTextRange = this.buildValueTextRange(astRoot); - } - - @Override - public boolean isUnset() { - return super.isUnset() && - (this.value == null); - } - - @Override - public void toString(StringBuilder sb) { - sb.append(this.value); - } - - - // ********** ChangeTrackingAnnotation implementation ********** - - // ***** value - public ChangeTrackingType getValue() { - return this.value; - } - - public void setValue(ChangeTrackingType value) { - if (this.attributeValueHasChanged(this.value, value)) { - this.value = value; - this.valueAdapter.setValue(ChangeTrackingType.toJavaAnnotationValue(value)); - } - } - - private void syncValue(ChangeTrackingType astValue) { - ChangeTrackingType old = this.value; - this.value = astValue; - this.firePropertyChanged(VALUE_PROPERTY, old, astValue); - } - - private ChangeTrackingType buildValue(CompilationUnit astRoot) { - return ChangeTrackingType.fromJavaAnnotationValue(this.valueAdapter.getValue(astRoot)); - } - - public TextRange getValueTextRange() { - return this.valueTextRange; - } - - private TextRange buildValueTextRange(CompilationUnit astRoot) { - return this.getElementTextRange(VALUE_ADAPTER, astRoot); - } - - - // ********** static methods ********** - - private static DeclarationAnnotationElementAdapter<String> buildValueAdapter() { - return new EnumDeclarationAnnotationElementAdapter(DECLARATION_ANNOTATION_ADAPTER, EclipseLink.CHANGE_TRACKING__VALUE); - } - -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/resource/java/source/SourceEclipseLinkClassExtractorAnnotation2_1.java b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/resource/java/source/SourceEclipseLinkClassExtractorAnnotation2_1.java deleted file mode 100644 index 959a9b6d5a..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/resource/java/source/SourceEclipseLinkClassExtractorAnnotation2_1.java +++ /dev/null @@ -1,138 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010, 2011 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.eclipselink.core.internal.resource.java.source; - -import org.eclipse.jdt.core.dom.CompilationUnit; -import org.eclipse.jpt.common.core.internal.resource.java.source.SourceAnnotation; -import org.eclipse.jpt.common.core.internal.utility.jdt.ASTTools; -import org.eclipse.jpt.common.core.internal.utility.jdt.AnnotatedElementAnnotationElementAdapter; -import org.eclipse.jpt.common.core.internal.utility.jdt.ConversionDeclarationAnnotationElementAdapter; -import org.eclipse.jpt.common.core.internal.utility.jdt.SimpleDeclarationAnnotationAdapter; -import org.eclipse.jpt.common.core.internal.utility.jdt.SimpleTypeStringExpressionConverter; -import org.eclipse.jpt.common.core.resource.java.JavaResourceAnnotatedElement; -import org.eclipse.jpt.common.core.utility.TextRange; -import org.eclipse.jpt.common.core.utility.jdt.AnnotatedElement; -import org.eclipse.jpt.common.core.utility.jdt.AnnotationElementAdapter; -import org.eclipse.jpt.common.core.utility.jdt.DeclarationAnnotationAdapter; -import org.eclipse.jpt.common.core.utility.jdt.DeclarationAnnotationElementAdapter; -import org.eclipse.jpt.jpa.eclipselink.core.resource.java.EclipseLink; -import org.eclipse.jpt.jpa.eclipselink.core.resource.java.EclipseLinkClassExtractorAnnotation2_1; - -/** - * org.eclipse.persistence.annotations.ClassExtractor - */ -public final class SourceEclipseLinkClassExtractorAnnotation2_1 - extends SourceAnnotation - implements EclipseLinkClassExtractorAnnotation2_1 -{ - private static final DeclarationAnnotationAdapter DECLARATION_ANNOTATION_ADAPTER = new SimpleDeclarationAnnotationAdapter(ANNOTATION_NAME); - - private static final DeclarationAnnotationElementAdapter<String> VALUE_ADAPTER = buildValueAdapter(); - private final AnnotationElementAdapter<String> valueAdapter; - private String value; - - /** - * @see org.eclipse.jpt.jpa.core.internal.resource.java.source.SourceIdClassAnnotation#fullyQualifiedClassName - */ - private String fullyQualifiedClassName; - // we need a flag since the f-q name can be null - private boolean fqClassNameStale = true; - - - public SourceEclipseLinkClassExtractorAnnotation2_1(JavaResourceAnnotatedElement parent, AnnotatedElement element) { - super(parent, element, DECLARATION_ANNOTATION_ADAPTER); - this.valueAdapter = new AnnotatedElementAnnotationElementAdapter<String>(element, VALUE_ADAPTER); - } - - public String getAnnotationName() { - return ANNOTATION_NAME; - } - - public void initialize(CompilationUnit astRoot) { - this.value = this.buildValue(astRoot); - } - - public void synchronizeWith(CompilationUnit astRoot) { - this.syncValue(this.buildValue(astRoot)); - } - - @Override - public boolean isUnset() { - return super.isUnset() && - (this.value == null); - } - - @Override - public void toString(StringBuilder sb) { - sb.append(this.value); - } - - - // ********** EclipseLinkClassExtractorAnnotation2_1 implementation ********** - - // ***** value - public String getValue() { - return this.value; - } - - public void setValue(String value) { - if (this.attributeValueHasChanged(this.value, value)) { - this.value = value; - this.fqClassNameStale = true; - this.valueAdapter.setValue(value); - } - } - - private void syncValue(String astValue) { - if (this.attributeValueHasChanged(this.value, astValue)) { - this.syncValue_(astValue); - } - } - - private void syncValue_(String astValue) { - String old = this.value; - this.value = astValue; - this.fqClassNameStale = true; - this.firePropertyChanged(VALUE_PROPERTY, old, astValue); - } - - private String buildValue(CompilationUnit astRoot) { - return this.valueAdapter.getValue(astRoot); - } - - public TextRange getValueTextRange(CompilationUnit astRoot) { - return this.getElementTextRange(VALUE_ADAPTER, astRoot); - } - - // ***** fully-qualified class name - public String getFullyQualifiedClassName() { - if (this.fqClassNameStale) { - this.fullyQualifiedClassName = this.buildFullyQualifiedClassName(); - this.fqClassNameStale = false; - } - return this.fullyQualifiedClassName; - } - - private String buildFullyQualifiedClassName() { - return (this.value == null) ? null : this.buildFullyQualifiedClassName_(); - } - - private String buildFullyQualifiedClassName_() { - return ASTTools.resolveFullyQualifiedName(this.valueAdapter.getExpression(this.buildASTRoot())); - } - - - // ********** static methods ********** - - protected static DeclarationAnnotationElementAdapter<String> buildValueAdapter() { - return new ConversionDeclarationAnnotationElementAdapter<String>(DECLARATION_ANNOTATION_ADAPTER, EclipseLink.CLASS_EXTRACTOR__VALUE, SimpleTypeStringExpressionConverter.instance()); - } - -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/resource/java/source/SourceEclipseLinkConversionValueAnnotation.java b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/resource/java/source/SourceEclipseLinkConversionValueAnnotation.java deleted file mode 100644 index a2d5629249..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/resource/java/source/SourceEclipseLinkConversionValueAnnotation.java +++ /dev/null @@ -1,173 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2008, 2012 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.eclipselink.core.internal.resource.java.source; - -import org.eclipse.jdt.core.dom.CompilationUnit; -import org.eclipse.jpt.common.core.internal.resource.java.source.SourceAnnotation; -import org.eclipse.jpt.common.core.internal.utility.jdt.ConversionDeclarationAnnotationElementAdapter; -import org.eclipse.jpt.common.core.internal.utility.jdt.ElementIndexedAnnotationAdapter; -import org.eclipse.jpt.common.core.resource.java.JavaResourceNode; -import org.eclipse.jpt.common.core.utility.TextRange; -import org.eclipse.jpt.common.core.utility.jdt.AnnotatedElement; -import org.eclipse.jpt.common.core.utility.jdt.AnnotationElementAdapter; -import org.eclipse.jpt.common.core.utility.jdt.DeclarationAnnotationElementAdapter; -import org.eclipse.jpt.common.core.utility.jdt.IndexedDeclarationAnnotationAdapter; -import org.eclipse.jpt.jpa.eclipselink.core.resource.java.EclipseLink; -import org.eclipse.jpt.jpa.eclipselink.core.resource.java.EclipseLinkConversionValueAnnotation; - -/** - * <code>org.eclipse.persistence.annotations.ConversionValue</code> - */ -final class SourceEclipseLinkConversionValueAnnotation - extends SourceAnnotation - implements EclipseLinkConversionValueAnnotation -{ - private DeclarationAnnotationElementAdapter<String> dataValueDeclarationAdapter; - private AnnotationElementAdapter<String> dataValueAdapter; - private String dataValue; - private TextRange dataValueTextRange; - - private DeclarationAnnotationElementAdapter<String> objectValueDeclarationAdapter; - private AnnotationElementAdapter<String> objectValueAdapter; - private String objectValue; - private TextRange objectValueTextRange; - - public static SourceEclipseLinkConversionValueAnnotation buildNestedSourceConversionValueAnnotation( - JavaResourceNode parent, - AnnotatedElement element, - IndexedDeclarationAnnotationAdapter idaa) { - - return new SourceEclipseLinkConversionValueAnnotation(parent, element, idaa); - } - - private SourceEclipseLinkConversionValueAnnotation(JavaResourceNode parent, AnnotatedElement element, IndexedDeclarationAnnotationAdapter idaa) { - super(parent, element, idaa, new ElementIndexedAnnotationAdapter(element, idaa)); - this.dataValueDeclarationAdapter = this.buildDataValueDeclarationAdapter(); - this.dataValueAdapter = this.buildDataValueAdapter(); - this.objectValueDeclarationAdapter = this.buildObjectValueDeclarationAdapter(); - this.objectValueAdapter = this.buildObjectValueAdapter(); - } - - public String getAnnotationName() { - return ANNOTATION_NAME; - } - - public void initialize(CompilationUnit astRoot) { - this.dataValue = this.buildDataValue(astRoot); - this.dataValueTextRange = this.buildDataValueTextRange(astRoot); - - this.objectValue = this.buildObjectValue(astRoot); - this.objectValueTextRange = this.buildObjectValueTextRange(astRoot); - } - - public void synchronizeWith(CompilationUnit astRoot) { - this.syncDataValue(this.buildDataValue(astRoot)); - this.dataValueTextRange = this.buildDataValueTextRange(astRoot); - - this.syncObjectValue(this.buildObjectValue(astRoot)); - this.objectValueTextRange = this.buildObjectValueTextRange(astRoot); - } - - - // ********** ConversionValueAnnotation implementation ********** - - // ***** data value - public String getDataValue() { - return this.dataValue; - } - - public void setDataValue(String dataValue) { - if (this.attributeValueHasChanged(this.dataValue, dataValue)) { - this.dataValue = dataValue; - this.dataValueAdapter.setValue(dataValue); - } - } - - private void syncDataValue(String astDataValue) { - String old = this.dataValue; - this.dataValue = astDataValue; - this.firePropertyChanged(DATA_VALUE_PROPERTY, old, astDataValue); - } - - private String buildDataValue(CompilationUnit astRoot) { - return this.dataValueAdapter.getValue(astRoot); - } - - public TextRange getDataValueTextRange() { - return this.dataValueTextRange; - } - - private TextRange buildDataValueTextRange(CompilationUnit astRoot) { - return this.getElementTextRange(this.dataValueDeclarationAdapter, astRoot); - } - - private DeclarationAnnotationElementAdapter<String> buildDataValueDeclarationAdapter() { - return ConversionDeclarationAnnotationElementAdapter.forStrings(this.daa, EclipseLink.CONVERSION_VALUE__DATA_VALUE); - } - - private AnnotationElementAdapter<String> buildDataValueAdapter() { - return this.buildStringElementAdapter(this.dataValueDeclarationAdapter); - } - - // ***** object value - public String getObjectValue() { - return this.objectValue; - } - - public void setObjectValue(String objectValue) { - if (this.attributeValueHasChanged(this.objectValue, objectValue)) { - this.objectValue = objectValue; - this.objectValueAdapter.setValue(objectValue); - } - } - - private void syncObjectValue(String astObjectValue) { - String old = this.objectValue; - this.objectValue = astObjectValue; - this.firePropertyChanged(OBJECT_VALUE_PROPERTY, old, astObjectValue); - } - - private String buildObjectValue(CompilationUnit astRoot) { - return this.objectValueAdapter.getValue(astRoot); - } - - public TextRange getObjectValueTextRange() { - return this.objectValueTextRange; - } - - private TextRange buildObjectValueTextRange(CompilationUnit astRoot) { - return this.getElementTextRange(this.objectValueDeclarationAdapter, astRoot); - } - - private DeclarationAnnotationElementAdapter<String> buildObjectValueDeclarationAdapter() { - return ConversionDeclarationAnnotationElementAdapter.forStrings(this.daa, EclipseLink.CONVERSION_VALUE__OBJECT_VALUE); - } - - private AnnotationElementAdapter<String> buildObjectValueAdapter() { - return this.buildStringElementAdapter(this.objectValueDeclarationAdapter); - } - - - // ********** misc ********** - - @Override - public boolean isUnset() { - return super.isUnset() && - (this.dataValue == null) && - (this.objectValue == null); - } - - @Override - public void toString(StringBuilder sb) { - sb.append(this.dataValue); - sb.append("=>"); //$NON-NLS-1$ - sb.append(this.objectValue); - } -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/resource/java/source/SourceEclipseLinkConvertAnnotation.java b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/resource/java/source/SourceEclipseLinkConvertAnnotation.java deleted file mode 100644 index 9334e2dc0a..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/resource/java/source/SourceEclipseLinkConvertAnnotation.java +++ /dev/null @@ -1,41 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2008, 2012 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.eclipselink.core.internal.resource.java.source; - -import org.eclipse.jpt.common.core.internal.utility.jdt.SimpleDeclarationAnnotationAdapter; -import org.eclipse.jpt.common.core.resource.java.JavaResourceAnnotatedElement; -import org.eclipse.jpt.common.core.utility.jdt.AnnotatedElement; -import org.eclipse.jpt.common.core.utility.jdt.DeclarationAnnotationAdapter; -import org.eclipse.jpt.jpa.eclipselink.core.resource.java.EclipseLink; -import org.eclipse.jpt.jpa.eclipselink.core.resource.java.EclipseLinkConvertAnnotation; - -/** - * <code>org.eclipse.persistence.annotations.Convert</code> - */ -public final class SourceEclipseLinkConvertAnnotation - extends SourceEclipseLinkBaseConvertAnnotation - implements EclipseLinkConvertAnnotation -{ - private static final DeclarationAnnotationAdapter DECLARATION_ANNOTATION_ADAPTER = new SimpleDeclarationAnnotationAdapter(ANNOTATION_NAME); - - - public SourceEclipseLinkConvertAnnotation(JavaResourceAnnotatedElement parent, AnnotatedElement element) { - super(parent, element, DECLARATION_ANNOTATION_ADAPTER); - } - - public String getAnnotationName() { - return ANNOTATION_NAME; - } - - @Override - protected String getValueElementName() { - return EclipseLink.CONVERT__VALUE; - } -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/resource/java/source/SourceEclipseLinkConverterAnnotation.java b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/resource/java/source/SourceEclipseLinkConverterAnnotation.java deleted file mode 100644 index 5a9271d96c..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/resource/java/source/SourceEclipseLinkConverterAnnotation.java +++ /dev/null @@ -1,192 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2008, 2012 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.eclipselink.core.internal.resource.java.source; - -import org.eclipse.jdt.core.dom.CompilationUnit; -import org.eclipse.jpt.common.core.internal.utility.jdt.ASTTools; -import org.eclipse.jpt.common.core.internal.utility.jdt.CombinationIndexedDeclarationAnnotationAdapter; -import org.eclipse.jpt.common.core.internal.utility.jdt.ConversionDeclarationAnnotationElementAdapter; -import org.eclipse.jpt.common.core.internal.utility.jdt.ElementIndexedAnnotationAdapter; -import org.eclipse.jpt.common.core.internal.utility.jdt.SimpleDeclarationAnnotationAdapter; -import org.eclipse.jpt.common.core.internal.utility.jdt.SimpleTypeStringExpressionConverter; -import org.eclipse.jpt.common.core.resource.java.JavaResourceAnnotatedElement; -import org.eclipse.jpt.common.core.utility.TextRange; -import org.eclipse.jpt.common.core.utility.jdt.AnnotatedElement; -import org.eclipse.jpt.common.core.utility.jdt.AnnotationElementAdapter; -import org.eclipse.jpt.common.core.utility.jdt.DeclarationAnnotationAdapter; -import org.eclipse.jpt.common.core.utility.jdt.DeclarationAnnotationElementAdapter; -import org.eclipse.jpt.common.core.utility.jdt.IndexedAnnotationAdapter; -import org.eclipse.jpt.common.core.utility.jdt.IndexedDeclarationAnnotationAdapter; -import org.eclipse.jpt.jpa.eclipselink.core.resource.java.EclipseLink; -import org.eclipse.jpt.jpa.eclipselink.core.resource.java.EclipseLinkConverterAnnotation; - -/** - * <code>org.eclipse.persistence.annotations.Converter</code> - */ -public final class SourceEclipseLinkConverterAnnotation - extends SourceEclipseLinkNamedConverterAnnotation - implements EclipseLinkConverterAnnotation -{ - private static final DeclarationAnnotationAdapter DECLARATION_ANNOTATION_ADAPTER = new SimpleDeclarationAnnotationAdapter(ANNOTATION_NAME); - private static final DeclarationAnnotationAdapter CONTAINER_DECLARATION_ANNOTATION_ADAPTER = new SimpleDeclarationAnnotationAdapter(EclipseLink.CONVERTERS); - - private final DeclarationAnnotationElementAdapter<String> converterClassDeclarationAdapter; - private final AnnotationElementAdapter<String> converterClassAdapter; - private String converterClass; - private TextRange converterClassTextRange; - - /** - * @see org.eclipse.jpt.jpa.core.internal.resource.java.source.SourceIdClassAnnotation#fullyQualifiedClassName - */ - private String fullyQualifiedConverterClassName; - // we need a flag since the f-q name can be null - private boolean fqConverterClassNameStale = true; - - - public static SourceEclipseLinkConverterAnnotation buildSourceConverterAnnotation(JavaResourceAnnotatedElement parent, AnnotatedElement element, int index) { - IndexedDeclarationAnnotationAdapter idaa = buildConverterDeclarationAnnotationAdapter(index); - IndexedAnnotationAdapter iaa = buildConverterAnnotationAdapter(element, idaa); - return new SourceEclipseLinkConverterAnnotation( - parent, - element, - idaa, - iaa); - } - - public SourceEclipseLinkConverterAnnotation( - JavaResourceAnnotatedElement parent, - AnnotatedElement element, - IndexedDeclarationAnnotationAdapter daa, - IndexedAnnotationAdapter annotationAdapter) { - super(parent, element, daa, annotationAdapter); - this.converterClassDeclarationAdapter = this.buildConverterDeclarationClassAdapter(); - this.converterClassAdapter = this.buildConverterClassAdapter(); - } - - public String getAnnotationName() { - return ANNOTATION_NAME; - } - - @Override - public void initialize(CompilationUnit astRoot) { - super.initialize(astRoot); - this.converterClass = this.buildConverterClass(astRoot); - this.converterClassTextRange = this.buildConverterClassTextRange(astRoot); - } - - @Override - public void synchronizeWith(CompilationUnit astRoot) { - super.synchronizeWith(astRoot); - this.syncConverterClass(this.buildConverterClass(astRoot)); - this.converterClassTextRange = this.buildConverterClassTextRange(astRoot); - } - - @Override - public boolean isUnset() { - return super.isUnset() && - (this.converterClass == null); - } - - - // ********** SourceNamedConverterAnnotation implementation ********** - - @Override - String getNameElementName() { - return EclipseLink.CONVERTER__NAME; - } - - - // ********** ConverterAnnotation implementation ********** - - // ***** converter class - public String getConverterClass() { - return this.converterClass; - } - - public void setConverterClass(String converterClass) { - if (this.attributeValueHasChanged(this.converterClass, converterClass)) { - this.converterClass = converterClass; - this.fqConverterClassNameStale = true; - this.converterClassAdapter.setValue(converterClass); - } - } - - private void syncConverterClass(String astConverterClass) { - if (this.attributeValueHasChanged(this.converterClass, astConverterClass)) { - this.syncConverterClass_(astConverterClass); - } - } - - private void syncConverterClass_(String astConverterClass) { - String old = this.converterClass; - this.converterClass = astConverterClass; - this.fqConverterClassNameStale = true; - this.firePropertyChanged(CONVERTER_CLASS_PROPERTY, old, astConverterClass); - } - - private String buildConverterClass(CompilationUnit astRoot) { - return this.converterClassAdapter.getValue(astRoot); - } - - public TextRange getConverterClassTextRange() { - return this.converterClassTextRange; - } - - private TextRange buildConverterClassTextRange(CompilationUnit astRoot) { - return this.getElementTextRange(this.converterClassDeclarationAdapter, astRoot); - } - - private DeclarationAnnotationElementAdapter<String> buildConverterDeclarationClassAdapter() { - return new ConversionDeclarationAnnotationElementAdapter<String>(this.daa, EclipseLink.CONVERTER__CONVERTER_CLASS, SimpleTypeStringExpressionConverter.instance()); - } - - private AnnotationElementAdapter<String> buildConverterClassAdapter() { - return this.buildStringElementAdapter(this.converterClassDeclarationAdapter); - } - - public boolean converterClassImplementsInterface(String interfaceName, CompilationUnit astRoot) { - return (this.converterClass != null) - && ASTTools.typeImplementsInterface(this.converterClassAdapter.getExpression(astRoot), interfaceName); - } - - // ***** fully-qualified converter class name - public String getFullyQualifiedConverterClassName() { - if (this.fqConverterClassNameStale) { - this.fullyQualifiedConverterClassName = this.buildFullyQualifiedConverterClassName(); - this.fqConverterClassNameStale = false; - } - return this.fullyQualifiedConverterClassName; - } - - private String buildFullyQualifiedConverterClassName() { - return (this.converterClass == null) ? null : this.buildFullyQualifiedConverterClassName_(); - } - - private String buildFullyQualifiedConverterClassName_() { - return ASTTools.resolveFullyQualifiedName(this.converterClassAdapter.getExpression(this.buildASTRoot())); - } - - - // ********** static methods ********** - - private static IndexedAnnotationAdapter buildConverterAnnotationAdapter(AnnotatedElement annotatedElement, IndexedDeclarationAnnotationAdapter idaa) { - return new ElementIndexedAnnotationAdapter(annotatedElement, idaa); - } - - private static IndexedDeclarationAnnotationAdapter buildConverterDeclarationAnnotationAdapter(int index) { - IndexedDeclarationAnnotationAdapter idaa = - new CombinationIndexedDeclarationAnnotationAdapter( - DECLARATION_ANNOTATION_ADAPTER, - CONTAINER_DECLARATION_ANNOTATION_ADAPTER, - index, - ANNOTATION_NAME); - return idaa; - } -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/resource/java/source/SourceEclipseLinkCustomizerAnnotation.java b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/resource/java/source/SourceEclipseLinkCustomizerAnnotation.java deleted file mode 100644 index 5ed3d70cd7..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/resource/java/source/SourceEclipseLinkCustomizerAnnotation.java +++ /dev/null @@ -1,151 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2008, 2012 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.eclipselink.core.internal.resource.java.source; - -import org.eclipse.jdt.core.dom.CompilationUnit; -import org.eclipse.jpt.common.core.internal.resource.java.source.SourceAnnotation; -import org.eclipse.jpt.common.core.internal.utility.jdt.ASTTools; -import org.eclipse.jpt.common.core.internal.utility.jdt.AnnotatedElementAnnotationElementAdapter; -import org.eclipse.jpt.common.core.internal.utility.jdt.ConversionDeclarationAnnotationElementAdapter; -import org.eclipse.jpt.common.core.internal.utility.jdt.SimpleDeclarationAnnotationAdapter; -import org.eclipse.jpt.common.core.internal.utility.jdt.SimpleTypeStringExpressionConverter; -import org.eclipse.jpt.common.core.resource.java.JavaResourceAnnotatedElement; -import org.eclipse.jpt.common.core.utility.TextRange; -import org.eclipse.jpt.common.core.utility.jdt.AnnotatedElement; -import org.eclipse.jpt.common.core.utility.jdt.AnnotationElementAdapter; -import org.eclipse.jpt.common.core.utility.jdt.DeclarationAnnotationAdapter; -import org.eclipse.jpt.common.core.utility.jdt.DeclarationAnnotationElementAdapter; -import org.eclipse.jpt.jpa.eclipselink.core.resource.java.EclipseLink; -import org.eclipse.jpt.jpa.eclipselink.core.resource.java.EclipseLinkCustomizerAnnotation; - -/** - * <code>org.eclipse.persistence.annotations.Customizer</code> - */ -public final class SourceEclipseLinkCustomizerAnnotation - extends SourceAnnotation - implements EclipseLinkCustomizerAnnotation -{ - private static final DeclarationAnnotationAdapter DECLARATION_ANNOTATION_ADAPTER = new SimpleDeclarationAnnotationAdapter(ANNOTATION_NAME); - - private static final DeclarationAnnotationElementAdapter<String> VALUE_ADAPTER = buildValueAdapter(); - private final AnnotationElementAdapter<String> valueAdapter; - private String value; - private TextRange valueTextRange; - - /** - * @see org.eclipse.jpt.jpa.core.internal.resource.java.source.SourceIdClassAnnotation#fullyQualifiedClassName - */ - private String fullyQualifiedCustomizerClassName; - // we need a flag since the f-q name can be null - private boolean fqCustomizerClassNameStale = true; - - - public SourceEclipseLinkCustomizerAnnotation(JavaResourceAnnotatedElement parent, AnnotatedElement element) { - super(parent, element, DECLARATION_ANNOTATION_ADAPTER); - this.valueAdapter = new AnnotatedElementAnnotationElementAdapter<String>(element, VALUE_ADAPTER); - } - - public String getAnnotationName() { - return ANNOTATION_NAME; - } - - public void initialize(CompilationUnit astRoot) { - this.value = this.buildValue(astRoot); - this.valueTextRange = this.buildValueTextRange(astRoot); - } - - public void synchronizeWith(CompilationUnit astRoot) { - this.syncValue(this.buildValue(astRoot)); - this.valueTextRange = this.buildValueTextRange(astRoot); - } - - @Override - public boolean isUnset() { - return super.isUnset() && - (this.value == null); - } - - @Override - public void toString(StringBuilder sb) { - sb.append(this.value); - } - - - // ********** CustomizerAnnotation implementation ********** - - // ***** value - public String getValue() { - return this.value; - } - - public void setValue(String value) { - if (this.attributeValueHasChanged(this.value, value)) { - this.value = value; - this.fqCustomizerClassNameStale = true; - this.valueAdapter.setValue(value); - } - } - - private void syncValue(String astValue) { - if (this.attributeValueHasChanged(this.value, astValue)) { - this.syncValue_(astValue); - } - } - - private void syncValue_(String astValue) { - String old = this.value; - this.value = astValue; - this.fqCustomizerClassNameStale = true; - this.firePropertyChanged(VALUE_PROPERTY, old, astValue); - } - - private String buildValue(CompilationUnit astRoot) { - return this.valueAdapter.getValue(astRoot); - } - - public TextRange getValueTextRange() { - return this.valueTextRange; - } - - private TextRange buildValueTextRange(CompilationUnit astRoot) { - return this.getElementTextRange(VALUE_ADAPTER, astRoot); - } - - public boolean customizerClassImplementsInterface(String interfaceName, CompilationUnit astRoot) { - return (this.value != null) - && ASTTools.typeIsSubTypeOf(this.valueAdapter.getExpression(astRoot), interfaceName); - } - - - // ***** fully-qualified customizer class name - public String getFullyQualifiedCustomizerClassName() { - if (this.fqCustomizerClassNameStale) { - this.fullyQualifiedCustomizerClassName = this.buildFullyQualifiedCustomizerClassName(); - this.fqCustomizerClassNameStale = false; - } - return this.fullyQualifiedCustomizerClassName; - } - - private String buildFullyQualifiedCustomizerClassName() { - return (this.value == null) ? null : this.buildFullyQualifiedCustomizerClassName_(); - } - - private String buildFullyQualifiedCustomizerClassName_() { - return ASTTools.resolveFullyQualifiedName(this.valueAdapter.getExpression(this.buildASTRoot())); - } - - - // ********** static methods ********** - - private static DeclarationAnnotationElementAdapter<String> buildValueAdapter() { - return new ConversionDeclarationAnnotationElementAdapter<String>(DECLARATION_ANNOTATION_ADAPTER, EclipseLink.CUSTOMIZER__VALUE, SimpleTypeStringExpressionConverter.instance()); - } - -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/resource/java/source/SourceEclipseLinkExistenceCheckingAnnotation.java b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/resource/java/source/SourceEclipseLinkExistenceCheckingAnnotation.java deleted file mode 100644 index ce4017a341..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/resource/java/source/SourceEclipseLinkExistenceCheckingAnnotation.java +++ /dev/null @@ -1,112 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2008, 2012 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.eclipselink.core.internal.resource.java.source; - -import org.eclipse.jdt.core.dom.CompilationUnit; -import org.eclipse.jpt.common.core.internal.resource.java.source.SourceAnnotation; -import org.eclipse.jpt.common.core.internal.utility.jdt.AnnotatedElementAnnotationElementAdapter; -import org.eclipse.jpt.common.core.internal.utility.jdt.EnumDeclarationAnnotationElementAdapter; -import org.eclipse.jpt.common.core.internal.utility.jdt.SimpleDeclarationAnnotationAdapter; -import org.eclipse.jpt.common.core.resource.java.JavaResourceAnnotatedElement; -import org.eclipse.jpt.common.core.utility.TextRange; -import org.eclipse.jpt.common.core.utility.jdt.AnnotatedElement; -import org.eclipse.jpt.common.core.utility.jdt.AnnotationElementAdapter; -import org.eclipse.jpt.common.core.utility.jdt.DeclarationAnnotationAdapter; -import org.eclipse.jpt.common.core.utility.jdt.DeclarationAnnotationElementAdapter; -import org.eclipse.jpt.jpa.eclipselink.core.resource.java.EclipseLink; -import org.eclipse.jpt.jpa.eclipselink.core.resource.java.EclipseLinkExistenceCheckingAnnotation; -import org.eclipse.jpt.jpa.eclipselink.core.resource.java.ExistenceType; - -/** - * <code>org.eclipse.persistence.annotations.ExistenceChecking</code> - */ -public final class SourceEclipseLinkExistenceCheckingAnnotation - extends SourceAnnotation - implements EclipseLinkExistenceCheckingAnnotation -{ - private static final DeclarationAnnotationAdapter DECLARATION_ANNOTATION_ADAPTER = new SimpleDeclarationAnnotationAdapter(ANNOTATION_NAME); - - private static final DeclarationAnnotationElementAdapter<String> VALUE_ADAPTER = buildValueAdapter(); - private final AnnotationElementAdapter<String> valueAdapter; - private ExistenceType value; - private TextRange valueTextRange; - - - public SourceEclipseLinkExistenceCheckingAnnotation(JavaResourceAnnotatedElement parent, AnnotatedElement element) { - super(parent, element, DECLARATION_ANNOTATION_ADAPTER); - this.valueAdapter = new AnnotatedElementAnnotationElementAdapter<String>(element, VALUE_ADAPTER); - } - - public String getAnnotationName() { - return ANNOTATION_NAME; - } - - public void initialize(CompilationUnit astRoot) { - this.value = this.buildValue(astRoot); - this.valueTextRange = this.buildValueTextRange(astRoot); - } - - public void synchronizeWith(CompilationUnit astRoot) { - this.syncValue(this.buildValue(astRoot)); - this.valueTextRange = this.buildValueTextRange(astRoot); - } - - @Override - public boolean isUnset() { - return super.isUnset() && - (this.value == null); - } - - @Override - public void toString(StringBuilder sb) { - sb.append(this.value); - } - - - // ********** ExistenceCheckingAnnotation implementation ********** - - // ***** value - public ExistenceType getValue() { - return this.value; - } - - public void setValue(ExistenceType value) { - if (this.attributeValueHasChanged(this.value, value)) { - this.value = value; - this.valueAdapter.setValue(ExistenceType.toJavaAnnotationValue(value)); - } - } - - private void syncValue(ExistenceType astValue) { - ExistenceType old = this.value; - this.value = astValue; - this.firePropertyChanged(VALUE_PROPERTY, old, astValue); - } - - private ExistenceType buildValue(CompilationUnit astRoot) { - return ExistenceType.fromJavaAnnotationValue(this.valueAdapter.getValue(astRoot)); - } - - public TextRange getValueTextRange() { - return this.valueTextRange; - } - - private TextRange buildValueTextRange(CompilationUnit astRoot) { - return this.getElementTextRange(VALUE_ADAPTER, astRoot); - } - - - // ********** static methods ********** - - private static DeclarationAnnotationElementAdapter<String> buildValueAdapter() { - return new EnumDeclarationAnnotationElementAdapter(DECLARATION_ANNOTATION_ADAPTER, EclipseLink.EXISTENCE_CHECKING__VALUE); - } - -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/resource/java/source/SourceEclipseLinkJoinFetchAnnotation.java b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/resource/java/source/SourceEclipseLinkJoinFetchAnnotation.java deleted file mode 100644 index 1302924aac..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/resource/java/source/SourceEclipseLinkJoinFetchAnnotation.java +++ /dev/null @@ -1,112 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2008, 2012 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.eclipselink.core.internal.resource.java.source; - -import org.eclipse.jdt.core.dom.CompilationUnit; -import org.eclipse.jpt.common.core.internal.resource.java.source.SourceAnnotation; -import org.eclipse.jpt.common.core.internal.utility.jdt.AnnotatedElementAnnotationElementAdapter; -import org.eclipse.jpt.common.core.internal.utility.jdt.EnumDeclarationAnnotationElementAdapter; -import org.eclipse.jpt.common.core.internal.utility.jdt.SimpleDeclarationAnnotationAdapter; -import org.eclipse.jpt.common.core.resource.java.JavaResourceAnnotatedElement; -import org.eclipse.jpt.common.core.utility.TextRange; -import org.eclipse.jpt.common.core.utility.jdt.AnnotatedElement; -import org.eclipse.jpt.common.core.utility.jdt.AnnotationElementAdapter; -import org.eclipse.jpt.common.core.utility.jdt.DeclarationAnnotationAdapter; -import org.eclipse.jpt.common.core.utility.jdt.DeclarationAnnotationElementAdapter; -import org.eclipse.jpt.jpa.eclipselink.core.resource.java.EclipseLink; -import org.eclipse.jpt.jpa.eclipselink.core.resource.java.EclipseLinkJoinFetchAnnotation; -import org.eclipse.jpt.jpa.eclipselink.core.resource.java.JoinFetchType; - -/** - * <code>org.eclipse.persistence.annotations.JoinFetch</code> - */ -public final class SourceEclipseLinkJoinFetchAnnotation - extends SourceAnnotation - implements EclipseLinkJoinFetchAnnotation -{ - private static final DeclarationAnnotationAdapter DECLARATION_ANNOTATION_ADAPTER = new SimpleDeclarationAnnotationAdapter(ANNOTATION_NAME); - - private static final DeclarationAnnotationElementAdapter<String> VALUE_ADAPTER = buildValueAdapter(); - private final AnnotationElementAdapter<String> valueAdapter; - private JoinFetchType value; - private TextRange valueTextRange; - - - public SourceEclipseLinkJoinFetchAnnotation(JavaResourceAnnotatedElement parent, AnnotatedElement element) { - super(parent, element, DECLARATION_ANNOTATION_ADAPTER); - this.valueAdapter = new AnnotatedElementAnnotationElementAdapter<String>(element, VALUE_ADAPTER); - } - - public String getAnnotationName() { - return ANNOTATION_NAME; - } - - public void initialize(CompilationUnit astRoot) { - this.value = this.buildValue(astRoot); - this.valueTextRange = this.buildValueTextRange(astRoot); - } - - public void synchronizeWith(CompilationUnit astRoot) { - this.syncValue(this.buildValue(astRoot)); - this.valueTextRange = this.buildValueTextRange(astRoot); - } - - @Override - public boolean isUnset() { - return super.isUnset() && - (this.value == null); - } - - @Override - public void toString(StringBuilder sb) { - sb.append(this.value); - } - - - // ********** JoinFetchAnnotation implementation ********** - - // ***** value - public JoinFetchType getValue() { - return this.value; - } - - public void setValue(JoinFetchType value) { - if (this.attributeValueHasChanged(this.value, value)) { - this.value = value; - this.valueAdapter.setValue(JoinFetchType.toJavaAnnotationValue(value)); - } - } - - private void syncValue(JoinFetchType astValue) { - JoinFetchType old = this.value; - this.value = astValue; - this.firePropertyChanged(VALUE_PROPERTY, old, astValue); - } - - private JoinFetchType buildValue(CompilationUnit astRoot) { - return JoinFetchType.fromJavaAnnotationValue(this.valueAdapter.getValue(astRoot)); - } - - public TextRange getValueTextRange() { - return this.valueTextRange; - } - - private TextRange buildValueTextRange(CompilationUnit astRoot) { - return this.getElementTextRange(VALUE_ADAPTER, astRoot); - } - - - // ********** static methods ********** - - private static DeclarationAnnotationElementAdapter<String> buildValueAdapter() { - return new EnumDeclarationAnnotationElementAdapter(DECLARATION_ANNOTATION_ADAPTER, EclipseLink.JOIN_FETCH__VALUE); - } - -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/resource/java/source/SourceEclipseLinkMapKeyConvertAnnotation2_0.java b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/resource/java/source/SourceEclipseLinkMapKeyConvertAnnotation2_0.java deleted file mode 100644 index bc217e5e2b..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/resource/java/source/SourceEclipseLinkMapKeyConvertAnnotation2_0.java +++ /dev/null @@ -1,41 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2011, 2012 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.eclipselink.core.internal.resource.java.source; - -import org.eclipse.jpt.common.core.internal.utility.jdt.SimpleDeclarationAnnotationAdapter; -import org.eclipse.jpt.common.core.resource.java.JavaResourceAnnotatedElement; -import org.eclipse.jpt.common.core.utility.jdt.AnnotatedElement; -import org.eclipse.jpt.common.core.utility.jdt.DeclarationAnnotationAdapter; -import org.eclipse.jpt.jpa.eclipselink.core.resource.java.EclipseLink; -import org.eclipse.jpt.jpa.eclipselink.core.resource.java.EclipseLinkMapKeyConvertAnnotation2_0; - -/** - * <code>org.eclipse.persistence.annotations.MapKeyConvert</code> - */ -public final class SourceEclipseLinkMapKeyConvertAnnotation2_0 - extends SourceEclipseLinkBaseConvertAnnotation - implements EclipseLinkMapKeyConvertAnnotation2_0 -{ - private static final DeclarationAnnotationAdapter DECLARATION_ANNOTATION_ADAPTER = new SimpleDeclarationAnnotationAdapter(EclipseLinkMapKeyConvertAnnotation2_0.ANNOTATION_NAME); - - - public SourceEclipseLinkMapKeyConvertAnnotation2_0(JavaResourceAnnotatedElement parent, AnnotatedElement element) { - super(parent, element, DECLARATION_ANNOTATION_ADAPTER); - } - - public String getAnnotationName() { - return EclipseLinkMapKeyConvertAnnotation2_0.ANNOTATION_NAME; - } - - @Override - protected String getValueElementName() { - return EclipseLink.MAP_KEY_CONVERT__VALUE; - } -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/resource/java/source/SourceEclipseLinkMultitenantAnnotation2_3.java b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/resource/java/source/SourceEclipseLinkMultitenantAnnotation2_3.java deleted file mode 100644 index f3a94f289f..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/resource/java/source/SourceEclipseLinkMultitenantAnnotation2_3.java +++ /dev/null @@ -1,150 +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 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.eclipselink.core.internal.resource.java.source; - -import org.eclipse.jdt.core.dom.CompilationUnit; -import org.eclipse.jpt.common.core.internal.resource.java.source.SourceAnnotation; -import org.eclipse.jpt.common.core.internal.utility.jdt.AnnotatedElementAnnotationElementAdapter; -import org.eclipse.jpt.common.core.internal.utility.jdt.BooleanExpressionConverter; -import org.eclipse.jpt.common.core.internal.utility.jdt.ConversionDeclarationAnnotationElementAdapter; -import org.eclipse.jpt.common.core.internal.utility.jdt.EnumDeclarationAnnotationElementAdapter; -import org.eclipse.jpt.common.core.internal.utility.jdt.SimpleDeclarationAnnotationAdapter; -import org.eclipse.jpt.common.core.resource.java.JavaResourceAnnotatedElement; -import org.eclipse.jpt.common.core.utility.TextRange; -import org.eclipse.jpt.common.core.utility.jdt.AnnotatedElement; -import org.eclipse.jpt.common.core.utility.jdt.AnnotationElementAdapter; -import org.eclipse.jpt.common.core.utility.jdt.DeclarationAnnotationAdapter; -import org.eclipse.jpt.common.core.utility.jdt.DeclarationAnnotationElementAdapter; -import org.eclipse.jpt.jpa.eclipselink.core.resource.java.EclipseLink; -import org.eclipse.jpt.jpa.eclipselink.core.resource.java.EclipseLinkMultitenantAnnotation2_3; -import org.eclipse.jpt.jpa.eclipselink.core.resource.java.MultitenantType2_3; - -/** - * org.eclipse.persistence.annotations.Multitenant - */ -public class SourceEclipseLinkMultitenantAnnotation2_3 - extends SourceAnnotation - implements EclipseLinkMultitenantAnnotation2_3 -{ - private static final DeclarationAnnotationAdapter DECLARATION_ANNOTATION_ADAPTER - = new SimpleDeclarationAnnotationAdapter(ANNOTATION_NAME); - - private static final DeclarationAnnotationElementAdapter<String> VALUE_ADAPTER = buildValueAdapter(); - private final AnnotationElementAdapter<String> valueAdapter; - private MultitenantType2_3 value; - - private static final DeclarationAnnotationElementAdapter<Boolean> INCLUDE_CRITERIA_ADAPTER = buildIncludeCriteriaAdapter(); - private final AnnotationElementAdapter<Boolean> includeCriteriaAdapter; - private Boolean includeCriteria; - - public SourceEclipseLinkMultitenantAnnotation2_3(JavaResourceAnnotatedElement parent, AnnotatedElement element) { - super(parent, element, DECLARATION_ANNOTATION_ADAPTER); - this.valueAdapter = new AnnotatedElementAnnotationElementAdapter<String>(element, VALUE_ADAPTER); - this.includeCriteriaAdapter = new AnnotatedElementAnnotationElementAdapter<Boolean>(element, INCLUDE_CRITERIA_ADAPTER); - } - - - public String getAnnotationName() { - return ANNOTATION_NAME; - } - - public void initialize(CompilationUnit astRoot) { - this.value = this.buildValue(astRoot); - this.includeCriteria = this.buildIncludeCriteria(astRoot); - } - - public void synchronizeWith(CompilationUnit astRoot) { - this.syncValue(this.buildValue(astRoot)); - this.syncIncludeCriteria(this.buildIncludeCriteria(astRoot)); - } - - @Override - public boolean isUnset() { - return super.isUnset() && - (this.value == null) && - (this.includeCriteria == null); - } - - @Override - public void toString(StringBuilder sb) { - sb.append(this.value); - } - - // ********** EclipseLinkMultitenantAnnotation implementation ********** - - public boolean isSpecified() { - return true; - } - - // ***** value - public MultitenantType2_3 getValue() { - return this.value; - } - - public void setValue(MultitenantType2_3 value) { - if (this.attributeValueHasChanged(this.value, value)) { - this.value = value; - this.valueAdapter.setValue(MultitenantType2_3.toJavaAnnotationValue(value)); - } - } - - private void syncValue(MultitenantType2_3 astValue) { - MultitenantType2_3 old = this.value; - this.value = astValue; - this.firePropertyChanged(VALUE_PROPERTY, old, astValue); - } - - private MultitenantType2_3 buildValue(CompilationUnit astRoot) { - return MultitenantType2_3.fromJavaAnnotationValue(this.valueAdapter.getValue(astRoot)); - } - - public TextRange getValueTextRange(CompilationUnit astRoot) { - return this.getElementTextRange(VALUE_ADAPTER, astRoot); - } - - // ***** include criteria - public Boolean getIncludeCriteria() { - return this.includeCriteria; - } - - public void setIncludeCriteria(Boolean includeCriteria) { - if (this.attributeValueHasChanged(this.includeCriteria, includeCriteria)) { - this.includeCriteria = includeCriteria; - this.includeCriteriaAdapter.setValue(includeCriteria); - } - } - - private void syncIncludeCriteria(Boolean astIncludeCriteria) { - Boolean old = this.includeCriteria; - this.includeCriteria = astIncludeCriteria; - this.firePropertyChanged(INCLUDE_CRITERIA_PROPERTY, old, astIncludeCriteria); - } - - private Boolean buildIncludeCriteria(CompilationUnit astRoot) { - return this.includeCriteriaAdapter.getValue(astRoot); - } - - public TextRange getIncludeCriteriaTextRange(CompilationUnit astRoot) { - return this.getElementTextRange(INCLUDE_CRITERIA_ADAPTER, astRoot); - } - - - // ********** static methods ********** - - private static DeclarationAnnotationElementAdapter<String> buildValueAdapter() { - return new EnumDeclarationAnnotationElementAdapter(DECLARATION_ANNOTATION_ADAPTER, EclipseLink.MULTITENANT__VALUE); - } - - private static DeclarationAnnotationElementAdapter<Boolean> buildIncludeCriteriaAdapter() { - return new ConversionDeclarationAnnotationElementAdapter<Boolean>(DECLARATION_ANNOTATION_ADAPTER, EclipseLink.MULTITENANT__INCLUDE_CRITERIA, BooleanExpressionConverter.instance()); - } - -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/resource/java/source/SourceEclipseLinkMutableAnnotation.java b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/resource/java/source/SourceEclipseLinkMutableAnnotation.java deleted file mode 100644 index e3337c620b..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/resource/java/source/SourceEclipseLinkMutableAnnotation.java +++ /dev/null @@ -1,112 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2008, 2012 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.eclipselink.core.internal.resource.java.source; - -import org.eclipse.jdt.core.dom.CompilationUnit; -import org.eclipse.jpt.common.core.internal.resource.java.source.SourceAnnotation; -import org.eclipse.jpt.common.core.internal.utility.jdt.AnnotatedElementAnnotationElementAdapter; -import org.eclipse.jpt.common.core.internal.utility.jdt.BooleanExpressionConverter; -import org.eclipse.jpt.common.core.internal.utility.jdt.ConversionDeclarationAnnotationElementAdapter; -import org.eclipse.jpt.common.core.internal.utility.jdt.SimpleDeclarationAnnotationAdapter; -import org.eclipse.jpt.common.core.resource.java.JavaResourceAnnotatedElement; -import org.eclipse.jpt.common.core.utility.TextRange; -import org.eclipse.jpt.common.core.utility.jdt.AnnotatedElement; -import org.eclipse.jpt.common.core.utility.jdt.AnnotationElementAdapter; -import org.eclipse.jpt.common.core.utility.jdt.DeclarationAnnotationAdapter; -import org.eclipse.jpt.common.core.utility.jdt.DeclarationAnnotationElementAdapter; -import org.eclipse.jpt.jpa.eclipselink.core.resource.java.EclipseLink; -import org.eclipse.jpt.jpa.eclipselink.core.resource.java.EclipseLinkMutableAnnotation; - -/** - * <code>org.eclipse.persistence.annotations.Mutable</code> - */ -public final class SourceEclipseLinkMutableAnnotation - extends SourceAnnotation - implements EclipseLinkMutableAnnotation -{ - private static final DeclarationAnnotationAdapter DECLARATION_ANNOTATION_ADAPTER = new SimpleDeclarationAnnotationAdapter(ANNOTATION_NAME); - - private static final DeclarationAnnotationElementAdapter<Boolean> VALUE_ADAPTER = buildValueAdapter(); - private final AnnotationElementAdapter<Boolean> valueAdapter; - private Boolean value; - private TextRange valueTextRange; - - - public SourceEclipseLinkMutableAnnotation(JavaResourceAnnotatedElement parent, AnnotatedElement element) { - super(parent, element, DECLARATION_ANNOTATION_ADAPTER); - this.valueAdapter = new AnnotatedElementAnnotationElementAdapter<Boolean>(element, VALUE_ADAPTER); - } - - public String getAnnotationName() { - return ANNOTATION_NAME; - } - - public void initialize(CompilationUnit astRoot) { - this.value = this.buildValue(astRoot); - this.valueTextRange = this.buildValueTextRange(astRoot); - } - - public void synchronizeWith(CompilationUnit astRoot) { - this.syncValue(this.buildValue(astRoot)); - this.valueTextRange = this.buildValueTextRange(astRoot); - } - - @Override - public boolean isUnset() { - return super.isUnset() && - (this.value == null); - } - - @Override - public void toString(StringBuilder sb) { - sb.append(this.value); - } - - - // ********** MutableAnnotation implementation ********** - - // ***** value - public Boolean getValue() { - return this.value; - } - - public void setValue(Boolean value) { - if (this.attributeValueHasChanged(this.value, value)) { - this.value = value; - this.valueAdapter.setValue(value); - } - } - - private void syncValue(Boolean astValue) { - Boolean old = this.value; - this.value = astValue; - this.firePropertyChanged(VALUE_PROPERTY, old, astValue); - } - - private Boolean buildValue(CompilationUnit astRoot) { - return this.valueAdapter.getValue(astRoot); - } - - public TextRange getValueTextRange() { - return this.valueTextRange; - } - - private TextRange buildValueTextRange(CompilationUnit astRoot) { - return this.getElementTextRange(VALUE_ADAPTER, astRoot); - } - - - // ********** static methods ********** - - private static DeclarationAnnotationElementAdapter<Boolean> buildValueAdapter() { - return new ConversionDeclarationAnnotationElementAdapter<Boolean>(DECLARATION_ANNOTATION_ADAPTER, EclipseLink.MUTABLE__VALUE, BooleanExpressionConverter.instance()); - } - -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/resource/java/source/SourceEclipseLinkNamedConverterAnnotation.java b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/resource/java/source/SourceEclipseLinkNamedConverterAnnotation.java deleted file mode 100644 index 0da397ff44..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/resource/java/source/SourceEclipseLinkNamedConverterAnnotation.java +++ /dev/null @@ -1,117 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2009, 2012 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.eclipselink.core.internal.resource.java.source; - -import org.eclipse.jdt.core.dom.CompilationUnit; -import org.eclipse.jpt.common.core.internal.resource.java.source.SourceAnnotation; -import org.eclipse.jpt.common.core.internal.utility.jdt.AnnotatedElementAnnotationElementAdapter; -import org.eclipse.jpt.common.core.internal.utility.jdt.ConversionDeclarationAnnotationElementAdapter; -import org.eclipse.jpt.common.core.resource.java.JavaResourceAnnotatedElement; -import org.eclipse.jpt.common.core.utility.TextRange; -import org.eclipse.jpt.common.core.utility.jdt.AnnotatedElement; -import org.eclipse.jpt.common.core.utility.jdt.AnnotationElementAdapter; -import org.eclipse.jpt.common.core.utility.jdt.DeclarationAnnotationElementAdapter; -import org.eclipse.jpt.common.core.utility.jdt.IndexedAnnotationAdapter; -import org.eclipse.jpt.common.core.utility.jdt.IndexedDeclarationAnnotationAdapter; -import org.eclipse.jpt.jpa.core.resource.java.OverrideAnnotation; -import org.eclipse.jpt.jpa.eclipselink.core.resource.java.EclipseLinkNamedConverterAnnotation; - -/** - * <code> - * <ul> - * <li>org.eclipse.persistence.annotations.Converter - * <li>org.eclipse.persistence.annotations.StructConverter - * <li>org.eclipse.persistence.annotations.TypeConverter - * <li>org.eclipse.persistence.annotations.ObjectTypeConverter - * </ul> - * </code> - */ -abstract class SourceEclipseLinkNamedConverterAnnotation - extends SourceAnnotation - implements EclipseLinkNamedConverterAnnotation -{ - final DeclarationAnnotationElementAdapter<String> nameDeclarationAdapter; - final AnnotationElementAdapter<String> nameAdapter; - String name; - TextRange nameTextRange; - - - // ********** construction/initialization ********** - - SourceEclipseLinkNamedConverterAnnotation( - JavaResourceAnnotatedElement parent, - AnnotatedElement element, - IndexedDeclarationAnnotationAdapter daa, - IndexedAnnotationAdapter annotationAdapter) { - super(parent, element, daa, annotationAdapter); - this.nameDeclarationAdapter = ConversionDeclarationAnnotationElementAdapter.forStrings(daa, this.getNameElementName()); - this.nameAdapter = new AnnotatedElementAnnotationElementAdapter<String>(this.annotatedElement, this.nameDeclarationAdapter); - } - - public void initialize(CompilationUnit astRoot) { - this.name = this.buildName(astRoot); - this.nameTextRange = this.buildNameTextRange(astRoot); - } - - public void synchronizeWith(CompilationUnit astRoot) { - this.syncName(this.buildName(astRoot)); - this.nameTextRange = this.buildNameTextRange(astRoot); - } - - @Override - public boolean isUnset() { - return super.isUnset() && - (this.name == null); - } - - @Override - public void toString(StringBuilder sb) { - sb.append(this.name); - } - - - // ********** NamedConverterAnnotation implementation ********** - - // ***** name - public String getName() { - return this.name; - } - - public void setName(String name) { - if (this.attributeValueHasChanged(this.name, name)) { - this.name = name; - this.nameAdapter.setValue(name); - } - } - - private void syncName(String astName) { - String old = this.name; - this.name = astName; - this.firePropertyChanged(OverrideAnnotation.NAME_PROPERTY, old, astName); - } - - private String buildName(CompilationUnit astRoot) { - return this.nameAdapter.getValue(astRoot); - } - - public TextRange getNameTextRange() { - return this.nameTextRange; - } - - private TextRange buildNameTextRange(CompilationUnit astRoot) { - return this.getElementTextRange(this.nameDeclarationAdapter, astRoot); - } - - public boolean nameTouches(int pos, CompilationUnit astRoot) { - return this.elementTouches(this.nameDeclarationAdapter, pos, astRoot); - } - - abstract String getNameElementName(); -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/resource/java/source/SourceEclipseLinkObjectTypeConverterAnnotation.java b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/resource/java/source/SourceEclipseLinkObjectTypeConverterAnnotation.java deleted file mode 100644 index 08f215b296..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/resource/java/source/SourceEclipseLinkObjectTypeConverterAnnotation.java +++ /dev/null @@ -1,234 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2008, 2012 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.eclipselink.core.internal.resource.java.source; - -import org.eclipse.jdt.core.dom.CompilationUnit; -import org.eclipse.jpt.common.core.internal.utility.jdt.AnnotatedElementAnnotationElementAdapter; -import org.eclipse.jpt.common.core.internal.utility.jdt.CombinationIndexedDeclarationAnnotationAdapter; -import org.eclipse.jpt.common.core.internal.utility.jdt.ConversionDeclarationAnnotationElementAdapter; -import org.eclipse.jpt.common.core.internal.utility.jdt.ElementIndexedAnnotationAdapter; -import org.eclipse.jpt.common.core.internal.utility.jdt.NestedIndexedDeclarationAnnotationAdapter; -import org.eclipse.jpt.common.core.internal.utility.jdt.SimpleDeclarationAnnotationAdapter; -import org.eclipse.jpt.common.core.internal.utility.jdt.StringExpressionConverter; -import org.eclipse.jpt.common.core.resource.java.JavaResourceAnnotatedElement; -import org.eclipse.jpt.common.core.utility.TextRange; -import org.eclipse.jpt.common.core.utility.jdt.AnnotatedElement; -import org.eclipse.jpt.common.core.utility.jdt.AnnotationElementAdapter; -import org.eclipse.jpt.common.core.utility.jdt.DeclarationAnnotationAdapter; -import org.eclipse.jpt.common.core.utility.jdt.DeclarationAnnotationElementAdapter; -import org.eclipse.jpt.common.core.utility.jdt.IndexedAnnotationAdapter; -import org.eclipse.jpt.common.core.utility.jdt.IndexedDeclarationAnnotationAdapter; -import org.eclipse.jpt.common.utility.internal.iterables.ListIterable; -import org.eclipse.jpt.jpa.eclipselink.core.resource.java.EclipseLink; -import org.eclipse.jpt.jpa.eclipselink.core.resource.java.EclipseLinkConversionValueAnnotation; -import org.eclipse.jpt.jpa.eclipselink.core.resource.java.EclipseLinkObjectTypeConverterAnnotation; - -/** - * <code>org.eclipse.persistence.annotations.ObjectTypeConverter</code> - */ -public final class SourceEclipseLinkObjectTypeConverterAnnotation - extends SourceEclipseLinkBaseTypeConverterAnnotation - implements EclipseLinkObjectTypeConverterAnnotation -{ - private static final DeclarationAnnotationAdapter DECLARATION_ANNOTATION_ADAPTER = new SimpleDeclarationAnnotationAdapter(ANNOTATION_NAME); - private static final DeclarationAnnotationAdapter CONTAINER_DECLARATION_ANNOTATION_ADAPTER = new SimpleDeclarationAnnotationAdapter(EclipseLink.OBJECT_TYPE_CONVERTERS); - - private final DeclarationAnnotationElementAdapter<String> defaultObjectValueDeclarationAdapter; - private final AnnotationElementAdapter<String> defaultObjectValueAdapter; - private String defaultObjectValue; - private TextRange defaultObjectValueTextRange; - - private final ConversionValuesAnnotationContainer conversionValuesContainer = new ConversionValuesAnnotationContainer(); - - - public static SourceEclipseLinkObjectTypeConverterAnnotation buildSourceObjectTypeConverterAnnotation(JavaResourceAnnotatedElement parent, AnnotatedElement element, int index) { - IndexedDeclarationAnnotationAdapter idaa = buildObjectTypeConverterDeclarationAnnotationAdapter(index); - IndexedAnnotationAdapter iaa = buildObjectTypeConverterAnnotationAdapter(element, idaa); - return new SourceEclipseLinkObjectTypeConverterAnnotation( - parent, - element, - idaa, - iaa); - } - - private SourceEclipseLinkObjectTypeConverterAnnotation( - JavaResourceAnnotatedElement parent, - AnnotatedElement element, - IndexedDeclarationAnnotationAdapter daa, - IndexedAnnotationAdapter annotationAdapter) { - super(parent, element, daa, annotationAdapter); - this.defaultObjectValueDeclarationAdapter = this.buildDefaultObjectValueAdapter(); - this.defaultObjectValueAdapter = new AnnotatedElementAnnotationElementAdapter<String>(element, this.defaultObjectValueDeclarationAdapter); - } - - public String getAnnotationName() { - return ANNOTATION_NAME; - } - - @Override - public void initialize(CompilationUnit astRoot) { - super.initialize(astRoot); - this.defaultObjectValue = this.buildDefaultObjectValue(astRoot); - this.defaultObjectValueTextRange = this.buildDefaultObjectValueTextRange(astRoot); - this.conversionValuesContainer.initializeFromContainerAnnotation(this.getAstAnnotation(astRoot)); - } - - @Override - public void synchronizeWith(CompilationUnit astRoot) { - super.synchronizeWith(astRoot); - this.syncDefaultObjectValue(this.buildDefaultObjectValue(astRoot)); - this.defaultObjectValueTextRange = this.buildDefaultObjectValueTextRange(astRoot); - this.conversionValuesContainer.synchronize(this.getAstAnnotation(astRoot)); - } - - @Override - public boolean isUnset() { - return super.isUnset() && - (this.defaultObjectValue == null) && - this.conversionValuesContainer.isEmpty(); - } - - - // ********** SourceNamedConverterAnnotation implementation ********** - - @Override - String getNameElementName() { - return EclipseLink.OBJECT_TYPE_CONVERTER__NAME; - } - - - // ********** SourceBaseTypeConverterAnnotation implementation ********** - - @Override - String getDataTypeElementName() { - return EclipseLink.OBJECT_TYPE_CONVERTER__DATA_TYPE; - } - - @Override - String getObjectTypeElementName() { - return EclipseLink.OBJECT_TYPE_CONVERTER__OBJECT_TYPE; - } - - - // ********** ObjectTypeConverterAnnotation implementation ********** - - // ***** default object value - public String getDefaultObjectValue() { - return this.defaultObjectValue; - } - - public void setDefaultObjectValue(String defaultObjectValue) { - if (this.attributeValueHasChanged(this.defaultObjectValue, defaultObjectValue)) { - this.defaultObjectValue = defaultObjectValue; - this.defaultObjectValueAdapter.setValue(defaultObjectValue); - } - } - - private void syncDefaultObjectValue(String astDefaultObjectValue) { - String old = this.defaultObjectValue; - this.defaultObjectValue = astDefaultObjectValue; - this.firePropertyChanged(DEFAULT_OBJECT_VALUE_PROPERTY, old, astDefaultObjectValue); - } - - private String buildDefaultObjectValue(CompilationUnit astRoot) { - return this.defaultObjectValueAdapter.getValue(astRoot); - } - - public TextRange getDefaultObjectValueTextRange() { - return this.defaultObjectValueTextRange; - } - - private TextRange buildDefaultObjectValueTextRange(CompilationUnit astRoot) { - return this.getElementTextRange(this.defaultObjectValueDeclarationAdapter, astRoot); - } - - private DeclarationAnnotationElementAdapter<String> buildDefaultObjectValueAdapter() { - return new ConversionDeclarationAnnotationElementAdapter<String>(this.daa, EclipseLink.OBJECT_TYPE_CONVERTER__DEFAULT_OBJECT_VALUE, StringExpressionConverter.instance()); - } - - // ***** conversion values - - public ListIterable<EclipseLinkConversionValueAnnotation> getConversionValues() { - return this.conversionValuesContainer.getNestedAnnotations(); - } - - public int getConversionValuesSize() { - return this.conversionValuesContainer.getNestedAnnotationsSize(); - } - - public EclipseLinkConversionValueAnnotation conversionValueAt(int index) { - return this.conversionValuesContainer.getNestedAnnotation(index); - } - - public EclipseLinkConversionValueAnnotation addConversionValue(int index) { - return this.conversionValuesContainer.addNestedAnnotation(index); - } - - public void moveConversionValue(int targetIndex, int sourceIndex) { - this.conversionValuesContainer.moveNestedAnnotation(targetIndex, sourceIndex); - } - - public void removeConversionValue(int index) { - this.conversionValuesContainer.removeNestedAnnotation(index); - } - - protected EclipseLinkConversionValueAnnotation buildConversionValue(int index) { - return SourceEclipseLinkConversionValueAnnotation.buildNestedSourceConversionValueAnnotation( - this, this.annotatedElement, this.buildConversionValueIndexedDeclarationAnnotationAdapter(index)); - } - - private IndexedDeclarationAnnotationAdapter buildConversionValueIndexedDeclarationAnnotationAdapter(int index) { - return new NestedIndexedDeclarationAnnotationAdapter( - this.daa, EclipseLink.OBJECT_TYPE_CONVERTER__CONVERSION_VALUES, index, EclipseLink.CONVERSION_VALUE); - } - - - - // ********** static methods ********** - - private static IndexedAnnotationAdapter buildObjectTypeConverterAnnotationAdapter(AnnotatedElement annotatedElement, IndexedDeclarationAnnotationAdapter idaa) { - return new ElementIndexedAnnotationAdapter(annotatedElement, idaa); - } - - private static IndexedDeclarationAnnotationAdapter buildObjectTypeConverterDeclarationAnnotationAdapter(int index) { - IndexedDeclarationAnnotationAdapter idaa = - new CombinationIndexedDeclarationAnnotationAdapter( - DECLARATION_ANNOTATION_ADAPTER, - CONTAINER_DECLARATION_ANNOTATION_ADAPTER, - index, - ANNOTATION_NAME); - return idaa; - } - - // ********** hint container ********** - /** - * adapt the AnnotationContainer interface to the xml schema's xmlns - */ - class ConversionValuesAnnotationContainer - extends AnnotationContainer<EclipseLinkConversionValueAnnotation> - { - @Override - protected String getNestedAnnotationsListName() { - return CONVERSION_VALUES_LIST; - } - @Override - protected String getElementName() { - return EclipseLink.OBJECT_TYPE_CONVERTER__CONVERSION_VALUES; - } - @Override - protected String getNestedAnnotationName() { - return EclipseLinkConversionValueAnnotation.ANNOTATION_NAME; - } - @Override - protected EclipseLinkConversionValueAnnotation buildNestedAnnotation(int index) { - return SourceEclipseLinkObjectTypeConverterAnnotation.this.buildConversionValue(index); - } - } -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/resource/java/source/SourceEclipseLinkPrimaryKeyAnnotation.java b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/resource/java/source/SourceEclipseLinkPrimaryKeyAnnotation.java deleted file mode 100644 index 467ee1e470..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/resource/java/source/SourceEclipseLinkPrimaryKeyAnnotation.java +++ /dev/null @@ -1,48 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010, 2011 Oracle. - * All rights reserved. This program and the accompanying materials are - * made available under the terms of the Eclipse Public License v1.0 which - * accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Oracle - initial API and implementation - *******************************************************************************/ -package org.eclipse.jpt.jpa.eclipselink.core.internal.resource.java.source; - -import org.eclipse.jdt.core.dom.CompilationUnit; -import org.eclipse.jpt.common.core.internal.resource.java.source.SourceAnnotation; -import org.eclipse.jpt.common.core.internal.utility.jdt.SimpleDeclarationAnnotationAdapter; -import org.eclipse.jpt.common.core.resource.java.JavaResourceAnnotatedElement; -import org.eclipse.jpt.common.core.utility.jdt.AnnotatedElement; -import org.eclipse.jpt.common.core.utility.jdt.DeclarationAnnotationAdapter; -import org.eclipse.jpt.jpa.eclipselink.core.resource.java.EclipseLinkPrimaryKeyAnnotation; - -/** - * org.eclipse.persistence.annotations.PrimaryKey - */ -public class SourceEclipseLinkPrimaryKeyAnnotation - extends SourceAnnotation - implements EclipseLinkPrimaryKeyAnnotation -{ - private static final DeclarationAnnotationAdapter DECLARATION_ANNOTATION_ADAPTER - = new SimpleDeclarationAnnotationAdapter(ANNOTATION_NAME); - - - public SourceEclipseLinkPrimaryKeyAnnotation(JavaResourceAnnotatedElement parent, AnnotatedElement element) { - super(parent, element, DECLARATION_ANNOTATION_ADAPTER); - } - - - public String getAnnotationName() { - return ANNOTATION_NAME; - } - - public void initialize(CompilationUnit astRoot) { - // nothing to initialize - } - - public void synchronizeWith(CompilationUnit astRoot) { - // nothing to sync - } -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/resource/java/source/SourceEclipseLinkPrivateOwnedAnnotation.java b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/resource/java/source/SourceEclipseLinkPrivateOwnedAnnotation.java deleted file mode 100644 index da831d609c..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/resource/java/source/SourceEclipseLinkPrivateOwnedAnnotation.java +++ /dev/null @@ -1,46 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2008, 2011 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.eclipselink.core.internal.resource.java.source; - -import org.eclipse.jdt.core.dom.CompilationUnit; -import org.eclipse.jpt.common.core.internal.resource.java.source.SourceAnnotation; -import org.eclipse.jpt.common.core.internal.utility.jdt.SimpleDeclarationAnnotationAdapter; -import org.eclipse.jpt.common.core.resource.java.JavaResourceAnnotatedElement; -import org.eclipse.jpt.common.core.utility.jdt.AnnotatedElement; -import org.eclipse.jpt.common.core.utility.jdt.DeclarationAnnotationAdapter; -import org.eclipse.jpt.jpa.eclipselink.core.resource.java.EclipseLinkPrivateOwnedAnnotation; - -/** - * org.eclipse.persistence.annotations.PrivateOwned - */ -public final class SourceEclipseLinkPrivateOwnedAnnotation - extends SourceAnnotation - implements EclipseLinkPrivateOwnedAnnotation -{ - private static final DeclarationAnnotationAdapter DECLARATION_ANNOTATION_ADAPTER = new SimpleDeclarationAnnotationAdapter(ANNOTATION_NAME); - - - public SourceEclipseLinkPrivateOwnedAnnotation(JavaResourceAnnotatedElement parent, AnnotatedElement element) { - super(parent, element, DECLARATION_ANNOTATION_ADAPTER); - } - - public String getAnnotationName() { - return ANNOTATION_NAME; - } - - public void initialize(CompilationUnit astRoot) { - // nothing to initialize - } - - public void synchronizeWith(CompilationUnit astRoot) { - // nothing to sync - } - -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/resource/java/source/SourceEclipseLinkReadOnlyAnnotation.java b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/resource/java/source/SourceEclipseLinkReadOnlyAnnotation.java deleted file mode 100644 index ae7014e382..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/resource/java/source/SourceEclipseLinkReadOnlyAnnotation.java +++ /dev/null @@ -1,46 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2008, 2011 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.eclipselink.core.internal.resource.java.source; - -import org.eclipse.jdt.core.dom.CompilationUnit; -import org.eclipse.jpt.common.core.internal.resource.java.source.SourceAnnotation; -import org.eclipse.jpt.common.core.internal.utility.jdt.SimpleDeclarationAnnotationAdapter; -import org.eclipse.jpt.common.core.resource.java.JavaResourceAnnotatedElement; -import org.eclipse.jpt.common.core.utility.jdt.AnnotatedElement; -import org.eclipse.jpt.common.core.utility.jdt.DeclarationAnnotationAdapter; -import org.eclipse.jpt.jpa.eclipselink.core.resource.java.EclipseLinkReadOnlyAnnotation; - -/** - * org.eclipse.persistence.annotations.ReadOnly - */ -public final class SourceEclipseLinkReadOnlyAnnotation - extends SourceAnnotation - implements EclipseLinkReadOnlyAnnotation -{ - private static final DeclarationAnnotationAdapter DECLARATION_ANNOTATION_ADAPTER = new SimpleDeclarationAnnotationAdapter(ANNOTATION_NAME); - - - public SourceEclipseLinkReadOnlyAnnotation(JavaResourceAnnotatedElement parent, AnnotatedElement element) { - super(parent, element, DECLARATION_ANNOTATION_ADAPTER); - } - - public String getAnnotationName() { - return ANNOTATION_NAME; - } - - public void initialize(CompilationUnit astRoot) { - // nothing to initialize - } - - public void synchronizeWith(CompilationUnit astRoot) { - // nothing to sync - } - -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/resource/java/source/SourceEclipseLinkReadTransformerAnnotation.java b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/resource/java/source/SourceEclipseLinkReadTransformerAnnotation.java deleted file mode 100644 index 0e7fbd7bf8..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/resource/java/source/SourceEclipseLinkReadTransformerAnnotation.java +++ /dev/null @@ -1,50 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2008, 2011 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.eclipselink.core.internal.resource.java.source; - -import org.eclipse.jpt.common.core.internal.utility.jdt.SimpleDeclarationAnnotationAdapter; -import org.eclipse.jpt.common.core.resource.java.JavaResourceAnnotatedElement; -import org.eclipse.jpt.common.core.utility.jdt.AnnotatedElement; -import org.eclipse.jpt.common.core.utility.jdt.DeclarationAnnotationAdapter; -import org.eclipse.jpt.jpa.eclipselink.core.resource.java.EclipseLink; -import org.eclipse.jpt.jpa.eclipselink.core.resource.java.EclipseLinkReadTransformerAnnotation; - -/** - * org.eclipse.persistence.annotations.ReadTransformer - */ -public final class SourceEclipseLinkReadTransformerAnnotation - extends SourceEclipseLinkTransformerAnnotation - implements EclipseLinkReadTransformerAnnotation -{ - private static final DeclarationAnnotationAdapter DECLARATION_ANNOTATION_ADAPTER = new SimpleDeclarationAnnotationAdapter(ANNOTATION_NAME); - - - public SourceEclipseLinkReadTransformerAnnotation(JavaResourceAnnotatedElement parent, AnnotatedElement element) { - super(parent, element, DECLARATION_ANNOTATION_ADAPTER); - } - - public String getAnnotationName() { - return ANNOTATION_NAME; - } - - - // ********** SourceTransformerAnnotation implementation ********** - - @Override - String getTransformerClassElementName() { - return EclipseLink.READ_TRANSFORMER__TRANSFORMER_CLASS; - } - - @Override - String getMethodElementName() { - return EclipseLink.READ_TRANSFORMER__METHOD; - } - -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/resource/java/source/SourceEclipseLinkStructConverterAnnotation.java b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/resource/java/source/SourceEclipseLinkStructConverterAnnotation.java deleted file mode 100644 index 2bc300cc02..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/resource/java/source/SourceEclipseLinkStructConverterAnnotation.java +++ /dev/null @@ -1,153 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2008, 2012 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.eclipselink.core.internal.resource.java.source; - -import org.eclipse.jdt.core.dom.CompilationUnit; -import org.eclipse.jpt.common.core.internal.utility.jdt.CombinationIndexedDeclarationAnnotationAdapter; -import org.eclipse.jpt.common.core.internal.utility.jdt.ConversionDeclarationAnnotationElementAdapter; -import org.eclipse.jpt.common.core.internal.utility.jdt.ElementIndexedAnnotationAdapter; -import org.eclipse.jpt.common.core.internal.utility.jdt.SimpleDeclarationAnnotationAdapter; -import org.eclipse.jpt.common.core.resource.java.JavaResourceAnnotatedElement; -import org.eclipse.jpt.common.core.utility.TextRange; -import org.eclipse.jpt.common.core.utility.jdt.AnnotatedElement; -import org.eclipse.jpt.common.core.utility.jdt.AnnotationElementAdapter; -import org.eclipse.jpt.common.core.utility.jdt.DeclarationAnnotationAdapter; -import org.eclipse.jpt.common.core.utility.jdt.DeclarationAnnotationElementAdapter; -import org.eclipse.jpt.common.core.utility.jdt.IndexedAnnotationAdapter; -import org.eclipse.jpt.common.core.utility.jdt.IndexedDeclarationAnnotationAdapter; -import org.eclipse.jpt.jpa.eclipselink.core.resource.java.EclipseLink; -import org.eclipse.jpt.jpa.eclipselink.core.resource.java.EclipseLinkStructConverterAnnotation; - -/** - * <code>org.eclipse.persistence.annotations.StructConverter</code> - */ -public final class SourceEclipseLinkStructConverterAnnotation - extends SourceEclipseLinkNamedConverterAnnotation - implements EclipseLinkStructConverterAnnotation -{ - private static final DeclarationAnnotationAdapter DECLARATION_ANNOTATION_ADAPTER = new SimpleDeclarationAnnotationAdapter(ANNOTATION_NAME); - private static final DeclarationAnnotationAdapter CONTAINER_DECLARATION_ANNOTATION_ADAPTER = new SimpleDeclarationAnnotationAdapter(EclipseLink.STRUCT_CONVERTERS); - - private final DeclarationAnnotationElementAdapter<String> converterDeclarationAdapter; - private final AnnotationElementAdapter<String> converterAdapter; - private String converter; - private TextRange converterTextRange; - - - public static SourceEclipseLinkStructConverterAnnotation buildSourceStructConverterAnnotation(JavaResourceAnnotatedElement parent, AnnotatedElement element, int index) { - IndexedDeclarationAnnotationAdapter idaa = buildStructConverterDeclarationAnnotationAdapter(index); - IndexedAnnotationAdapter iaa = buildStructConverterAnnotationAdapter(element, idaa); - return new SourceEclipseLinkStructConverterAnnotation( - parent, - element, - idaa, - iaa); - } - - private SourceEclipseLinkStructConverterAnnotation( - JavaResourceAnnotatedElement parent, - AnnotatedElement element, - IndexedDeclarationAnnotationAdapter daa, - IndexedAnnotationAdapter annotationAdapter) { - super(parent, element, daa, annotationAdapter); - this.converterDeclarationAdapter = this.buildConverterDeclarationAdapter(); - this.converterAdapter = this.buildConverterAdapter(); - } - - public String getAnnotationName() { - return ANNOTATION_NAME; - } - - @Override - public void initialize(CompilationUnit astRoot) { - super.initialize(astRoot); - this.converter = this.buildConverter(astRoot); - this.converterTextRange = this.buildConverterTextRange(astRoot); - } - - @Override - public void synchronizeWith(CompilationUnit astRoot) { - super.synchronizeWith(astRoot); - this.syncConverter(this.buildConverter(astRoot)); - this.converterTextRange = this.buildConverterTextRange(astRoot); - } - - @Override - public boolean isUnset() { - return super.isUnset() && - (this.converter == null); - } - - - // ********** SourceNamedConverterAnnotation implementation ********** - - @Override - String getNameElementName() { - return EclipseLink.STRUCT_CONVERTER__NAME; - } - - - // ********** StructConverterAnnotation implementation ********** - - // ***** converter - public String getConverter() { - return this.converter; - } - - public void setConverter(String converter) { - if (this.attributeValueHasChanged(this.converter, converter)) { - this.converter = converter; - this.converterAdapter.setValue(converter); - } - } - - private void syncConverter(String astConverter) { - String old = this.converter; - this.converter = astConverter; - this.firePropertyChanged(CONVERTER_PROPERTY, old, astConverter); - } - - private String buildConverter(CompilationUnit astRoot) { - return this.converterAdapter.getValue(astRoot); - } - - public TextRange getConverterTextRange() { - return this.converterTextRange; - } - - private TextRange buildConverterTextRange(CompilationUnit astRoot) { - return this.getElementTextRange(this.converterDeclarationAdapter, astRoot); - } - - private DeclarationAnnotationElementAdapter<String> buildConverterDeclarationAdapter() { - return ConversionDeclarationAnnotationElementAdapter.forStrings(this.daa, EclipseLink.STRUCT_CONVERTER__CONVERTER); - } - - private AnnotationElementAdapter<String> buildConverterAdapter() { - return this.buildStringElementAdapter(this.converterDeclarationAdapter); - } - - // ********** static methods ********** - - private static IndexedAnnotationAdapter buildStructConverterAnnotationAdapter(AnnotatedElement annotatedElement, IndexedDeclarationAnnotationAdapter idaa) { - return new ElementIndexedAnnotationAdapter(annotatedElement, idaa); - } - - private static IndexedDeclarationAnnotationAdapter buildStructConverterDeclarationAnnotationAdapter(int index) { - IndexedDeclarationAnnotationAdapter idaa = - new CombinationIndexedDeclarationAnnotationAdapter( - DECLARATION_ANNOTATION_ADAPTER, - CONTAINER_DECLARATION_ANNOTATION_ADAPTER, - index, - ANNOTATION_NAME); - return idaa; - } - -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/resource/java/source/SourceEclipseLinkStructureAnnotation.java b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/resource/java/source/SourceEclipseLinkStructureAnnotation.java deleted file mode 100644 index db0455c1ab..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/resource/java/source/SourceEclipseLinkStructureAnnotation.java +++ /dev/null @@ -1,45 +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, 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.eclipselink.core.internal.resource.java.source; - -import org.eclipse.jdt.core.dom.CompilationUnit; -import org.eclipse.jpt.common.core.internal.resource.java.source.SourceAnnotation; -import org.eclipse.jpt.common.core.internal.utility.jdt.SimpleDeclarationAnnotationAdapter; -import org.eclipse.jpt.common.core.resource.java.JavaResourceAnnotatedElement; -import org.eclipse.jpt.common.core.utility.jdt.AnnotatedElement; -import org.eclipse.jpt.common.core.utility.jdt.DeclarationAnnotationAdapter; -import org.eclipse.jpt.jpa.eclipselink.core.resource.java.EclipseLinkStructureAnnotation2_3; - -/** - * org.eclipse.persistence.annotations.Structure - */ -public final class SourceEclipseLinkStructureAnnotation - extends SourceAnnotation - implements EclipseLinkStructureAnnotation2_3 -{ - private static final DeclarationAnnotationAdapter DECLARATION_ANNOTATION_ADAPTER = new SimpleDeclarationAnnotationAdapter(ANNOTATION_NAME); - - - public SourceEclipseLinkStructureAnnotation(JavaResourceAnnotatedElement parent, AnnotatedElement element) { - super(parent, element, DECLARATION_ANNOTATION_ADAPTER); - } - - public String getAnnotationName() { - return ANNOTATION_NAME; - } - - public void initialize(CompilationUnit astRoot) { - // do nothing - } - - public void synchronizeWith(CompilationUnit astRoot) { - // do nothing - } -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/resource/java/source/SourceEclipseLinkTenantDiscriminatorColumnAnnotation2_3.java b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/resource/java/source/SourceEclipseLinkTenantDiscriminatorColumnAnnotation2_3.java deleted file mode 100644 index 7b95520212..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/resource/java/source/SourceEclipseLinkTenantDiscriminatorColumnAnnotation2_3.java +++ /dev/null @@ -1,308 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2011, 2012 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.eclipselink.core.internal.resource.java.source; - -import org.eclipse.jdt.core.dom.CompilationUnit; -import org.eclipse.jpt.common.core.internal.utility.jdt.CombinationIndexedDeclarationAnnotationAdapter; -import org.eclipse.jpt.common.core.internal.utility.jdt.ElementAnnotationAdapter; -import org.eclipse.jpt.common.core.internal.utility.jdt.ElementIndexedAnnotationAdapter; -import org.eclipse.jpt.common.core.internal.utility.jdt.SimpleDeclarationAnnotationAdapter; -import org.eclipse.jpt.common.core.resource.java.JavaResourceAnnotatedElement; -import org.eclipse.jpt.common.core.resource.java.JavaResourceNode; -import org.eclipse.jpt.common.core.utility.TextRange; -import org.eclipse.jpt.common.core.utility.jdt.AnnotatedElement; -import org.eclipse.jpt.common.core.utility.jdt.AnnotationAdapter; -import org.eclipse.jpt.common.core.utility.jdt.AnnotationElementAdapter; -import org.eclipse.jpt.common.core.utility.jdt.DeclarationAnnotationAdapter; -import org.eclipse.jpt.common.core.utility.jdt.DeclarationAnnotationElementAdapter; -import org.eclipse.jpt.common.core.utility.jdt.IndexedAnnotationAdapter; -import org.eclipse.jpt.common.core.utility.jdt.IndexedDeclarationAnnotationAdapter; -import org.eclipse.jpt.jpa.core.internal.resource.java.source.SourceBaseDiscriminatorColumnAnnotation; -import org.eclipse.jpt.jpa.eclipselink.core.resource.java.EclipseLink; -import org.eclipse.jpt.jpa.eclipselink.core.resource.java.EclipseLinkTenantDiscriminatorColumnAnnotation2_3; - -/** - * <code>org.eclipse.persistence.annotations.TenantDiscriminatorColumn</code> - */ -public final class SourceEclipseLinkTenantDiscriminatorColumnAnnotation2_3 - extends SourceBaseDiscriminatorColumnAnnotation - implements EclipseLinkTenantDiscriminatorColumnAnnotation2_3 -{ - private static final DeclarationAnnotationAdapter DECLARATION_ANNOTATION_ADAPTER = new SimpleDeclarationAnnotationAdapter(EclipseLinkTenantDiscriminatorColumnAnnotation2_3.ANNOTATION_NAME); - private static final DeclarationAnnotationAdapter CONTAINER_DECLARATION_ANNOTATION_ADAPTER = new SimpleDeclarationAnnotationAdapter(EclipseLink.TENANT_DISCRIMINATOR_COLUMNS); - - private DeclarationAnnotationElementAdapter<String> contextPropertyDeclarationAdapter; - private AnnotationElementAdapter<String> contextPropertyAdapter; - private String contextProperty; - private TextRange contextPropertyTextRange; - - private DeclarationAnnotationElementAdapter<String> tableDeclarationAdapter; - private AnnotationElementAdapter<String> tableAdapter; - private String table; - private TextRange tableTextRange; - - private DeclarationAnnotationElementAdapter<Boolean> primaryKeyDeclarationAdapter; - private AnnotationElementAdapter<Boolean> primaryKeyAdapter; - private Boolean primaryKey; - private TextRange primaryKeyTextRange; - - public static SourceEclipseLinkTenantDiscriminatorColumnAnnotation2_3 buildSourceTenantDiscriminatorColumnAnnotation( - JavaResourceNode parent, - AnnotatedElement element) { - - return new SourceEclipseLinkTenantDiscriminatorColumnAnnotation2_3(parent, element, DECLARATION_ANNOTATION_ADAPTER); - } - - public static SourceEclipseLinkTenantDiscriminatorColumnAnnotation2_3 buildSourceTenantDiscriminatorColumnAnnotation( - JavaResourceAnnotatedElement parent, - AnnotatedElement annotatedElement, - int index) { - IndexedDeclarationAnnotationAdapter idaa = buildTenantDiscriminatorColumnDeclarationAnnotationAdapter(index); - IndexedAnnotationAdapter iaa = buildTenantDiscriminatorColumnAnnotationAdapter(annotatedElement, idaa); - return new SourceEclipseLinkTenantDiscriminatorColumnAnnotation2_3( - parent, - annotatedElement, - idaa, - iaa); - } - - - public static SourceEclipseLinkTenantDiscriminatorColumnAnnotation2_3 buildNestedSourceTenantDiscriminatorColumnAnnotation( - JavaResourceNode parent, - AnnotatedElement element, - IndexedDeclarationAnnotationAdapter idaa) { - - return new SourceEclipseLinkTenantDiscriminatorColumnAnnotation2_3(parent, element, idaa); - } - - private SourceEclipseLinkTenantDiscriminatorColumnAnnotation2_3(JavaResourceNode parent, AnnotatedElement element, DeclarationAnnotationAdapter daa) { - this(parent, element, daa, new ElementAnnotationAdapter(element, daa)); - } - - private SourceEclipseLinkTenantDiscriminatorColumnAnnotation2_3(JavaResourceNode parent, AnnotatedElement element, IndexedDeclarationAnnotationAdapter idaa) { - this(parent, element, idaa, new ElementIndexedAnnotationAdapter(element, idaa)); - } - - private SourceEclipseLinkTenantDiscriminatorColumnAnnotation2_3(JavaResourceNode parent, AnnotatedElement element, DeclarationAnnotationAdapter daa, AnnotationAdapter annotationAdapter) { - super(parent, element, daa, annotationAdapter); - this.contextPropertyDeclarationAdapter = this.buildContextPropertyDeclarationAdapter(); - this.contextPropertyAdapter = this.buildContextPropertyAdapter(); - this.tableDeclarationAdapter = this.buildTableDeclarationAdapter(); - this.tableAdapter = this.buildTableAdapter(); - this.primaryKeyDeclarationAdapter = this.buildPrimaryKeyDeclarationAdapter(); - this.primaryKeyAdapter = this.buildPrimaryKeyAdapter(); - } - - @Override - public void initialize(CompilationUnit astRoot) { - super.initialize(astRoot); - - this.contextProperty = this.buildContextProperty(astRoot); - this.contextPropertyTextRange = this.buildContextPropertyTextRange(astRoot); - - this.table = this.buildTable(astRoot); - this.tableTextRange = this.buildTableTextRange(astRoot); - - this.primaryKey = this.buildPrimaryKey(astRoot); - this.primaryKeyTextRange = this.buildPrimaryKeyTextRange(astRoot); - } - - @Override - public void synchronizeWith(CompilationUnit astRoot) { - super.synchronizeWith(astRoot); - - this.syncContextProperty(this.buildContextProperty(astRoot)); - this.contextPropertyTextRange = this.buildContextPropertyTextRange(astRoot); - - this.syncTable(this.buildTable(astRoot)); - this.tableTextRange = this.buildTableTextRange(astRoot); - - this.syncPrimaryKey(this.buildPrimaryKey(astRoot)); - this.primaryKeyTextRange = this.buildPrimaryKeyTextRange(astRoot); - } - - public String getAnnotationName() { - return EclipseLinkTenantDiscriminatorColumnAnnotation2_3.ANNOTATION_NAME; - } - - - // ********** SourceNamedColumnAnnotation implementation ********** - - @Override - protected String getNameElementName() { - return EclipseLink.TENANT_DISCRIMINATOR_COLUMN__NAME; - } - - @Override - protected String getColumnDefinitionElementName() { - return EclipseLink.TENANT_DISCRIMINATOR_COLUMN__COLUMN_DEFINITION; - } - - - //************* SourceBaseDiscriminatorColumnAnnotation implementation ************* - - @Override - protected String getDiscriminatorTypeElementName() { - return EclipseLink.TENANT_DISCRIMINATOR_COLUMN__DISCRIMINATOR_TYPE; - } - - @Override - protected String getLengthElementName() { - return EclipseLink.TENANT_DISCRIMINATOR_COLUMN__LENGTH; - } - - - //************* TenantDiscriminatorColumnAnnotation implementation ************* - - // ***** contextProperty - public String getContextProperty() { - return this.contextProperty; - } - - public void setContextProperty(String contextProperty) { - if (this.attributeValueHasChanged(this.contextProperty, contextProperty)) { - this.contextProperty = contextProperty; - this.contextPropertyAdapter.setValue(contextProperty); - } - } - - private void syncContextProperty(String astContextProperty) { - String old = this.contextProperty; - this.contextProperty = astContextProperty; - this.firePropertyChanged(CONTEXT_PROPERTY_PROPERTY, old, astContextProperty); - } - - private String buildContextProperty(CompilationUnit astRoot) { - return this.contextPropertyAdapter.getValue(astRoot); - } - - public TextRange getContextPropertyTextRange() { - return this.contextPropertyTextRange; - } - - private TextRange buildContextPropertyTextRange(CompilationUnit astRoot) { - return this.getElementTextRange(this.contextPropertyDeclarationAdapter, astRoot); - } - - private DeclarationAnnotationElementAdapter<String> buildContextPropertyDeclarationAdapter() { - return this.buildStringElementAdapter(EclipseLink.TENANT_DISCRIMINATOR_COLUMN__CONTEXT_PROPERTY); - } - - private AnnotationElementAdapter<String> buildContextPropertyAdapter() { - return this.buildStringElementAdapter(this.contextPropertyDeclarationAdapter); - } - - // ***** table - public String getTable() { - return this.table; - } - - public void setTable(String table) { - if (this.attributeValueHasChanged(this.table, table)) { - this.table = table; - this.tableAdapter.setValue(table); - } - } - - private void syncTable(String astTable) { - String old = this.table; - this.table = astTable; - this.firePropertyChanged(TABLE_PROPERTY, old, astTable); - } - - private String buildTable(CompilationUnit astRoot) { - return this.tableAdapter.getValue(astRoot); - } - - public TextRange getTableTextRange() { - return this.tableTextRange; - } - - private TextRange buildTableTextRange(CompilationUnit astRoot) { - return this.getElementTextRange(this.tableDeclarationAdapter, astRoot); - } - - public boolean tableTouches(int pos) { - return this.textRangeTouches(this.tableTextRange, pos); - } - - private DeclarationAnnotationElementAdapter<String> buildTableDeclarationAdapter() { - return this.buildStringElementAdapter(EclipseLink.TENANT_DISCRIMINATOR_COLUMN__TABLE); - } - - private AnnotationElementAdapter<String> buildTableAdapter() { - return this.buildStringElementAdapter(this.tableDeclarationAdapter); - } - - // ***** primaryKey - public Boolean getPrimaryKey() { - return this.primaryKey; - } - - public void setPrimaryKey(Boolean primaryKey) { - if (this.attributeValueHasChanged(this.primaryKey, primaryKey)) { - this.primaryKey = primaryKey; - this.primaryKeyAdapter.setValue(primaryKey); - } - } - - private void syncPrimaryKey(Boolean astPrimaryKey) { - Boolean old = this.primaryKey; - this.primaryKey = astPrimaryKey; - this.firePropertyChanged(PRIMARY_KEY_PROPERTY, old, astPrimaryKey); - } - - private Boolean buildPrimaryKey(CompilationUnit astRoot) { - return this.primaryKeyAdapter.getValue(astRoot); - } - - public TextRange getPrimaryKeyTextRange() { - return this.primaryKeyTextRange; - } - - private TextRange buildPrimaryKeyTextRange(CompilationUnit astRoot) { - return this.getElementTextRange(this.primaryKeyDeclarationAdapter, astRoot); - } - - private DeclarationAnnotationElementAdapter<Boolean> buildPrimaryKeyDeclarationAdapter() { - return this.buildBooleanElementAdapter(EclipseLink.TENANT_DISCRIMINATOR_COLUMN__PRIMARY_KEY); - } - - private AnnotationElementAdapter<Boolean> buildPrimaryKeyAdapter() { - return this.buildBooleanElementAdapter(this.primaryKeyDeclarationAdapter); - } - - - // ********** misc ********** - - @Override - public boolean isUnset() { - return super.isUnset() && - (this.contextProperty == null) && - (this.primaryKey == null) && - (this.table == null); - } - - // ********** static methods ********** - - private static IndexedAnnotationAdapter buildTenantDiscriminatorColumnAnnotationAdapter(AnnotatedElement annotatedElement, IndexedDeclarationAnnotationAdapter idaa) { - return new ElementIndexedAnnotationAdapter(annotatedElement, idaa); - } - - private static IndexedDeclarationAnnotationAdapter buildTenantDiscriminatorColumnDeclarationAnnotationAdapter(int index) { - IndexedDeclarationAnnotationAdapter idaa = - new CombinationIndexedDeclarationAnnotationAdapter( - DECLARATION_ANNOTATION_ADAPTER, - CONTAINER_DECLARATION_ANNOTATION_ADAPTER, - index, - EclipseLinkTenantDiscriminatorColumnAnnotation2_3.ANNOTATION_NAME); - return idaa; - } -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/resource/java/source/SourceEclipseLinkTimeOfDayAnnotation.java b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/resource/java/source/SourceEclipseLinkTimeOfDayAnnotation.java deleted file mode 100644 index 53ef14756f..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/resource/java/source/SourceEclipseLinkTimeOfDayAnnotation.java +++ /dev/null @@ -1,249 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2008, 2011 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.eclipselink.core.internal.resource.java.source; - -import org.eclipse.jdt.core.dom.CompilationUnit; -import org.eclipse.jpt.common.core.internal.resource.java.source.SourceAnnotation; -import org.eclipse.jpt.common.core.internal.utility.jdt.AnnotatedElementAnnotationElementAdapter; -import org.eclipse.jpt.common.core.internal.utility.jdt.ConversionDeclarationAnnotationElementAdapter; -import org.eclipse.jpt.common.core.internal.utility.jdt.NumberIntegerExpressionConverter; -import org.eclipse.jpt.common.core.resource.java.JavaResourceNode; -import org.eclipse.jpt.common.core.utility.TextRange; -import org.eclipse.jpt.common.core.utility.jdt.AnnotatedElement; -import org.eclipse.jpt.common.core.utility.jdt.AnnotationElementAdapter; -import org.eclipse.jpt.common.core.utility.jdt.DeclarationAnnotationAdapter; -import org.eclipse.jpt.common.core.utility.jdt.DeclarationAnnotationElementAdapter; -import org.eclipse.jpt.jpa.eclipselink.core.resource.java.EclipseLink; -import org.eclipse.jpt.jpa.eclipselink.core.resource.java.EclipseLinkTimeOfDayAnnotation; - -/** - * org.eclipse.persistence.annotations.TimeOfDay - */ -public final class SourceEclipseLinkTimeOfDayAnnotation - extends SourceAnnotation - implements EclipseLinkTimeOfDayAnnotation -{ - private final DeclarationAnnotationElementAdapter<Integer> hourDeclarationAdapter; - private final AnnotationElementAdapter<Integer> hourAdapter; - private Integer hour; - private TextRange hourTextRange; - - private final DeclarationAnnotationElementAdapter<Integer> minuteDeclarationAdapter; - private final AnnotationElementAdapter<Integer> minuteAdapter; - private Integer minute; - private TextRange minuteTextRange; - - private final DeclarationAnnotationElementAdapter<Integer> secondDeclarationAdapter; - private final AnnotationElementAdapter<Integer> secondAdapter; - private Integer second; - private TextRange secondTextRange; - - private final DeclarationAnnotationElementAdapter<Integer> millisecondDeclarationAdapter; - private final AnnotationElementAdapter<Integer> millisecondAdapter; - private Integer millisecond; - private TextRange millisecondTextRange; - - - public SourceEclipseLinkTimeOfDayAnnotation(JavaResourceNode parent, AnnotatedElement element, DeclarationAnnotationAdapter daa) { - super(parent, element, daa); - this.hourDeclarationAdapter = buildHourAdapter(daa); - this.hourAdapter = new AnnotatedElementAnnotationElementAdapter<Integer>(element, this.hourDeclarationAdapter); - this.minuteDeclarationAdapter = buildMinuteAdapter(daa); - this.minuteAdapter = new AnnotatedElementAnnotationElementAdapter<Integer>(element, this.minuteDeclarationAdapter); - this.secondDeclarationAdapter = buildSecondAdapter(daa); - this.secondAdapter = new AnnotatedElementAnnotationElementAdapter<Integer>(element, this.secondDeclarationAdapter); - this.millisecondDeclarationAdapter = buildMillisecondAdapter(daa); - this.millisecondAdapter = new AnnotatedElementAnnotationElementAdapter<Integer>(element, this.millisecondDeclarationAdapter); - } - - public String getAnnotationName() { - return ANNOTATION_NAME; - } - - public void initialize(CompilationUnit astRoot) { - this.hour = this.buildHour(astRoot); - this.hourTextRange = this.buildHourTextRange(astRoot); - - this.minute = this.buildMinute(astRoot); - this.minuteTextRange = this.buildMinuteTextRange(astRoot); - - this.second = this.buildSecond(astRoot); - this.secondTextRange = this.buildSecondTextRange(astRoot); - - this.millisecond = this.buildMillisecond(astRoot); - this.millisecondTextRange = this.buildMillisecondTextRange(astRoot); - } - - public void synchronizeWith(CompilationUnit astRoot) { - this.syncHour(this.buildHour(astRoot)); - this.hourTextRange = this.buildHourTextRange(astRoot); - - this.syncMinute(this.buildMinute(astRoot)); - this.minuteTextRange = this.buildMinuteTextRange(astRoot); - - this.syncSecond(this.buildSecond(astRoot)); - this.secondTextRange = this.buildSecondTextRange(astRoot); - - this.syncMillisecond(this.buildMillisecond(astRoot)); - this.millisecondTextRange = this.buildMillisecondTextRange(astRoot); - } - - @Override - public boolean isUnset() { - return super.isUnset() && - (this.hour == null) && - (this.minute == null) && - (this.second == null) && - (this.millisecond == null); - } - - - // ********** TimeOfDayAnnotation implementation ********** - - // ***** hour - public Integer getHour() { - return this.hour; - } - - public void setHour(Integer hour) { - if (this.attributeValueHasChanged(this.hour, hour)) { - this.hour = hour; - this.hourAdapter.setValue(hour); - } - } - - private void syncHour(Integer astHour) { - Integer old = this.hour; - this.hour = astHour; - this.firePropertyChanged(HOUR_PROPERTY, old, astHour); - } - - private Integer buildHour(CompilationUnit astRoot) { - return this.hourAdapter.getValue(astRoot); - } - - public TextRange getHourTextRange() { - return this.hourTextRange; - } - - private TextRange buildHourTextRange(CompilationUnit astRoot) { - return this.getElementTextRange(this.hourDeclarationAdapter, astRoot); - } - - // ***** minute - public Integer getMinute() { - return this.minute; - } - - public void setMinute(Integer minute) { - if (this.attributeValueHasChanged(this.minute, minute)) { - this.minute = minute; - this.minuteAdapter.setValue(minute); - } - } - - private void syncMinute(Integer astMinute) { - Integer old = this.minute; - this.minute = astMinute; - this.firePropertyChanged(MINUTE_PROPERTY, old, astMinute); - } - - private Integer buildMinute(CompilationUnit astRoot) { - return this.minuteAdapter.getValue(astRoot); - } - - public TextRange getMinuteTextRange() { - return this.minuteTextRange; - } - - private TextRange buildMinuteTextRange(CompilationUnit astRoot) { - return this.getElementTextRange(this.minuteDeclarationAdapter, astRoot); - } - - // ***** second - public Integer getSecond() { - return this.second; - } - - public void setSecond(Integer newSecond) { - if (this.attributeValueHasChanged(this.second, newSecond)) { - this.second = newSecond; - this.secondAdapter.setValue(newSecond); - } - } - - private void syncSecond(Integer astSecond) { - Integer old = this.second; - this.second = astSecond; - this.firePropertyChanged(SECOND_PROPERTY, old, astSecond); - } - - private Integer buildSecond(CompilationUnit astRoot) { - return this.secondAdapter.getValue(astRoot); - } - - public TextRange getSecondTextRange() { - return this.secondTextRange; - } - - private TextRange buildSecondTextRange(CompilationUnit astRoot) { - return this.getElementTextRange(this.secondDeclarationAdapter, astRoot); - } - - // ***** millisecond - public Integer getMillisecond() { - return this.millisecond; - } - - public void setMillisecond(Integer millisecond) { - if (this.attributeValueHasChanged(this.millisecond, millisecond)) { - this.millisecond = millisecond; - this.millisecondAdapter.setValue(millisecond); - } - } - - private void syncMillisecond(Integer astMillisecond) { - Integer oldMillisecond = this.millisecond; - this.millisecond = astMillisecond; - this.firePropertyChanged(MILLISECOND_PROPERTY, oldMillisecond, astMillisecond); - } - - private Integer buildMillisecond(CompilationUnit astRoot) { - return this.millisecondAdapter.getValue(astRoot); - } - - public TextRange getMillisecondTextRange() { - return this.millisecondTextRange; - } - - private TextRange buildMillisecondTextRange(CompilationUnit astRoot) { - return this.getElementTextRange(this.millisecondDeclarationAdapter, astRoot); - } - - - // ********** static methods ********** - - private static DeclarationAnnotationElementAdapter<Integer> buildHourAdapter(DeclarationAnnotationAdapter daa) { - return new ConversionDeclarationAnnotationElementAdapter<Integer>(daa, EclipseLink.TIME_OF_DAY__HOUR, NumberIntegerExpressionConverter.instance()); - } - - private static DeclarationAnnotationElementAdapter<Integer> buildMinuteAdapter(DeclarationAnnotationAdapter daa) { - return new ConversionDeclarationAnnotationElementAdapter<Integer>(daa, EclipseLink.TIME_OF_DAY__MINUTE, NumberIntegerExpressionConverter.instance()); - } - - private static DeclarationAnnotationElementAdapter<Integer> buildSecondAdapter(DeclarationAnnotationAdapter daa) { - return new ConversionDeclarationAnnotationElementAdapter<Integer>(daa, EclipseLink.TIME_OF_DAY__SECOND, NumberIntegerExpressionConverter.instance()); - } - - private static DeclarationAnnotationElementAdapter<Integer> buildMillisecondAdapter(DeclarationAnnotationAdapter daa) { - return new ConversionDeclarationAnnotationElementAdapter<Integer>(daa, EclipseLink.TIME_OF_DAY__MILLISECOND, NumberIntegerExpressionConverter.instance()); - } - -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/resource/java/source/SourceEclipseLinkTransformationAnnotation.java b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/resource/java/source/SourceEclipseLinkTransformationAnnotation.java deleted file mode 100644 index fa9c3c0545..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/resource/java/source/SourceEclipseLinkTransformationAnnotation.java +++ /dev/null @@ -1,160 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2008, 2012 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.eclipselink.core.internal.resource.java.source; - -import org.eclipse.jdt.core.dom.CompilationUnit; -import org.eclipse.jpt.common.core.internal.resource.java.source.SourceAnnotation; -import org.eclipse.jpt.common.core.internal.utility.jdt.AnnotatedElementAnnotationElementAdapter; -import org.eclipse.jpt.common.core.internal.utility.jdt.BooleanExpressionConverter; -import org.eclipse.jpt.common.core.internal.utility.jdt.ConversionDeclarationAnnotationElementAdapter; -import org.eclipse.jpt.common.core.internal.utility.jdt.EnumDeclarationAnnotationElementAdapter; -import org.eclipse.jpt.common.core.internal.utility.jdt.SimpleDeclarationAnnotationAdapter; -import org.eclipse.jpt.common.core.resource.java.JavaResourceAnnotatedElement; -import org.eclipse.jpt.common.core.utility.TextRange; -import org.eclipse.jpt.common.core.utility.jdt.AnnotatedElement; -import org.eclipse.jpt.common.core.utility.jdt.AnnotationElementAdapter; -import org.eclipse.jpt.common.core.utility.jdt.DeclarationAnnotationAdapter; -import org.eclipse.jpt.common.core.utility.jdt.DeclarationAnnotationElementAdapter; -import org.eclipse.jpt.jpa.core.resource.java.FetchType; -import org.eclipse.jpt.jpa.eclipselink.core.resource.java.EclipseLink; -import org.eclipse.jpt.jpa.eclipselink.core.resource.java.EclipseLinkTransformationAnnotation; - -/** - * <code>org.eclipse.persistence.annotations.Transformation</code> - */ -public final class SourceEclipseLinkTransformationAnnotation - extends SourceAnnotation - implements EclipseLinkTransformationAnnotation -{ - private static final DeclarationAnnotationAdapter DECLARATION_ANNOTATION_ADAPTER = new SimpleDeclarationAnnotationAdapter(ANNOTATION_NAME); - - private static final DeclarationAnnotationElementAdapter<String> FETCH_ADAPTER = buildFetchAdapter(); - private final AnnotationElementAdapter<String> fetchAdapter; - private FetchType fetch; - private TextRange fetchTextRange; - - private static final DeclarationAnnotationElementAdapter<Boolean> OPTIONAL_ADAPTER = buildOptionalAdapter(); - private final AnnotationElementAdapter<Boolean> optionalAdapter; - private Boolean optional; - private TextRange optionalTextRange; - - - public SourceEclipseLinkTransformationAnnotation(JavaResourceAnnotatedElement parent, AnnotatedElement element) { - super(parent, element, DECLARATION_ANNOTATION_ADAPTER); - this.fetchAdapter = new AnnotatedElementAnnotationElementAdapter<String>(element, FETCH_ADAPTER); - this.optionalAdapter = new AnnotatedElementAnnotationElementAdapter<Boolean>(element, OPTIONAL_ADAPTER); - } - - public String getAnnotationName() { - return ANNOTATION_NAME; - } - - public void initialize(CompilationUnit astRoot) { - this.fetch = this.buildFetch(astRoot); - this.fetchTextRange = this.buildFetchTextRange(astRoot); - - this.optional = this.buildOptional(astRoot); - this.optionalTextRange = this.buildOptionalTextRange(astRoot); - } - - public void synchronizeWith(CompilationUnit astRoot) { - this.syncFetch(this.buildFetch(astRoot)); - this.fetchTextRange = this.buildFetchTextRange(astRoot); - - this.syncOptional(this.buildOptional(astRoot)); - this.optionalTextRange = this.buildOptionalTextRange(astRoot); - } - - @Override - public boolean isUnset() { - return super.isUnset() && - (this.fetch == null) && - (this.optional == null); - } - - @Override - public void toString(StringBuilder sb) { - sb.append(this.fetch); - } - - - // ********** TransformationAnnotation implementation ********** - - // ***** fetch - public FetchType getFetch() { - return this.fetch; - } - - public void setFetch(FetchType fetch) { - if (this.attributeValueHasChanged(this.fetch, fetch)) { - this.fetch = fetch; - this.fetchAdapter.setValue(FetchType.toJavaAnnotationValue(fetch)); - } - } - - private void syncFetch(FetchType astFetch) { - FetchType old = this.fetch; - this.fetch = astFetch; - this.firePropertyChanged(FETCH_PROPERTY, old, astFetch); - } - - private FetchType buildFetch(CompilationUnit astRoot) { - return FetchType.fromJavaAnnotationValue(this.fetchAdapter.getValue(astRoot)); - } - - public TextRange getFetchTextRange() { - return this.fetchTextRange; - } - - private TextRange buildFetchTextRange(CompilationUnit astRoot) { - return this.getElementTextRange(FETCH_ADAPTER, astRoot); - } - - // ***** optional - public Boolean getOptional() { - return this.optional; - } - - public void setOptional(Boolean optional) { - if (this.attributeValueHasChanged(this.optional, optional)) { - this.optional = optional; - this.optionalAdapter.setValue(optional); - } - } - - private void syncOptional(Boolean astOptional) { - Boolean old = this.optional; - this.optional = astOptional; - this.firePropertyChanged(OPTIONAL_PROPERTY, old, astOptional); - } - - private Boolean buildOptional(CompilationUnit astRoot) { - return this.optionalAdapter.getValue(astRoot); - } - - public TextRange getOptionalTextRange() { - return this.optionalTextRange; - } - - private TextRange buildOptionalTextRange(CompilationUnit astRoot) { - return this.getElementTextRange(OPTIONAL_ADAPTER, astRoot); - } - - - // ********** static methods ********** - - private static DeclarationAnnotationElementAdapter<Boolean> buildOptionalAdapter() { - return new ConversionDeclarationAnnotationElementAdapter<Boolean>(DECLARATION_ANNOTATION_ADAPTER, EclipseLink.TRANSFORMATION__OPTIONAL, BooleanExpressionConverter.instance()); - } - - private static DeclarationAnnotationElementAdapter<String> buildFetchAdapter() { - return new EnumDeclarationAnnotationElementAdapter(DECLARATION_ANNOTATION_ADAPTER, EclipseLink.TRANSFORMATION__FETCH); - } -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/resource/java/source/SourceEclipseLinkTransformerAnnotation.java b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/resource/java/source/SourceEclipseLinkTransformerAnnotation.java deleted file mode 100644 index 85ea7825fa..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/resource/java/source/SourceEclipseLinkTransformerAnnotation.java +++ /dev/null @@ -1,149 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2008, 2012 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.eclipselink.core.internal.resource.java.source; - -import org.eclipse.jdt.core.dom.CompilationUnit; -import org.eclipse.jpt.common.core.internal.resource.java.source.SourceAnnotation; -import org.eclipse.jpt.common.core.internal.utility.jdt.AnnotatedElementAnnotationElementAdapter; -import org.eclipse.jpt.common.core.internal.utility.jdt.ConversionDeclarationAnnotationElementAdapter; -import org.eclipse.jpt.common.core.internal.utility.jdt.SimpleTypeStringExpressionConverter; -import org.eclipse.jpt.common.core.resource.java.JavaResourceAnnotatedElement; -import org.eclipse.jpt.common.core.utility.TextRange; -import org.eclipse.jpt.common.core.utility.jdt.AnnotatedElement; -import org.eclipse.jpt.common.core.utility.jdt.AnnotationElementAdapter; -import org.eclipse.jpt.common.core.utility.jdt.DeclarationAnnotationAdapter; -import org.eclipse.jpt.common.core.utility.jdt.DeclarationAnnotationElementAdapter; -import org.eclipse.jpt.jpa.eclipselink.core.resource.java.EclipseLinkTransformerAnnotation; - -/** - * <code><ul> - * <li>org.eclipse.persistence.annotations.ReadTransformer - * <li>org.eclipse.persistence.annotations.WriteTransformer - * </ul></code> - */ -abstract class SourceEclipseLinkTransformerAnnotation - extends SourceAnnotation - implements EclipseLinkTransformerAnnotation -{ - final DeclarationAnnotationElementAdapter<String> transformerClassDeclarationAdapter; - final AnnotationElementAdapter<String> transformerClassAdapter; - String transformerClass; - TextRange transformerClassTextRange; - - final DeclarationAnnotationElementAdapter<String> methodDeclarationAdapter; - final AnnotationElementAdapter<String> methodAdapter; - String method; - TextRange methodTextRange; - - - SourceEclipseLinkTransformerAnnotation(JavaResourceAnnotatedElement parent, AnnotatedElement element, DeclarationAnnotationAdapter daa) { - super(parent, element, daa); - this.transformerClassDeclarationAdapter = new ConversionDeclarationAnnotationElementAdapter<String>(daa, this.getTransformerClassElementName(), SimpleTypeStringExpressionConverter.instance()); - this.transformerClassAdapter = new AnnotatedElementAnnotationElementAdapter<String>(element, this.transformerClassDeclarationAdapter); - - this.methodDeclarationAdapter = ConversionDeclarationAnnotationElementAdapter.forStrings(daa, this.getMethodElementName()); - this.methodAdapter = new AnnotatedElementAnnotationElementAdapter<String>(element, this.methodDeclarationAdapter); - } - - public void initialize(CompilationUnit astRoot) { - this.transformerClass = this.buildTransformerClass(astRoot); - this.transformerClassTextRange = this.buildTransformerClassTextRange(astRoot); - - this.method = this.buildMethod(astRoot); - this.methodTextRange = this.buildMethodTextRange(astRoot); - } - - public void synchronizeWith(CompilationUnit astRoot) { - this.syncTransformerClass(this.buildTransformerClass(astRoot)); - this.transformerClassTextRange = this.buildTransformerClassTextRange(astRoot); - - this.syncMethod(this.buildMethod(astRoot)); - this.methodTextRange = this.buildMethodTextRange(astRoot); - } - - @Override - public boolean isUnset() { - return super.isUnset() && - (this.transformerClass == null) && - (this.method == null); - } - - @Override - public void toString(StringBuilder sb) { - sb.append(this.transformerClass); - } - - - // ********** TransformerAnnotation implementation ********** - - // ***** transformer class - public String getTransformerClass() { - return this.transformerClass; - } - - public void setTransformerClass(String transformerClass) { - if (this.attributeValueHasChanged(this.transformerClass, transformerClass)) { - this.transformerClass = transformerClass; - this.transformerClassAdapter.setValue(transformerClass); - } - } - - private void syncTransformerClass(String astTransformerClass) { - String old = this.transformerClass; - this.transformerClass = astTransformerClass; - this.firePropertyChanged(TRANSFORMER_CLASS_PROPERTY, old, astTransformerClass); - } - - private String buildTransformerClass(CompilationUnit astRoot) { - return this.transformerClassAdapter.getValue(astRoot); - } - - public TextRange getTransformerClassTextRange() { - return this.transformerClassTextRange; - } - - private TextRange buildTransformerClassTextRange(CompilationUnit astRoot) { - return this.getElementTextRange(this.transformerClassDeclarationAdapter, astRoot); - } - - abstract String getTransformerClassElementName(); - - // ***** method - public String getMethod() { - return this.method; - } - - public void setMethod(String method) { - if (this.attributeValueHasChanged(this.method, method)) { - this.method = method; - this.methodAdapter.setValue(method); - } - } - - private void syncMethod(String astMethod) { - String old = this.method; - this.method = astMethod; - this.firePropertyChanged(METHOD_PROPERTY, old, astMethod); - } - - private String buildMethod(CompilationUnit astRoot) { - return this.methodAdapter.getValue(astRoot); - } - - public TextRange getMethodTextRange() { - return this.methodTextRange; - } - - private TextRange buildMethodTextRange(CompilationUnit astRoot) { - return this.getElementTextRange(this.methodDeclarationAdapter, astRoot); - } - - abstract String getMethodElementName(); -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/resource/java/source/SourceEclipseLinkTypeConverterAnnotation.java b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/resource/java/source/SourceEclipseLinkTypeConverterAnnotation.java deleted file mode 100644 index 5900ad9a43..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/resource/java/source/SourceEclipseLinkTypeConverterAnnotation.java +++ /dev/null @@ -1,91 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2008, 2012 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.eclipselink.core.internal.resource.java.source; - -import org.eclipse.jpt.common.core.internal.utility.jdt.CombinationIndexedDeclarationAnnotationAdapter; -import org.eclipse.jpt.common.core.internal.utility.jdt.ElementIndexedAnnotationAdapter; -import org.eclipse.jpt.common.core.internal.utility.jdt.SimpleDeclarationAnnotationAdapter; -import org.eclipse.jpt.common.core.resource.java.JavaResourceAnnotatedElement; -import org.eclipse.jpt.common.core.utility.jdt.AnnotatedElement; -import org.eclipse.jpt.common.core.utility.jdt.DeclarationAnnotationAdapter; -import org.eclipse.jpt.common.core.utility.jdt.IndexedAnnotationAdapter; -import org.eclipse.jpt.common.core.utility.jdt.IndexedDeclarationAnnotationAdapter; -import org.eclipse.jpt.jpa.eclipselink.core.resource.java.EclipseLink; -import org.eclipse.jpt.jpa.eclipselink.core.resource.java.EclipseLinkTypeConverterAnnotation; - -/** - * <code>org.eclipse.persistence.annotations.TypeConverter</code> - */ -public final class SourceEclipseLinkTypeConverterAnnotation - extends SourceEclipseLinkBaseTypeConverterAnnotation - implements EclipseLinkTypeConverterAnnotation -{ - private static final DeclarationAnnotationAdapter DECLARATION_ANNOTATION_ADAPTER = new SimpleDeclarationAnnotationAdapter(ANNOTATION_NAME); - private static final DeclarationAnnotationAdapter CONTAINER_DECLARATION_ANNOTATION_ADAPTER = new SimpleDeclarationAnnotationAdapter(EclipseLink.TYPE_CONVERTERS); - - public static SourceEclipseLinkTypeConverterAnnotation buildSourceTypeConverterAnnotation(JavaResourceAnnotatedElement parent, AnnotatedElement element, int index) { - IndexedDeclarationAnnotationAdapter idaa = buildTypeConverterDeclarationAnnotationAdapter(index); - IndexedAnnotationAdapter iaa = buildTypeConverterAnnotationAdapter(element, idaa); - return new SourceEclipseLinkTypeConverterAnnotation( - parent, - element, - idaa, - iaa); - } - - private SourceEclipseLinkTypeConverterAnnotation( - JavaResourceAnnotatedElement parent, - AnnotatedElement element, - IndexedDeclarationAnnotationAdapter daa, - IndexedAnnotationAdapter annotationAdapter) { - super(parent, element, daa, annotationAdapter); - } - - public String getAnnotationName() { - return ANNOTATION_NAME; - } - - - // ********** SourceNamedConverterAnnotation implementation ********** - - @Override - String getNameElementName() { - return EclipseLink.TYPE_CONVERTER__NAME; - } - - - // ********** SourceBaseTypeConverterAnnotation implementation ********** - - @Override - String getDataTypeElementName() { - return EclipseLink.TYPE_CONVERTER__DATA_TYPE; - } - - @Override - String getObjectTypeElementName() { - return EclipseLink.TYPE_CONVERTER__OBJECT_TYPE; - } - - // ********** static methods ********** - - private static IndexedAnnotationAdapter buildTypeConverterAnnotationAdapter(AnnotatedElement annotatedElement, IndexedDeclarationAnnotationAdapter idaa) { - return new ElementIndexedAnnotationAdapter(annotatedElement, idaa); - } - - private static IndexedDeclarationAnnotationAdapter buildTypeConverterDeclarationAnnotationAdapter(int index) { - IndexedDeclarationAnnotationAdapter idaa = - new CombinationIndexedDeclarationAnnotationAdapter( - DECLARATION_ANNOTATION_ADAPTER, - CONTAINER_DECLARATION_ANNOTATION_ADAPTER, - index, - ANNOTATION_NAME); - return idaa; - } -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/resource/java/source/SourceEclipseLinkVariableOneToOneAnnotation.java b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/resource/java/source/SourceEclipseLinkVariableOneToOneAnnotation.java deleted file mode 100644 index 8e8ee15d3e..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/resource/java/source/SourceEclipseLinkVariableOneToOneAnnotation.java +++ /dev/null @@ -1,46 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2009, 2011 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.eclipselink.core.internal.resource.java.source; - -import org.eclipse.jdt.core.dom.CompilationUnit; -import org.eclipse.jpt.common.core.internal.resource.java.source.SourceAnnotation; -import org.eclipse.jpt.common.core.internal.utility.jdt.SimpleDeclarationAnnotationAdapter; -import org.eclipse.jpt.common.core.resource.java.JavaResourceAnnotatedElement; -import org.eclipse.jpt.common.core.utility.jdt.AnnotatedElement; -import org.eclipse.jpt.common.core.utility.jdt.DeclarationAnnotationAdapter; -import org.eclipse.jpt.jpa.eclipselink.core.resource.java.EclipseLinkVariableOneToOneAnnotation; - -/** - * org.eclipse.persistence.annotations.VariableOneToOne - */ -public final class SourceEclipseLinkVariableOneToOneAnnotation - extends SourceAnnotation - implements EclipseLinkVariableOneToOneAnnotation -{ - private static final DeclarationAnnotationAdapter DECLARATION_ANNOTATION_ADAPTER = new SimpleDeclarationAnnotationAdapter(ANNOTATION_NAME); - - - public SourceEclipseLinkVariableOneToOneAnnotation(JavaResourceAnnotatedElement parent, AnnotatedElement element) { - super(parent, element, DECLARATION_ANNOTATION_ADAPTER); - } - - public String getAnnotationName() { - return ANNOTATION_NAME; - } - - public void initialize(CompilationUnit astRoot) { - // nothing to initialize - } - - public void synchronizeWith(CompilationUnit astRoot) { - // nothing to update - } - -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/resource/java/source/SourceEclipseLinkWriteTransformerAnnotation.java b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/resource/java/source/SourceEclipseLinkWriteTransformerAnnotation.java deleted file mode 100644 index 4962657e4e..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/resource/java/source/SourceEclipseLinkWriteTransformerAnnotation.java +++ /dev/null @@ -1,165 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2008, 2012 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.eclipselink.core.internal.resource.java.source; - -import org.eclipse.jdt.core.dom.CompilationUnit; -import org.eclipse.jpt.common.core.internal.utility.jdt.ElementAnnotationAdapter; -import org.eclipse.jpt.common.core.internal.utility.jdt.NestedDeclarationAnnotationAdapter; -import org.eclipse.jpt.common.core.internal.utility.jdt.SimpleDeclarationAnnotationAdapter; -import org.eclipse.jpt.common.core.resource.java.JavaResourceAnnotatedElement; -import org.eclipse.jpt.common.core.resource.java.JavaResourceNode; -import org.eclipse.jpt.common.core.utility.TextRange; -import org.eclipse.jpt.common.core.utility.jdt.AnnotatedElement; -import org.eclipse.jpt.common.core.utility.jdt.DeclarationAnnotationAdapter; -import org.eclipse.jpt.jpa.core.internal.resource.java.source.SourceColumnAnnotation; -import org.eclipse.jpt.jpa.core.resource.java.ColumnAnnotation; -import org.eclipse.jpt.jpa.core.resource.java.JPA; -import org.eclipse.jpt.jpa.eclipselink.core.internal.resource.java.NullEclipseLinkWriteTransformerColumnAnnotation; -import org.eclipse.jpt.jpa.eclipselink.core.resource.java.EclipseLink; -import org.eclipse.jpt.jpa.eclipselink.core.resource.java.EclipseLinkWriteTransformerAnnotation; - -/** - * <code>org.eclipse.persistence.annotations.WriteTransformer</code> - */ -public final class SourceEclipseLinkWriteTransformerAnnotation - extends SourceEclipseLinkTransformerAnnotation - implements EclipseLinkWriteTransformerAnnotation -{ - private static final DeclarationAnnotationAdapter DECLARATION_ANNOTATION_ADAPTER = new SimpleDeclarationAnnotationAdapter(ANNOTATION_NAME); - - private final ElementAnnotationAdapter columnAdapter; - private ColumnAnnotation column; - private final ColumnAnnotation nullColumn; - private TextRange columnTextRange; - - - public SourceEclipseLinkWriteTransformerAnnotation(JavaResourceAnnotatedElement parent, AnnotatedElement element) { - super(parent, element, DECLARATION_ANNOTATION_ADAPTER); - this.columnAdapter = new ElementAnnotationAdapter(this.annotatedElement, buildColumnAnnotationAdapter(this.daa)); - this.nullColumn = this.buildNullColumn(); - } - - public String getAnnotationName() { - return ANNOTATION_NAME; - } - - @Override - public void initialize(CompilationUnit astRoot) { - super.initialize(astRoot); - if (this.columnAdapter.getAnnotation(astRoot) != null) { - this.column = createColumn(this, this.annotatedElement, this.daa); - this.column.initialize(astRoot); - } - this.columnTextRange = this.buildColumnTextRange(astRoot); - } - - @Override - public void synchronizeWith(CompilationUnit astRoot) { - super.synchronizeWith(astRoot); - this.syncColumn(astRoot); - this.columnTextRange = this.buildColumnTextRange(astRoot); - } - - @Override - public boolean isUnset() { - return super.isUnset() && - (this.column == null); - } - - - // ********** SourceTransformerAnnotation implementation ********** - - @Override - String getTransformerClassElementName() { - return EclipseLink.WRITE_TRANSFORMER__TRANSFORMER_CLASS; - } - - @Override - String getMethodElementName() { - return EclipseLink.WRITE_TRANSFORMER__METHOD; - } - - - // ********** WriteTransformerAnnotation implementation ********** - - // ***** column - public ColumnAnnotation getColumn() { - return this.column; - } - - public ColumnAnnotation getNonNullColumn() { - return (this.column != null) ? this.column : this.nullColumn; - } - - public ColumnAnnotation addColumn() { - if (this.column != null) { - throw new IllegalStateException("'column' element already exists: " + this.column); //$NON-NLS-1$ - } - this.column = createColumn(this, this.annotatedElement, this.daa); - this.column.newAnnotation(); - return this.column; - } - - public void removeColumn() { - if (this.column == null) { - throw new IllegalStateException("'column' element does not exist"); //$NON-NLS-1$ - } - ColumnAnnotation old = this.column; - this.column = null; - old.removeAnnotation(); - } - - private void syncColumn(CompilationUnit astRoot) { - if (this.columnAdapter.getAnnotation(astRoot) == null) { - this.syncColumn_(null); - } else { - if (this.column == null) { - ColumnAnnotation col = createColumn(this, this.annotatedElement, this.daa); - col.initialize(astRoot); - this.syncColumn_(col); - } else { - this.column.synchronizeWith(astRoot); - } - } - } - - private void syncColumn_(ColumnAnnotation astColumn) { - ColumnAnnotation old = this.column; - this.column = astColumn; - this.firePropertyChanged(COLUMN_PROPERTY, old, astColumn); - } - - private ColumnAnnotation buildNullColumn() { - return new NullEclipseLinkWriteTransformerColumnAnnotation(this); - } - - public TextRange getColumnTextRange() { - return this.columnTextRange; - } - - private TextRange buildColumnTextRange(CompilationUnit astRoot) { - if (this.column != null) { - return this.column.getTextRange(astRoot); - } - return this.getTextRange(astRoot); - } - - - // ********** static methods ********** - - private static DeclarationAnnotationAdapter buildColumnAnnotationAdapter(DeclarationAnnotationAdapter writeTransformerAnnotationAdapter) { - return new NestedDeclarationAnnotationAdapter(writeTransformerAnnotationAdapter, EclipseLink.WRITE_TRANSFORMER__COLUMN, JPA.COLUMN); - } - - private static ColumnAnnotation createColumn(JavaResourceNode parent, AnnotatedElement element, DeclarationAnnotationAdapter writeTransformerAnnotationAdapter) { - return new SourceColumnAnnotation(parent, element, buildColumnAnnotationAdapter(writeTransformerAnnotationAdapter)); - } - -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/resource/orm/EclipseLinkOrmXmlResourceProvider.java b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/resource/orm/EclipseLinkOrmXmlResourceProvider.java deleted file mode 100644 index d6d6be213c..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/resource/orm/EclipseLinkOrmXmlResourceProvider.java +++ /dev/null @@ -1,82 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2008, 2012 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - *******************************************************************************/ -package org.eclipse.jpt.jpa.eclipselink.core.internal.resource.orm; - -import org.eclipse.core.resources.IFile; -import org.eclipse.core.resources.IProject; -import org.eclipse.core.runtime.IPath; -import org.eclipse.jpt.jpa.core.internal.operations.OrmFileCreationDataModelProperties; -import org.eclipse.jpt.jpa.core.resource.AbstractXmlResourceProvider; -import org.eclipse.jpt.jpa.core.resource.orm.XmlPersistenceUnitDefaults; -import org.eclipse.jpt.jpa.core.resource.orm.XmlPersistenceUnitMetadata; -import org.eclipse.jpt.jpa.eclipselink.core.JptJpaEclipseLinkCorePlugin; -import org.eclipse.jpt.jpa.eclipselink.core.resource.orm.EclipseLinkOrmFactory; -import org.eclipse.jpt.jpa.eclipselink.core.resource.orm.XmlEntityMappings; -import org.eclipse.wst.common.frameworks.datamodel.IDataModel; - -public class EclipseLinkOrmXmlResourceProvider - extends AbstractXmlResourceProvider - implements OrmFileCreationDataModelProperties -{ - /** - * (Convenience method) Returns an EclipseLink ORM resource model provider for - * the given file. - */ - public static EclipseLinkOrmXmlResourceProvider getXmlResourceProvider(IFile file) { - return getXmlResourceProvider_(file.getProject(), file.getFullPath()); - } - - /** - * (Convenience method) Returns an EclipseLink ORM resource model provider for - * the given project in the specified runtime location - */ - public static EclipseLinkOrmXmlResourceProvider getXmlResourceProvider(IProject project, IPath runtimePath) { - return getXmlResourceProvider_(project, runtimePath); - } - - /** - * (Convenience method) Returns an EclipseLink ORM resource model provider for - * the given project in the default runtime location - */ - public static EclipseLinkOrmXmlResourceProvider getDefaultXmlResourceProvider(IProject project) { - return getXmlResourceProvider(project, JptJpaEclipseLinkCorePlugin.DEFAULT_ECLIPSELINK_ORM_XML_RUNTIME_PATH); - } - - private static EclipseLinkOrmXmlResourceProvider getXmlResourceProvider_(IProject project, IPath fullPath) { - return new EclipseLinkOrmXmlResourceProvider(project, fullPath); - } - - - public EclipseLinkOrmXmlResourceProvider(IProject project) { - this(project, JptJpaEclipseLinkCorePlugin.DEFAULT_ECLIPSELINK_ORM_XML_RUNTIME_PATH); - } - - public EclipseLinkOrmXmlResourceProvider(IProject project, IPath filePath) { - super(project, filePath, JptJpaEclipseLinkCorePlugin.ECLIPSELINK_ORM_XML_CONTENT_TYPE); - } - - - @Override - protected void populateRoot(Object config) { - IDataModel dataModel = (IDataModel) config; - XmlEntityMappings entityMappings = EclipseLinkOrmFactory.eINSTANCE.createXmlEntityMappings(); - entityMappings.setVersion(dataModel.getStringProperty(VERSION)); - getResourceContents().add(entityMappings); - - String defaultAccess = (String) dataModel.getProperty(DEFAULT_ACCESS); - if (defaultAccess != null) { - XmlPersistenceUnitMetadata puMetadata = EclipseLinkOrmFactory.eINSTANCE.createXmlPersistenceUnitMetadata(); - entityMappings.setPersistenceUnitMetadata(puMetadata); - XmlPersistenceUnitDefaults puDefaults = EclipseLinkOrmFactory.eINSTANCE.createXmlPersistenceUnitDefaults(); - puMetadata.setPersistenceUnitDefaults(puDefaults); - puDefaults.setAccess(defaultAccess); - } - } -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/weave/StaticWeave.java b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/weave/StaticWeave.java deleted file mode 100644 index 84f9531c63..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/weave/StaticWeave.java +++ /dev/null @@ -1,178 +0,0 @@ -/******************************************************************************* -* Copyright (c) 2012 Oracle. All rights reserved. -* This program and the accompanying materials are made available under the -* terms of the Eclipse Public License v1.0, which accompanies this distribution -* and is available at http://www.eclipse.org/legal/epl-v10.html. -* -* Contributors: -* Oracle - initial API and implementation -*******************************************************************************/ -package org.eclipse.jpt.jpa.eclipselink.core.internal.weave; - -import java.util.ArrayList; -import java.util.List; - -import org.eclipse.core.runtime.CoreException; -import org.eclipse.core.runtime.IProgressMonitor; -import org.eclipse.jdt.core.IClasspathContainer; -import org.eclipse.jdt.core.IClasspathEntry; -import org.eclipse.jdt.core.IJavaProject; -import org.eclipse.jdt.core.JavaCore; -import org.eclipse.jdt.launching.IJavaLaunchConfigurationConstants; -import org.eclipse.jdt.launching.IRuntimeClasspathEntry; -import org.eclipse.jdt.launching.JavaRuntime; -import org.eclipse.jpt.common.core.internal.gen.AbstractJptGenerator; -import org.eclipse.jpt.common.utility.internal.StringTools; - -/** - * StaticWeave - * Running Static Weaving from Project's classpath - */ -public class StaticWeave extends AbstractJptGenerator -{ - static public String LAUNCH_CONFIG_NAME = "Static Weaving Run Config"; //$NON-NLS-1$ - static public String WEAVING_PACKAGE_NAME = "org.eclipse.persistence.tools.weaving.jpa"; //$NON-NLS-1$ - static public String WEAVING_CLASS = WEAVING_PACKAGE_NAME + ".StaticWeave"; //$NON-NLS-1$ - - private String source; - private String target; - private String loglevel; - private String persistenceinfo; - private final String mainType; - - // ********** static methods ********** - - public static void weave( - IJavaProject javaProject, - String source, - String target, - String loglevel, - String persistenceinfo, - IProgressMonitor monitor) { - - if(javaProject == null) { - throw new NullPointerException("javaProject is null"); //$NON-NLS-1$ - } - - new StaticWeave(javaProject, - source, - target, - loglevel, - persistenceinfo).generate(monitor); - } - - // ********** constructors ********** - - protected StaticWeave( - IJavaProject javaProject, - String source, - String target, - String loglevel, - String persistenceinfo) { - super(javaProject); - - this.source = source; - this.target = target; - this.loglevel = loglevel; - this.persistenceinfo = persistenceinfo; - - this.mainType = WEAVING_CLASS; - - this.setDebug(false); - } - - // ********** overrides ********** - - @Override - protected String getMainType() { - return this.mainType; - } - - @Override - protected String getLaunchConfigName() { - return LAUNCH_CONFIG_NAME; - } - - @Override - protected void specifyJRE() { - // do nothing - } - - @Override - protected void refreshProject() throws CoreException { - // do nothing - // 370895 - Static weaving results in infinite builder loop when enabled - } - - // ********** behavior ********** - - @Override - protected void preGenerate(IProgressMonitor monitor) { - // nothing to do yet... - } - - // ********** Launch Configuration Setup ********** - - @Override - protected List<String> buildClasspath() throws CoreException { - List<String> classpath = new ArrayList<String>(); - // Default Project classpath - classpath.add(this.getDefaultProjectClasspathEntry().getMemento()); - // System Library - classpath.add(this.getSystemLibraryClasspathEntry().getMemento()); - // Containers classpath - for(IRuntimeClasspathEntry containerClasspathEntry: this.getContainersClasspathEntries()) { - classpath.add(containerClasspathEntry.getMemento()); - } - return classpath; - } - - @Override - protected void specifyProgramArguments() { - StringBuffer programArguments = new StringBuffer(); - - if(StringTools.stringIsEmpty(this.source)) { - throw new RuntimeException("Source directory cannot be empty"); //$NON-NLS-1$ - } - if(StringTools.stringIsEmpty(this.target)) { - throw new RuntimeException("Target directory cannot be empty"); //$NON-NLS-1$ - } - - if( ! StringTools.stringIsEmpty(this.loglevel)) { - programArguments.append("-loglevel "); //$NON-NLS-1$ - programArguments.append(this.loglevel); - } - - if( ! StringTools.stringIsEmpty(this.persistenceinfo)) { - programArguments.append(" -persistenceinfo "); //$NON-NLS-1$ - programArguments.append(StringTools.quote(this.persistenceinfo)); - } - - programArguments.append(' '); - programArguments.append(StringTools.quote(this.source)); - - programArguments.append(' '); - programArguments.append(StringTools.quote(this.target)); - - this.launchConfig.setAttribute(IJavaLaunchConfigurationConstants.ATTR_PROGRAM_ARGUMENTS, programArguments.toString()); - } - - // ********** queries ********** - - private List<IRuntimeClasspathEntry> getContainersClasspathEntries() throws CoreException { - ArrayList<IRuntimeClasspathEntry> classpathEntries = new ArrayList<IRuntimeClasspathEntry>(); - for(IClasspathEntry classpathEntry: this.javaProject.getRawClasspath()) { - if(classpathEntry.getEntryKind() == IClasspathEntry.CPE_CONTAINER) { - IClasspathContainer container = JavaCore.getClasspathContainer(classpathEntry.getPath(), this.javaProject); - if(container != null && container.getKind() == IClasspathContainer.K_SYSTEM) { - classpathEntries.add( - JavaRuntime.newRuntimeContainerClasspathEntry( - container.getPath(), - IRuntimeClasspathEntry.BOOTSTRAP_CLASSES, - this.javaProject)); - } - } - } - return classpathEntries; - } -}
\ No newline at end of file |