diff options
Diffstat (limited to 'jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal')
241 files changed, 0 insertions, 29194 deletions
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 2403108791..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/DefaultEclipseLinkJpaValidationMessages.java +++ /dev/null @@ -1,91 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2005, 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 java.util.Locale; -import java.util.MissingResourceException; -import java.util.ResourceBundle; -import org.eclipse.jpt.common.core.utility.TextRange; -import org.eclipse.jpt.jpa.core.JptJpaCorePlugin; -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 severity, String messageId, Object targetObject) { - return buildMessage(severity, messageId, DEFAULT_PARMS, targetObject); - } - - public static IMessage buildMessage( - int severity, String messageId, String[] parms, Object targetObject) { - return buildMessage(severity, messageId, parms, targetObject, DEFAULT_TEXT_RANGE); - } - - public static IMessage buildMessage( - int severity, String messageId, Object targetObject, TextRange textRange) { - return buildMessage(severity, messageId, DEFAULT_PARMS, targetObject, textRange); - } - - public static IMessage buildMessage( - int severity, String messageId, String[] parms, Object targetObject, TextRange textRange) { - IMessage message = new EclipseLinkMessage(EclipseLinkJpaValidationMessages.BUNDLE_NAME, severity, messageId, parms, targetObject); - message.setMarkerId(JptJpaCorePlugin.VALIDATION_MARKER_ID); //TODO do we need an 'EclipseLink JPA' problem marker? - if (textRange == null) { - //log an exception and then continue without setting location information - //At least the user will still get the validation message and will - //be able to see other validation messages with valid textRanges - JptJpaCorePlugin.log(new IllegalArgumentException("Null text range for message ID: " + messageId)); //$NON-NLS-1$ - } - else { - message.setLineNo(textRange.getLineNumber()); - message.setOffset(textRange.getOffset()); - message.setLength(textRange.getLength()); - } - return message; - } - - - private DefaultEclipseLinkJpaValidationMessages() { - super(); - throw new UnsupportedOperationException(); - } - - /** - * Used so that we can find the resource bundle using this classLoader. - * Otherwise the wst validation message attempts to use the ClassLoader - * of JpaValidator which is in the org.eclipse.jpt.jpa.core plugin. - * - * Another way we could potentially solve this is to have a separate - * EclispeLinkJpaValidator and set up the extension points so that - * it only runs against jpaProjects with the EclispeLinkPlatform - * while JpaValidator runs against jpaProjects with the GenericPlatform. - * I am unsure if this is possible - */ - private static class EclipseLinkMessage extends Message { - public EclipseLinkMessage(String aBundleName, int aSeverity, String anId, String[] aParams, Object aTargetObject) { - super(aBundleName, aSeverity, anId, aParams, aTargetObject); - } - - @Override - public ResourceBundle getBundle(Locale locale, ClassLoader classLoader) { - ResourceBundle bundle = null; - try { - bundle = ResourceBundle.getBundle(getBundleName(), locale, getClass().getClassLoader()); - } catch (MissingResourceException e) { - return super.getBundle(locale, classLoader); - } - return bundle; - } - } -} 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 c0b2b266d6..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/EclipseLinkJpaAnnotationDefinitionProvider.java +++ /dev/null @@ -1,111 +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; - -import java.util.ArrayList; -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.core.resource.java.AnnotationDefinition; -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 addTypeAnnotationDefinitionsTo(ArrayList<AnnotationDefinition> definitions) { - CollectionTools.addAll(definitions, TYPE_ANNOTATION_DEFINITIONS); - } - - protected static final AnnotationDefinition[] TYPE_ANNOTATION_DEFINITIONS = new AnnotationDefinition[] { - EclipseLinkCacheAnnotationDefinition.instance(), - EclipseLinkChangeTrackingAnnotationDefinition.instance(), - EclipseLinkConverterAnnotationDefinition.instance(), - EclipseLinkCustomizerAnnotationDefinition.instance(), - EclipseLinkExistenceCheckingAnnotationDefinition.instance(), - EclipseLinkObjectTypeConverterAnnotationDefinition.instance(), - EclipseLinkPrimaryKeyAnnotationDefinition.instance(), - EclipseLinkReadOnlyAnnotationDefinition.instance(), - EclipseLinkStructConverterAnnotationDefinition.instance(), - EclipseLinkTypeConverterAnnotationDefinition.instance() - }; - - @Override - protected void addTypeMappingAnnotationDefinitionsTo(ArrayList<AnnotationDefinition> definitions) { - // nothing new for EclipseLink - } - - @Override - protected void addAttributeAnnotationDefinitionsTo(ArrayList<AnnotationDefinition> definitions) { - CollectionTools.addAll(definitions, ATTRIBUTE_ANNOTATION_DEFINITIONS); - } - - protected static final AnnotationDefinition[] ATTRIBUTE_ANNOTATION_DEFINITIONS = new AnnotationDefinition[] { - EclipseLinkBasicCollectionAnnotationDefinition.instance(), - EclipseLinkBasicMapAnnotationDefinition.instance(), - EclipseLinkConvertAnnotationDefinition.instance(), - EclipseLinkConverterAnnotationDefinition.instance(), - EclipseLinkJoinFetchAnnotationDefinition.instance(), - EclipseLinkMutableAnnotationDefinition.instance(), - EclipseLinkObjectTypeConverterAnnotationDefinition.instance(), - EclipseLinkPrivateOwnedAnnotationDefinition.instance(), - EclipseLinkReadTransformerAnnotationDefinition.instance(), - EclipseLinkStructConverterAnnotationDefinition.instance(), - EclipseLinkTransformationAnnotationDefinition.instance(), - EclipseLinkTypeConverterAnnotationDefinition.instance(), - EclipseLinkVariableOneToOneAnnotationDefinition.instance(), - EclipseLinkWriteTransformerAnnotationDefinition.instance() - }; - - @Override - protected void addPackageAnnotationDefinitionsTo(ArrayList<AnnotationDefinition> definitions) { - // no package annotations - } -} 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 4f9365fa98..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/EclipseLinkJpaFactory.java +++ /dev/null @@ -1,139 +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; - -import org.eclipse.jpt.jpa.core.JpaProject; -import org.eclipse.jpt.jpa.core.context.PersistentType; -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.JavaResourcePersistentAttribute; -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.JavaEclipseLinkPersistentAttribute; -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, JavaResourcePersistentAttribute jrpa) { - return new JavaEclipseLinkPersistentAttribute(parent, jrpa); - } - - @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/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 c48c099f14..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/EclipseLinkJpaPlatformFactory.java +++ /dev/null @@ -1,91 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2007, 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.jpt.jpa.core.JpaAnnotationProvider; -import org.eclipse.jpt.jpa.core.JpaFacet; -import org.eclipse.jpt.jpa.core.JpaPlatform; -import org.eclipse.jpt.jpa.core.JpaPlatformFactory; -import org.eclipse.jpt.jpa.core.JpaPlatformVariation; -import org.eclipse.jpt.jpa.core.internal.GenericJpaAnnotationDefinitionProvider; -import org.eclipse.jpt.jpa.core.internal.GenericJpaAnnotationProvider; -import org.eclipse.jpt.jpa.core.internal.GenericJpaPlatform; -import org.eclipse.jpt.jpa.core.internal.GenericJpaPlatformFactory.SimpleVersion; -import org.eclipse.jpt.jpa.eclipselink.core.JptJpaEclipseLinkCorePlugin; - -/** - * 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(), - buildJpaAnnotationProvider(), - EclipseLinkJpaPlatformProvider.instance(), - buildJpaPlatformVariation()); - } - - private JpaPlatform.Version buildJpaVersion() { - return new EclipseLinkVersion( - JptJpaEclipseLinkCorePlugin.ECLIPSELINK_PLATFORM_VERSION_1_0, - JpaFacet.VERSION_1_0.getVersionString()); - } - - protected JpaAnnotationProvider buildJpaAnnotationProvider() { - return new GenericJpaAnnotationProvider( - GenericJpaAnnotationDefinitionProvider.instance(), - EclipseLinkJpaAnnotationDefinitionProvider.instance()); - } - - protected JpaPlatformVariation buildJpaPlatformVariation() { - return new JpaPlatformVariation() { - public Supported getTablePerConcreteClassInheritanceIsSupported() { - return Supported.NO; - } - public boolean isJoinTableOverridable() { - return false; - } - }; - } - - - 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; - } - - @Override - public String toString() { - return super.toString() + " EclipseLink version: " + this.getVersion(); //$NON-NLS-1$ - } - } - -} 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 17cdff696d..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, 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 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.JavaEmbeddableDefinition; -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.JavaEntityDefinition; -import org.eclipse.jpt.jpa.core.internal.context.java.JavaMappedSuperclassDefinition; -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.JavaEclipseLinkBasicCollectionMappingDefinition; -import org.eclipse.jpt.jpa.eclipselink.core.internal.context.java.JavaEclipseLinkBasicMapMappingDefinition; -import org.eclipse.jpt.jpa.eclipselink.core.internal.context.java.JavaEclipseLinkBasicMappingDefinition; -import org.eclipse.jpt.jpa.eclipselink.core.internal.context.java.JavaEclipseLinkIdMappingDefinition; -import org.eclipse.jpt.jpa.eclipselink.core.internal.context.java.JavaEclipseLinkManyToManyMappingDefinition; -import org.eclipse.jpt.jpa.eclipselink.core.internal.context.java.JavaEclipseLinkManyToOneMappingDefinition; -import org.eclipse.jpt.jpa.eclipselink.core.internal.context.java.JavaEclipseLinkOneToManyMappingDefinition; -import org.eclipse.jpt.jpa.eclipselink.core.internal.context.java.JavaEclipseLinkOneToOneMappingDefinition; -import org.eclipse.jpt.jpa.eclipselink.core.internal.context.java.JavaEclipseLinkTransformationMappingDefinition; -import org.eclipse.jpt.jpa.eclipselink.core.internal.context.java.JavaEclipseLinkVariableOneToOneMappingDefinition; -import org.eclipse.jpt.jpa.eclipselink.core.internal.context.java.JavaEclipseLinkVersionMappingDefinition; -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[] { - JavaEntityDefinition.instance(), - JavaEmbeddableDefinition.instance(), - JavaMappedSuperclassDefinition.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(), - JavaEclipseLinkOneToManyMappingDefinition.instance(), - JavaEclipseLinkOneToOneMappingDefinition.instance(), - JavaEclipseLinkVariableOneToOneMappingDefinition.instance(), - JavaEclipseLinkBasicMappingDefinition.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(), - JavaEclipseLinkBasicCollectionMappingDefinition.instance(), - JavaEclipseLinkBasicMapMappingDefinition.instance(), - JavaEclipseLinkIdMappingDefinition.instance(), - JavaEclipseLinkVersionMappingDefinition.instance(), - JavaEclipseLinkBasicMappingDefinition.instance(), - JavaEmbeddedMappingDefinition.instance(), - JavaEmbeddedIdMappingDefinition.instance(), - JavaEclipseLinkTransformationMappingDefinition.instance(), - JavaEclipseLinkManyToManyMappingDefinition.instance(), - JavaEclipseLinkManyToOneMappingDefinition.instance(), - JavaEclipseLinkOneToManyMappingDefinition.instance(), - JavaEclipseLinkOneToOneMappingDefinition.instance(), - JavaEclipseLinkVariableOneToOneMappingDefinition.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 2caf06cbb0..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/EclipseLinkJpaValidationMessages.java +++ /dev/null @@ -1,46 +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; - -@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 CONVERTER_DUPLICATE_NAME = "CONVERTER_DUPLICATE_NAME"; - - public static final String CONVERTER_NAME_UNDEFINED = "CONVERTER_NAME_UNDEFINED"; - - public static final String CONVERTER_CLASS_EXISTS = "CONVERTER_CLASS_EXISTS"; - - public static final String CONVERTER_CLASS_DEFINED = "CONVERTER_CLASS_DEFINED"; - - public static final String CUSTOMIZER_CLASS_IMPLEMENTS_DESCRIPTOR_CUSTOMIZER = "CUSTOMIZER_CLASS_IMPLEMENTS_DESCRIPTOR_CUSTOMIZER"; - - 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 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 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"; - -} 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/JptEclipseLinkCoreMessages.java b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/JptEclipseLinkCoreMessages.java deleted file mode 100644 index 64f77b9e03..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/JptEclipseLinkCoreMessages.java +++ /dev/null @@ -1,34 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010 Oracle. - * All rights reserved. This program and the accompanying materials are - * made available under the terms of the Eclipse Public License v1.0 which - * accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Oracle - initial API and implementation - *******************************************************************************/ -package org.eclipse.jpt.jpa.eclipselink.core.internal; - -import org.eclipse.osgi.util.NLS; - -/** - * Localized messages used by Dali eclipselink core. - */ -public class JptEclipseLinkCoreMessages -{ - public static String EclipseLinkLibraryValidator_noEclipseLinkVersion; - public static String EclipseLinkLibraryValidator_multipleEclipseLinkVersions; - public static String EclipseLinkLibraryValidator_improperEclipseLinkVersion; - - - private static final String BUNDLE_NAME = "jpt_eclipselink_core"; //$NON-NLS-1$ - private static final Class<?> BUNDLE_CLASS = JptEclipseLinkCoreMessages.class; - static { - NLS.initializeMessages(BUNDLE_NAME, BUNDLE_CLASS); - } - - private JptEclipseLinkCoreMessages() { - throw new UnsupportedOperationException(); - } -} 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 6d4ffac8f1..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.v2_0.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/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 7e4785f2d4..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,137 +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.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 ********** - - public EclipseLinkTimeOfDayAnnotation getTimeOfDayAnnotation() { - return this.todAnnotation; - } - - - // ********** validation ********** - - public TextRange getValidationTextRange(CompilationUnit astRoot) { - return this.todAnnotation.getTextRange(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 02d43ef7d1..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,50 +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.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.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.resource.java.EclipseLinkBasicCollectionAnnotation; - -public class JavaEclipseLinkBasicCollectionMapping - extends AbstractJavaAttributeMapping<EclipseLinkBasicCollectionAnnotation> - implements EclipseLinkBasicCollectionMapping -{ - - public JavaEclipseLinkBasicCollectionMapping(JavaPersistentAttribute parent) { - super(parent); - } - - public String getKey() { - return EclipseLinkMappingKeys.BASIC_COLLECTION_ATTRIBUTE_MAPPING_KEY; - } - - @Override - protected String getAnnotationName() { - return EclipseLinkBasicCollectionAnnotation.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; - } -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/java/JavaEclipseLinkBasicCollectionMappingDefinition.java b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/java/JavaEclipseLinkBasicCollectionMappingDefinition.java deleted file mode 100644 index 5ff177adb0..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/java/JavaEclipseLinkBasicCollectionMappingDefinition.java +++ /dev/null @@ -1,66 +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.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 JavaEclipseLinkBasicCollectionMappingDefinition - implements JavaAttributeMappingDefinition -{ - // singleton - private static final JavaAttributeMappingDefinition INSTANCE = new JavaEclipseLinkBasicCollectionMappingDefinition(); - - /** - * Return the singleton. - */ - public static JavaAttributeMappingDefinition instance() { - return INSTANCE; - } - - - /** - * Enforce singleton usage - */ - private JavaEclipseLinkBasicCollectionMappingDefinition() { - 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.getResourcePersistentAttribute().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/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 b96b46292d..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,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.java; - -import java.util.ArrayList; -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.resource.java.EclipseLinkBasicMapAnnotation; - -public class JavaEclipseLinkBasicMapMapping - extends AbstractJavaAttributeMapping<EclipseLinkBasicMapAnnotation> - implements EclipseLinkBasicMapMapping -{ - - public JavaEclipseLinkBasicMapMapping(JavaPersistentAttribute parent) { - super(parent); - } - - 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/JavaEclipseLinkBasicMapMappingDefinition.java b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/java/JavaEclipseLinkBasicMapMappingDefinition.java deleted file mode 100644 index b4806fd131..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/java/JavaEclipseLinkBasicMapMappingDefinition.java +++ /dev/null @@ -1,66 +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.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 JavaEclipseLinkBasicMapMappingDefinition - implements JavaAttributeMappingDefinition -{ - // singleton - private static final JavaAttributeMappingDefinition INSTANCE = new JavaEclipseLinkBasicMapMappingDefinition(); - - /** - * Return the singleton. - */ - public static JavaAttributeMappingDefinition instance() { - return INSTANCE; - } - - - /** - * Enforce singleton usage - */ - private JavaEclipseLinkBasicMapMappingDefinition() { - 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.getResourcePersistentAttribute().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/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 da41f55e9d..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,79 +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.java; - -import java.util.List; -import org.eclipse.jdt.core.dom.CompilationUnit; -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.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.wst.validation.internal.provisional.core.IMessage; -import org.eclipse.wst.validation.internal.provisional.core.IReporter; - -public class JavaEclipseLinkBasicMapping - extends AbstractJavaBasicMapping - implements EclipseLinkBasicMapping -{ - protected final JavaEclipseLinkMutable mutable; - - - public JavaEclipseLinkBasicMapping(JavaPersistentAttribute parent) { - super(parent); - this.mutable = new JavaEclipseLinkMutable(this); - } - - - // ********** synchronize/update ********** - - @Override - public void synchronizeWithResourceModel() { - super.synchronizeWithResourceModel(); - this.mutable.synchronizeWithResourceModel(); - } - - @Override - public void update() { - super.update(); - this.mutable.update(); - } - - - // ********** mutable ********** - - public EclipseLinkMutable getMutable() { - return this.mutable; - } - - - // ********** 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/JavaEclipseLinkBasicMappingDefinition.java b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/java/JavaEclipseLinkBasicMappingDefinition.java deleted file mode 100644 index 200024b762..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/java/JavaEclipseLinkBasicMappingDefinition.java +++ /dev/null @@ -1,56 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.eclipselink.core.internal.context.java; - -import org.eclipse.jpt.common.utility.internal.ArrayTools; -import org.eclipse.jpt.common.utility.internal.iterables.ArrayIterable; -import org.eclipse.jpt.jpa.core.context.java.DefaultJavaAttributeMappingDefinition; -import org.eclipse.jpt.jpa.core.internal.context.java.AbstractJavaBasicMappingDefinition; -import org.eclipse.jpt.jpa.eclipselink.core.resource.java.EclipseLinkConvertAnnotation; -import org.eclipse.jpt.jpa.eclipselink.core.resource.java.EclipseLinkMutableAnnotation; - -public class JavaEclipseLinkBasicMappingDefinition - extends AbstractJavaBasicMappingDefinition -{ - // singleton - private static final DefaultJavaAttributeMappingDefinition INSTANCE = new JavaEclipseLinkBasicMappingDefinition(); - - /** - * Return the singleton. - */ - public static DefaultJavaAttributeMappingDefinition instance() { - return INSTANCE; - } - - - /** - * Enforce singleton usage - */ - private JavaEclipseLinkBasicMappingDefinition() { - super(); - } - - @Override - public Iterable<String> getSupportingAnnotationNames() { - return COMBINED_SUPPORTING_ANNOTATION_NAMES; - } - - // the EclipseLink Id and Version mappings also support these annotations - public static final String[] ECLIPSE_LINK_SUPPORTING_ANNOTATION_NAMES_ARRAY = new String[] { - EclipseLinkMutableAnnotation.ANNOTATION_NAME, - EclipseLinkConvertAnnotation.ANNOTATION_NAME, - }; - - protected static final String[] COMBINED_SUPPORTING_ANNOTATION_NAMES_ARRAY = ArrayTools.concatenate( - SUPPORTING_ANNOTATION_NAMES_ARRAY, - ECLIPSE_LINK_SUPPORTING_ANNOTATION_NAMES_ARRAY - ); - protected static final Iterable<String> COMBINED_SUPPORTING_ANNOTATION_NAMES = new ArrayIterable<String>(COMBINED_SUPPORTING_ANNOTATION_NAMES_ARRAY); -} 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 8996a90093..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,603 +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.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.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.core.resource.java.JavaResourcePersistentType; -import org.eclipse.jpt.jpa.eclipselink.core.context.EclipseLinkCacheCoordinationType; -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.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; - - - 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(); - } - - - // ********** 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(); - } - - @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() { - 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() { - 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() { - return 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); - } - - - // ********** cache annotation ********** - - protected EclipseLinkCacheAnnotation getCacheAnnotation() { - return (EclipseLinkCacheAnnotation) this.getResourcePersistentType().getNonNullAnnotation(this.getCacheAnnotationName()); - } - - protected String getCacheAnnotationName() { - return EclipseLinkCacheAnnotation.ANNOTATION_NAME; - } - - - // ********** existence checking annotation ********** - - protected EclipseLinkExistenceCheckingAnnotation getExistenceCheckingAnnotation() { - return (EclipseLinkExistenceCheckingAnnotation) this.getResourcePersistentType().getAnnotation(this.getExistenceCheckingAnnotationName()); - } - - protected EclipseLinkExistenceCheckingAnnotation addExistenceCheckingAnnotation() { - return (EclipseLinkExistenceCheckingAnnotation) this.getResourcePersistentType().addAnnotation(this.getExistenceCheckingAnnotationName()); - } - - protected void removeExistenceCheckingAnnotation() { - this.getResourcePersistentType().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 JavaResourcePersistentType getResourcePersistentType() { - return this.getTypeMapping().getResourcePersistentType(); - } - - - // ********** 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 aeddeb1e4b..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,138 +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.java; - -import org.eclipse.jdt.core.dom.CompilationUnit; -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.core.resource.java.JavaResourcePersistentType; -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.getResourcePersistentType().getAnnotation(this.getChangeTrackingAnnotationName()); - } - - protected EclipseLinkChangeTrackingAnnotation addChangeTrackingAnnotation() { - return (EclipseLinkChangeTrackingAnnotation) this.getResourcePersistentType().addAnnotation(this.getChangeTrackingAnnotationName()); - } - - protected void removeChangeTrackingAnnotation() { - this.getResourcePersistentType().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 JavaResourcePersistentType getResourcePersistentType() { - return this.getPersistentType().getResourcePersistentType(); - } - - - // ********** validation ********** - - public TextRange getValidationTextRange(CompilationUnit astRoot) { - EclipseLinkChangeTrackingAnnotation annotation = this.getChangeTrackingAnnotation(); - TextRange textRange = (annotation == null) ? null : annotation.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/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 aa585cb45c..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,140 +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.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.CollectionTools; -import org.eclipse.jpt.common.utility.internal.HashBag; -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.internal.DefaultEclipseLinkJpaValidationMessages; -import org.eclipse.jpt.jpa.eclipselink.core.internal.EclipseLinkJpaValidationMessages; -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; - } - - protected TextRange getDataValueTextRange(CompilationUnit astRoot) { - return this.conversionValueAnnotation.getDataValueTextRange(astRoot); - } - - protected TextRange getObjectValueTextRange(CompilationUnit astRoot) { - return this.conversionValueAnnotation.getObjectValueTextRange(astRoot); - } - - - // ********** validation ********** - - @Override - public void validate(List<IMessage> messages, IReporter reporter, CompilationUnit astRoot) { - super.validate(messages, reporter, astRoot); - this.validateDataValuesUnique(messages, astRoot); - } - - protected void validateDataValuesUnique(List<IMessage> messages, CompilationUnit astRoot) { - HashBag<String> dataValues = CollectionTools.bag(this.getObjectTypeConverter().getDataValues(), this.getObjectTypeConverter().getDataValuesSize()); - if (dataValues.count(this.dataValue) > 1) { - messages.add( - DefaultEclipseLinkJpaValidationMessages.buildMessage( - IMessage.HIGH_SEVERITY, - EclipseLinkJpaValidationMessages.MULTIPLE_OBJECT_VALUES_FOR_DATA_VALUE, - new String[] {this.dataValue}, - this, - this.getDataValueTextRange(astRoot) - ) - ); - } - } - - public TextRange getValidationTextRange(CompilationUnit astRoot) { - return this.conversionValueAnnotation.getTextRange(astRoot); - } -} 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 1d3a2a1cd9..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,357 +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.java; - -import java.util.Iterator; -import java.util.List; -import org.eclipse.jdt.core.dom.CompilationUnit; -import org.eclipse.jpt.common.core.utility.TextRange; -import org.eclipse.jpt.common.utility.Filter; -import org.eclipse.jpt.common.utility.internal.ArrayTools; -import org.eclipse.jpt.common.utility.internal.Association; -import org.eclipse.jpt.common.utility.internal.SimpleAssociation; -import org.eclipse.jpt.common.utility.internal.StringTools; -import org.eclipse.jpt.common.utility.internal.iterables.ArrayIterable; -import org.eclipse.jpt.common.utility.internal.iterators.FilteringIterator; -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.jpa1.context.java.AbstractJavaConverter; -import org.eclipse.jpt.jpa.core.resource.java.Annotation; -import org.eclipse.jpt.jpa.core.resource.java.JavaResourcePersistentAttribute; -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.internal.DefaultEclipseLinkJpaValidationMessages; -import org.eclipse.jpt.jpa.eclipselink.core.internal.EclipseLinkJpaValidationMessages; -import org.eclipse.jpt.jpa.eclipselink.core.internal.context.persistence.EclipseLinkPersistenceUnit; -import org.eclipse.jpt.jpa.eclipselink.core.resource.java.EclipseLinkConvertAnnotation; -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; - -public class JavaEclipseLinkConvert - extends AbstractJavaConverter - implements EclipseLinkConvert -{ - private final EclipseLinkConvertAnnotation convertAnnotation; - - private String specifiedConverterName; - private String defaultConverterName; - - private JavaEclipseLinkConverter<?> converter; - - - protected static final JavaEclipseLinkConverter.Adapter[] CONVERTER_ADAPTER_ARRAY = new JavaEclipseLinkConverter.Adapter[] { - JavaEclipseLinkCustomConverter.Adapter.instance(), - JavaEclipseLinkTypeConverter.Adapter.instance(), - JavaEclipseLinkObjectTypeConverter.Adapter.instance(), - JavaEclipseLinkStructConverter.Adapter.instance() - }; - protected static final Iterable<JavaEclipseLinkConverter.Adapter> CONVERTER_ADAPTERS = new ArrayIterable<JavaEclipseLinkConverter.Adapter>(CONVERTER_ADAPTER_ARRAY); - - - public JavaEclipseLinkConvert(JavaAttributeMapping parent, EclipseLinkConvertAnnotation convertAnnotation) { - super(parent); - this.convertAnnotation = convertAnnotation; - this.specifiedConverterName = convertAnnotation.getValue(); - this.converter = this.buildConverter(); - } - - - // ********** synchronize/update ********** - - @Override - public void synchronizeWithResourceModel() { - super.synchronizeWithResourceModel(); - this.setSpecifiedConverterName_(this.convertAnnotation.getValue()); - this.syncConverter(); - } - - @Override - public void update() { - super.update(); - this.setDefaultConverterName(this.buildDefaultConverterName()); - if (this.converter != null) { - this.converter.update(); - } - } - - - // ********** 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; - } - - - // ********** converter ********** - - public JavaEclipseLinkConverter<?> getConverter() { - return this.converter; - } - - public void setConverter(Class<? extends EclipseLinkConverter> converterType) { - if (converterType == null) { - if (this.converter != null) { - this.setConverter_(null); - this.retainConverterAnnotation(null); - } - } else { - if ((this.converter == null) || (this.converter.getType() != converterType)) { - JavaEclipseLinkConverter.Adapter converterAdapter = this.getConverterAdapter(converterType); - this.retainConverterAnnotation(converterAdapter); - this.setConverter_(converterAdapter.buildNewConverter(this.getResourcePersistentAttribute(), this)); - } - } - } - - protected void setConverter_(JavaEclipseLinkConverter<?> converter) { - JavaEclipseLinkConverter<?> old = this.converter; - this.converter = converter; - this.firePropertyChanged(CONVERTER_PROPERTY, old, converter); - } - - protected JavaEclipseLinkConverter<?> buildConverter() { - JavaResourcePersistentAttribute resourceAttribute = this.getResourcePersistentAttribute(); - for (JavaEclipseLinkConverter.Adapter adapter : this.getConverterAdapters()) { - JavaEclipseLinkConverter<?> javaConverter = adapter.buildConverter(resourceAttribute, this); - if (javaConverter != null) { - return javaConverter; - } - } - return null; - } - - /** - * 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(JavaEclipseLinkConverter.Adapter converterAdapter) { - JavaResourcePersistentAttribute resourceAttribute = this.getResourcePersistentAttribute(); - for (JavaEclipseLinkConverter.Adapter adapter : this.getConverterAdapters()) { - if (adapter != converterAdapter) { - adapter.removeConverterAnnotation(resourceAttribute); - } - } - } - - protected void syncConverter() { - Association<JavaEclipseLinkConverter.Adapter, EclipseLinkNamedConverterAnnotation> assoc = this.getEclipseLinkConverterAnnotation(); - if (assoc == null) { - if (this.converter != null) { - this.setConverter_(null); - } - } else { - JavaEclipseLinkConverter.Adapter adapter = assoc.getKey(); - EclipseLinkNamedConverterAnnotation annotation = assoc.getValue(); - if ((this.converter != null) && - (this.converter.getType() == adapter.getConverterType()) && - (this.converter.getConverterAnnotation() == annotation)) { - this.converter.synchronizeWithResourceModel(); - } else { - this.setConverter_(adapter.buildConverter(annotation, this)); - } - } - } - - /** - * Return the first EclipseLink converter annotation we find along with its - * corresponding adapter. Return <code>null</code> if there are no - * converter annotations. - */ - protected Association<JavaEclipseLinkConverter.Adapter, EclipseLinkNamedConverterAnnotation> getEclipseLinkConverterAnnotation() { - JavaResourcePersistentAttribute resourceAttribute = this.getResourcePersistentAttribute(); - for (JavaEclipseLinkConverter.Adapter adapter : this.getConverterAdapters()) { - EclipseLinkNamedConverterAnnotation annotation = adapter.getConverterAnnotation(resourceAttribute); - if (annotation != null) { - return new SimpleAssociation<JavaEclipseLinkConverter.Adapter, EclipseLinkNamedConverterAnnotation>(adapter, annotation); - } - } - return null; - } - - - // ********** converter adapters ********** - - /** - * Return the converter adapter for the specified converter type. - */ - protected JavaEclipseLinkConverter.Adapter getConverterAdapter(Class<? extends EclipseLinkConverter> converterType) { - for (JavaEclipseLinkConverter.Adapter adapter : this.getConverterAdapters()) { - if (adapter.getConverterType() == converterType) { - return adapter; - } - } - throw new IllegalArgumentException("unknown converter type: " + converterType.getName()); //$NON-NLS-1$ - } - - protected Iterable<JavaEclipseLinkConverter.Adapter> getConverterAdapters() { - return CONVERTER_ADAPTERS; - } - - - // ********** misc ********** - - public Class<? extends Converter> getType() { - return EclipseLinkConvert.class; - } - - @Override - protected String getAnnotationName() { - return EclipseLinkConvertAnnotation.ANNOTATION_NAME; - } - - @Override - public void dispose() { - super.dispose(); - this.setConverter(null); - } - - - // ********** Java completion proposals ********** - - @Override - public Iterator<String> javaCompletionProposals(int pos, Filter<String> filter, CompilationUnit astRoot) { - Iterator<String> result = super.javaCompletionProposals(pos, filter, astRoot); - if (result != null) { - return result; - } - if (this.convertValueTouches(pos, astRoot)) { - result = this.javaCandidateConverterNames(filter); - if (result != null) { - return result; - } - } - return null; - } - - protected boolean convertValueTouches(int pos, CompilationUnit astRoot) { - return this.convertAnnotation.valueTouches(pos, astRoot); - } - - protected Iterator<String> javaCandidateConverterNames(Filter<String> filter) { - return StringTools.convertToJavaStringLiterals(this.candidateConverterNames(filter)); - } - - protected Iterator<String> candidateConverterNames(Filter<String> filter) { - return new FilteringIterator<String>(this.converterNames(), filter); - } - - protected Iterator<String> converterNames() { - return this.getEclipseLinkPersistenceUnit().getUniqueConverterNames().iterator(); - } - - protected EclipseLinkPersistenceUnit getEclipseLinkPersistenceUnit() { - return (EclipseLinkPersistenceUnit) this.getPersistenceUnit(); - } - - - // ********** validation ********** - - @Override - public void validate(List<IMessage> messages, IReporter reporter, CompilationUnit astRoot) { - super.validate(messages, reporter, astRoot); - if (this.converter != null) { - this.converter.validate(messages, reporter, astRoot); - } - this.validateConvertValue(messages, astRoot); - } - - private void validateConvertValue(List<IMessage> messages, CompilationUnit astRoot) { - String converterName = this.getConverterName(); - if (converterName == null) { - return; - } - - for (Iterator<EclipseLinkConverter> converters = this.getEclipseLinkPersistenceUnit().allConverters(); converters.hasNext(); ) { - if (converterName.equals(converters.next().getName())) { - return; - } - } - - if (ArrayTools.contains(RESERVED_CONVERTER_NAMES, converterName)) { - return; - } - - messages.add( - DefaultEclipseLinkJpaValidationMessages.buildMessage( - IMessage.HIGH_SEVERITY, - EclipseLinkJpaValidationMessages.ID_MAPPING_UNRESOLVED_CONVERTER_NAME, - new String[] {converterName, this.getParent().getName()}, - this.getParent(), - this.getValidationTextRange(astRoot) - ) - ); - } - - public TextRange getValidationTextRange(CompilationUnit astRoot) { - return this.convertAnnotation.getTextRange(astRoot); - } - - - // ********** 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); - } - } -} 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 bcc7117880..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,257 +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.java; - -import java.util.ArrayList; -import java.util.List; -import java.util.ListIterator; -import org.eclipse.jdt.core.dom.CompilationUnit; -import org.eclipse.jpt.common.core.utility.TextRange; -import org.eclipse.jpt.common.utility.internal.ClassName; -import org.eclipse.jpt.common.utility.internal.StringTools; -import org.eclipse.jpt.jpa.core.context.java.JavaJpaContextNode; -import org.eclipse.jpt.jpa.core.internal.context.java.AbstractJavaJpaContextNode; -import org.eclipse.jpt.jpa.core.resource.java.JavaResourcePersistentMember; -import org.eclipse.jpt.jpa.eclipselink.core.context.EclipseLinkConverter; -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.persistence.EclipseLinkPersistenceUnit; -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; - -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(); - this.getPersistenceUnit().addConverter(this); - } - - - // ********** 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 ********** - - 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 ********** - - public boolean overrides(EclipseLinkConverter converter) { - // java is at the base of the tree - return false; - } - - public boolean duplicates(EclipseLinkConverter converter) { - return (this != converter) && - ! StringTools.stringIsEmpty(this.name) && - this.name.equals(converter.getName()) && - ! this.overrides(converter) && - ! converter.overrides(this); - } - - public TextRange getValidationTextRange(CompilationUnit astRoot) { - return this.converterAnnotation.getTextRange(astRoot); - } - - - // ********** adapter ********** - - /** - * This interface allows a client to interact with various - * EclipseLink Java converters via the same protocol. - */ - public interface Adapter - { - /** - * Return the type of converter handled by the adapter. - */ - Class<? extends EclipseLinkConverter> getConverterType(); - - /** - * Build a converter corresponding to the specified Java resource - * persistent member if the member is modified by the adapter's - * converter annotation. Return <code>null</code> otherwise. - * This is used to build a converter during construction of the - * converter's parent. - */ - JavaEclipseLinkConverter<? extends EclipseLinkNamedConverterAnnotation> buildConverter(JavaResourcePersistentMember javaResourcePersistentMember, JavaJpaContextNode parent); - - /** - * Return the adapter's converter annotation for the specified Java - * resource persistent member. - * Return <code>null</code> if the adapter's converter annotation is - * missing. - * The returned converter annotation is compared to the parent's - * converter's converter annotation while the context model is synchronized - * with the resource model. If it has changed, the parent will build - * a new converter (via the adapter). - * - * @see #buildConverter(EclipseLinkNamedConverterAnnotation, JavaJpaContextNode) - */ - EclipseLinkNamedConverterAnnotation getConverterAnnotation(JavaResourcePersistentMember javaResourcePersistentMember); - - /** - * Build a converter using the specified converter annotation. - * This is used when the context model is synchronized with the - * resource model (and the resource model has changed). - * - * @see #getConverterAnnotation(JavaResourcePersistentMember) - */ - JavaEclipseLinkConverter<? extends EclipseLinkNamedConverterAnnotation> buildConverter(EclipseLinkNamedConverterAnnotation converterAnnotation, JavaJpaContextNode parent); - - /** - * Build a new converter and, if necessary, its corresponding converter - * annotation. - */ - JavaEclipseLinkConverter<? extends EclipseLinkNamedConverterAnnotation> buildNewConverter(JavaResourcePersistentMember javaResourcePersistentMember, JavaJpaContextNode parent); - - /** - * Remove the adapter's converter annotation from the specified - * Java resource persistent member. - */ - void removeConverterAnnotation(JavaResourcePersistentMember javaResourcePersistentMember); - } - - - // ********** abstract adapter ********** - - public abstract static class AbstractAdapter - implements JavaEclipseLinkConverter.Adapter - { - public JavaEclipseLinkConverter<? extends EclipseLinkNamedConverterAnnotation> buildConverter(JavaResourcePersistentMember member, JavaJpaContextNode parent) { - EclipseLinkNamedConverterAnnotation annotation = this.getConverterAnnotation(member); - return (annotation == null) ? null : this.buildConverter(annotation, parent); - } - - public EclipseLinkNamedConverterAnnotation getConverterAnnotation(JavaResourcePersistentMember member) { - return (EclipseLinkNamedConverterAnnotation) member.getAnnotation(this.getAnnotationName()); - } - - protected abstract String getAnnotationName(); - - public JavaEclipseLinkConverter<? extends EclipseLinkNamedConverterAnnotation> buildNewConverter(JavaResourcePersistentMember member, JavaJpaContextNode parent) { - return this.buildConverter(this.buildConverterAnnotationIfNecessary(member), parent); - } - - protected EclipseLinkNamedConverterAnnotation buildConverterAnnotationIfNecessary(JavaResourcePersistentMember member) { - // the annotation may already be present, after we remove the other converter annotations - EclipseLinkNamedConverterAnnotation annotation = this.getConverterAnnotation(member); - return (annotation != null) ? annotation : this.buildConverterAnnotation(member); - } - - protected EclipseLinkNamedConverterAnnotation buildConverterAnnotation(JavaResourcePersistentMember member) { - return (EclipseLinkNamedConverterAnnotation) member.addAnnotation(this.getAnnotationName()); - } - - public void removeConverterAnnotation(JavaResourcePersistentMember member) { - member.removeAnnotation(this.getAnnotationName()); - } - - @Override - public String toString() { - return StringTools.buildToStringFor(this, ClassName.getSimpleName(this.getAnnotationName())); - } - } - - public TextRange getNameTextRange(CompilationUnit astRoot){ - return getConverterAnnotation().getNameTextRange(astRoot); - } - - @Override - public void validate(List<IMessage> messages, IReporter reporter, CompilationUnit astRoot) { - super.validate(messages, reporter, astRoot); - this.validateConverterNames(messages, astRoot); - } - - protected void validateConverterNames(List<IMessage> messages, CompilationUnit astRoot){ - String name = this.getName(); - if (StringTools.stringIsEmpty(name)) { - messages.add( - DefaultEclipseLinkJpaValidationMessages.buildMessage( - IMessage.HIGH_SEVERITY, - EclipseLinkJpaValidationMessages.CONVERTER_NAME_UNDEFINED, - new String[] {}, - this, - this.getNameTextRange(astRoot) - )); - } else { - List<String> reportedNames = new ArrayList<String>(); - for (ListIterator<EclipseLinkConverter> globalConverters = this.getPersistenceUnit ().allConverters(); globalConverters.hasNext(); ) { - if ( this.duplicates( globalConverters.next()) && !reportedNames.contains(name)){ - messages.add( - DefaultEclipseLinkJpaValidationMessages.buildMessage( - IMessage.HIGH_SEVERITY, - EclipseLinkJpaValidationMessages.CONVERTER_DUPLICATE_NAME, - new String[] {name}, - this, - this.getNameTextRange(astRoot) - )); - reportedNames.add(name); - } - } - } - } -} 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 2c0f2d54a7..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,340 +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.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.core.context.java.JavaTypeMapping; -import org.eclipse.jpt.jpa.core.internal.context.java.AbstractJavaJpaContextNode; -import org.eclipse.jpt.jpa.core.resource.java.JavaResourcePersistentType; -import org.eclipse.jpt.jpa.eclipselink.core.context.java.JavaEclipseLinkConverterContainer; -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; - -public class JavaEclipseLinkConverterContainerImpl - extends AbstractJavaJpaContextNode - implements JavaEclipseLinkConverterContainer -{ - protected JavaEclipseLinkCustomConverter customConverter; - protected JavaEclipseLinkObjectTypeConverter objectTypeConverter; - protected JavaEclipseLinkStructConverter structConverter; - protected JavaEclipseLinkTypeConverter typeConverter; - - - public JavaEclipseLinkConverterContainerImpl(JavaTypeMapping parent) { - super(parent); - this.customConverter = this.buildCustomConverter(); - this.objectTypeConverter = this.buildObjectTypeConverter(); - this.structConverter = this.buildStructConverter(); - this.typeConverter = this.buildTypeConverter(); - } - - - // ********** synchronize/update ********** - - @Override - public void synchronizeWithResourceModel() { - super.synchronizeWithResourceModel(); - this.syncCustomConverter(); - this.syncObjectTypeConverter(); - this.syncStructConverter(); - this.syncTypeConverter(); - } - - @Override - public void update() { - super.update(); - if (this.customConverter != null) { - this.customConverter.update(); - } - if (this.objectTypeConverter != null) { - this.objectTypeConverter.update(); - } - if (this.structConverter != null) { - this.structConverter.update(); - } - if (this.typeConverter != null) { - this.typeConverter.update(); - } - } - - - // ********** custom converter ********** - - public JavaEclipseLinkCustomConverter getCustomConverter() { - return this.customConverter; - } - - public JavaEclipseLinkCustomConverter addCustomConverter() { - if (this.customConverter != null) { - throw new IllegalStateException("custom converter already exists: " + this.customConverter); //$NON-NLS-1$ - } - JavaEclipseLinkCustomConverter converter = this.buildNewConverter(this.getCustomConverterAdapter()); - this.setCustomConverter_(converter); - return converter; - } - - public void removeCustomConverter() { - if (this.customConverter == null) { - throw new IllegalStateException("custom converter is null"); //$NON-NLS-1$ - } - this.getCustomConverterAdapter().removeConverterAnnotation(this.getResourcePersistentType()); - this.setCustomConverter_(null); - } - - protected void setCustomConverter_(JavaEclipseLinkCustomConverter converter) { - JavaEclipseLinkCustomConverter old = this.customConverter; - this.customConverter = converter; - this.firePropertyChanged(CUSTOM_CONVERTER_PROPERTY, old, converter); - } - - protected JavaEclipseLinkCustomConverter buildCustomConverter() { - return this.buildConverter(this.getCustomConverterAdapter()); - } - - protected void syncCustomConverter() { - EclipseLinkNamedConverterAnnotation annotation = this.getCustomConverterAdapter().getConverterAnnotation(this.getResourcePersistentType()); - if (annotation == null) { - if (this.customConverter != null) { - this.setCustomConverter_(null); - } - } else { - if ((this.customConverter != null) && (this.customConverter.getConverterAnnotation() == annotation)) { - this.customConverter.synchronizeWithResourceModel(); - } else { - JavaEclipseLinkCustomConverter converter = this.buildConverter(this.getCustomConverterAdapter(), annotation); - this.setCustomConverter_(converter); - } - } - } - - protected JavaEclipseLinkCustomConverter.Adapter getCustomConverterAdapter() { - return JavaEclipseLinkCustomConverter.Adapter.instance(); - } - - - // ********** object type converter ********** - - public JavaEclipseLinkObjectTypeConverter getObjectTypeConverter() { - return this.objectTypeConverter; - } - - public JavaEclipseLinkObjectTypeConverter addObjectTypeConverter() { - if (this.objectTypeConverter != null) { - throw new IllegalStateException("object type converter already exists: " + this.objectTypeConverter); //$NON-NLS-1$ - } - JavaEclipseLinkObjectTypeConverter converter = this.buildNewConverter(this.getObjectTypeConverterAdapter()); - this.setObjectTypeConverter_(converter); - return converter; - } - - public void removeObjectTypeConverter() { - if (this.objectTypeConverter == null) { - throw new IllegalStateException("object type converter is null"); //$NON-NLS-1$ - } - this.getObjectTypeConverterAdapter().removeConverterAnnotation(this.getResourcePersistentType()); - this.setObjectTypeConverter_(null); - } - - protected void setObjectTypeConverter_(JavaEclipseLinkObjectTypeConverter converter) { - JavaEclipseLinkObjectTypeConverter old = this.objectTypeConverter; - this.objectTypeConverter = converter; - this.firePropertyChanged(OBJECT_TYPE_CONVERTER_PROPERTY, old, converter); - } - - protected JavaEclipseLinkObjectTypeConverter buildObjectTypeConverter() { - return this.buildConverter(this.getObjectTypeConverterAdapter()); - } - - protected void syncObjectTypeConverter() { - EclipseLinkNamedConverterAnnotation annotation = this.getObjectTypeConverterAdapter().getConverterAnnotation(this.getResourcePersistentType()); - if (annotation == null) { - if (this.objectTypeConverter != null) { - this.setObjectTypeConverter_(null); - } - } else { - if ((this.objectTypeConverter != null) && (this.objectTypeConverter.getConverterAnnotation() == annotation)) { - this.objectTypeConverter.synchronizeWithResourceModel(); - } else { - JavaEclipseLinkObjectTypeConverter converter = this.buildConverter(this.getObjectTypeConverterAdapter(), annotation); - this.setObjectTypeConverter_(converter); - } - } - } - - protected JavaEclipseLinkObjectTypeConverter.Adapter getObjectTypeConverterAdapter() { - return JavaEclipseLinkObjectTypeConverter.Adapter.instance(); - } - - - // ********** struct converter ********** - - public JavaEclipseLinkStructConverter getStructConverter() { - return this.structConverter; - } - - public JavaEclipseLinkStructConverter addStructConverter() { - if (this.structConverter != null) { - throw new IllegalStateException("struct converter already exists: " + this.structConverter); //$NON-NLS-1$ - } - JavaEclipseLinkStructConverter converter = this.buildNewConverter(this.getStructConverterAdapter()); - this.setStructConverter_(converter); - return converter; - } - - public void removeStructConverter() { - if (this.structConverter == null) { - throw new IllegalStateException("struct converter is null"); //$NON-NLS-1$ - } - this.getStructConverterAdapter().removeConverterAnnotation(this.getResourcePersistentType()); - this.setStructConverter_(null); - } - - protected void setStructConverter_(JavaEclipseLinkStructConverter converter) { - JavaEclipseLinkStructConverter old = this.structConverter; - this.structConverter = converter; - this.firePropertyChanged(STRUCT_CONVERTER_PROPERTY, old, converter); - } - - protected JavaEclipseLinkStructConverter buildStructConverter() { - return this.buildConverter(this.getStructConverterAdapter()); - } - - protected void syncStructConverter() { - EclipseLinkNamedConverterAnnotation annotation = this.getStructConverterAdapter().getConverterAnnotation(this.getResourcePersistentType()); - if (annotation == null) { - if (this.structConverter != null) { - this.setStructConverter_(null); - } - } else { - if ((this.structConverter != null) && (this.structConverter.getConverterAnnotation() == annotation)) { - this.structConverter.synchronizeWithResourceModel(); - } else { - JavaEclipseLinkStructConverter converter = this.buildConverter(this.getStructConverterAdapter(), annotation); - this.setStructConverter_(converter); - } - } - } - - protected JavaEclipseLinkStructConverter.Adapter getStructConverterAdapter() { - return JavaEclipseLinkStructConverter.Adapter.instance(); - } - - - // ********** object type converter ********** - - public JavaEclipseLinkTypeConverter getTypeConverter() { - return this.typeConverter; - } - - public JavaEclipseLinkTypeConverter addTypeConverter() { - if (this.typeConverter != null) { - throw new IllegalStateException("type converter already exists: " + this.typeConverter); //$NON-NLS-1$ - } - JavaEclipseLinkTypeConverter converter = this.buildNewConverter(this.getTypeConverterAdapter()); - this.setTypeConverter_(converter); - return converter; - } - - public void removeTypeConverter() { - if (this.typeConverter == null) { - throw new IllegalStateException("type converter is null"); //$NON-NLS-1$ - } - this.getTypeConverterAdapter().removeConverterAnnotation(this.getResourcePersistentType()); - this.setTypeConverter_(null); - } - - protected void setTypeConverter_(JavaEclipseLinkTypeConverter converter) { - JavaEclipseLinkTypeConverter old = this.typeConverter; - this.typeConverter = converter; - this.firePropertyChanged(TYPE_CONVERTER_PROPERTY, old, converter); - } - - protected JavaEclipseLinkTypeConverter buildTypeConverter() { - return this.buildConverter(this.getTypeConverterAdapter()); - } - - protected void syncTypeConverter() { - EclipseLinkNamedConverterAnnotation annotation = this.getTypeConverterAdapter().getConverterAnnotation(this.getResourcePersistentType()); - if (annotation == null) { - if (this.typeConverter != null) { - this.setTypeConverter_(null); - } - } else { - if ((this.typeConverter != null) && (this.typeConverter.getConverterAnnotation() == annotation)) { - this.typeConverter.synchronizeWithResourceModel(); - } else { - JavaEclipseLinkTypeConverter converter = this.buildConverter(this.getTypeConverterAdapter(), annotation); - this.setTypeConverter_(converter); - } - } - } - - protected JavaEclipseLinkTypeConverter.Adapter getTypeConverterAdapter() { - return JavaEclipseLinkTypeConverter.Adapter.instance(); - } - - - // ********** misc ********** - - @Override - public JavaTypeMapping getParent() { - return (JavaTypeMapping) super.getParent(); - } - - protected JavaTypeMapping getTypeMapping() { - return this.getParent(); - } - - protected JavaResourcePersistentType getResourcePersistentType() { - return this.getTypeMapping().getResourcePersistentType(); - } - - @SuppressWarnings("unchecked") - protected <C extends JavaEclipseLinkConverter<?>> C buildConverter(C.Adapter adapter) { - return (C) adapter.buildConverter(this.getResourcePersistentType(), this); - } - - @SuppressWarnings("unchecked") - protected <C extends JavaEclipseLinkConverter<?>> C buildConverter(C.Adapter adapter, EclipseLinkNamedConverterAnnotation converterAnnotation) { - return (C) adapter.buildConverter(converterAnnotation, this); - } - - @SuppressWarnings("unchecked") - protected <C extends JavaEclipseLinkConverter<?>> C buildNewConverter(C.Adapter adapter) { - return (C) adapter.buildNewConverter(this.getResourcePersistentType(), this); - } - - - // ********** validation ********** - - @Override - public void validate(List<IMessage> messages, IReporter reporter, CompilationUnit astRoot) { - super.validate(messages, reporter, astRoot); - if (this.customConverter != null) { - this.customConverter.validate(messages, reporter, astRoot); - } - if (this.objectTypeConverter != null) { - this.objectTypeConverter.validate(messages, reporter, astRoot); - } - if (this.typeConverter != null) { - this.typeConverter.validate(messages, reporter, astRoot); - } - if (this.structConverter != null) { - this.structConverter.validate(messages, reporter, astRoot); - } - } - - public TextRange getValidationTextRange(CompilationUnit astRoot) { - return this.getResourcePersistentType().getTextRange(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 e18c7fd58a..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,165 +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.java; - -import java.util.List; -import org.eclipse.jdt.core.dom.CompilationUnit; -import org.eclipse.jpt.common.core.utility.TextRange; -import org.eclipse.jpt.common.utility.internal.StringTools; -import org.eclipse.jpt.jpa.core.context.java.JavaJpaContextNode; -import org.eclipse.jpt.jpa.eclipselink.core.context.EclipseLinkCustomConverter; -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.EclipseLinkConverterAnnotation; -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; - -public class JavaEclipseLinkCustomConverter - extends JavaEclipseLinkConverter<EclipseLinkConverterAnnotation> - implements EclipseLinkCustomConverter -{ - private String converterClass; - private String fullyQualifiedConverterClass; - public static final String FULLY_QUALIFIED_CONVERTER_CLASS_PROPERTY = "fullyQualifiedConverterClass"; //$NON-NLS-1$ - - - public JavaEclipseLinkCustomConverter(JavaJpaContextNode parent, EclipseLinkConverterAnnotation converterAnnotation) { - super(parent, converterAnnotation); - this.converterClass = converterAnnotation.getConverterClass(); - } - - - // ********** synchronize/update ********** - - @Override - public void synchronizeWithResourceModel() { - super.synchronizeWithResourceModel(); - this.setConverterClass_(this.converterAnnotation.getConverterClass()); - } - - @Override - public void update() { - super.update(); - this.setFullyQualifiedConverterClass(this.converterAnnotation.getFullyQualifiedConverterClassName()); - } - - - // ********** converter class ********** - - public String getConverterClass() { - return this.converterClass; - } - - public void setConverterClass(String converterClass) { - this.converterAnnotation.setConverterClass(converterClass); - this.setConverterClass_(converterClass); - } - - protected void setConverterClass_(String converterClass) { - String old = this.converterClass; - this.converterClass = converterClass; - this.firePropertyChanged(CONVERTER_CLASS_PROPERTY, old, 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 - public void validate(List<IMessage> messages, IReporter reporter, CompilationUnit astRoot) { - super.validate(messages, reporter, astRoot); - if (this.converterClass != null) { - // the annotation will have a compile error if its converter class is missing - this.validateConverterClass(messages, astRoot); - } - } - - protected void validateConverterClass(List<IMessage> messages, CompilationUnit astRoot) { - if (this.converterClass == null) { - //Annotation itself will have compile error if converter class not defined - return; - } - - if (StringTools.stringIsEmpty(this.converterClass)) { - messages.add( - DefaultEclipseLinkJpaValidationMessages.buildMessage( - IMessage.HIGH_SEVERITY, - EclipseLinkJpaValidationMessages.CONVERTER_CLASS_DEFINED, - this, - getConverterClassTextRange(astRoot) - ) - ); - } - else if ( ! this.converterAnnotation.converterClassImplementsInterface(ECLIPSELINK_CONVERTER_CLASS_NAME, astRoot)) { - messages.add( - DefaultEclipseLinkJpaValidationMessages.buildMessage( - IMessage.HIGH_SEVERITY, - EclipseLinkJpaValidationMessages.CONVERTER_CLASS_IMPLEMENTS_CONVERTER, - new String[] {this.converterClass}, - this, - this.getConverterClassTextRange(astRoot) - ) - ); - } - } - - protected TextRange getConverterClassTextRange(CompilationUnit astRoot) { - return this.converterAnnotation.getConverterClassTextRange(astRoot); - } - - - // ********** adapter ********** - - public static class Adapter - extends AbstractAdapter - { - private static final Adapter INSTANCE = new Adapter(); - public static Adapter instance() { - return INSTANCE; - } - - private Adapter() { - super(); - } - - public Class<EclipseLinkCustomConverter> getConverterType() { - return EclipseLinkCustomConverter.class; - } - - @Override - protected String getAnnotationName() { - return EclipseLinkConverterAnnotation.ANNOTATION_NAME; - } - - public JavaEclipseLinkConverter<? extends EclipseLinkNamedConverterAnnotation> buildConverter(EclipseLinkNamedConverterAnnotation converterAnnotation, JavaJpaContextNode parent) { - return new JavaEclipseLinkCustomConverter(parent, (EclipseLinkConverterAnnotation) converterAnnotation); - } - } -} 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 3af1df0890..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,187 +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.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.core.internal.context.java.AbstractJavaJpaContextNode; -import org.eclipse.jpt.jpa.core.resource.java.JavaResourcePersistentType; -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 static final String FULLY_QUALIFIED_CUSTOMIZER_CLASS_PROPERTY = "fullyQualifiedCustomizerClass"; //$NON-NLS-1$ - - - 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.getResourcePersistentType().getAnnotation(this.getCustomizerAnnotationName()); - } - - protected EclipseLinkCustomizerAnnotation addCustomizerAnnotation() { - return (EclipseLinkCustomizerAnnotation) this.getResourcePersistentType().addAnnotation(this.getCustomizerAnnotationName()); - } - - protected void removeCustomizerAnnotation() { - this.getResourcePersistentType().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 JavaResourcePersistentType getResourcePersistentType() { - return this.getTypeMapping().getResourcePersistentType(); - } - - public char getCustomizerClassEnclosingTypeSeparator() { - return '.'; - } - - - // ********** 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) { - EclipseLinkCustomizerAnnotation annotation = this.getCustomizerAnnotation(); - if ((annotation != null) && ! annotation.customizerClassImplementsInterface(ECLIPSELINK_DESCRIPTOR_CUSTOMIZER_CLASS_NAME, astRoot)) { - messages.add( - DefaultEclipseLinkJpaValidationMessages.buildMessage( - IMessage.HIGH_SEVERITY, - EclipseLinkJpaValidationMessages.CUSTOMIZER_CLASS_IMPLEMENTS_DESCRIPTOR_CUSTOMIZER, - new String[] {this.getCustomizerClass()}, - this, - this.getCustomizerClassTextRange(astRoot) - ) - ); - } - } - - protected TextRange getCustomizerClassTextRange(CompilationUnit astRoot) { - return this.getCustomizerAnnotation().getValueTextRange(astRoot); - } - - public TextRange getValidationTextRange(CompilationUnit astRoot) { - return this.getCustomizerAnnotation().getTextRange(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 81d50b6dd2..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,122 +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.java; - -import java.util.List; -import org.eclipse.jdt.core.dom.CompilationUnit; -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.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.v1_1.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 -{ - 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); - } - - - // ********** 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; - } - - - // ********** 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.getResourcePersistentType(), this.buildTextRangeResolver(astRoot)); - } -} 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 6f88eecd1a..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,192 +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.java; - -import java.util.List; -import org.eclipse.jdt.core.dom.CompilationUnit; -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.context.EclipseLinkChangeTracking; -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.internal.v1_1.context.EclipseLinkEntityPrimaryKeyValidator; -import org.eclipse.jpt.jpa.eclipselink.core.internal.v1_1.context.EclipseLinkTypeMappingValidator; -import org.eclipse.jpt.jpa.eclipselink.core.resource.java.EclipseLink; -import org.eclipse.jpt.jpa.eclipselink.core.v2_0.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 -{ - protected final JavaEclipseLinkCaching caching; - - protected final JavaEclipseLinkReadOnly readOnly; - - protected final JavaEclipseLinkConverterContainer converterContainer; - - protected final JavaEclipseLinkChangeTracking changeTracking; - - protected final JavaEclipseLinkCustomizer customizer; - - - 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(); - } - - - // ********** synchronize/update ********** - - @Override - public void synchronizeWithResourceModel() { - super.synchronizeWithResourceModel(); - this.caching.synchronizeWithResourceModel(); - this.readOnly.synchronizeWithResourceModel(); - this.converterContainer.synchronizeWithResourceModel(); - this.changeTracking.synchronizeWithResourceModel(); - this.customizer.synchronizeWithResourceModel(); - } - - @Override - public void update() { - super.update(); - this.caching.update(); - this.readOnly.update(); - this.converterContainer.update(); - this.changeTracking.update(); - this.customizer.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); - } - - - // ********** 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); - } - - - // ********** 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.getResourcePersistentType().getAnnotation(EclipseLinkClassExtractorAnnotation2_1.ANNOTATION_NAME); - } - - - // ********** misc ********** - - public boolean usesPrimaryKeyColumns() { - return this.getResourcePersistentType().getAnnotation(EclipseLink.PRIMARY_KEY) != null; - } - - public JavaCacheable2_0 getCacheable() { - return ((JavaCacheableHolder2_0) this.getCaching()).getCacheable(); - } - - public boolean calculateDefaultCacheable() { - return ((JavaCacheableHolder2_0) this.getCaching()).calculateDefaultCacheable(); - } - - - // ********** 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); - } - - @Override - protected JptValidator buildPrimaryKeyValidator(CompilationUnit astRoot) { - return new EclipseLinkEntityPrimaryKeyValidator(this, this.buildTextRangeResolver(astRoot)); - } - - @Override - protected JptValidator buildTypeMappingValidator(CompilationUnit astRoot) { - return new EclipseLinkTypeMappingValidator(this, this.getResourcePersistentType(), 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 3e7c5f9659..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,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.java; - -import java.util.List; -import org.eclipse.jdt.core.dom.CompilationUnit; -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.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.wst.validation.internal.provisional.core.IMessage; -import org.eclipse.wst.validation.internal.provisional.core.IReporter; - -public class JavaEclipseLinkIdMapping - extends AbstractJavaIdMapping - implements EclipseLinkIdMapping -{ - protected final JavaEclipseLinkMutable mutable; - - - public JavaEclipseLinkIdMapping(JavaPersistentAttribute parent) { - super(parent); - this.mutable = new JavaEclipseLinkMutable(this); - } - - - // ********** synchronize/update ********** - - @Override - public void synchronizeWithResourceModel() { - super.synchronizeWithResourceModel(); - this.mutable.synchronizeWithResourceModel(); - } - - @Override - public void update() { - super.update(); - this.mutable.update(); - } - - - // ********** mutable ********** - - public EclipseLinkMutable getMutable() { - return this.mutable; - } - - - // ********** 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/JavaEclipseLinkIdMappingDefinition.java b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/java/JavaEclipseLinkIdMappingDefinition.java deleted file mode 100644 index 5a2b241465..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/java/JavaEclipseLinkIdMappingDefinition.java +++ /dev/null @@ -1,48 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.eclipselink.core.internal.context.java; - -import org.eclipse.jpt.common.utility.internal.ArrayTools; -import org.eclipse.jpt.common.utility.internal.iterables.ArrayIterable; -import org.eclipse.jpt.jpa.core.context.java.JavaAttributeMappingDefinition; -import org.eclipse.jpt.jpa.core.internal.context.java.AbstractJavaIdMappingDefinition; - -public class JavaEclipseLinkIdMappingDefinition - extends AbstractJavaIdMappingDefinition -{ - // singleton - private static final JavaAttributeMappingDefinition INSTANCE = new JavaEclipseLinkIdMappingDefinition(); - - /** - * Return the singleton. - */ - public static JavaAttributeMappingDefinition instance() { - return INSTANCE; - } - - - /** - * Enforce singleton usage - */ - private JavaEclipseLinkIdMappingDefinition() { - super(); - } - - @Override - public Iterable<String> getSupportingAnnotationNames() { - return COMBINED_SUPPORTING_ANNOTATION_NAMES; - } - - protected static final String[] COMBINED_SUPPORTING_ANNOTATION_NAMES_ARRAY = ArrayTools.concatenate( - SUPPORTING_ANNOTATION_NAMES_ARRAY, - JavaEclipseLinkBasicMappingDefinition.ECLIPSE_LINK_SUPPORTING_ANNOTATION_NAMES_ARRAY - ); - protected static final Iterable<String> COMBINED_SUPPORTING_ANNOTATION_NAMES = new ArrayIterable<String>(COMBINED_SUPPORTING_ANNOTATION_NAMES_ARRAY); -} 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 12acc639f2..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,131 +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.java; - -import org.eclipse.jdt.core.dom.CompilationUnit; -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.core.resource.java.JavaResourcePersistentAttribute; -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.getResourcePersistentAttribute().getAnnotation(this.getJoinFetchAnnotationName()); - } - - protected EclipseLinkJoinFetchAnnotation addJoinFetchAnnotation() { - return (EclipseLinkJoinFetchAnnotation) this.getResourcePersistentAttribute().addAnnotation(this.getJoinFetchAnnotationName()); - } - - protected void removeJoinFetchAnnotation() { - this.getResourcePersistentAttribute().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 JavaResourcePersistentAttribute getResourcePersistentAttribute() { - return this.getAttributeMapping().getResourcePersistentAttribute(); - } - - - // ********** validation ********** - - public TextRange getValidationTextRange(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 00ae92279f..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,63 +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.java; - -import java.util.List; -import org.eclipse.jdt.core.dom.CompilationUnit; -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.EclipseLinkRelationshipMapping; -import org.eclipse.wst.validation.internal.provisional.core.IMessage; -import org.eclipse.wst.validation.internal.provisional.core.IReporter; - -public class JavaEclipseLinkManyToManyMapping - extends AbstractJavaManyToManyMapping - implements EclipseLinkRelationshipMapping -{ - protected final JavaEclipseLinkJoinFetch joinFetch; - - - public JavaEclipseLinkManyToManyMapping(JavaPersistentAttribute parent) { - super(parent); - this.joinFetch = new JavaEclipseLinkJoinFetch(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, 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/JavaEclipseLinkManyToManyMappingDefinition.java b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/java/JavaEclipseLinkManyToManyMappingDefinition.java deleted file mode 100644 index 5b41923f8d..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/java/JavaEclipseLinkManyToManyMappingDefinition.java +++ /dev/null @@ -1,53 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.eclipselink.core.internal.context.java; - -import org.eclipse.jpt.common.utility.internal.ArrayTools; -import org.eclipse.jpt.common.utility.internal.iterables.ArrayIterable; -import org.eclipse.jpt.jpa.core.context.java.JavaAttributeMappingDefinition; -import org.eclipse.jpt.jpa.core.internal.context.java.AbstractJavaManyToManyMappingDefinition; -import org.eclipse.jpt.jpa.eclipselink.core.resource.java.EclipseLinkJoinFetchAnnotation; - -public class JavaEclipseLinkManyToManyMappingDefinition - extends AbstractJavaManyToManyMappingDefinition -{ - // singleton - private static final JavaAttributeMappingDefinition INSTANCE = new JavaEclipseLinkManyToManyMappingDefinition(); - - /** - * Return the singleton. - */ - public static JavaAttributeMappingDefinition instance() { - return INSTANCE; - } - - - /** - * Enforce singleton usage - */ - private JavaEclipseLinkManyToManyMappingDefinition() { - super(); - } - - @Override - public Iterable<String> getSupportingAnnotationNames() { - return COMBINED_SUPPORTING_ANNOTATION_NAMES; - } - - public static final String[] ECLIPSE_LINK_SUPPORTING_ANNOTATION_NAMES_ARRAY = new String[] { - EclipseLinkJoinFetchAnnotation.ANNOTATION_NAME - }; - - protected static final String[] COMBINED_SUPPORTING_ANNOTATION_NAMES_ARRAY = ArrayTools.concatenate( - SUPPORTING_ANNOTATION_NAMES_ARRAY, - ECLIPSE_LINK_SUPPORTING_ANNOTATION_NAMES_ARRAY - ); - protected static final Iterable<String> COMBINED_SUPPORTING_ANNOTATION_NAMES = new ArrayIterable<String>(COMBINED_SUPPORTING_ANNOTATION_NAMES_ARRAY); -} 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 69c63f635e..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,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.java; - -import java.util.List; -import org.eclipse.jdt.core.dom.CompilationUnit; -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.wst.validation.internal.provisional.core.IMessage; -import org.eclipse.wst.validation.internal.provisional.core.IReporter; - -public class JavaEclipseLinkManyToOneMapping - extends AbstractJavaManyToOneMapping - implements EclipseLinkRelationshipMapping -{ - protected final JavaEclipseLinkJoinFetch joinFetch; - - - public JavaEclipseLinkManyToOneMapping(JavaPersistentAttribute parent) { - super(parent); - this.joinFetch = new JavaEclipseLinkJoinFetch(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, 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/JavaEclipseLinkManyToOneMappingDefinition.java b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/java/JavaEclipseLinkManyToOneMappingDefinition.java deleted file mode 100644 index 1e3408ddaf..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/java/JavaEclipseLinkManyToOneMappingDefinition.java +++ /dev/null @@ -1,53 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.eclipselink.core.internal.context.java; - -import org.eclipse.jpt.common.utility.internal.ArrayTools; -import org.eclipse.jpt.common.utility.internal.iterables.ArrayIterable; -import org.eclipse.jpt.jpa.core.context.java.JavaAttributeMappingDefinition; -import org.eclipse.jpt.jpa.core.internal.context.java.AbstractJavaManyToOneMappingDefinition; -import org.eclipse.jpt.jpa.eclipselink.core.resource.java.EclipseLinkJoinFetchAnnotation; - -public class JavaEclipseLinkManyToOneMappingDefinition - extends AbstractJavaManyToOneMappingDefinition -{ - // singleton - private static final JavaAttributeMappingDefinition INSTANCE = new JavaEclipseLinkManyToOneMappingDefinition(); - - /** - * Return the singleton. - */ - public static JavaAttributeMappingDefinition instance() { - return INSTANCE; - } - - - /** - * Enforce singleton usage - */ - private JavaEclipseLinkManyToOneMappingDefinition() { - super(); - } - - @Override - public Iterable<String> getSupportingAnnotationNames() { - return COMBINED_SUPPORTING_ANNOTATION_NAMES; - } - - public static final String[] ECLIPSE_LINK_SUPPORTING_ANNOTATION_NAMES_ARRAY = new String[] { - EclipseLinkJoinFetchAnnotation.ANNOTATION_NAME - }; - - protected static final String[] COMBINED_SUPPORTING_ANNOTATION_NAMES_ARRAY = ArrayTools.concatenate( - SUPPORTING_ANNOTATION_NAMES_ARRAY, - ECLIPSE_LINK_SUPPORTING_ANNOTATION_NAMES_ARRAY - ); - protected static final Iterable<String> COMBINED_SUPPORTING_ANNOTATION_NAMES = new ArrayIterable<String>(COMBINED_SUPPORTING_ANNOTATION_NAMES_ARRAY); -} 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 658b369daf..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,176 +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.java; - -import java.util.List; -import org.eclipse.jdt.core.dom.CompilationUnit; -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.context.EclipseLinkChangeTracking; -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.internal.v1_1.context.EclipseLinkMappedSuperclassPrimaryKeyValidator; -import org.eclipse.jpt.jpa.eclipselink.core.internal.v1_1.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 -{ - protected final JavaEclipseLinkCaching caching; - - protected final JavaEclipseLinkReadOnly readOnly; - - protected final JavaEclipseLinkConverterContainer converterContainer; - - protected final JavaEclipseLinkChangeTracking changeTracking; - - protected final JavaEclipseLinkCustomizer customizer; - - - 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(); - } - - - // ********** synchronize/update ********** - - @Override - public void synchronizeWithResourceModel() { - super.synchronizeWithResourceModel(); - this.caching.synchronizeWithResourceModel(); - this.readOnly.synchronizeWithResourceModel(); - this.converterContainer.synchronizeWithResourceModel(); - this.changeTracking.synchronizeWithResourceModel(); - this.customizer.synchronizeWithResourceModel(); - } - - @Override - public void update() { - super.update(); - this.caching.update(); - this.readOnly.update(); - this.converterContainer.update(); - this.changeTracking.update(); - this.customizer.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); - } - - - // ********** 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 this.getResourcePersistentType().getAnnotation(EclipseLink.PRIMARY_KEY) != null; - } - - public JavaCacheable2_0 getCacheable() { - return ((JavaCacheableHolder2_0) this.getCaching()).getCacheable(); - } - - public boolean calculateDefaultCacheable() { - return ((CacheableHolder2_0) this.getCaching()).calculateDefaultCacheable(); - } - - - // ********** 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); - } - - @Override - protected JptValidator buildPrimaryKeyValidator(CompilationUnit astRoot) { - return new EclipseLinkMappedSuperclassPrimaryKeyValidator(this, this.buildTextRangeResolver(astRoot)); - } - - @Override - protected JptValidator buildTypeMappingValidator(CompilationUnit astRoot) { - return new EclipseLinkMappedSuperclassValidator(this, this.getResourcePersistentType(), this.buildTextRangeResolver(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 3b9ce8f6c1..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,169 +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.java; - -import org.eclipse.jdt.core.dom.CompilationUnit; -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.core.resource.java.JavaResourcePersistentAttribute; -import org.eclipse.jpt.jpa.eclipselink.core.context.EclipseLinkMutable; -import org.eclipse.jpt.jpa.eclipselink.core.internal.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.getResourcePersistentAttribute().getAnnotation(this.getMutableAnnotationName()); - } - - protected EclipseLinkMutableAnnotation addMutableAnnotation() { - return (EclipseLinkMutableAnnotation) this.getResourcePersistentAttribute().addAnnotation(this.getMutableAnnotationName()); - } - - protected void removeMutableAnnotation() { - this.getResourcePersistentAttribute().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 JavaResourcePersistentAttribute getResourcePersistentAttribute() { - return this.getAttributeMapping().getResourcePersistentAttribute(); - } - - protected JavaEclipseLinkPersistentAttribute getPersistentAttribute() { - return (JavaEclipseLinkPersistentAttribute) this.getAttributeMapping().getPersistentAttribute(); - } - - @Override - public EclipseLinkPersistenceUnit getPersistenceUnit() { - return (EclipseLinkPersistenceUnit) super.getPersistenceUnit(); - } - - - // ********** validation ********** - - public TextRange getValidationTextRange(CompilationUnit astRoot) { - EclipseLinkMutableAnnotation mutableAnnotation = this.getMutableAnnotation(); - return (mutableAnnotation == null) ? null : mutableAnnotation.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 79945fb920..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,320 +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.java; - -import java.util.Iterator; -import java.util.List; -import java.util.ListIterator; -import java.util.Vector; -import org.eclipse.jdt.core.dom.CompilationUnit; -import org.eclipse.jpt.common.utility.internal.CollectionTools; -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.java.JavaJpaContextNode; -import org.eclipse.jpt.jpa.core.internal.context.ContextContainerTools; -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.resource.java.EclipseLinkConversionValueAnnotation; -import org.eclipse.jpt.jpa.eclipselink.core.resource.java.EclipseLinkNamedConverterAnnotation; -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; - -public class JavaEclipseLinkObjectTypeConverter - extends JavaEclipseLinkConverter<EclipseLinkObjectTypeConverterAnnotation> - implements EclipseLinkObjectTypeConverter -{ - private String dataType; - private String fullyQualifiedDataType; - public static final String FULLY_QUALIFIED_DATA_TYPE_PROPERTY = "fullyQualifiedDataType"; //$NON-NLS-1$ - - private String objectType; - private String fullyQualifiedObjectType; - public static final String FULLY_QUALIFIED_OBJECT_TYPE_PROPERTY = "fullyQualifiedObjectType"; //$NON-NLS-1$ - - private final Vector<JavaEclipseLinkConversionValue> conversionValues = new Vector<JavaEclipseLinkConversionValue>(); - private final ConversionValueContainerAdapter conversionValueContainerAdapter = new ConversionValueContainerAdapter(); - - private String defaultObjectValue; - - - public JavaEclipseLinkObjectTypeConverter(JavaJpaContextNode parent, EclipseLinkObjectTypeConverterAnnotation converterAnnotation) { - super(parent, converterAnnotation); - this.dataType = converterAnnotation.getDataType(); - this.objectType = converterAnnotation.getObjectType(); - this.initializeConversionValues(); - 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 ********** - - @SuppressWarnings("unchecked") - public ListIterator<JavaEclipseLinkConversionValue> conversionValues() { - return this.getConversionValues().iterator(); - } - - public ListIterable<JavaEclipseLinkConversionValue> getConversionValues() { - return new LiveCloneListIterable<JavaEclipseLinkConversionValue>(this.conversionValues); - } - - public int conversionValuesSize() { - return this.conversionValues.size(); - } - - public JavaEclipseLinkConversionValue addConversionValue() { - return this.addConversionValue(this.conversionValues.size()); - } - - public JavaEclipseLinkConversionValue addConversionValue(int index) { - EclipseLinkConversionValueAnnotation annotation = this.converterAnnotation.addConversionValue(index); - return this.addConversionValue_(index, annotation); - } - - public void removeConversionValue(EclipseLinkConversionValue conversionValue) { - this.removeConversionValue(this.conversionValues.indexOf(conversionValue)); - } - - public void removeConversionValue(int index) { - this.converterAnnotation.removeConversionValue(index); - this.removeConversionValue_(index); - } - - protected void removeConversionValue_(int index) { - this.removeItemFromList(index, this.conversionValues, CONVERSION_VALUES_LIST); - } - - public void moveConversionValue(int targetIndex, int sourceIndex) { - this.converterAnnotation.moveConversionValue(targetIndex, sourceIndex); - this.moveItemInList(targetIndex, sourceIndex, this.conversionValues, CONVERSION_VALUES_LIST); - } - - protected void initializeConversionValues() { - for (Iterator<EclipseLinkConversionValueAnnotation> stream = this.converterAnnotation.conversionValues(); stream.hasNext(); ) { - this.conversionValues.add(this.buildConversionValue(stream.next())); - } - } - - protected JavaEclipseLinkConversionValue buildConversionValue(EclipseLinkConversionValueAnnotation conversionValueAnnotation) { - return new JavaEclipseLinkConversionValue(this, conversionValueAnnotation); - } - - protected void syncConversionValues() { - ContextContainerTools.synchronizeWithResourceModel(this.conversionValueContainerAdapter); - } - - protected Iterable<EclipseLinkConversionValueAnnotation> getConversionValueAnnotations() { - return CollectionTools.iterable(this.converterAnnotation.conversionValues()); - } - - protected void moveConversionValue_(int index, JavaEclipseLinkConversionValue conversionValue) { - this.moveItemInList(index, conversionValue, this.conversionValues, CONVERSION_VALUES_LIST); - } - - protected JavaEclipseLinkConversionValue addConversionValue_(int index, EclipseLinkConversionValueAnnotation conversionValueAnnotation) { - JavaEclipseLinkConversionValue conversionValue = this.buildConversionValue(conversionValueAnnotation); - this.addItemToList(index, conversionValue, this.conversionValues, CONVERSION_VALUES_LIST); - return conversionValue; - } - - protected void removeConversionValue_(JavaEclipseLinkConversionValue conversionValue) { - this.removeConversionValue_(this.conversionValues.indexOf(conversionValue)); - } - - /** - * conversion value container adapter - */ - protected class ConversionValueContainerAdapter - implements ContextContainerTools.Adapter<JavaEclipseLinkConversionValue, EclipseLinkConversionValueAnnotation> - { - public Iterable<JavaEclipseLinkConversionValue> getContextElements() { - return JavaEclipseLinkObjectTypeConverter.this.getConversionValues(); - } - public Iterable<EclipseLinkConversionValueAnnotation> getResourceElements() { - return JavaEclipseLinkObjectTypeConverter.this.getConversionValueAnnotations(); - } - public EclipseLinkConversionValueAnnotation getResourceElement(JavaEclipseLinkConversionValue contextElement) { - return contextElement.getConversionValueAnnotation(); - } - public void moveContextElement(int index, JavaEclipseLinkConversionValue element) { - JavaEclipseLinkObjectTypeConverter.this.moveConversionValue_(index, element); - } - public void addContextElement(int index, EclipseLinkConversionValueAnnotation resourceElement) { - JavaEclipseLinkObjectTypeConverter.this.addConversionValue_(index, resourceElement); - } - public void removeContextElement(JavaEclipseLinkConversionValue element) { - JavaEclipseLinkObjectTypeConverter.this.removeConversionValue_(element); - } - } - - - // ********** 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.conversionValuesSize(); - } - - - // ********** 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); - for (JavaEclipseLinkConversionValue conversionValue : this.getConversionValues()) { - conversionValue.validate(messages, reporter, astRoot); - } - } - - - // ********** adapter ********** - - public static class Adapter - extends AbstractAdapter - { - private static final Adapter INSTANCE = new Adapter(); - public static Adapter instance() { - return INSTANCE; - } - - private Adapter() { - super(); - } - - public Class<EclipseLinkObjectTypeConverter> getConverterType() { - return EclipseLinkObjectTypeConverter.class; - } - - @Override - protected String getAnnotationName() { - return EclipseLinkObjectTypeConverterAnnotation.ANNOTATION_NAME; - } - - public JavaEclipseLinkConverter<? extends EclipseLinkNamedConverterAnnotation> buildConverter(EclipseLinkNamedConverterAnnotation converterAnnotation, JavaJpaContextNode parent) { - return new JavaEclipseLinkObjectTypeConverter(parent, (EclipseLinkObjectTypeConverterAnnotation) converterAnnotation); - } - } -} 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 afb73f485d..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,92 +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.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.EclipseLinkPrivateOwned; -import org.eclipse.jpt.jpa.eclipselink.core.v2_0.context.EclipseLinkOneToManyMapping2_0; -import org.eclipse.jpt.jpa.eclipselink.core.v2_0.context.java.EclipseLinkJavaOneToManyRelationship2_0; -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 -{ - protected final JavaEclipseLinkJoinFetch joinFetch; - - protected final JavaEclipseLinkPrivateOwned privateOwned; - - - public JavaEclipseLinkOneToManyMapping(JavaPersistentAttribute parent) { - super(parent); - this.joinFetch = new JavaEclipseLinkJoinFetch(this); - this.privateOwned = new JavaEclipseLinkPrivateOwned(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; - } - - - // ********** 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/JavaEclipseLinkOneToManyMappingDefinition.java b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/java/JavaEclipseLinkOneToManyMappingDefinition.java deleted file mode 100644 index 4784171e89..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/java/JavaEclipseLinkOneToManyMappingDefinition.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.java; - -import org.eclipse.jpt.common.utility.internal.ArrayTools; -import org.eclipse.jpt.common.utility.internal.iterables.ArrayIterable; -import org.eclipse.jpt.jpa.core.context.java.DefaultJavaAttributeMappingDefinition; -import org.eclipse.jpt.jpa.core.context.java.JavaPersistentAttribute; -import org.eclipse.jpt.jpa.core.internal.context.java.AbstractJavaOneToManyMappingDefinition; -import org.eclipse.jpt.jpa.eclipselink.core.resource.java.EclipseLinkJoinFetchAnnotation; -import org.eclipse.jpt.jpa.eclipselink.core.resource.java.EclipseLinkPrivateOwnedAnnotation; - -public class JavaEclipseLinkOneToManyMappingDefinition - extends AbstractJavaOneToManyMappingDefinition - implements DefaultJavaAttributeMappingDefinition -{ - // singleton - private static final DefaultJavaAttributeMappingDefinition INSTANCE = new JavaEclipseLinkOneToManyMappingDefinition(); - - /** - * Return the singleton. - */ - public static DefaultJavaAttributeMappingDefinition instance() { - return INSTANCE; - } - - - /** - * Enforce singleton usage - */ - private JavaEclipseLinkOneToManyMappingDefinition() { - super(); - } - - @Override - public Iterable<String> getSupportingAnnotationNames() { - return COMBINED_SUPPORTING_ANNOTATION_NAMES; - } - - public static final String[] ECLIPSE_LINK_SUPPORTING_ANNOTATION_NAMES_ARRAY = new String[] { - EclipseLinkJoinFetchAnnotation.ANNOTATION_NAME, - EclipseLinkPrivateOwnedAnnotation.ANNOTATION_NAME - }; - - protected static final String[] COMBINED_SUPPORTING_ANNOTATION_NAMES_ARRAY = ArrayTools.concatenate( - SUPPORTING_ANNOTATION_NAMES_ARRAY, - ECLIPSE_LINK_SUPPORTING_ANNOTATION_NAMES_ARRAY - ); - protected static final Iterable<String> COMBINED_SUPPORTING_ANNOTATION_NAMES = new ArrayIterable<String>(COMBINED_SUPPORTING_ANNOTATION_NAMES_ARRAY); - - 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/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 9c13729ff3..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,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.java; - -import java.util.List; -import org.eclipse.jdt.core.dom.CompilationUnit; -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.EclipseLinkPrivateOwned; -import org.eclipse.jpt.jpa.eclipselink.core.v2_0.context.EclipseLinkOneToOneMapping2_0; -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 -{ - protected final JavaEclipseLinkJoinFetch joinFetch; - - protected final JavaEclipseLinkPrivateOwned privateOwned; - - - public JavaEclipseLinkOneToOneMapping(JavaPersistentAttribute parent) { - super(parent); - this.joinFetch = new JavaEclipseLinkJoinFetch(this); - this.privateOwned = new JavaEclipseLinkPrivateOwned(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, 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/JavaEclipseLinkOneToOneMappingDefinition.java b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/java/JavaEclipseLinkOneToOneMappingDefinition.java deleted file mode 100644 index 6e1730261b..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/java/JavaEclipseLinkOneToOneMappingDefinition.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.java; - -import org.eclipse.jpt.common.utility.internal.ArrayTools; -import org.eclipse.jpt.common.utility.internal.iterables.ArrayIterable; -import org.eclipse.jpt.jpa.core.context.java.DefaultJavaAttributeMappingDefinition; -import org.eclipse.jpt.jpa.core.context.java.JavaPersistentAttribute; -import org.eclipse.jpt.jpa.core.internal.context.java.AbstractJavaOneToOneMappingDefinition; -import org.eclipse.jpt.jpa.eclipselink.core.resource.java.EclipseLinkJoinFetchAnnotation; -import org.eclipse.jpt.jpa.eclipselink.core.resource.java.EclipseLinkPrivateOwnedAnnotation; - -public class JavaEclipseLinkOneToOneMappingDefinition - extends AbstractJavaOneToOneMappingDefinition - implements DefaultJavaAttributeMappingDefinition -{ - // singleton - private static final DefaultJavaAttributeMappingDefinition INSTANCE = new JavaEclipseLinkOneToOneMappingDefinition(); - - /** - * Return the singleton. - */ - public static DefaultJavaAttributeMappingDefinition instance() { - return INSTANCE; - } - - - /** - * Enforce singleton usage - */ - private JavaEclipseLinkOneToOneMappingDefinition() { - super(); - } - - @Override - public Iterable<String> getSupportingAnnotationNames() { - return COMBINED_SUPPORTING_ANNOTATION_NAMES; - } - - public static final String[] ECLIPSE_LINK_SUPPORTING_ANNOTATION_NAMES_ARRAY = new String[] { - EclipseLinkJoinFetchAnnotation.ANNOTATION_NAME, - EclipseLinkPrivateOwnedAnnotation.ANNOTATION_NAME - }; - - protected static final String[] COMBINED_SUPPORTING_ANNOTATION_NAMES_ARRAY = ArrayTools.concatenate( - SUPPORTING_ANNOTATION_NAMES_ARRAY, - ECLIPSE_LINK_SUPPORTING_ANNOTATION_NAMES_ARRAY - ); - protected static final Iterable<String> COMBINED_SUPPORTING_ANNOTATION_NAMES = new ArrayIterable<String>(COMBINED_SUPPORTING_ANNOTATION_NAMES_ARRAY); - - 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/JavaEclipseLinkPersistentAttribute.java b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/java/JavaEclipseLinkPersistentAttribute.java deleted file mode 100644 index 786bb4d771..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/java/JavaEclipseLinkPersistentAttribute.java +++ /dev/null @@ -1,109 +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.java; - -import org.eclipse.jdt.core.dom.CompilationUnit; -import org.eclipse.jpt.common.utility.internal.Tools; -import org.eclipse.jpt.jpa.core.MappingKeys; -import org.eclipse.jpt.jpa.core.context.AccessType; -import org.eclipse.jpt.jpa.core.context.PersistentType; -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.core.resource.java.JavaResourcePersistentAttribute; -import org.eclipse.jpt.jpa.eclipselink.core.internal.v1_1.context.EclipseLinkPersistentAttributeValidator; - -/** - * EclipseLink Java persistent attribute - */ -public class JavaEclipseLinkPersistentAttribute - extends AbstractJavaPersistentAttribute -{ - public JavaEclipseLinkPersistentAttribute(PersistentType parent, JavaResourcePersistentAttribute jrpa) { - super(parent, jrpa); - } - - - // ********** access ********** - - @Override - public AccessType getSpecifiedAccess() { - return null; - } - - public void setSpecifiedAccess(AccessType access) { - throw new UnsupportedOperationException(); - } - - - // ********** 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.resourcePersistentAttribute.typeIsSubTypeOf(DATE_TYPE_NAME) - || this.resourcePersistentAttribute.typeIsSubTypeOf(CALENDAR_TYPE_NAME); - } - protected static final String DATE_TYPE_NAME = java.util.Date.class.getName(); - protected static final String CALENDAR_TYPE_NAME = java.util.Calendar.class.getName(); - - public boolean typeIsSerializable() { - return this.resourcePersistentAttribute.typeIsVariablePrimitive() - || this.resourcePersistentAttribute.typeIsSubTypeOf(SERIALIZABLE_TYPE_NAME); - } - - public boolean typeIsValidForVariableOneToOne() { - return this.resourcePersistentAttribute.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 buildAttibuteValidator(CompilationUnit astRoot) { - return new EclipseLinkPersistentAttributeValidator(this, this, buildTextRangeResolver(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 a77f1d3241..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,117 +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.java; - -import org.eclipse.jdt.core.dom.CompilationUnit; -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.core.resource.java.JavaResourcePersistentAttribute; -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.getResourcePersistentAttribute().getAnnotation(this.getPrivateOwnedAnnotationName()); - } - - protected EclipseLinkPrivateOwnedAnnotation addPrivateOwnedAnnotation() { - return (EclipseLinkPrivateOwnedAnnotation) this.getResourcePersistentAttribute().addAnnotation(this.getPrivateOwnedAnnotationName()); - } - - protected void removePrivateOwnedAnnotation() { - this.getResourcePersistentAttribute().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 JavaResourcePersistentAttribute getResourcePersistentAttribute() { - return this.getAttributeMapping().getResourcePersistentAttribute(); - } - - - // ********** validation ********** - - public TextRange getValidationTextRange(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 30d07531b9..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,131 +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.java; - -import org.eclipse.jdt.core.dom.CompilationUnit; -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.core.resource.java.JavaResourcePersistentType; -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.getResourcePersistentType().getAnnotation(this.getReadOnlyAnnotationName()); - } - - protected void addReadOnlyAnnotation() { - this.getResourcePersistentType().addAnnotation(this.getReadOnlyAnnotationName()); - } - - protected void removeReadOnlyAnnotation() { - this.getResourcePersistentType().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 JavaResourcePersistentType getResourcePersistentType() { - return this.getTypeMapping().getResourcePersistentType(); - } - - - // ********** validation ********** - - public TextRange getValidationTextRange(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 a90aa52f1c..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,174 +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.java; - -import java.util.List; -import org.eclipse.jdt.core.IJavaProject; -import org.eclipse.jdt.core.dom.CompilationUnit; -import org.eclipse.jpt.common.core.internal.utility.jdt.JDTTools; -import org.eclipse.jpt.common.core.utility.TextRange; -import org.eclipse.jpt.common.utility.internal.StringTools; -import org.eclipse.jpt.jpa.core.context.java.JavaJpaContextNode; -import org.eclipse.jpt.jpa.eclipselink.core.context.EclipseLinkStructConverter; -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.jpt.jpa.eclipselink.core.resource.java.EclipseLinkStructConverterAnnotation; -import org.eclipse.wst.validation.internal.provisional.core.IMessage; -import org.eclipse.wst.validation.internal.provisional.core.IReporter; - -public class JavaEclipseLinkStructConverter - extends JavaEclipseLinkConverter<EclipseLinkStructConverterAnnotation> - implements EclipseLinkStructConverter -{ - private String converterClass; - - - public JavaEclipseLinkStructConverter(JavaJpaContextNode parent, EclipseLinkStructConverterAnnotation converterAnnotation) { - super(parent, converterAnnotation); - this.converterClass = converterAnnotation.getConverter(); - } - - - // ********** synchronize/update ********** - - @Override - public void synchronizeWithResourceModel() { - super.synchronizeWithResourceModel(); - this.setConverterClass_(this.converterAnnotation.getConverter()); - } - - - // ********** converter class ********** - - public String getConverterClass() { - return this.converterClass; - } - - public void setConverterClass(String converterClass) { - this.converterAnnotation.setConverter(converterClass); - this.setConverterClass_(converterClass); - } - - protected void setConverterClass_(String converterClass) { - String old = this.converterClass; - this.converterClass = converterClass; - this.firePropertyChanged(CONVERTER_CLASS_PROPERTY, old, converterClass); - } - - - // ********** misc ********** - - public Class<EclipseLinkStructConverter> getType() { - return EclipseLinkStructConverter.class; - } - - //************ validation *************** - - @Override - public void validate(List<IMessage> messages, IReporter reporter, CompilationUnit astRoot) { - super.validate(messages, reporter, astRoot); - if (this.converterClass != null) { - // the annotation will have a compile error if its converter class is missing - validateConverterClass(messages, astRoot); - } - } - - protected void validateConverterClass(List<IMessage> messages, CompilationUnit astRoot) { - IJavaProject javaProject = getJpaProject().getJavaProject(); - - if (StringTools.stringIsEmpty(this.converterClass)) { - messages.add( - DefaultEclipseLinkJpaValidationMessages.buildMessage( - IMessage.HIGH_SEVERITY, - EclipseLinkJpaValidationMessages.CONVERTER_CLASS_DEFINED, - this, - getConverterClassTextRange(astRoot) - ) - ); - } - - else if (!converterClassExists(javaProject)) { - messages.add( - DefaultEclipseLinkJpaValidationMessages.buildMessage( - IMessage.HIGH_SEVERITY, - EclipseLinkJpaValidationMessages.CONVERTER_CLASS_EXISTS, - new String[] {this.converterClass}, - this, - getConverterClassTextRange(astRoot) - ) - ); - } - else if (!converterClassImplementsInterface(javaProject, ECLIPSELINK_CONVERTER_CLASS_NAME)) { - messages.add( - DefaultEclipseLinkJpaValidationMessages.buildMessage( - IMessage.HIGH_SEVERITY, - EclipseLinkJpaValidationMessages.CONVERTER_CLASS_IMPLEMENTS_CONVERTER, - new String[] {this.converterClass}, - this, - getConverterClassTextRange(astRoot) - ) - ); - } - } - - private boolean converterClassExists(IJavaProject javaProject) { - if (this.converterClass != null) - { - if (JDTTools.getJDTType(javaProject, this.converterClass) != null) { - return true; - } - } - return false; - } - - private boolean converterClassImplementsInterface(IJavaProject javaProject, String interfaceName) { - if (this.converterClass != null) - { - if (JDTTools.typeNamedImplementsInterfaceNamed(javaProject, this.converterClass, interfaceName)) { - return true; - } - } - return false; - } - - protected TextRange getConverterClassTextRange(CompilationUnit astRoot) { - return this.converterAnnotation.getConverterTextRange(astRoot); - } - - // ********** adapter ********** - - public static class Adapter - extends AbstractAdapter - { - private static final Adapter INSTANCE = new Adapter(); - public static Adapter instance() { - return INSTANCE; - } - - private Adapter() { - super(); - } - - public Class<EclipseLinkStructConverter> getConverterType() { - return EclipseLinkStructConverter.class; - } - - @Override - protected String getAnnotationName() { - return EclipseLinkStructConverterAnnotation.ANNOTATION_NAME; - } - - public JavaEclipseLinkConverter<? extends EclipseLinkNamedConverterAnnotation> buildConverter(EclipseLinkNamedConverterAnnotation converterAnnotation, JavaJpaContextNode parent) { - return new JavaEclipseLinkStructConverter(parent, (EclipseLinkStructConverterAnnotation) converterAnnotation); - } - - } -} 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 74a4d668d7..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,35 +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.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.EclipseLinkTransformationMapping; -import org.eclipse.jpt.jpa.eclipselink.core.resource.java.EclipseLinkTransformationAnnotation; - -public class JavaEclipseLinkTransformationMapping - extends AbstractJavaAttributeMapping<EclipseLinkTransformationAnnotation> - implements EclipseLinkTransformationMapping -{ - - public JavaEclipseLinkTransformationMapping(JavaPersistentAttribute parent) { - super(parent); - } - - 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/JavaEclipseLinkTransformationMappingDefinition.java b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/java/JavaEclipseLinkTransformationMappingDefinition.java deleted file mode 100644 index 6d80ee42c9..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/java/JavaEclipseLinkTransformationMappingDefinition.java +++ /dev/null @@ -1,66 +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.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 JavaEclipseLinkTransformationMappingDefinition - implements JavaAttributeMappingDefinition -{ - // singleton - private static final JavaAttributeMappingDefinition INSTANCE = new JavaEclipseLinkTransformationMappingDefinition(); - - /** - * Return the singleton. - */ - public static JavaAttributeMappingDefinition instance() { - return INSTANCE; - } - - - /** - * Enforce singleton usage - */ - private JavaEclipseLinkTransformationMappingDefinition() { - super(); - } - - public String getKey() { - return EclipseLinkMappingKeys.TRANSFORMATION_ATTRIBUTE_MAPPING_KEY; - } - - public String getAnnotationName() { - return EclipseLinkTransformationAnnotation.ANNOTATION_NAME; - } - - public boolean isSpecified(JavaPersistentAttribute persistentAttribute) { - return persistentAttribute.getResourcePersistentAttribute().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/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 08117463ac..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,150 +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.java; - -import org.eclipse.jpt.jpa.core.context.java.JavaJpaContextNode; -import org.eclipse.jpt.jpa.eclipselink.core.context.EclipseLinkTypeConverter; -import org.eclipse.jpt.jpa.eclipselink.core.resource.java.EclipseLinkNamedConverterAnnotation; -import org.eclipse.jpt.jpa.eclipselink.core.resource.java.EclipseLinkTypeConverterAnnotation; - -public class JavaEclipseLinkTypeConverter - extends JavaEclipseLinkConverter<EclipseLinkTypeConverterAnnotation> - implements EclipseLinkTypeConverter -{ - private String dataType; - private String fullyQualifiedDataType; - public static final String FULLY_QUALIFIED_DATA_TYPE_PROPERTY = "fullyQualifiedDataType"; //$NON-NLS-1$ - - private String objectType; - private String fullyQualifiedObjectType; - public static final String FULLY_QUALIFIED_OBJECT_TYPE_PROPERTY = "fullyQualifiedObjectType"; //$NON-NLS-1$ - - - public JavaEclipseLinkTypeConverter(JavaJpaContextNode 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; - } - - - // ********** adapter ********** - - public static class Adapter - extends AbstractAdapter - { - private static final Adapter INSTANCE = new Adapter(); - public static Adapter instance() { - return INSTANCE; - } - - private Adapter() { - super(); - } - - public Class<EclipseLinkTypeConverter> getConverterType() { - return EclipseLinkTypeConverter.class; - } - - @Override - protected String getAnnotationName() { - return EclipseLinkTypeConverterAnnotation.ANNOTATION_NAME; - } - - public JavaEclipseLinkConverter<? extends EclipseLinkNamedConverterAnnotation> buildConverter(EclipseLinkNamedConverterAnnotation converterAnnotation, JavaJpaContextNode parent) { - return new JavaEclipseLinkTypeConverter(parent, (EclipseLinkTypeConverterAnnotation) converterAnnotation); - } - } -} 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 a1ec8eefad..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,35 +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.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.EclipseLinkVariableOneToOneMapping; -import org.eclipse.jpt.jpa.eclipselink.core.resource.java.EclipseLinkVariableOneToOneAnnotation; - -public class JavaEclipseLinkVariableOneToOneMapping - extends AbstractJavaAttributeMapping<EclipseLinkVariableOneToOneAnnotation> - implements EclipseLinkVariableOneToOneMapping -{ - - public JavaEclipseLinkVariableOneToOneMapping(JavaPersistentAttribute parent) { - super(parent); - } - - 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/JavaEclipseLinkVariableOneToOneMappingDefinition.java b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/java/JavaEclipseLinkVariableOneToOneMappingDefinition.java deleted file mode 100644 index e29d4d5c1e..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/java/JavaEclipseLinkVariableOneToOneMappingDefinition.java +++ /dev/null @@ -1,70 +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.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.internal.EclipseLinkJpaFactory; -import org.eclipse.jpt.jpa.eclipselink.core.resource.java.EclipseLinkVariableOneToOneAnnotation; - -public class JavaEclipseLinkVariableOneToOneMappingDefinition - implements DefaultJavaAttributeMappingDefinition -{ - // singleton - private static final DefaultJavaAttributeMappingDefinition INSTANCE = new JavaEclipseLinkVariableOneToOneMappingDefinition(); - - /** - * Return the singleton. - */ - public static DefaultJavaAttributeMappingDefinition instance() { - return INSTANCE; - } - - - /** - * Enforce singleton usage - */ - private JavaEclipseLinkVariableOneToOneMappingDefinition() { - 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.getResourcePersistentAttribute().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/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 73de74afc6..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,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.java; - -import java.util.List; -import org.eclipse.jdt.core.dom.CompilationUnit; -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.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.wst.validation.internal.provisional.core.IMessage; -import org.eclipse.wst.validation.internal.provisional.core.IReporter; - -public class JavaEclipseLinkVersionMapping - extends AbstractJavaVersionMapping - implements EclipseLinkVersionMapping -{ - protected final JavaEclipseLinkMutable mutable; - - - public JavaEclipseLinkVersionMapping(JavaPersistentAttribute parent) { - super(parent); - this.mutable = new JavaEclipseLinkMutable(this); - } - - - // ********** synchronize/update ********** - - @Override - public void synchronizeWithResourceModel() { - super.synchronizeWithResourceModel(); - this.mutable.synchronizeWithResourceModel(); - } - - @Override - public void update() { - super.update(); - this.mutable.update(); - } - - - // ********** mutable ********** - - public EclipseLinkMutable getMutable() { - return this.mutable; - } - - - // ********** 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/JavaEclipseLinkVersionMappingDefinition.java b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/java/JavaEclipseLinkVersionMappingDefinition.java deleted file mode 100644 index 1e666e6a74..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/java/JavaEclipseLinkVersionMappingDefinition.java +++ /dev/null @@ -1,48 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.eclipselink.core.internal.context.java; - -import org.eclipse.jpt.common.utility.internal.ArrayTools; -import org.eclipse.jpt.common.utility.internal.iterables.ArrayIterable; -import org.eclipse.jpt.jpa.core.context.java.JavaAttributeMappingDefinition; -import org.eclipse.jpt.jpa.core.internal.context.java.AbstractJavaVersionMappingDefinition; - -public class JavaEclipseLinkVersionMappingDefinition - extends AbstractJavaVersionMappingDefinition -{ - // singleton - private static final JavaAttributeMappingDefinition INSTANCE = new JavaEclipseLinkVersionMappingDefinition(); - - /** - * Return the singleton. - */ - public static JavaAttributeMappingDefinition instance() { - return INSTANCE; - } - - - /** - * Enforce singleton usage - */ - private JavaEclipseLinkVersionMappingDefinition() { - super(); - } - - @Override - public Iterable<String> getSupportingAnnotationNames() { - return COMBINED_SUPPORTING_ANNOTATION_NAMES; - } - - protected static final String[] COMBINED_SUPPORTING_ANNOTATION_NAMES_ARRAY = ArrayTools.concatenate( - SUPPORTING_ANNOTATION_NAMES_ARRAY, - JavaEclipseLinkBasicMappingDefinition.ECLIPSE_LINK_SUPPORTING_ANNOTATION_NAMES_ARRAY - ); - protected static final Iterable<String> COMBINED_SUPPORTING_ANNOTATION_NAMES = new ArrayIterable<String>(COMBINED_SUPPORTING_ANNOTATION_NAMES_ARRAY); -} 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 db69e327d6..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,87 +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.emf.ecore.EFactory; -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.OrmTypeMappingDefinition; -import org.eclipse.jpt.jpa.core.internal.context.orm.AbstractOrmXmlDefinition; -import org.eclipse.jpt.jpa.core.internal.context.orm.OrmBasicMappingDefinition; -import org.eclipse.jpt.jpa.core.internal.context.orm.OrmEmbeddableDefinition; -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.OrmEntityDefinition; -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.OrmMappedSuperclassDefinition; -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.internal.EclipseLinkJpaPlatformProvider; -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; - } - - @Override - protected void addTypeMappingDefinitionsTo(ArrayList<OrmTypeMappingDefinition> definitions) { - CollectionTools.addAll(definitions, TYPE_MAPPING_DEFINITIONS); - } - - /** - * Order should not matter here; but we'll use the same order as for Java. - * @see EclipseLinkJpaPlatformProvider - */ - protected static final OrmTypeMappingDefinition[] TYPE_MAPPING_DEFINITIONS = new OrmTypeMappingDefinition[] { - OrmEntityDefinition.instance(), - OrmEmbeddableDefinition.instance(), - OrmMappedSuperclassDefinition.instance() - }; - - @Override - protected void addAttributeMappingDefinitionsTo(ArrayList<OrmAttributeMappingDefinition> definitions) { - CollectionTools.addAll(definitions, ATTRIBUTE_MAPPING_DEFINITIONS); - } - - /** - * Order should not matter here; but we'll use the same order as for Java. - * @see EclipseLinkJpaPlatformProvider - */ - protected static final OrmAttributeMappingDefinition[] 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/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 15c197aae8..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,121 +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.core.runtime.content.IContentType; -import org.eclipse.jdt.core.IPackageFragment; -import org.eclipse.jdt.core.IType; -import org.eclipse.jpt.common.utility.internal.iterables.CompositeIterable; -import org.eclipse.jpt.jpa.core.context.orm.OrmXml; -import org.eclipse.jpt.jpa.core.internal.context.orm.AbstractEntityMappings; -import org.eclipse.jpt.jpa.eclipselink.core.JptJpaEclipseLinkCorePlugin; -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.resource.orm.XmlEntityMappings; -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 -{ - protected final OrmEclipseLinkConverterContainer converterContainer; - - - public EclipseLinkEntityMappingsImpl(OrmXml parent, XmlEntityMappings resource) { - super(parent, resource); - this.converterContainer = this.buildConverterContainer(); - } - - - // ********** synchronize/update ********** - - @Override - public void synchronizeWithResourceModel() { - super.synchronizeWithResourceModel(); - this.converterContainer.synchronizeWithResourceModel(); - } - - @Override - public void update() { - super.update(); - this.converterContainer.update(); - } - - - // ********** converter container ********** - - public OrmEclipseLinkConverterContainer getConverterContainer() { - return this.converterContainer; - } - - protected OrmEclipseLinkConverterContainer buildConverterContainer() { - return new OrmEclipseLinkConverterContainerImpl(this, (XmlEntityMappings) this.xmlEntityMappings); - } - - - // ********** misc ********** - - @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/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 ab00aa20ec..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.v2_0.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/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 a179e5e62a..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,136 +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.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 ********** - - public XmlTimeOfDay getXmlTimeOfDay() { - return this.xmlTimeOfDay; - } - - - // ********** validation ********** - - public TextRange getValidationTextRange() { - return this.xmlTimeOfDay.getValidationTextRange(); - } -} 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 359b90dfa5..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,124 +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.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.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.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.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.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.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, 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 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); - } -} 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 7b662157ab..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,46 +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.common.core.JptResourceType; -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 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(); - } -} 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/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/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 c43844d42d..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,79 +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.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.orm.AbstractOrmBasicMapping; -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.resource.orm.XmlBasic; -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 -{ - protected final OrmEclipseLinkMutable mutable; - - - public OrmEclipseLinkBasicMapping(OrmPersistentAttribute parent, XmlBasic xmlMapping) { - super(parent, xmlMapping); - this.mutable = new OrmEclipseLinkMutable(this); - } - - - // ********** synchronize/update ********** - - @Override - public void synchronizeWithResourceModel() { - super.synchronizeWithResourceModel(); - this.mutable.synchronizeWithResourceModel(); - } - - @Override - public void update() { - super.update(); - this.mutable.update(); - } - - - // ********** mutable ********** - - public EclipseLinkMutable getMutable() { - return this.mutable; - } - - - // ********** 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() - ); - } - - - // ********** validation ********** - - @Override - public void validate(List<IMessage> messages, IReporter reporter) { - super.validate(messages, reporter); - // TODO mutable validation - } -} 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 74821dfe4d..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,727 +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.common.core.utility.TextRange; -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.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.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; - - protected Integer specifiedSize; - protected int defaultSize; - - protected Boolean specifiedShared; - protected boolean defaultShared; - - protected Boolean specifiedAlwaysRefresh; - protected boolean defaultAlwaysRefresh; - - protected Boolean specifiedRefreshOnlyIfNewer; - protected boolean defaultRefreshOnlyIfNewer; - - protected Boolean specifiedDisableHits; - protected boolean defaultDisableHits; - - protected EclipseLinkCacheCoordinationType specifiedCoordinationType; - protected EclipseLinkCacheCoordinationType defaultCoordinationType; - - protected Integer expiry; - protected EclipseLinkOrmTimeOfDay expiryTimeOfDay; - - protected EclipseLinkExistenceType specifiedExistenceType; - protected EclipseLinkExistenceType defaultExistenceType; - - protected final OrmCacheable2_0 cacheable; - - - 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(); - } - - - // ********** 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(); - } - - @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(); - } - - - // ********** 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() { - 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() { - 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() { - return 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.isJpa2_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 - } - - - // ********** 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() { - 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 bd71d02f8a..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,166 +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.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; - - - 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 null 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() { - return this.getXmlChangeTrackingHolder().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 0588694437..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,139 +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.common.core.utility.TextRange; -import org.eclipse.jpt.common.utility.internal.CollectionTools; -import org.eclipse.jpt.common.utility.internal.HashBag; -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.DefaultEclipseLinkJpaValidationMessages; -import org.eclipse.jpt.jpa.eclipselink.core.internal.EclipseLinkJpaValidationMessages; -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; - } - - protected TextRange getDataValueTextRange() { - return this.xmlConversionValue.getDataValueTextRange(); - } - - protected TextRange getObjectValueTextRange() { - return this.xmlConversionValue.getObjectValueTextRange(); - } - - - // ********** validation ********** - - @Override - public void validate(List<IMessage> messages, IReporter reporter) { - super.validate(messages, reporter); - this.validateDataValuesUnique(messages); - } - - protected void validateDataValuesUnique(List<IMessage> messages) { - HashBag<String> dataValues = CollectionTools.bag(this.getObjectTypeConverter().getDataValues(), this.getObjectTypeConverter().getDataValuesSize()); - if (dataValues.count(this.dataValue) > 1) { - messages.add( - DefaultEclipseLinkJpaValidationMessages.buildMessage( - IMessage.HIGH_SEVERITY, - EclipseLinkJpaValidationMessages.MULTIPLE_OBJECT_VALUES_FOR_DATA_VALUE, - new String[] {this.dataValue}, - this, - this.getDataValueTextRange() - ) - ); - } - } - - public TextRange getValidationTextRange() { - return this.xmlConversionValue.getValidationTextRange(); - } -} 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 47099016dd..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,343 +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.Iterator; -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.Association; -import org.eclipse.jpt.common.utility.internal.SimpleAssociation; -import org.eclipse.jpt.common.utility.internal.iterables.ArrayIterable; -import org.eclipse.jpt.common.utility.internal.iterables.EmptyIterable; -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.jpa1.context.orm.AbstractOrmConverter; -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.internal.DefaultEclipseLinkJpaValidationMessages; -import org.eclipse.jpt.jpa.eclipselink.core.internal.EclipseLinkJpaValidationMessages; -import org.eclipse.jpt.jpa.eclipselink.core.internal.context.persistence.EclipseLinkPersistenceUnit; -import org.eclipse.jpt.jpa.eclipselink.core.resource.orm.XmlConvertibleMapping; -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 class OrmEclipseLinkConvert - extends AbstractOrmConverter - implements EclipseLinkConvert -{ - protected String specifiedConverterName; - protected String defaultConverterName; - - protected OrmEclipseLinkConverter<?> converter; - - - protected static final OrmEclipseLinkConverter.Adapter[] CONVERTER_ADAPTER_ARRAY = new OrmEclipseLinkConverter.Adapter[] { - OrmEclipseLinkCustomConverter.Adapter.instance(), - OrmEclipseLinkTypeConverter.Adapter.instance(), - OrmEclipseLinkObjectTypeConverter.Adapter.instance(), - OrmEclipseLinkStructConverter.Adapter.instance() - }; - protected static final Iterable<OrmEclipseLinkConverter.Adapter> CONVERTER_ADAPTERS = new ArrayIterable<OrmEclipseLinkConverter.Adapter>(CONVERTER_ADAPTER_ARRAY); - - - public OrmEclipseLinkConvert(OrmAttributeMapping parent) { - super(parent); - this.specifiedConverterName = this.getXmlConvertibleMapping().getConvert(); - this.converter = this.buildConverter(); - } - - - // ********** synchronize/update ********** - - @Override - public EclipseLinkPersistenceUnit getPersistenceUnit(){ - return (EclipseLinkPersistenceUnit) super.getPersistenceUnit(); - } - - @Override - public void synchronizeWithResourceModel() { - super.synchronizeWithResourceModel(); - this.setSpecifiedConverterName_(this.getXmlConvertibleMapping().getConvert()); - this.syncConverter(); - } - - @Override - public void update() { - super.update(); - this.setDefaultConverterName(this.buildDefaultConverterName()); - if (this.converter != null) { - this.converter.update(); - } - } - - - // ********** 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; - } - - - // ********** converter ********** - - public OrmEclipseLinkConverter<?> getConverter() { - return this.converter; - } - - public void setConverter(Class<? extends EclipseLinkConverter> converterType) { - if (converterType == null) { - if (this.converter != null) { - this.setConverter_(null); - this.removeXmlConverters(); - } - } else { - if ((this.converter == null) || (this.converter.getType() != converterType)) { - // note: we may also remove the XML converter we want; - // but if we leave it, the resulting sync will screw things up... - this.removeXmlConverters(); - OrmEclipseLinkConverter.Adapter converterAdapter = this.getConverterAdapter(converterType); - this.setConverter_(converterAdapter.buildConverter(this)); - converterAdapter.addXmlConverter(this.getXmlConvertibleMapping(), this.converter.getXmlConverter()); - } - } - } - - protected void setConverter_(OrmEclipseLinkConverter<?> converter) { - OrmEclipseLinkConverter<?> old = this.converter; - this.converter = converter; - this.firePropertyChanged(CONVERTER_PROPERTY, old, converter); - } - - protected void removeXmlConverters() { - XmlConvertibleMapping xmlMapping = this.getXmlConvertibleMapping(); - for (OrmEclipseLinkConverter.Adapter adapter : this.getConverterAdapters()) { - adapter.removeXmlConverter(xmlMapping); - } - } - - protected OrmEclipseLinkConverter<?> buildConverter() { - XmlConvertibleMapping xmlMapping = this.getXmlConvertibleMapping(); - for (OrmEclipseLinkConverter.Adapter adapter : this.getConverterAdapters()) { - OrmEclipseLinkConverter<?> ormConverter = adapter.buildConverter(xmlMapping, this); - if (ormConverter != null) { - return ormConverter; - } - } - return null; - } - - protected void syncConverter() { - Association<OrmEclipseLinkConverter.Adapter, XmlNamedConverter> assoc = this.getXmlConverter(); - if (assoc == null) { - if (this.converter != null) { - this.setConverter_(null); - } - } else { - OrmEclipseLinkConverter.Adapter adapter = assoc.getKey(); - XmlNamedConverter xmlConverter = assoc.getValue(); - if ((this.converter != null) && - (this.converter.getType() == adapter.getConverterType()) && - (this.converter.getXmlConverter() == xmlConverter)) { - this.converter.synchronizeWithResourceModel(); - } else { - this.setConverter_(adapter.buildConverter(xmlConverter, this)); - } - } - } - - /** - * Return the first XML converter we find along with its corresponding - * adapter. Return <code>null</code> if there are no converters in the XML. - */ - protected Association<OrmEclipseLinkConverter.Adapter, XmlNamedConverter> getXmlConverter() { - XmlConvertibleMapping xmlMapping = this.getXmlConvertibleMapping(); - for (OrmEclipseLinkConverter.Adapter adapter : this.getConverterAdapters()) { - XmlNamedConverter xmlConverter = adapter.getXmlConverter(xmlMapping); - if (xmlConverter != null) { - return new SimpleAssociation<OrmEclipseLinkConverter.Adapter, XmlNamedConverter>(adapter, xmlConverter); - } - } - return null; - } - - - // ********** converter adapters ********** - - /** - * Return the converter adapter for the specified converter type. - */ - protected OrmEclipseLinkConverter.Adapter getConverterAdapter(Class<? extends EclipseLinkConverter> converterType) { - for (OrmEclipseLinkConverter.Adapter adapter : this.getConverterAdapters()) { - if (adapter.getConverterType() == converterType) { - return adapter; - } - } - throw new IllegalArgumentException("unknown converter type: " + converterType.getName()); //$NON-NLS-1$ - } - - protected Iterable<OrmEclipseLinkConverter.Adapter> getConverterAdapters() { - return CONVERTER_ADAPTERS; - } - - - // ********** misc ********** - - @Override - protected XmlConvertibleMapping getXmlConvertibleMapping() { - // cast to EclipseLink type - return (XmlConvertibleMapping) super.getXmlConvertibleMapping(); - } - - public Class<? extends Converter> getType() { - return EclipseLinkConvert.class; - } - - public void initialize() { - this.specifiedConverterName = ""; //$NON-NLS-1$ - this.getXmlConvertibleMapping().setConvert(this.specifiedConverterName); - } - - - // ********** refactoring ********** - - public Iterable<ReplaceEdit> createRenameTypeEdits(IType originalType, String newName) { - return (this.converter != null) ? - this.converter.createRenameTypeEdits(originalType, newName) : - EmptyIterable.<ReplaceEdit>instance(); - } - - public Iterable<ReplaceEdit> createRenamePackageEdits(IPackageFragment originalPackage, String newName) { - return (this.converter != null) ? - this.converter.createRenamePackageEdits(originalPackage, newName) : - EmptyIterable.<ReplaceEdit>instance(); - } - - public Iterable<ReplaceEdit> createMoveTypeEdits(IType originalType, IPackageFragment newPackage) { - return (this.converter != null) ? - this.converter.createMoveTypeEdits(originalType, newPackage) : - EmptyIterable.<ReplaceEdit>instance(); - } - - - // ********** validation ********** - - @Override - public void validate(List<IMessage> messages, IReporter reporter) { - super.validate(messages, reporter); - if (this.converter != null) { - this.converter.validate(messages, reporter); - } - this.validateConvertValue(messages); - } - - private void validateConvertValue(List<IMessage> messages) { - String converterName = this.getConverterName(); - if (converterName == null) { - return; - } - - for (Iterator<EclipseLinkConverter> converters = this.getPersistenceUnit().allConverters(); converters.hasNext(); ) { - if (converterName.equals(converters.next().getName())) { - return; - } - } - - if (ArrayTools.contains(RESERVED_CONVERTER_NAMES, converterName)) { - return; - } - - messages.add( - DefaultEclipseLinkJpaValidationMessages.buildMessage( - IMessage.HIGH_SEVERITY, - EclipseLinkJpaValidationMessages.ID_MAPPING_UNRESOLVED_CONVERTER_NAME, - new String[] {converterName, this.getParent().getName()}, - this.getParent(), - this.getValidationTextRange() - ) - ); - } - - public TextRange getValidationTextRange() { - return this.getXmlConvertibleMapping().getConvertTextRange(); - } - - - // ********** adapter ********** - - public static class Adapter - implements OrmConverter.Adapter - { - 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); - } - - public boolean isActive(org.eclipse.jpt.jpa.core.resource.orm.XmlConvertibleMapping xmlMapping) { - return ((XmlConvertibleMapping) xmlMapping).getConvert() != null; - } - - public OrmConverter buildNewConverter(OrmAttributeMapping parent, OrmXmlContextNodeFactory factory) { - return new OrmEclipseLinkConvert(parent); - } - - public void clearXmlValue(org.eclipse.jpt.jpa.core.resource.orm.XmlConvertibleMapping xmlMapping) { - ((XmlConvertibleMapping) xmlMapping).setConvert(null); - } - } -} 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 4d33d9ec04..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,270 +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 java.util.List; -import java.util.ListIterator; -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.StringTools; -import org.eclipse.jpt.common.utility.internal.iterables.EmptyIterable; -import org.eclipse.jpt.jpa.core.context.XmlContextNode; -import org.eclipse.jpt.jpa.core.context.orm.EntityMappings; -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.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.internal.context.persistence.EclipseLinkPersistenceUnit; -import org.eclipse.jpt.jpa.eclipselink.core.resource.orm.XmlConverterHolder; -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(); - this.getPersistenceUnit().addConverter(this); - } - - - // ********** 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 ********** - - public X getXmlConverter() { - return this.xmlConverter; - } - - @Override - public EclipseLinkPersistenceUnit getPersistenceUnit() { - return (EclipseLinkPersistenceUnit) super.getPersistenceUnit(); - } - - protected EntityMappings getEntityMappings() { - return (EntityMappings) this.getMappingFileRoot(); - } - - public char getEnclosingTypeSeparator() { - return '$'; - } - - - // ********** refactoring ********** - - public Iterable<ReplaceEdit> createRenameTypeEdits(IType originalType, String newName) { - return EmptyIterable.instance(); - } - - public Iterable<ReplaceEdit> createMoveTypeEdits(IType originalType, IPackageFragment newPackage) { - return EmptyIterable.instance(); - } - - public Iterable<ReplaceEdit> createRenamePackageEdits(IPackageFragment originalPackage, String newName) { - return EmptyIterable.instance(); - } - - // ********** validation ********** - - @Override - public void validate(List<IMessage> messages, IReporter reporter) { - super.validate(messages, reporter); - this.validateConverterNames(messages); - } - - protected void validateConverterNames(List<IMessage> messages){ - String name = this.getName(); - if (StringTools.stringIsEmpty(name)) { - messages.add( - DefaultEclipseLinkJpaValidationMessages.buildMessage( - IMessage.HIGH_SEVERITY, - EclipseLinkJpaValidationMessages.CONVERTER_NAME_UNDEFINED, - new String[] {}, - this, - this.getNameTextRange() - )); - } else { - List<String> reportedNames = new ArrayList<String>(); - for (ListIterator<EclipseLinkConverter> globalConverters = this.getPersistenceUnit().allConverters(); globalConverters.hasNext(); ) { - if ( this.duplicates(globalConverters.next()) && !reportedNames.contains(name) ){ - messages.add( - DefaultEclipseLinkJpaValidationMessages.buildMessage( - IMessage.HIGH_SEVERITY, - EclipseLinkJpaValidationMessages.CONVERTER_DUPLICATE_NAME, - new String[] {name}, - this, - this.getNameTextRange() - ) - ); - reportedNames.add(name); - } - } - } - } - - public boolean overrides(EclipseLinkConverter converter) { - if (this.name == null) { - return false; - } - // this isn't ideal, but it will have to do until we have further adopter input - return this.name.equals(converter.getName()) && - (converter instanceof JavaEclipseLinkConverter); - } - - public boolean duplicates(EclipseLinkConverter converter) { - return (this != converter) && - ! StringTools.stringIsEmpty(this.name) && - this.name.equals(converter.getName()) && - ! this.overrides(converter) && - ! converter.overrides(this); - } - - public TextRange getValidationTextRange() { - return this.xmlConverter.getValidationTextRange(); - } - - public TextRange getNameTextRange() { - return this.xmlConverter.getNameTextRange(); - } - - // ********** adapter ********** - - /** - * This interface allows a client to interact with various - * EclipseLink <code>orm.xml</code> converters via the same protocol. - */ - public interface Adapter - { - /** - * Return the type of converter handled by the adapter. - */ - Class<? extends EclipseLinkConverter> getConverterType(); - - /** - * Build a converter corresponding to the specified XML converter - * container if the container holds the adapter's XML converter. Return - * <code>null</code> otherwise. - * This is used to build a converter during construction of the - * converter's parent. - */ - OrmEclipseLinkConverter<? extends XmlNamedConverter> buildConverter(XmlConverterHolder xmlConverterContainer, XmlContextNode parent); - - /** - * Return the adapter's XML converter for the specified XML converter - * container. Return <code>null</code> if the container does not hold - * the adapter's XML converter. - * The returned XML converter is compared to the parent's - * converter's XML converter while the context model is synchronized - * with the resource model. If it has changed, the parent will build - * a new converter (via the adapter). - * - * @see #buildConverter(XmlNamedConverter, XmlContextNode) - */ - XmlNamedConverter getXmlConverter(XmlConverterHolder xmlConverterContainer); - - /** - * Build a converter using the specified XML converter. - * This is used when the context model is synchronized with the - * resource model (and the resource model has changed). - * - * @see #getXmlConverter(XmlConverterHolder) - */ - OrmEclipseLinkConverter<? extends XmlNamedConverter> buildConverter(XmlNamedConverter xmlConverter, XmlContextNode parent); - - /** - * Build a new converter and its corresponding XML converter. - * The XML converter will be added to the XML converter container once - * the context converter has been added to the context model. - * - * @see #addXmlConverter(XmlConverterHolder, XmlNamedConverter) - */ - OrmEclipseLinkConverter<? extends XmlNamedConverter> buildConverter(XmlContextNode parent); - - /** - * Remove the adapter's XML converter from the specified XML converter - * container. - */ - void removeXmlConverter(XmlConverterHolder xmlConverterContainer); - - /** - * Add the specified XML converter to the specified XML converter - * container. - */ - void addXmlConverter(XmlConverterHolder xmlConverterContainer, XmlNamedConverter xmlConverter); - } - - public abstract static class AbstractAdapter - implements Adapter - { - public OrmEclipseLinkConverter<? extends XmlNamedConverter> buildConverter(XmlConverterHolder xmlConverterContainer, XmlContextNode parent) { - XmlNamedConverter xmlConverter = this.getXmlConverter(xmlConverterContainer); - return (xmlConverter == null) ? null : this.buildConverter(xmlConverter, parent); - } - - public OrmEclipseLinkConverter<? extends XmlNamedConverter> buildConverter(XmlContextNode parent) { - return this.buildConverter(this.buildXmlConverter(), parent); - } - - protected abstract XmlNamedConverter buildXmlConverter(); - - public void removeXmlConverter(XmlConverterHolder xmlConverterContainer) { - this.setXmlConverter(xmlConverterContainer, null); - } - - public void addXmlConverter(XmlConverterHolder xmlConverterContainer, XmlNamedConverter xmlConverter) { - this.setXmlConverter(xmlConverterContainer, xmlConverter); - } - - protected abstract void setXmlConverter(XmlConverterHolder xmlConverterContainer, XmlNamedConverter xmlConverter); - } -} 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 32d6e79f9b..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,179 +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.List; -import org.eclipse.jdt.core.IJavaProject; -import org.eclipse.jdt.core.IPackageFragment; -import org.eclipse.jdt.core.IType; -import org.eclipse.jpt.common.core.internal.utility.jdt.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.EmptyIterable; -import org.eclipse.jpt.common.utility.internal.iterables.SingleElementIterable; -import org.eclipse.jpt.jpa.core.context.XmlContextNode; -import org.eclipse.jpt.jpa.core.resource.java.JavaResourcePersistentType; -import org.eclipse.jpt.jpa.eclipselink.core.context.EclipseLinkCustomConverter; -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 EclipseLinkCustomConverter -{ - - protected String converterClass; - - protected JavaResourcePersistentType converterPersistentType; - - public OrmEclipseLinkConverterClassConverter(XmlContextNode parent, X xmlConverter) { - super(parent, xmlConverter); - } - - // **************** converter class **************************************** - - public String getConverterClass() { - return this.converterClass; - } - - protected void setConverterClass_(String newConverterClass) { - String oldConverterClass = this.converterClass; - this.converterClass = newConverterClass; - firePropertyChanged(CONVERTER_CLASS_PROPERTY, oldConverterClass, newConverterClass); - } - - protected JavaResourcePersistentType getConverterJavaResourcePersistentType() { - return this.getEntityMappings().resolveJavaResourcePersistentType(this.converterClass); - } - - // **************** resource interaction *********************************** - - protected void updateConverterPersistentType() { - this.converterPersistentType = this.getConverterJavaResourcePersistentType(); - } - - // **************** validation ********************************************* - - @Override - public void validate(List<IMessage> messages, IReporter reporter) { - super.validate(messages, reporter); - validateConverterClass(messages); - } - - protected void validateConverterClass(List<IMessage> messages) { - IJavaProject javaProject = getJpaProject().getJavaProject(); - - if (StringTools.stringIsEmpty(this.converterClass)) { - messages.add( - DefaultEclipseLinkJpaValidationMessages.buildMessage( - IMessage.HIGH_SEVERITY, - EclipseLinkJpaValidationMessages.CONVERTER_CLASS_DEFINED, - this, - getConverterClassTextRange() - ) - ); - } - else if (!converterClassExists(javaProject)) { - messages.add( - DefaultEclipseLinkJpaValidationMessages.buildMessage( - IMessage.HIGH_SEVERITY, - EclipseLinkJpaValidationMessages.CONVERTER_CLASS_EXISTS, - new String[] {this.converterClass}, - this, - getConverterClassTextRange() - ) - ); - } - else if (!converterClassImplementsInterface(javaProject, ECLIPSELINK_CONVERTER_CLASS_NAME)) { - messages.add( - DefaultEclipseLinkJpaValidationMessages.buildMessage( - IMessage.HIGH_SEVERITY, - EclipseLinkJpaValidationMessages.CONVERTER_CLASS_IMPLEMENTS_CONVERTER, - new String[] {this.converterClass}, - this, - getConverterClassTextRange() - ) - ); - } - } - - private boolean converterClassExists(IJavaProject javaProject) { - if (this.converterClass != null) - { - String globalPackage = getEntityMappings().getPackage(); - IType type = JDTTools.getJDTType(javaProject, this.converterClass); - if (type != null) { - return true; - } else if (StringTools.stringIsNotEmpty(globalPackage)) { - type = JDTTools.getJDTType(javaProject, globalPackage + "." + this.converterClass); - if (type != null) { - return true; - } - } - } - return false; - } - - private boolean converterClassImplementsInterface(IJavaProject javaProject, String interfaceName) { - if (this.converterClass != null) - { - String globalPackage = getEntityMappings().getPackage(); - boolean implementFound = JDTTools.typeNamedImplementsInterfaceNamed(javaProject, this.converterClass, interfaceName); - if (!implementFound && StringTools.stringIsNotEmpty(globalPackage)) { - implementFound = JDTTools.typeNamedImplementsInterfaceNamed(javaProject, globalPackage + "." + this.converterClass, interfaceName); - } - return implementFound; - } - return false; - } - - public abstract TextRange getConverterClassTextRange(); - - //************************* 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) { - JavaResourcePersistentType converterType = this.getConverterJavaResourcePersistentType(); - return (converterType != null) && converterType.getQualifiedName().equals(typeName); - } - - protected boolean isIn(IPackageFragment packageFragment) { - JavaResourcePersistentType converterType = this.getConverterJavaResourcePersistentType(); - 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 945105e2bc..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,746 +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 java.util.ListIterator; -import java.util.Vector; -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.LiveCloneIterable; -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.ContextContainerTools; -import org.eclipse.jpt.jpa.core.internal.context.orm.AbstractOrmXmlContextNode; -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.XmlConvertersHolder; -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 XmlConvertersHolder xmlConvertersHolder; - - protected final Vector<OrmEclipseLinkCustomConverter> customConverters = new Vector<OrmEclipseLinkCustomConverter>(); - protected final CustomConverterContainerAdapter customConverterContainerAdapter; - - protected final Vector<OrmEclipseLinkObjectTypeConverter> objectTypeConverters = new Vector<OrmEclipseLinkObjectTypeConverter>(); - protected final ObjectTypeConverterContainerAdapter objectTypeConverterContainerAdapter; - - protected final Vector<OrmEclipseLinkStructConverter> structConverters = new Vector<OrmEclipseLinkStructConverter>(); - protected final StructConverterContainerAdapter structConverterContainerAdapter; - - protected final Vector<OrmEclipseLinkTypeConverter> typeConverters = new Vector<OrmEclipseLinkTypeConverter>(); - protected final TypeConverterContainerAdapter typeConverterContainerAdapter; - - - public OrmEclipseLinkConverterContainerImpl(XmlContextNode parent, XmlConvertersHolder xmlConvertersHolder) { - super(parent); - this.xmlConvertersHolder = xmlConvertersHolder; - - this.customConverterContainerAdapter = this.buildCustomConverterContainerAdapter(); - this.objectTypeConverterContainerAdapter = this.buildObjectTypeConverterContainerAdapter(); - this.structConverterContainerAdapter = this.buildStructConverterContainerAdapter(); - this.typeConverterContainerAdapter = this.buildTypeConverterContainerAdapter(); - - this.initializeCustomConverters(); - this.initializeObjectTypeConverters(); - this.initializeStructConverters(); - this.initializeTypeConverters(); - } - - - // ********** 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 ********** - - @SuppressWarnings("unchecked") - public ListIterator<OrmEclipseLinkCustomConverter> customConverters() { - return this.getCustomConverters().iterator(); - } - - public ListIterable<OrmEclipseLinkCustomConverter> getCustomConverters() { - return new LiveCloneListIterable<OrmEclipseLinkCustomConverter>(this.customConverters); - } - - public int customConvertersSize() { - return this.customConverters.size(); - } - - public OrmEclipseLinkCustomConverter addCustomConverter() { - return this.addCustomConverter(this.customConverters.size()); - } - - public OrmEclipseLinkCustomConverter addCustomConverter(int index) { - XmlConverter xmlConverter = this.buildXmlCustomConverter(); - OrmEclipseLinkCustomConverter converter = this.addCustomConverter_(index, xmlConverter); - this.xmlConvertersHolder.getConverters().add(index, xmlConverter); - return converter; - } - - protected XmlConverter buildXmlCustomConverter() { - return EclipseLinkOrmFactory.eINSTANCE.createXmlConverter(); - } - - public void removeCustomConverter(EclipseLinkCustomConverter converter) { - this.removeCustomConverter(this.customConverters.indexOf(converter)); - } - - public void removeCustomConverter(int index) { - this.removeCustomConverter_(index); - this.xmlConvertersHolder.getConverters().remove(index); - } - - protected void removeCustomConverter_(int index) { - this.removeItemFromList(index, this.customConverters, CUSTOM_CONVERTERS_LIST); - } - - public void moveCustomConverter(int targetIndex, int sourceIndex) { - this.moveItemInList(targetIndex, sourceIndex, this.customConverters, CUSTOM_CONVERTERS_LIST); - this.xmlConvertersHolder.getConverters().move(targetIndex, sourceIndex); - } - - protected void initializeCustomConverters() { - for (XmlConverter xmlConverter : this.getXmlCustomConverters()) { - this.customConverters.add(this.buildCustomConverter(xmlConverter)); - } - } - - protected OrmEclipseLinkCustomConverter buildCustomConverter(XmlConverter xmlConverter) { - return new OrmEclipseLinkCustomConverter(this, xmlConverter); - } - - protected void syncCustomConverters() { - ContextContainerTools.synchronizeWithResourceModel(this.customConverterContainerAdapter); - } - - protected Iterable<XmlConverter> getXmlCustomConverters() { - // clone to reduce chance of concurrency problems - return new LiveCloneIterable<XmlConverter>(this.xmlConvertersHolder.getConverters()); - } - - protected void moveCustomConverter_(int index, OrmEclipseLinkCustomConverter converter) { - this.moveItemInList(index, converter, this.customConverters, CUSTOM_CONVERTERS_LIST); - } - - protected OrmEclipseLinkCustomConverter addCustomConverter_(int index, XmlConverter xmlConverter) { - OrmEclipseLinkCustomConverter converter = this.buildCustomConverter(xmlConverter); - this.addItemToList(index, converter, this.customConverters, CUSTOM_CONVERTERS_LIST); - return converter; - } - - protected void removeCustomConverter_(OrmEclipseLinkCustomConverter converter) { - this.removeCustomConverter_(this.customConverters.indexOf(converter)); - } - - protected CustomConverterContainerAdapter buildCustomConverterContainerAdapter() { - return new CustomConverterContainerAdapter(); - } - - /** - * custom converter container adapter - */ - protected class CustomConverterContainerAdapter - implements ContextContainerTools.Adapter<OrmEclipseLinkCustomConverter, XmlConverter> - { - public Iterable<OrmEclipseLinkCustomConverter> getContextElements() { - return OrmEclipseLinkConverterContainerImpl.this.getCustomConverters(); - } - public Iterable<XmlConverter> getResourceElements() { - return OrmEclipseLinkConverterContainerImpl.this.getXmlCustomConverters(); - } - public XmlConverter getResourceElement(OrmEclipseLinkCustomConverter contextElement) { - return contextElement.getXmlConverter(); - } - public void moveContextElement(int index, OrmEclipseLinkCustomConverter element) { - OrmEclipseLinkConverterContainerImpl.this.moveCustomConverter_(index, element); - } - public void addContextElement(int index, XmlConverter resourceElement) { - OrmEclipseLinkConverterContainerImpl.this.addCustomConverter_(index, resourceElement); - } - public void removeContextElement(OrmEclipseLinkCustomConverter element) { - OrmEclipseLinkConverterContainerImpl.this.removeCustomConverter_(element); - } - } - - - // ********** object type converters ********** - - @SuppressWarnings("unchecked") - public ListIterator<OrmEclipseLinkObjectTypeConverter> objectTypeConverters() { - return this.getObjectTypeConverters().iterator(); - } - - public ListIterable<OrmEclipseLinkObjectTypeConverter> getObjectTypeConverters() { - return new LiveCloneListIterable<OrmEclipseLinkObjectTypeConverter>(this.objectTypeConverters); - } - - public int objectTypeConvertersSize() { - return this.objectTypeConverters.size(); - } - - public OrmEclipseLinkObjectTypeConverter addObjectTypeConverter() { - return this.addObjectTypeConverter(this.objectTypeConverters.size()); - } - - public OrmEclipseLinkObjectTypeConverter addObjectTypeConverter(int index) { - XmlObjectTypeConverter xmlConverter = this.buildXmlObjectTypeConverter(); - OrmEclipseLinkObjectTypeConverter converter = this.addObjectTypeConverter_(index, xmlConverter); - this.xmlConvertersHolder.getObjectTypeConverters().add(index, xmlConverter); - return converter; - } - - protected XmlObjectTypeConverter buildXmlObjectTypeConverter() { - return EclipseLinkOrmFactory.eINSTANCE.createXmlObjectTypeConverter(); - } - - public void removeObjectTypeConverter(EclipseLinkObjectTypeConverter converter) { - this.removeObjectTypeConverter(this.objectTypeConverters.indexOf(converter)); - } - - public void removeObjectTypeConverter(int index) { - this.removeObjectTypeConverter_(index); - this.xmlConvertersHolder.getObjectTypeConverters().remove(index); - } - - protected void removeObjectTypeConverter_(int index) { - this.removeItemFromList(index, this.objectTypeConverters, OBJECT_TYPE_CONVERTERS_LIST); - } - - public void moveObjectTypeConverter(int targetIndex, int sourceIndex) { - this.moveItemInList(targetIndex, sourceIndex, this.objectTypeConverters, OBJECT_TYPE_CONVERTERS_LIST); - this.xmlConvertersHolder.getObjectTypeConverters().move(targetIndex, sourceIndex); - } - - protected void initializeObjectTypeConverters() { - for (XmlObjectTypeConverter xmlConverter : this.getXmlObjectTypeConverters()) { - this.objectTypeConverters.add(this.buildObjectTypeConverter(xmlConverter)); - } - } - - protected OrmEclipseLinkObjectTypeConverter buildObjectTypeConverter(XmlObjectTypeConverter xmlConverter) { - return new OrmEclipseLinkObjectTypeConverter(this, xmlConverter); - } - - protected void syncObjectTypeConverters() { - ContextContainerTools.synchronizeWithResourceModel(this.objectTypeConverterContainerAdapter); - } - - protected Iterable<XmlObjectTypeConverter> getXmlObjectTypeConverters() { - // clone to reduce chance of concurrency problems - return new LiveCloneIterable<XmlObjectTypeConverter>(this.xmlConvertersHolder.getObjectTypeConverters()); - } - - protected void moveObjectTypeConverter_(int index, OrmEclipseLinkObjectTypeConverter converter) { - this.moveItemInList(index, converter, this.objectTypeConverters, OBJECT_TYPE_CONVERTERS_LIST); - } - - protected OrmEclipseLinkObjectTypeConverter addObjectTypeConverter_(int index, XmlObjectTypeConverter xmlConverter) { - OrmEclipseLinkObjectTypeConverter converter = this.buildObjectTypeConverter(xmlConverter); - this.addItemToList(index, converter, this.objectTypeConverters, OBJECT_TYPE_CONVERTERS_LIST); - return converter; - } - - protected void removeObjectTypeConverter_(OrmEclipseLinkObjectTypeConverter converter) { - this.removeObjectTypeConverter_(this.objectTypeConverters.indexOf(converter)); - } - - protected ObjectTypeConverterContainerAdapter buildObjectTypeConverterContainerAdapter() { - return new ObjectTypeConverterContainerAdapter(); - } - - /** - * object type converter container adapter - */ - protected class ObjectTypeConverterContainerAdapter - implements ContextContainerTools.Adapter<OrmEclipseLinkObjectTypeConverter, XmlObjectTypeConverter> - { - public Iterable<OrmEclipseLinkObjectTypeConverter> getContextElements() { - return OrmEclipseLinkConverterContainerImpl.this.getObjectTypeConverters(); - } - public Iterable<XmlObjectTypeConverter> getResourceElements() { - return OrmEclipseLinkConverterContainerImpl.this.getXmlObjectTypeConverters(); - } - public XmlObjectTypeConverter getResourceElement(OrmEclipseLinkObjectTypeConverter contextElement) { - return contextElement.getXmlConverter(); - } - public void moveContextElement(int index, OrmEclipseLinkObjectTypeConverter element) { - OrmEclipseLinkConverterContainerImpl.this.moveObjectTypeConverter_(index, element); - } - public void addContextElement(int index, XmlObjectTypeConverter resourceElement) { - OrmEclipseLinkConverterContainerImpl.this.addObjectTypeConverter_(index, resourceElement); - } - public void removeContextElement(OrmEclipseLinkObjectTypeConverter element) { - OrmEclipseLinkConverterContainerImpl.this.removeObjectTypeConverter_(element); - } - } - - - // ********** struct converters ********** - - @SuppressWarnings("unchecked") - public ListIterator<OrmEclipseLinkStructConverter> structConverters() { - return this.getStructConverters().iterator(); - } - - public ListIterable<OrmEclipseLinkStructConverter> getStructConverters() { - return new LiveCloneListIterable<OrmEclipseLinkStructConverter>(this.structConverters); - } - - public int structConvertersSize() { - return this.structConverters.size(); - } - - public OrmEclipseLinkStructConverter addStructConverter() { - return this.addStructConverter(this.structConverters.size()); - } - - public OrmEclipseLinkStructConverter addStructConverter(int index) { - XmlStructConverter xmlConverter = this.buildXmlStructConverter(); - OrmEclipseLinkStructConverter converter = this.addStructConverter_(index, xmlConverter); - this.xmlConvertersHolder.getStructConverters().add(index, xmlConverter); - return converter; - } - - protected XmlStructConverter buildXmlStructConverter() { - return EclipseLinkOrmFactory.eINSTANCE.createXmlStructConverter(); - } - - public void removeStructConverter(EclipseLinkStructConverter converter) { - this.removeStructConverter(this.structConverters.indexOf(converter)); - } - - public void removeStructConverter(int index) { - this.removeStructConverter_(index); - this.xmlConvertersHolder.getStructConverters().remove(index); - } - - protected void removeStructConverter_(int index) { - this.removeItemFromList(index, this.structConverters, STRUCT_CONVERTERS_LIST); - } - - public void moveStructConverter(int targetIndex, int sourceIndex) { - this.moveItemInList(targetIndex, sourceIndex, this.structConverters, STRUCT_CONVERTERS_LIST); - this.xmlConvertersHolder.getStructConverters().move(targetIndex, sourceIndex); - } - - protected void initializeStructConverters() { - for (XmlStructConverter xmlConverter : this.getXmlStructConverters()) { - this.structConverters.add(this.buildStructConverter(xmlConverter)); - } - } - - protected OrmEclipseLinkStructConverter buildStructConverter(XmlStructConverter xmlConverter) { - return new OrmEclipseLinkStructConverter(this, xmlConverter); - } - - protected void syncStructConverters() { - ContextContainerTools.synchronizeWithResourceModel(this.structConverterContainerAdapter); - } - - protected Iterable<XmlStructConverter> getXmlStructConverters() { - // clone to reduce chance of concurrency problems - return new LiveCloneIterable<XmlStructConverter>(this.xmlConvertersHolder.getStructConverters()); - } - - protected void moveStructConverter_(int index, OrmEclipseLinkStructConverter converter) { - this.moveItemInList(index, converter, this.structConverters, STRUCT_CONVERTERS_LIST); - } - - protected OrmEclipseLinkStructConverter addStructConverter_(int index, XmlStructConverter xmlConverter) { - OrmEclipseLinkStructConverter converter = this.buildStructConverter(xmlConverter); - this.addItemToList(index, converter, this.structConverters, STRUCT_CONVERTERS_LIST); - return converter; - } - - protected void removeStructConverter_(OrmEclipseLinkStructConverter converter) { - this.removeStructConverter_(this.structConverters.indexOf(converter)); - } - - protected StructConverterContainerAdapter buildStructConverterContainerAdapter() { - return new StructConverterContainerAdapter(); - } - - /** - * struct converter container adapter - */ - protected class StructConverterContainerAdapter - implements ContextContainerTools.Adapter<OrmEclipseLinkStructConverter, XmlStructConverter> - { - public Iterable<OrmEclipseLinkStructConverter> getContextElements() { - return OrmEclipseLinkConverterContainerImpl.this.getStructConverters(); - } - public Iterable<XmlStructConverter> getResourceElements() { - return OrmEclipseLinkConverterContainerImpl.this.getXmlStructConverters(); - } - public XmlStructConverter getResourceElement(OrmEclipseLinkStructConverter contextElement) { - return contextElement.getXmlConverter(); - } - public void moveContextElement(int index, OrmEclipseLinkStructConverter element) { - OrmEclipseLinkConverterContainerImpl.this.moveStructConverter_(index, element); - } - public void addContextElement(int index, XmlStructConverter resourceElement) { - OrmEclipseLinkConverterContainerImpl.this.addStructConverter_(index, resourceElement); - } - public void removeContextElement(OrmEclipseLinkStructConverter element) { - OrmEclipseLinkConverterContainerImpl.this.removeStructConverter_(element); - } - } - - - // ********** type converters ********** - - @SuppressWarnings("unchecked") - public ListIterator<OrmEclipseLinkTypeConverter> typeConverters() { - return this.getTypeConverters().iterator(); - } - - public ListIterable<OrmEclipseLinkTypeConverter> getTypeConverters() { - return new LiveCloneListIterable<OrmEclipseLinkTypeConverter>(this.typeConverters); - } - - public int typeConvertersSize() { - return this.typeConverters.size(); - } - - public OrmEclipseLinkTypeConverter addTypeConverter() { - return this.addTypeConverter(this.typeConverters.size()); - } - - public OrmEclipseLinkTypeConverter addTypeConverter(int index) { - XmlTypeConverter xmlConverter = this.buildXmlTypeConverter(); - OrmEclipseLinkTypeConverter converter = this.addTypeConverter_(index, xmlConverter); - this.xmlConvertersHolder.getTypeConverters().add(index, xmlConverter); - return converter; - } - - protected XmlTypeConverter buildXmlTypeConverter() { - return EclipseLinkOrmFactory.eINSTANCE.createXmlTypeConverter(); - } - - public void removeTypeConverter(EclipseLinkTypeConverter converter) { - this.removeTypeConverter(this.typeConverters.indexOf(converter)); - } - - public void removeTypeConverter(int index) { - this.removeTypeConverter_(index); - this.xmlConvertersHolder.getTypeConverters().remove(index); - } - - protected void removeTypeConverter_(int index) { - this.removeItemFromList(index, this.typeConverters, TYPE_CONVERTERS_LIST); - } - - public void moveTypeConverter(int targetIndex, int sourceIndex) { - this.moveItemInList(targetIndex, sourceIndex, this.typeConverters, TYPE_CONVERTERS_LIST); - this.xmlConvertersHolder.getTypeConverters().move(targetIndex, sourceIndex); - } - - protected void initializeTypeConverters() { - for (XmlTypeConverter xmlConverter : this.getXmlTypeConverters()) { - this.typeConverters.add(this.buildTypeConverter(xmlConverter)); - } - } - - protected OrmEclipseLinkTypeConverter buildTypeConverter(XmlTypeConverter xmlConverter) { - return new OrmEclipseLinkTypeConverter(this, xmlConverter); - } - - protected void syncTypeConverters() { - ContextContainerTools.synchronizeWithResourceModel(this.typeConverterContainerAdapter); - } - - protected Iterable<XmlTypeConverter> getXmlTypeConverters() { - // clone to reduce chance of concurrency problems - return new LiveCloneIterable<XmlTypeConverter>(this.xmlConvertersHolder.getTypeConverters()); - } - - protected void moveTypeConverter_(int index, OrmEclipseLinkTypeConverter converter) { - this.moveItemInList(index, converter, this.typeConverters, TYPE_CONVERTERS_LIST); - } - - protected OrmEclipseLinkTypeConverter addTypeConverter_(int index, XmlTypeConverter xmlConverter) { - OrmEclipseLinkTypeConverter converter = this.buildTypeConverter(xmlConverter); - this.addItemToList(index, converter, this.typeConverters, TYPE_CONVERTERS_LIST); - return converter; - } - - protected void removeTypeConverter_(OrmEclipseLinkTypeConverter converter) { - this.removeTypeConverter_(this.typeConverters.indexOf(converter)); - } - - protected TypeConverterContainerAdapter buildTypeConverterContainerAdapter() { - return new TypeConverterContainerAdapter(); - } - - /** - * type converter container adapter - */ - protected class TypeConverterContainerAdapter - implements ContextContainerTools.Adapter<OrmEclipseLinkTypeConverter, XmlTypeConverter> - { - public Iterable<OrmEclipseLinkTypeConverter> getContextElements() { - return OrmEclipseLinkConverterContainerImpl.this.getTypeConverters(); - } - public Iterable<XmlTypeConverter> getResourceElements() { - return OrmEclipseLinkConverterContainerImpl.this.getXmlTypeConverters(); - } - public XmlTypeConverter getResourceElement(OrmEclipseLinkTypeConverter contextElement) { - return contextElement.getXmlConverter(); - } - public void moveContextElement(int index, OrmEclipseLinkTypeConverter element) { - OrmEclipseLinkConverterContainerImpl.this.moveTypeConverter_(index, element); - } - public void addContextElement(int index, XmlTypeConverter resourceElement) { - OrmEclipseLinkConverterContainerImpl.this.addTypeConverter_(index, resourceElement); - } - public void removeContextElement(OrmEclipseLinkTypeConverter element) { - OrmEclipseLinkConverterContainerImpl.this.removeTypeConverter_(element); - } - } - - - // ********** 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 ********** - - @Override - public void validate(List<IMessage> messages, IReporter reporter) { - super.validate(messages, reporter); - validateCustomConverters(messages, reporter); - validateObjectTypeConverters(messages, reporter); - validateStructConverters(messages, reporter); - validateTypeConverters(messages, reporter); - } - - private void validateCustomConverters(List<IMessage> messages, IReporter reporter) { - for (OrmEclipseLinkCustomConverter converter : this.getCustomConverters()) { - converter.validate(messages, reporter); - } - } - - private void validateObjectTypeConverters(List<IMessage> messages, IReporter reporter) { - for (OrmEclipseLinkObjectTypeConverter converter : this.getObjectTypeConverters()) { - converter.validate(messages, reporter); - } - } - - private void validateStructConverters(List<IMessage> messages, IReporter reporter) { - for (OrmEclipseLinkStructConverter converter : this.getStructConverters()) { - converter.validate(messages, reporter); - } - } - - private void validateTypeConverters(List<IMessage> messages, IReporter reporter) { - for (OrmEclipseLinkTypeConverter converter : this.getTypeConverters()) { - converter.validate(messages, reporter); - } - } - - public TextRange getValidationTextRange() { - return this.xmlConvertersHolder.getValidationTextRange(); - } -} 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 d82eb95ee8..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,108 +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.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.resource.orm.EclipseLinkOrmFactory; -import org.eclipse.jpt.jpa.eclipselink.core.resource.orm.XmlConverter; -import org.eclipse.jpt.jpa.eclipselink.core.resource.orm.XmlConverterHolder; -import org.eclipse.jpt.jpa.eclipselink.core.resource.orm.XmlNamedConverter; -import org.eclipse.text.edits.ReplaceEdit; - -public class OrmEclipseLinkCustomConverter - extends OrmEclipseLinkConverterClassConverter<XmlConverter> - implements EclipseLinkCustomConverter -{ - - public OrmEclipseLinkCustomConverter(XmlContextNode parent, XmlConverter xmlConverter) { - super(parent, xmlConverter); - this.converterClass = xmlConverter.getClassName(); - } - - - // ********** synchronize/update ********** - - @Override - public void synchronizeWithResourceModel() { - super.synchronizeWithResourceModel(); - this.setConverterClass_(this.xmlConverter.getClassName()); - } - - - // ********** converter class ********** - - public void setConverterClass(String converterClass) { - this.setConverterClass_(converterClass); - this.xmlConverter.setClassName(converterClass); - } - - // ********** misc ********** - - public Class<EclipseLinkCustomConverter> getType() { - return EclipseLinkCustomConverter.class; - } - - @Override - public TextRange getConverterClassTextRange() { - return this.xmlConverter.getConverterClassTextRange(); - } - - // ********** refactoring ********** - - @Override - protected ReplaceEdit createRenameEdit(IType originalType, String newName) { - return this.xmlConverter.createRenameEdit(originalType, newName); - } - - @Override - protected ReplaceEdit createRenamePackageEdit(String newName) { - return xmlConverter.createRenamePackageEdit(newName); - } - - // ********** adapter ********** - - public static class Adapter - extends AbstractAdapter - { - private static final Adapter INSTANCE = new Adapter(); - public static Adapter instance() { - return INSTANCE; - } - - private Adapter() { - super(); - } - - public Class<EclipseLinkCustomConverter> getConverterType() { - return EclipseLinkCustomConverter.class; - } - - public XmlConverter getXmlConverter(XmlConverterHolder xmlConverterContainer) { - return xmlConverterContainer.getConverter(); - } - - public OrmEclipseLinkCustomConverter buildConverter(XmlNamedConverter xmlConverter, XmlContextNode parent) { - return new OrmEclipseLinkCustomConverter(parent, (XmlConverter) xmlConverter); - } - - @Override - protected XmlConverter buildXmlConverter() { - return EclipseLinkOrmFactory.eINSTANCE.createXmlConverter(); - } - - @Override - public void setXmlConverter(XmlConverterHolder xmlConverterContainer, XmlNamedConverter xmlConverter) { - xmlConverterContainer.setConverter((XmlConverter) xmlConverter); - } - } -} 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 d82bc2071f..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,235 +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.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.EmptyIterable; -import org.eclipse.jpt.common.utility.internal.iterables.SingleElementIterable; -import org.eclipse.text.edits.ReplaceEdit; -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.java.JavaResourcePersistentType; -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.context.java.JavaEclipseLinkCustomizer; -import org.eclipse.jpt.jpa.eclipselink.core.resource.orm.XmlCustomizerHolder; - -public class OrmEclipseLinkCustomizer - extends AbstractOrmXmlContextNode - implements EclipseLinkCustomizer -{ - protected String specifiedCustomizerClass; - protected String defaultCustomizerClass; - - - 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()); - } - - - // ********** 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(); - } - - - // ********** 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 JavaResourcePersistentType getResourceCustomizerPersistentType() { - XmlClassReference customizerClassRef = this.getXmlCustomizerClassRef(); - if (customizerClassRef == null) { - return null; - } - - String className = customizerClassRef.getClassName(); - if (className == null) { - return null; - } - - return this.getEntityMappings().resolveJavaResourcePersistentType(className); - } - - - // ********** 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 (EntityMappings) this.getMappingFileRoot(); - } - - protected boolean isFor(String typeName) { - JavaResourcePersistentType customizerType = this.getResourceCustomizerPersistentType(); - return (customizerType != null) && customizerType.getQualifiedName().equals(typeName); - } - - protected boolean isIn(IPackageFragment packageFragment) { - JavaResourcePersistentType customizerType = this.getResourceCustomizerPersistentType(); - return (customizerType != null) && customizerType.isIn(packageFragment); - } - - public char getCustomizerClassEnclosingTypeSeparator() { - return '$'; - } - - - // ********** refactoring ********** - - public Iterable<ReplaceEdit> createRenameTypeEdits(IType originalType, String newName) { - return 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.isFor(originalType.getFullyQualifiedName('.')) ? - new SingleElementIterable<ReplaceEdit>(this.createRenamePackageEdit(newPackage.getElementName())) : - EmptyIterable.<ReplaceEdit>instance(); - } - - public Iterable<ReplaceEdit> createRenamePackageEdits(IPackageFragment originalPackage, String newName) { - return this.isIn(originalPackage) ? - new SingleElementIterable<ReplaceEdit>(this.createRenamePackageEdit(newName)) : - EmptyIterable.<ReplaceEdit>instance(); - } - - protected ReplaceEdit createRenamePackageEdit(String newName) { - return this.getXmlCustomizerClassRef().createRenamePackageEdit(newName); - } - - - // ********** validation ********** - - public TextRange getValidationTextRange() { - 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 95dad672fc..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,193 +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.jdt.core.IPackageFragment; -import org.eclipse.jdt.core.IType; -import org.eclipse.jpt.common.utility.internal.iterables.CompositeIterable; -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.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.internal.v1_1.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 -{ - 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.getXmlTypeMapping()); - } - - - // ********** 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); - } - - - // ********** misc ********** - - @Override - public JavaEclipseLinkEmbeddable getJavaTypeMapping() { - return (JavaEclipseLinkEmbeddable) super.getJavaTypeMapping(); - } - - @Override - public JavaEclipseLinkEmbeddable getJavaTypeMappingForDefaults() { - return (JavaEclipseLinkEmbeddable) super.getJavaTypeMappingForDefaults(); - } - - public boolean usesPrimaryKeyColumns() { - 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.customizer.validate(messages, reporter); - this.changeTracking.validate(messages, reporter); - this.converterContainer.validate(messages, reporter); - } - - @Override - protected JptValidator buildTypeMappingValidator() { - return new EclipseLinkTypeMappingValidator(this, getJavaResourcePersistentType(), buildTextRangeResolver()); - } -} 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 88742e4f99..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,336 +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.jdt.core.IPackageFragment; -import org.eclipse.jdt.core.IType; -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.orm.EntityMappings; -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.java.JavaResourcePersistentType; -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.context.EclipseLinkChangeTracking; -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.internal.v1_1.context.EclipseLinkEntityPrimaryKeyValidator; -import org.eclipse.jpt.jpa.eclipselink.core.internal.v1_1.context.EclipseLinkTypeMappingValidator; -import org.eclipse.jpt.jpa.eclipselink.core.resource.orm.XmlEntity; -import org.eclipse.jpt.jpa.eclipselink.core.v2_0.resource.java.EclipseLinkClassExtractorAnnotation2_1; -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 -{ - protected final OrmEclipseLinkReadOnly readOnly; - - protected final OrmEclipseLinkCustomizer customizer; - - protected final OrmEclipseLinkChangeTracking changeTracking; - - protected final OrmEclipseLinkCaching caching; - - protected final OrmEclipseLinkConverterContainer converterContainer; - - - 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(); - } - - - // ********** synchronize/update ********** - - @Override - public void synchronizeWithResourceModel() { - super.synchronizeWithResourceModel(); - this.caching.synchronizeWithResourceModel(); - this.readOnly.synchronizeWithResourceModel(); - this.converterContainer.synchronizeWithResourceModel(); - this.changeTracking.synchronizeWithResourceModel(); - this.customizer.synchronizeWithResourceModel(); - } - - @Override - public void update() { - super.update(); - this.caching.update(); - this.readOnly.update(); - this.converterContainer.update(); - this.changeTracking.update(); - this.customizer.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.xmlTypeMapping); - } - - - // ********** 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); - } - - - // ********** misc ********** - - @Override - public JavaEclipseLinkEntity getJavaTypeMapping() { - return (JavaEclipseLinkEntity) super.getJavaTypeMapping(); - } - - @Override - public JavaEclipseLinkEntity getJavaTypeMappingForDefaults() { - return (JavaEclipseLinkEntity) super.getJavaTypeMappingForDefaults(); - } - - public boolean usesPrimaryKeyColumns() { - return (this.getXmlTypeMapping().getPrimaryKey() != null) - || this.usesJavaPrimaryKeyColumns(); - } - - protected boolean usesJavaPrimaryKeyColumns() { - JavaEclipseLinkEntity javaEntity = this.getJavaTypeMappingForDefaults(); - return (javaEntity != null) && javaEntity.usesPrimaryKeyColumns(); - } - - @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) { - JavaResourcePersistentType jrpt = this.getJavaPersistentType().getResourcePersistentType(); - 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 JavaResourcePersistentType getResourceClassExtractorPersistentType() { - XmlClassReference classExtractorClassRef = this.getXmlClassExtractor(); - if (classExtractorClassRef == null) { - return null; - } - - String className = classExtractorClassRef.getClassName(); - if (className == null) { - return null; - } - - return this.getEntityMappings().resolveJavaResourcePersistentType(className); - } - - protected boolean classExtractorIsFor(String typeName) { - JavaResourcePersistentType classExtractorType = this.getResourceClassExtractorPersistentType(); - return (classExtractorType != null) && classExtractorType.getQualifiedName().equals(typeName); - } - - protected boolean classExtractorIsIn(IPackageFragment packageFragment) { - JavaResourcePersistentType classExtractorType = this.getResourceClassExtractorPersistentType(); - return (classExtractorType != null) && classExtractorType.isIn(packageFragment); - } - - protected EntityMappings getEntityMappings() { - return (EntityMappings) getMappingFileRoot(); - } - - - // ********** 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.caching.validate(messages, reporter); - this.readOnly.validate(messages, reporter); - this.converterContainer.validate(messages, reporter); - this.changeTracking.validate(messages, reporter); - this.customizer.validate(messages, reporter); - } - - @Override - protected JptValidator buildPrimaryKeyValidator() { - return new EclipseLinkEntityPrimaryKeyValidator(this, buildTextRangeResolver()); - } - - @Override - protected JptValidator buildTypeMappingValidator() { - return new EclipseLinkTypeMappingValidator(this, getJavaResourcePersistentType(), buildTextRangeResolver()); - } -} 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 c0f40771b4..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,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.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.orm.AbstractOrmIdMapping; -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.resource.orm.XmlId; -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 -{ - protected final OrmEclipseLinkMutable mutable; - - - public OrmEclipseLinkIdMapping(OrmPersistentAttribute parent, XmlId xmlMapping) { - super(parent, xmlMapping); - this.mutable = new OrmEclipseLinkMutable(this); - } - - - // ********** synchronize/update ********** - - @Override - public void synchronizeWithResourceModel() { - super.synchronizeWithResourceModel(); - this.mutable.synchronizeWithResourceModel(); - } - - @Override - public void update() { - super.update(); - this.mutable.update(); - } - - - // ********** mutable ********** - - public EclipseLinkMutable getMutable() { - return this.mutable; - } - - - // ********** 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()); - } - - - // ********** validation ********** - - @Override - public void validate(List<IMessage> messages, IReporter reporter) { - super.validate(messages, reporter); - // TODO mutable validation - } -} 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 3b0e9b59b9..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,89 +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.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() { - 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 de99c6f6e7..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,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.AbstractOrmManyToManyMapping; -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.XmlManyToMany; -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 EclipseLinkRelationshipMapping -{ - protected final OrmEclipseLinkJoinFetch joinFetch; - - - public OrmEclipseLinkManyToManyMapping(OrmPersistentAttribute parent, XmlManyToMany 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/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 a03b8b1557..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,261 +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.jdt.core.IPackageFragment; -import org.eclipse.jdt.core.IType; -import org.eclipse.jpt.common.utility.internal.iterables.CompositeIterable; -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.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.context.EclipseLinkChangeTracking; -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.internal.v1_1.context.EclipseLinkMappedSuperclassPrimaryKeyValidator; -import org.eclipse.jpt.jpa.eclipselink.core.internal.v1_1.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 -{ - protected final OrmEclipseLinkReadOnly readOnly; - - protected final OrmEclipseLinkCustomizer customizer; - - protected final OrmEclipseLinkChangeTracking changeTracking; - - protected final OrmEclipseLinkCaching caching; - - protected final OrmEclipseLinkConverterContainer converterContainer; - - - 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(); - } - - - // ********** synchronize/update ********** - - @Override - public void synchronizeWithResourceModel() { - super.synchronizeWithResourceModel(); - this.caching.synchronizeWithResourceModel(); - this.readOnly.synchronizeWithResourceModel(); - this.converterContainer.synchronizeWithResourceModel(); - this.changeTracking.synchronizeWithResourceModel(); - this.customizer.synchronizeWithResourceModel(); - } - - @Override - public void update() { - super.update(); - this.caching.update(); - this.readOnly.update(); - this.converterContainer.update(); - this.changeTracking.update(); - this.customizer.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.xmlTypeMapping); - } - - - // ********** 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); - } - - - // ********** misc ********** - - @Override - public JavaEclipseLinkMappedSuperclass getJavaTypeMapping() { - return (JavaEclipseLinkMappedSuperclass) super.getJavaTypeMapping(); - } - - @Override - public JavaEclipseLinkMappedSuperclass getJavaTypeMappingForDefaults() { - return (JavaEclipseLinkMappedSuperclass) super.getJavaTypeMappingForDefaults(); - } - - public boolean usesPrimaryKeyColumns() { - return (this.getXmlTypeMapping().getPrimaryKey() != null) - || this.usesJavaPrimaryKeyColumns(); - } - - protected boolean usesJavaPrimaryKeyColumns() { - JavaEclipseLinkMappedSuperclass javaMappedSuperclass = this.getJavaTypeMappingForDefaults(); - return (javaMappedSuperclass != null) && javaMappedSuperclass.usesPrimaryKeyColumns(); - } - - 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.caching.validate(messages, reporter); - this.readOnly.validate(messages, reporter); - this.converterContainer.validate(messages, reporter); - this.changeTracking.validate(messages, reporter); - this.customizer.validate(messages, reporter); - } - - @Override - protected JptValidator buildPrimaryKeyValidator() { - return new EclipseLinkMappedSuperclassPrimaryKeyValidator(this, this.buildTextRangeResolver()); - } - - @Override - protected JptValidator buildTypeMappingValidator() { - return new EclipseLinkMappedSuperclassValidator(this, this.getJavaResourcePersistentType(), this.buildTextRangeResolver()); - } -} 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 58120c55fc..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,127 +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.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.internal.context.java.JavaEclipseLinkPersistentAttribute; -import org.eclipse.jpt.jpa.eclipselink.core.internal.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() { - 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 1afdff2ed1..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,425 +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 java.util.ListIterator; -import java.util.Vector; -import org.eclipse.jdt.core.IPackageFragment; -import org.eclipse.jdt.core.IType; -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.LiveCloneIterable; -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.XmlContextNode; -import org.eclipse.jpt.jpa.core.internal.context.ContextContainerTools; -import org.eclipse.jpt.jpa.core.resource.java.JavaResourcePersistentType; -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.resource.orm.EclipseLinkOrmFactory; -import org.eclipse.jpt.jpa.eclipselink.core.resource.orm.XmlConversionValue; -import org.eclipse.jpt.jpa.eclipselink.core.resource.orm.XmlConverterHolder; -import org.eclipse.jpt.jpa.eclipselink.core.resource.orm.XmlNamedConverter; -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 objectType; - - private final Vector<OrmEclipseLinkConversionValue> conversionValues = new Vector<OrmEclipseLinkConversionValue>(); - private final ConversionValueContainerAdapter conversionValueContainerAdapter = new ConversionValueContainerAdapter(); - - private String defaultObjectValue; - - - public OrmEclipseLinkObjectTypeConverter(XmlContextNode parent, XmlObjectTypeConverter xmlConverter) { - super(parent, xmlConverter); - this.dataType = xmlConverter.getDataType(); - this.objectType = xmlConverter.getObjectType(); - this.initializeConversionValues(); - 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.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); - } - - protected boolean dataTypeIsFor(String typeName) { - return this.typeIsFor(this.getDataTypeJavaResourcePersistentType(), typeName); - } - - protected boolean dataTypeIsIn(IPackageFragment packageFragment) { - return this.typeIsIn(this.getDataTypeJavaResourcePersistentType(), packageFragment); - } - - protected JavaResourcePersistentType getDataTypeJavaResourcePersistentType() { - return this.getEntityMappings().resolveJavaResourcePersistentType(this.getDataType()); - } - - - // ********** 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); - } - - protected boolean objectTypeIsFor(String typeName) { - return this.typeIsFor(this.getObjectTypeJavaResourcePersistentType(), typeName); - } - - protected boolean objectTypeIsIn(IPackageFragment packageFragment) { - return this.typeIsIn(this.getObjectTypeJavaResourcePersistentType(), packageFragment); - } - - protected JavaResourcePersistentType getObjectTypeJavaResourcePersistentType() { - return this.getEntityMappings().resolveJavaResourcePersistentType(this.getObjectType()); - } - - - // ********** conversion values ********** - - @SuppressWarnings("unchecked") - public ListIterator<OrmEclipseLinkConversionValue> conversionValues() { - return this.getConversionValues().iterator(); - } - - public ListIterable<OrmEclipseLinkConversionValue> getConversionValues() { - return new LiveCloneListIterable<OrmEclipseLinkConversionValue>(this.conversionValues); - } - - public int conversionValuesSize() { - return this.conversionValues.size(); - } - - public OrmEclipseLinkConversionValue addConversionValue() { - return this.addConversionValue(this.conversionValues.size()); - } - - public OrmEclipseLinkConversionValue addConversionValue(int index) { - XmlConversionValue xmlConversionValue = this.buildXmlConversionValue(); - OrmEclipseLinkConversionValue conversionValue = this.addConversionValue_(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.conversionValues.indexOf(conversionValue)); - } - - public void removeConversionValue(int index) { - this.removeConversionValue_(index); - this.xmlConverter.getConversionValues().remove(index); - } - - protected void removeConversionValue_(int index) { - this.removeItemFromList(index, this.conversionValues, CONVERSION_VALUES_LIST); - } - - public void moveConversionValue(int targetIndex, int sourceIndex) { - this.moveItemInList(targetIndex, sourceIndex, this.conversionValues, CONVERSION_VALUES_LIST); - this.xmlConverter.getConversionValues().move(targetIndex, sourceIndex); - } - - protected void initializeConversionValues() { - for (XmlConversionValue xmlConversionValue : this.getXmlConversionValues()) { - this.conversionValues.add(this.buildConversionValue(xmlConversionValue)); - } - } - - protected OrmEclipseLinkConversionValue buildConversionValue(XmlConversionValue xmlConversionValue) { - return new OrmEclipseLinkConversionValue(this, xmlConversionValue); - } - - protected void syncConversionValues() { - ContextContainerTools.synchronizeWithResourceModel(this.conversionValueContainerAdapter); - } - - protected Iterable<XmlConversionValue> getXmlConversionValues() { - // clone to reduce chance of concurrency problems - return new LiveCloneIterable<XmlConversionValue>(this.xmlConverter.getConversionValues()); - } - - protected void moveConversionValue_(int index, OrmEclipseLinkConversionValue conversionValue) { - this.moveItemInList(index, conversionValue, this.conversionValues, CONVERSION_VALUES_LIST); - } - - protected OrmEclipseLinkConversionValue addConversionValue_(int index, XmlConversionValue xmlConversionValue) { - OrmEclipseLinkConversionValue conversionValue = this.buildConversionValue(xmlConversionValue); - this.addItemToList(index, conversionValue, this.conversionValues, CONVERSION_VALUES_LIST); - return conversionValue; - } - - protected void removeConversionValue_(OrmEclipseLinkConversionValue conversionValue) { - this.removeConversionValue_(this.conversionValues.indexOf(conversionValue)); - } - - /** - * conversion value container adapter - */ - protected class ConversionValueContainerAdapter - implements ContextContainerTools.Adapter<OrmEclipseLinkConversionValue, XmlConversionValue> - { - public Iterable<OrmEclipseLinkConversionValue> getContextElements() { - return OrmEclipseLinkObjectTypeConverter.this.getConversionValues(); - } - public Iterable<XmlConversionValue> getResourceElements() { - return OrmEclipseLinkObjectTypeConverter.this.getXmlConversionValues(); - } - public XmlConversionValue getResourceElement(OrmEclipseLinkConversionValue contextElement) { - return contextElement.getXmlConversionValue(); - } - public void moveContextElement(int index, OrmEclipseLinkConversionValue element) { - OrmEclipseLinkObjectTypeConverter.this.moveConversionValue_(index, element); - } - public void addContextElement(int index, XmlConversionValue resourceElement) { - OrmEclipseLinkObjectTypeConverter.this.addConversionValue_(index, resourceElement); - } - public void removeContextElement(OrmEclipseLinkConversionValue element) { - OrmEclipseLinkObjectTypeConverter.this.removeConversionValue_(element); - } - } - - - // ********** 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.conversionValuesSize(); - } - - - // ********** 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(JavaResourcePersistentType persistentType, String typeName) { - return (persistentType != null) && persistentType.getQualifiedName().equals(typeName); - } - - protected boolean typeIsIn(JavaResourcePersistentType persistentType, IPackageFragment packageFragment) { - return (persistentType != null) && persistentType.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); - for (OrmEclipseLinkConversionValue conversionValue : this.getConversionValues()) { - conversionValue.validate(messages, reporter); - } - } - - - // ********** adapter ********** - - public static class Adapter - extends AbstractAdapter - { - private static final Adapter INSTANCE = new Adapter(); - public static Adapter instance() { - return INSTANCE; - } - - private Adapter() { - super(); - } - - public Class<EclipseLinkObjectTypeConverter> getConverterType() { - return EclipseLinkObjectTypeConverter.class; - } - - public XmlObjectTypeConverter getXmlConverter(XmlConverterHolder xmlConverterContainer) { - return xmlConverterContainer.getObjectTypeConverter(); - } - - public OrmEclipseLinkConverter<? extends XmlNamedConverter> buildConverter(XmlNamedConverter xmlConverter, XmlContextNode parent) { - return new OrmEclipseLinkObjectTypeConverter(parent, (XmlObjectTypeConverter) xmlConverter); - } - - @Override - protected XmlObjectTypeConverter buildXmlConverter() { - return EclipseLinkOrmFactory.eINSTANCE.createXmlObjectTypeConverter(); - } - - @Override - protected void setXmlConverter(XmlConverterHolder xmlConverterContainer, XmlNamedConverter xmlConverter) { - xmlConverterContainer.setObjectTypeConverter((XmlObjectTypeConverter) xmlConverter); - } - } -} 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 f99c9d589c..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,91 +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.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.EclipseLinkJoinFetch; -import org.eclipse.jpt.jpa.eclipselink.core.context.EclipseLinkPrivateOwned; -import org.eclipse.jpt.jpa.eclipselink.core.resource.orm.XmlOneToMany; -import org.eclipse.jpt.jpa.eclipselink.core.v2_0.context.EclipseLinkOneToManyMapping2_0; -import org.eclipse.jpt.jpa.eclipselink.core.v2_0.context.orm.EclipseLinkOrmOneToManyRelationship2_0; -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 -{ - protected final OrmEclipseLinkPrivateOwned privateOwned; - - protected final OrmEclipseLinkJoinFetch joinFetch; - - - public OrmEclipseLinkOneToManyMapping(OrmPersistentAttribute parent, XmlOneToMany 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; - } - - - // ********** relationship ********** - - @Override - protected OrmOneToManyRelationship2_0 buildRelationship() { - return new EclipseLinkOrmOneToManyRelationship(this); - } - - @Override - public EclipseLinkOrmOneToManyRelationship2_0 getRelationship() { - return (EclipseLinkOrmOneToManyRelationship) super.getRelationship(); - } - - - // ********** 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/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/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 01557ebaa1..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,51 +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.AccessType; -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.core.resource.orm.XmlAttributeMapping; -import org.eclipse.jpt.jpa.eclipselink.core.internal.v1_1.context.EclipseLinkPersistentAttributeValidator; - -/** - * EclipseLink - * <code>orm.xml</code> persistent attribute - */ -public class OrmEclipseLinkPersistentAttribute - extends SpecifiedOrmPersistentAttribute -{ - public OrmEclipseLinkPersistentAttribute(OrmPersistentType parent, XmlAttributeMapping xmlMapping) { - super(parent, xmlMapping); - } - - - // ********** access ********** - - /** - * EclipseLink 1.0 does not support a specified access for attributes. - */ - @Override - public AccessType getSpecifiedAccess() { - return null; - } - - public void setSpecifiedAccess(AccessType access) { - throw new UnsupportedOperationException("A specified access is not supported in EclipseLink 1.0: " + this); //$NON-NLS-1$ - } - - // ********** validation ********** - - @Override - protected JptValidator buildAttibuteValidator() { - return new EclipseLinkPersistentAttributeValidator(this, getJavaPersistentAttribute(), 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 2e0728d336..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,88 +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.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() { - 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 cb55926fbe..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,124 +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.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() { - 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 acc0b0390b..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,108 +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.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.resource.orm.EclipseLinkOrmFactory; -import org.eclipse.jpt.jpa.eclipselink.core.resource.orm.XmlConverterHolder; -import org.eclipse.jpt.jpa.eclipselink.core.resource.orm.XmlNamedConverter; -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); - this.converterClass = xmlConverter.getConverter(); - } - - - // ********** synchronize/update ********** - - @Override - public void synchronizeWithResourceModel() { - super.synchronizeWithResourceModel(); - this.setConverterClass_(this.xmlConverter.getConverter()); - } - - - // ********** converter class ********** - - public void setConverterClass(String converterClass) { - this.setConverterClass_(converterClass); - this.xmlConverter.setConverter(converterClass); - } - - // ********** misc ********** - - public Class<EclipseLinkStructConverter> getType() { - return EclipseLinkStructConverter.class; - } - - @Override - public TextRange getConverterClassTextRange() { - return this.xmlConverter.getConverterClassTextRange(); - } - - // ********** 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); - } - - // ********** adapter ********** - - public static class Adapter - extends AbstractAdapter - { - private static final Adapter INSTANCE = new Adapter(); - public static Adapter instance() { - return INSTANCE; - } - - private Adapter() { - super(); - } - - public Class<EclipseLinkStructConverter> getConverterType() { - return EclipseLinkStructConverter.class; - } - - public XmlStructConverter getXmlConverter(XmlConverterHolder xmlConverterContainer) { - return xmlConverterContainer.getStructConverter(); - } - - public OrmEclipseLinkStructConverter buildConverter(XmlNamedConverter xmlConverter, XmlContextNode parent) { - return new OrmEclipseLinkStructConverter(parent, (XmlStructConverter) xmlConverter); - } - - @Override - protected XmlStructConverter buildXmlConverter() { - return EclipseLinkOrmFactory.eINSTANCE.createXmlStructConverter(); - } - - @Override - public void setXmlConverter(XmlConverterHolder xmlConverterContainer, XmlNamedConverter xmlConverter) { - xmlConverterContainer.setStructConverter((XmlStructConverter) xmlConverter); - } - } -} 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 de3ed85c22..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,47 +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.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); - } - - 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 a690145b1d..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,245 +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.jdt.core.IPackageFragment; -import org.eclipse.jdt.core.IType; -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.XmlContextNode; -import org.eclipse.jpt.jpa.core.resource.java.JavaResourcePersistentType; -import org.eclipse.jpt.jpa.eclipselink.core.context.EclipseLinkTypeConverter; -import org.eclipse.jpt.jpa.eclipselink.core.resource.orm.EclipseLinkOrmFactory; -import org.eclipse.jpt.jpa.eclipselink.core.resource.orm.XmlConverterHolder; -import org.eclipse.jpt.jpa.eclipselink.core.resource.orm.XmlNamedConverter; -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 objectType; - - - 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()); - } - - - // ********** 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); - } - - protected boolean dataTypeIsFor(String typeName) { - return this.typeIsFor(this.getDataTypeJavaResourcePersistentType(), typeName); - } - - protected boolean dataTypeIsIn(IPackageFragment packageFragment) { - return this.typeIsIn(this.getDataTypeJavaResourcePersistentType(), packageFragment); - } - - protected JavaResourcePersistentType getDataTypeJavaResourcePersistentType() { - return this.getEntityMappings().resolveJavaResourcePersistentType(this.dataType); - } - - - // ********** 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); - } - - protected boolean objectTypeIsFor(String typeName) { - return this.typeIsFor(this.getObjectTypeJavaResourcePersistentType(), typeName); - } - - protected boolean objectTypeIsIn(IPackageFragment packageFragment) { - return this.typeIsIn(this.getObjectTypeJavaResourcePersistentType(), packageFragment); - } - - protected JavaResourcePersistentType getObjectTypeJavaResourcePersistentType() { - return this.getEntityMappings().resolveJavaResourcePersistentType(this.objectType); - } - - - // ********** 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(JavaResourcePersistentType type, String typeName) { - return (type != null) && type.getQualifiedName().equals(typeName); - } - - protected boolean typeIsIn(JavaResourcePersistentType type, IPackageFragment packageFragment) { - return (type != null) && type.isIn(packageFragment); - } - - - // ********** adapter ********** - - public static class Adapter - extends AbstractAdapter - { - private static final Adapter INSTANCE = new Adapter(); - public static Adapter instance() { - return INSTANCE; - } - - private Adapter() { - super(); - } - - public Class<EclipseLinkTypeConverter> getConverterType() { - return EclipseLinkTypeConverter.class; - } - - public XmlTypeConverter getXmlConverter(XmlConverterHolder xmlConverterContainer) { - return xmlConverterContainer.getTypeConverter(); - } - - public OrmEclipseLinkTypeConverter buildConverter(XmlNamedConverter xmlConverter, XmlContextNode parent) { - return new OrmEclipseLinkTypeConverter(parent, (XmlTypeConverter) xmlConverter); - } - - @Override - protected XmlTypeConverter buildXmlConverter() { - return EclipseLinkOrmFactory.eINSTANCE.createXmlTypeConverter(); - } - - @Override - public void setXmlConverter(XmlConverterHolder xmlConverterContainer, XmlNamedConverter xmlConverter) { - xmlConverterContainer.setTypeConverter((XmlTypeConverter) xmlConverter); - } - } -} 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 ff609c8cf5..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,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.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.orm.AbstractOrmVersionMapping; -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.resource.orm.XmlVersion; -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 -{ - protected final OrmEclipseLinkMutable mutable; - - - public OrmEclipseLinkVersionMapping(OrmPersistentAttribute parent, XmlVersion xmlMapping) { - super(parent, xmlMapping); - this.mutable = new OrmEclipseLinkMutable(this); - } - - - // ********** synchronize/update ********** - - @Override - public void synchronizeWithResourceModel() { - super.synchronizeWithResourceModel(); - this.mutable.synchronizeWithResourceModel(); - } - - @Override - public void update() { - super.update(); - this.mutable.update(); - } - - - // ********** mutable ********** - - public EclipseLinkMutable getMutable() { - return this.mutable; - } - - - // ********** 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()); - } - - - // ********** validation ********** - - @Override - public void validate(List<IMessage> messages, IReporter reporter) { - super.validate(messages, reporter); - // TODO mutable validation - } -} 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/EclipseLinkPersistenceUnit.java b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/persistence/EclipseLinkPersistenceUnit.java deleted file mode 100644 index 8a208487f2..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/persistence/EclipseLinkPersistenceUnit.java +++ /dev/null @@ -1,548 +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 java.util.ArrayList; -import java.util.Iterator; -import java.util.List; -import java.util.ListIterator; -import java.util.Set; -import java.util.Vector; -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.NotNullFilter; -import org.eclipse.jpt.common.utility.internal.iterables.CompositeIterable; -import org.eclipse.jpt.common.utility.internal.iterables.CompositeListIterable; -import org.eclipse.jpt.common.utility.internal.iterables.FilteringIterable; -import org.eclipse.jpt.common.utility.internal.iterables.ListIterable; -import org.eclipse.jpt.common.utility.internal.iterators.CloneListIterator; -import org.eclipse.jpt.common.utility.internal.iterators.FilteringIterator; -import org.eclipse.jpt.common.utility.internal.iterators.TransformationIterator; -import org.eclipse.jpt.jpa.core.context.persistence.MappingFileRef; -import org.eclipse.jpt.jpa.core.context.persistence.Persistence; -import org.eclipse.jpt.jpa.core.internal.context.persistence.AbstractPersistenceUnit; -import org.eclipse.jpt.jpa.core.internal.jpa1.context.persistence.ImpliedMappingFileRef; -import org.eclipse.jpt.jpa.core.jpa2.context.persistence.options.SharedCacheMode; -import org.eclipse.jpt.jpa.core.resource.persistence.XmlPersistenceUnit; -import org.eclipse.jpt.jpa.eclipselink.core.EclipseLinkJpaProject; -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.persistence.EclipseLinkPersistenceXmlContextNodeFactory; -import org.eclipse.jpt.jpa.eclipselink.core.context.persistence.caching.Caching; -import org.eclipse.jpt.jpa.eclipselink.core.context.persistence.connection.Connection; -import org.eclipse.jpt.jpa.eclipselink.core.context.persistence.customization.Customization; -import org.eclipse.jpt.jpa.eclipselink.core.context.persistence.general.GeneralProperties; -import org.eclipse.jpt.jpa.eclipselink.core.context.persistence.logging.Logging; -import org.eclipse.jpt.jpa.eclipselink.core.context.persistence.options.Options; -import org.eclipse.jpt.jpa.eclipselink.core.context.persistence.schema.generation.SchemaGeneration; -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.persistence.caching.EclipseLinkCaching; -import org.eclipse.jpt.jpa.eclipselink.core.internal.context.persistence.customization.EclipseLinkCustomization; -import org.eclipse.jpt.jpa.eclipselink.core.internal.context.persistence.general.EclipseLinkGeneralProperties; -import org.eclipse.jpt.jpa.eclipselink.core.internal.context.persistence.schema.generation.EclipseLinkSchemaGeneration; -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 persistence unit - */ -public class EclipseLinkPersistenceUnit - extends AbstractPersistenceUnit -{ - protected MappingFileRef impliedEclipseLinkMappingFileRef; - /** - * String constant associated with changes to the implied eclipselink mapping file ref - */ - public static final String IMPLIED_ECLIPSELINK_MAPPING_FILE_REF_PROPERTY = "impliedEclipseLinkMappingFileRef"; //$NON-NLS-1$ - - - private/*final*/ GeneralProperties generalProperties; - private Customization customization; - private Caching caching; - private Logging logging; - private SchemaGeneration schemaGeneration; - - /* global converter definitions, defined elsewhere in model */ - protected final Vector<EclipseLinkConverter> converters = new Vector<EclipseLinkConverter>(); - - - public EclipseLinkPersistenceUnit(Persistence parent, XmlPersistenceUnit xmlPersistenceUnit) { - super(parent, xmlPersistenceUnit); - } - - - // ********** synchronize/update ********** - - // TODO bjv calculate converters directly... - @Override - public void update() { - this.converters.clear(); - super.update(); - this.fireCollectionChanged(CONVERTERS_COLLECTION, this.converters); - } - - - // ********** properties ********** - - public GeneralProperties getGeneralProperties() { - return this.generalProperties; - } - - @Override - public Connection getConnection() { - return (Connection) super.getConnection(); - } - - public Customization getCustomization() { - return this.customization; - } - - public Caching getCaching() { - return this.caching; - } - - public Logging getLogging() { - return this.logging; - } - - @Override - public Options getOptions() { - return (Options) super.getOptions(); - } - - public SchemaGeneration getSchemaGeneration() { - return this.schemaGeneration; - } - - protected GeneralProperties buildEclipseLinkGeneralProperties() { - return new EclipseLinkGeneralProperties(this); - } - - protected Connection buildEclipseLinkConnection() { - return (Connection) this.getContextNodeFactory().buildConnection(this); - } - - protected Customization buildEclipseLinkCustomization() { - return new EclipseLinkCustomization(this); - } - - protected Caching buildEclipseLinkCaching() { - return new EclipseLinkCaching(this); - } - - protected Logging buildEclipseLinkLogging() { - return (Logging) this.getContextNodeFactory().buildLogging(this); - } - - protected Options buildEclipseLinkOptions() { - return (Options) this.getContextNodeFactory().buildOptions(this); - } - - protected SchemaGeneration buildEclipseLinkSchemaGeneration() { - return new EclipseLinkSchemaGeneration(this); - } - - @Override - protected void initializeProperties() { - super.initializeProperties(); - this.generalProperties = this.buildEclipseLinkGeneralProperties(); - this.customization = this.buildEclipseLinkCustomization(); - this.caching = this.buildEclipseLinkCaching(); - this.logging = this.buildEclipseLinkLogging(); - this.schemaGeneration = this.buildEclipseLinkSchemaGeneration(); - } - - @Override - public void propertyValueChanged(String propertyName, String newValue) { - super.propertyValueChanged(propertyName, newValue); - this.generalProperties.propertyValueChanged(propertyName, newValue); - this.customization.propertyValueChanged(propertyName, newValue); - this.caching.propertyValueChanged(propertyName, newValue); - this.logging.propertyValueChanged(propertyName, newValue); - this.schemaGeneration.propertyValueChanged(propertyName, newValue); - } - - @Override - public void propertyRemoved(String propertyName) { - super.propertyRemoved(propertyName); - this.generalProperties.propertyRemoved(propertyName); - this.customization.propertyRemoved(propertyName); - this.caching.propertyRemoved(propertyName); - this.logging.propertyRemoved(propertyName); - this.schemaGeneration.propertyRemoved(propertyName); - } - - - // ********** mapping file refs ********** - - @Override - protected ListIterable<MappingFileRef> getMappingFileRefs() { - return (this.impliedEclipseLinkMappingFileRef == null) ? - super.getMappingFileRefs() : - new CompositeListIterable<MappingFileRef>(super.getMappingFileRefs(), this.impliedEclipseLinkMappingFileRef); - } - - @Override - public int mappingFileRefsSize() { - return (this.impliedEclipseLinkMappingFileRef == null) ? - super.mappingFileRefsSize() : - super.mappingFileRefsSize() + 1; - } - - - // ********** implied eclipselink mapping file ref ********** - - public MappingFileRef getImpliedEclipseLinkMappingFileRef() { - return this.impliedEclipseLinkMappingFileRef; - } - - protected MappingFileRef addImpliedEclipseLinkMappingFileRef() { - if (this.impliedEclipseLinkMappingFileRef != null) { - throw new IllegalStateException("The implied EclipseLink mapping file ref is already present: " + this.impliedEclipseLinkMappingFileRef); //$NON-NLS-1$ - } - MappingFileRef mappingFileRef = this.buildEclipseLinkImpliedMappingFileRef(); - this.impliedEclipseLinkMappingFileRef = mappingFileRef; - this.firePropertyChanged(IMPLIED_ECLIPSELINK_MAPPING_FILE_REF_PROPERTY, null, mappingFileRef); - return mappingFileRef; - } - - private ImpliedMappingFileRef buildEclipseLinkImpliedMappingFileRef() { - return new ImpliedMappingFileRef(this, JptJpaEclipseLinkCorePlugin.DEFAULT_ECLIPSELINK_ORM_XML_RUNTIME_PATH.toString()); - } - - protected void removeImpliedEclipseLinkMappingFileRef() { - if (this.impliedEclipseLinkMappingFileRef == null) { - throw new IllegalStateException("The implied EclipseLink mapping file ref is null."); //$NON-NLS-1$ - } - MappingFileRef mappingFileRef = this.impliedEclipseLinkMappingFileRef; - this.impliedEclipseLinkMappingFileRef.dispose(); - this.impliedEclipseLinkMappingFileRef = null; - this.firePropertyChanged(IMPLIED_ECLIPSELINK_MAPPING_FILE_REF_PROPERTY, mappingFileRef, null); - } - - @Override - protected void syncImpliedMappingFileRef() { - super.syncImpliedMappingFileRef(); - if (this.impliedEclipseLinkMappingFileRef != null) { - this.impliedEclipseLinkMappingFileRef.synchronizeWithResourceModel(); - } - } - - @Override - protected void updateImpliedMappingFileRef() { - super.updateImpliedMappingFileRef(); - - if (this.buildsImpliedEclipseLinkMappingFile()) { - if (this.impliedEclipseLinkMappingFileRef == null) { - this.addImpliedEclipseLinkMappingFileRef(); - } else { - this.impliedEclipseLinkMappingFileRef.update(); - } - } else { - if (this.impliedEclipseLinkMappingFileRef != null) { - this.removeImpliedEclipseLinkMappingFileRef(); - } - } - } - - /** - * Build a virtual EclipseLink mapping file if all the following are true:<ul> - * <li>the properties do not explicitly exclude it - * <li>it is not specified explicitly in the persistence unit - * <li>the file actually exists - * </ul> - */ - private boolean buildsImpliedEclipseLinkMappingFile() { - return this.impliedEclipseLinkMappingFileIsNotExcluded() && - this.impliedEclipseLinkMappingFileIsNotSpecified() && - this.impliedEclipseLinkMappingFileExists(); - } - - protected boolean impliedEclipseLinkMappingFileIsNotExcluded() { - return ! this.impliedEclipseLinkMappingFileIsExcluded(); - } - - protected boolean impliedEclipseLinkMappingFileIsExcluded() { - return this.getGeneralProperties().getExcludeEclipselinkOrm() == Boolean.TRUE; - } - - protected boolean impliedEclipseLinkMappingFileIsNotSpecified() { - return ! this.impliedEclipseLinkMappingFileIsSpecified(); - } - - protected boolean impliedEclipseLinkMappingFileIsSpecified() { - return this.mappingFileIsSpecified(JptJpaEclipseLinkCorePlugin.DEFAULT_ECLIPSELINK_ORM_XML_RUNTIME_PATH.toString()); - } - - protected boolean impliedEclipseLinkMappingFileExists() { - return this.getJpaProject().getDefaultEclipseLinkOrmXmlResource() != null; - } - - - // ********** converters ********** - - /** - * Identifier for changes to the list of global converter definitions. - * Note that there are no granular changes to this list. There is only - * notification that the entire list has changed. - */ - public static final String CONVERTERS_COLLECTION = "converters"; //$NON-NLS-1$ - - /** - * Add the converter definition (defined elsewhere) to the list of converters - * defined within this persistence unit. - * Note that this should only be called during the process of updating the - * local converter definition. - * No change notification accompanies this action specifically. - */ - public void addConverter(EclipseLinkConverter converter) { - this.converters.add(converter); - } - - /** - * Return an iterator on all converters defined within this persistence unit, - * included duplicately named converters definitions. - */ - public ListIterator<EclipseLinkConverter> allConverters() { - return new CloneListIterator<EclipseLinkConverter>(this.converters); - } - - public int convertersSize() { - return this.converters.size(); - } - - /** - * Return the names of the converters defined in the persistence - * unit, with duplicates removed. - */ - public Iterable<String> getUniqueConverterNames() { - return CollectionTools.set(this.allNonNullConverterNames(), this.converters.size()); - } - - protected Iterator<String> allNonNullConverterNames() { - return new FilteringIterator<String>(this.allConverterNames(), NotNullFilter.<String>instance()); - } - - protected Iterator<String> allConverterNames() { - return new TransformationIterator<EclipseLinkConverter, String>(this.allConverters()) { - @Override - protected String transform(EclipseLinkConverter converter) { - return converter.getName(); - } - }; - } - - - // ********** misc ********** - - @Override - public EclipseLinkJpaProject getJpaProject() { - return (EclipseLinkJpaProject) super.getJpaProject(); - } - - @Override - public EclipseLinkPersistenceXmlContextNodeFactory getContextNodeFactory() { - return (EclipseLinkPersistenceXmlContextNodeFactory) super.getContextNodeFactory(); - } - - @Override - protected void addNonUpdateAspectNamesTo(Set<String> nonUpdateAspectNames) { - super.addNonUpdateAspectNamesTo(nonUpdateAspectNames); - nonUpdateAspectNames.add(CONVERTERS_COLLECTION); - } - - @Override - public void setSpecifiedSharedCacheMode(SharedCacheMode specifiedSharedCacheMode) { - super.setSpecifiedSharedCacheMode(specifiedSharedCacheMode); - - if(specifiedSharedCacheMode == SharedCacheMode.NONE) { - this.caching.removeDefaultCachingProperties(); - } - } - - @Override - protected SharedCacheMode buildDefaultSharedCacheMode() { - return SharedCacheMode.DISABLE_SELECTIVE; - } - - @Override - public boolean calculateDefaultCacheable() { - SharedCacheMode sharedCacheMode = this.getSharedCacheMode(); - if (sharedCacheMode == null) { - return true; - } - switch (sharedCacheMode) { - case NONE: - case ENABLE_SELECTIVE: - return false; - case ALL: - case DISABLE_SELECTIVE: - case UNSPECIFIED: - return true; - } - return true; - } - - - // ********** validation ********** - - @Override - protected void validateProperties(List<IMessage> messages, IReporter reporter) { - - if(this.isJpa2_0Compatible()) { - for(Property property: this.getLegacyEntityCachingProperties()) { - messages.add( - DefaultEclipseLinkJpaValidationMessages.buildMessage( - IMessage.NORMAL_SEVERITY, - EclipseLinkJpaValidationMessages.PERSISTENCE_UNIT_LEGACY_ENTITY_CACHING, - new String[] {property.getName()}, - this.getPersistenceUnit(), - property.getValidationTextRange() - ) - ); - } - for(Property property: this.getLegacyDescriptorCustomizerProperties()) { - messages.add( - DefaultEclipseLinkJpaValidationMessages.buildMessage( - IMessage.NORMAL_SEVERITY, - EclipseLinkJpaValidationMessages.PERSISTENCE_UNIT_LEGACY_DESCRIPTOR_CUSTOMIZER, - new String[] {property.getName()}, - this.getPersistenceUnit(), - property.getValidationTextRange() - ) - ); - } - this.validateDefaultCachingProperty(this.getCacheTypeDefaultProperty(), messages); - this.validateDefaultCachingProperty(this.getCacheSizeDefaultProperty(), messages); - this.validateDefaultCachingProperty(this.getFlushClearCacheProperty(), messages); - } - } - - protected void validateDefaultCachingProperty(Property cachingProperty, List<IMessage> messages) { - - if(this.getSharedCacheMode() == SharedCacheMode.NONE) { - if(cachingProperty != null) { - messages.add( - DefaultEclipseLinkJpaValidationMessages.buildMessage( - IMessage.NORMAL_SEVERITY, - EclipseLinkJpaValidationMessages.PERSISTENCE_UNIT_CACHING_PROPERTY_IGNORED, - new String[] {cachingProperty.getName()}, - this.getPersistenceUnit(), - cachingProperty.getValidationTextRange() - ) - ); - } - } - } - - protected ArrayList<Property> getLegacyDescriptorCustomizerProperties() { - ArrayList<Property> result = new ArrayList<Property>(); - CollectionTools.addAll(result, this.getDescriptorCustomizerProperties()); - return result; - } - - protected ArrayList<Property> getLegacyEntityCachingProperties() { - ArrayList<Property> result = new ArrayList<Property>(); - CollectionTools.addAll(result, this.getSharedCacheProperties()); - CollectionTools.addAll(result, this.getEntityCacheTypeProperties()); - CollectionTools.addAll(result, this.getEntityCacheSizeProperties()); - return result; - } - - private Property getCacheTypeDefaultProperty() { - return this.getProperty(Caching.ECLIPSELINK_CACHE_TYPE_DEFAULT); - } - - private Property getCacheSizeDefaultProperty() { - return this.getProperty(Caching.ECLIPSELINK_CACHE_SIZE_DEFAULT); - } - - private Property getFlushClearCacheProperty() { - return this.getProperty(Caching.ECLIPSELINK_FLUSH_CLEAR_CACHE); - } - - /** - * Returns all Shared Cache Properties, including Entity and default. - */ - private Iterable<Property> getSharedCacheProperties() { - return CollectionTools.iterable(this.propertiesWithNamePrefix(Caching.ECLIPSELINK_SHARED_CACHE)); - } - - /** - * Returns Entity Cache Size Properties, excluding default. - */ - private Iterable<Property> getEntityCacheSizeProperties() { - return this.getEntityPropertiesWithPrefix(Caching.ECLIPSELINK_CACHE_SIZE); - } - - /** - * Returns Entity Cache Type Properties, excluding default. - */ - private Iterable<Property> getEntityCacheTypeProperties() { - return this.getEntityPropertiesWithPrefix(Caching.ECLIPSELINK_CACHE_TYPE); - } - - /** - * Returns Descriptor Customizer Properties. - */ - private Iterable<Property> getDescriptorCustomizerProperties() { - return this.getEntityPropertiesWithPrefix(Customization.ECLIPSELINK_DESCRIPTOR_CUSTOMIZER); - } - - /** - * Returns Entity Properties with the given prefix, - * excluding Entity which name equals "default". - */ - private Iterable<Property> getEntityPropertiesWithPrefix(String prefix) { - return new FilteringIterable<Property>( - CollectionTools.iterable(this.propertiesWithNamePrefix(prefix))) { - @Override - protected boolean accept(Property next) { - return ! next.getName().endsWith("default"); //$NON-NLS-1$ - } - }; - } - - - // ********** refactoring ********** - - @Override - @SuppressWarnings("unchecked") - protected Iterable<ReplaceEdit> createPersistenceUnitPropertiesRenameTypeEdits(IType originalType, String newName) { - return new CompositeIterable<ReplaceEdit>( - super.createPersistenceUnitPropertiesRenameTypeEdits(originalType, newName), - this.customization.createRenameTypeEdits(originalType, newName), - this.logging.createRenameTypeEdits(originalType, newName) - ); - } - - @Override - @SuppressWarnings("unchecked") - protected Iterable<ReplaceEdit> createPersistenceUnitPropertiesMoveTypeEdits(IType originalType, IPackageFragment newPackage) { - return new CompositeIterable<ReplaceEdit>( - super.createPersistenceUnitPropertiesMoveTypeEdits(originalType, newPackage), - this.customization.createMoveTypeEdits(originalType, newPackage), - this.logging.createMoveTypeEdits(originalType, newPackage) - ); - } - - @Override - @SuppressWarnings("unchecked") - protected Iterable<ReplaceEdit> createPersistenceUnitPropertiesRenamePackageEdits(IPackageFragment originalPackage, String newName) { - return new CompositeIterable<ReplaceEdit>( - super.createPersistenceUnitPropertiesRenamePackageEdits(originalPackage, newName), - this.customization.createRenamePackageEdits(originalPackage, newName), - this.logging.createRenamePackageEdits(originalPackage, newName) - ); - } -} 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 9cc0937c0e..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, 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.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().propertiesWithNamePrefix(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 17b158b84c..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,50 +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.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.internal.context.persistence.connection.EclipseLinkConnection; -import org.eclipse.jpt.jpa.eclipselink.core.internal.context.persistence.logging.EclipseLinkLogging; -import org.eclipse.jpt.jpa.eclipselink.core.internal.context.persistence.options.EclipseLinkOptions; - - -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/caching/EclipseLinkCaching.java b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/persistence/caching/EclipseLinkCaching.java deleted file mode 100644 index 3f47ccb4eb..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/persistence/caching/EclipseLinkCaching.java +++ /dev/null @@ -1,588 +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.caching; - -import java.util.ArrayList; -import java.util.Iterator; -import java.util.List; -import java.util.ListIterator; -import java.util.Map; -import java.util.Set; - -import org.eclipse.jpt.common.utility.internal.StringTools; -import org.eclipse.jpt.common.utility.internal.iterators.CloneListIterator; -import org.eclipse.jpt.common.utility.internal.iterators.TransformationIterator; -import org.eclipse.jpt.jpa.core.context.persistence.PersistenceUnit; -import org.eclipse.jpt.jpa.eclipselink.core.context.persistence.caching.CacheType; -import org.eclipse.jpt.jpa.eclipselink.core.context.persistence.caching.Caching; -import org.eclipse.jpt.jpa.eclipselink.core.context.persistence.caching.FlushClearCache; -import org.eclipse.jpt.jpa.eclipselink.core.internal.context.persistence.EclipseLinkPersistenceUnitProperties; - -/** - * 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<Entity> 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<Entity>(); - 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 Entity addEntity(String entityName) { - if (this.entityExists(entityName)) { - throw new IllegalStateException("Duplicate entity: " + entityName); //$NON-NLS-1$ - } - Entity newEntity = this.buildEntity(entityName); - this.addItemToList(newEntity, this.entities, ENTITIES_LIST); - return newEntity; - } - - public void removeEntity(String entityName) { - if ( ! this.entityExists(entityName)) { - return; - } - Entity entity = this.getEntityNamed(entityName); - this.clearEntity(entity); - this.removeEntity(entity); - } - - // ********** CacheType ********** - public CacheType getCacheTypeOf(String entityName) { - Entity entity = this.getEntityNamed(entityName); - return (entity == null) ? null : entity.getCacheType(); - } - - public void setCacheTypeOf(String entityName, CacheType newCacheType) { - Entity 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)) { - Entity 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) { - Entity entity = this.getEntityNamed(entityName); - return (entity == null) ? null : entity.getCacheSize(); - } - - public void setCacheSizeOf(String entityName, Integer newCacheSize) { - Entity 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)) { - Entity 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) { - Entity entity = this.getEntityNamed(entityName); - return (entity == null) ? null : entity.cacheIsShared(); - } - - public void setSharedCacheOf(String entityName, Boolean newSharedCache) { - Entity 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)) { - Entity 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 Entity 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 Entity setEntityCacheTypeOf(String entityName, CacheType cacheType) { - Entity entity = (this.entityExists(entityName)) ? - this.getEntityNamed(entityName) : - this.addEntity(entityName); - return this.setEntityCacheTypeOf(entity, cacheType); - } - - /** - * Returns the old Entity - */ - private Entity setEntityCacheTypeOf(Entity entity, CacheType cacheType) { - if(entity == null) { - throw new IllegalArgumentException(); - } - Entity 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 Entity 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 Entity setEntityCacheSizeOf(String entityName, Integer size) { - Entity entity = (this.entityExists(entityName)) ? - this.getEntityNamed(entityName) : - this.addEntity(entityName); - return this.setEntityCacheSizeOf(entity, size); - } - - /** - * Returns the old Entity - */ - private Entity setEntityCacheSizeOf(Entity entity, Integer size) { - if(entity == null) { - throw new IllegalArgumentException(); - } - Entity 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 Entity 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 Entity setEntitySharedCacheOf(String entityName, Boolean sharedCache) { - Entity entity = (this.entityExists(entityName)) ? - this.getEntityNamed(entityName) : - this.addEntity(entityName); - return this.setEntitySharedCacheOf(entity, sharedCache); - } - - /** - * Returns the old Entity - */ - private Entity setEntitySharedCacheOf(Entity entity, Boolean sharedCache) { - if(entity == null) { - throw new IllegalArgumentException(); - } - Entity 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(Entity 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 Entity getEntityNamed(String name) { - for(Entity entity: this.entities) { - if(entity.getName().equals(name)) { - return entity; - } - } - return null; - } - - private Entity buildEntity(String name) { - return new Entity(this, name); - } - - private void removeEntity(Entity 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(Entity 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 ListIterator<Entity> entities() { - return new CloneListIterator<Entity>(this.entities); - } - - public Iterator<String> entityNames() { - return new TransformationIterator<Entity, String>(this.entities()) { - @Override - protected String transform(Entity entity) { - return entity.getName(); - } - }; - } - - public int entitiesSize() { - 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/caching/Entity.java b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/persistence/caching/Entity.java deleted file mode 100644 index 92bd933fe6..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/persistence/caching/Entity.java +++ /dev/null @@ -1,144 +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.persistence.caching; - -import java.io.Serializable; - -import org.eclipse.jpt.common.utility.internal.StringTools; -import org.eclipse.jpt.common.utility.internal.model.AbstractModel; -import org.eclipse.jpt.jpa.eclipselink.core.context.persistence.caching.CacheType; -import org.eclipse.jpt.jpa.eclipselink.core.context.persistence.caching.Caching; - -/** - * Entity - */ -public class Entity extends AbstractModel implements Cloneable, Serializable -{ - private String name; - private Caching parent; - - public static final String CACHE_TYPE_PROPERTY = Caching.CACHE_TYPE_PROPERTY; - public static final String CACHE_SIZE_PROPERTY = Caching.CACHE_SIZE_PROPERTY; - public static final String SHARED_CACHE_PROPERTY = Caching.SHARED_CACHE_PROPERTY; - - // ********** EclipseLink properties ********** - private CacheType cacheType; - private Integer cacheSize; - private Boolean cacheIsShared; - - private static final long serialVersionUID = 1L; - - // ********** constructors ********** - public Entity(Caching parent, String name) { - this(parent); - this.initialize(name); - } - - private Entity(Caching parent) { - this.parent = parent; - } - - private void initialize(String name) { - if(StringTools.stringIsEmpty(name)) { - throw new IllegalArgumentException(); - } - this.name = name; - } - - // ********** behaviors ********** - @Override - public boolean equals(Object o) { - if(o == null) { - return false; - } - Entity entity = (Entity) o; - return ( - (this.cacheType == null ? - entity.cacheType == null : this.cacheType.equals(entity.cacheType)) && - (this.cacheIsShared == null ? - entity.cacheIsShared == null : this.cacheIsShared.equals(entity.cacheIsShared)) && - (this.cacheSize == null ? - entity.cacheSize == null : this.cacheSize.equals(entity.cacheSize))); - } - - @Override - public Entity clone() { - try { - return (Entity)super.clone(); - } - catch (CloneNotSupportedException ex) { - throw new InternalError(); - } - } - - public boolean isEmpty() { - return (this.cacheType == null) && - (this.cacheSize == null) && - (this.cacheIsShared == null); - } - - public boolean entityNameIsValid() { - return ! StringTools.stringIsEmpty(this.name); - } - - public Caching getParent() { - return this.parent; - } - - // ********** name ********** - public String getName() { - return this.name; - } - - // ********** cacheType ********** - protected CacheType getCacheType() { - return this.cacheType; - } - - protected void setCacheType(CacheType cacheType) { - CacheType old = this.cacheType; - this.cacheType = cacheType; - this.firePropertyChanged(CACHE_TYPE_PROPERTY, old, cacheType); - } - - // ********** cacheSize ********** - protected Integer getCacheSize() { - return this.cacheSize; - } - - protected void setCacheSize(Integer cacheSize) { - Integer old = this.cacheSize; - this.cacheSize = cacheSize; - this.firePropertyChanged(CACHE_SIZE_PROPERTY, old, cacheSize); - } - - // ********** cacheIsShared ********** - protected Boolean cacheIsShared() { - return this.cacheIsShared; - } - - protected void setSharedCache(Boolean isShared) { - Boolean old = this.cacheIsShared; - this.cacheIsShared = isShared; - this.firePropertyChanged(SHARED_CACHE_PROPERTY, old, isShared); - } - - @Override - public void toString(StringBuilder sb) { - sb.append("name: "); //$NON-NLS-1$ - sb.append(this.name); - sb.append(", cacheType: "); //$NON-NLS-1$ - sb.append(this.cacheType); - sb.append(", cacheSize: "); //$NON-NLS-1$ - sb.append(this.cacheSize); - sb.append(", cacheIsShared: "); //$NON-NLS-1$ - sb.append(this.cacheIsShared); - } -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/persistence/connection/EclipseLinkConnection.java b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/persistence/connection/EclipseLinkConnection.java deleted file mode 100644 index 1e12e58f60..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/persistence/connection/EclipseLinkConnection.java +++ /dev/null @@ -1,677 +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.connection; - -import java.util.Map; - -import org.eclipse.jpt.jpa.core.context.persistence.PersistenceUnit; -import org.eclipse.jpt.jpa.eclipselink.core.context.persistence.connection.BatchWriting; -import org.eclipse.jpt.jpa.eclipselink.core.context.persistence.connection.Connection; -import org.eclipse.jpt.jpa.eclipselink.core.context.persistence.connection.ExclusiveConnectionMode; -import org.eclipse.jpt.jpa.eclipselink.core.internal.context.persistence.EclipseLinkPersistenceUnitProperties; - -/** - * 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/customization/EclipseLinkCustomization.java b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/persistence/customization/EclipseLinkCustomization.java deleted file mode 100644 index 5aa80c0529..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/persistence/customization/EclipseLinkCustomization.java +++ /dev/null @@ -1,873 +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.customization; - -import java.util.ArrayList; -import java.util.Iterator; -import java.util.List; -import java.util.ListIterator; -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.TransformationIterable; -import org.eclipse.jpt.common.utility.internal.iterators.CloneListIterator; -import org.eclipse.jpt.common.utility.internal.iterators.TransformationIterator; -import org.eclipse.jpt.jpa.core.context.persistence.PersistenceUnit; -import org.eclipse.jpt.jpa.eclipselink.core.context.persistence.customization.Customization; -import org.eclipse.jpt.jpa.eclipselink.core.context.persistence.customization.Profiler; -import org.eclipse.jpt.jpa.eclipselink.core.context.persistence.customization.Weaving; -import org.eclipse.jpt.jpa.eclipselink.core.internal.context.persistence.EclipseLinkPersistenceUnitProperties; -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<Entity> 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<Entity>(); - - 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 Entity addEntity(String entityName) { - if (this.entityExists(entityName)) { - throw new IllegalStateException("Duplicate entity: " + entityName); //$NON-NLS-1$ - } - Entity newEntity = this.buildEntity(entityName); - this.addItemToList(newEntity, this.entities, ENTITIES_LIST); - return newEntity; - } - - public void removeEntity(String entityName) { - if ( ! this.entityExists(entityName)) { - return; - } - Entity 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 ListIterator<String> sessionCustomizers(){ - return new CloneListIterator<String>(this.sessionCustomizers); - } - - public int sessionCustomizersSize(){ - 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) { - Entity entity = this.getEntityNamed(entityName); - return (entity == null) ? null : entity.getDescriptorCustomizer(); - } - - public void setDescriptorCustomizerOf(String entityName, String newDescriptorCustomizer) { - Entity 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)) { - Entity 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 Entity 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; - } - Entity entity = (this.entityExists(entityName)) ? - this.getEntityNamed(entityName) : - this.addEntity(entityName); - return this.setEntityDescriptorCustomizerOf(entity, descriptorCustomizerClassName); - } - - /** - * Returns the old Entity - */ - private Entity setEntityDescriptorCustomizerOf(Entity entity, String descriptorCustomizerClassName) { - if(entity == null) { - throw new IllegalArgumentException(); - } - Entity old = entity.clone(); - entity.setDescriptorCustomizer(descriptorCustomizerClassName); - return old; - } - - /** - * Convenience method to update the descriptorCustomizerClassName in entities. - * Returns the old Entity - */ - private Entity 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(Entity entity) { - if(entity.isEmpty()) { - return; - } - String entityName = entity.getName(); - this.setDescriptorCustomizerOf(entityName, null); - } - - /** - * Returns the Entity with the given name. - */ - private Entity getEntityNamed(String name) { - for(Entity entity: this.entities) { - if(entity.getName().equals(name)) { - return entity; - } - } - return null; - } - - private Entity buildEntity(String name) { - return new Entity(this, name); - } - - private void removeEntity(Entity 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(Entity entity: this.entities) { - if(entity.getName().equals(name)) { - return true; - } - } - return false; - } - - // ****** entities list ******* - - public ListIterator<Entity> entities() { - return new CloneListIterator<Entity>(this.entities); - } - - public Iterator<String> entityNames() { - return new TransformationIterator<Entity, String>(this.entities()) { - @Override - protected String transform(Entity entity) { - return entity.getName(); - } - }; - } - - public int entitiesSize() { - 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/customization/Entity.java b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/persistence/customization/Entity.java deleted file mode 100644 index 17847182e1..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/persistence/customization/Entity.java +++ /dev/null @@ -1,107 +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.persistence.customization; - -import java.io.Serializable; - -import org.eclipse.jpt.common.utility.internal.StringTools; -import org.eclipse.jpt.common.utility.internal.model.AbstractModel; -import org.eclipse.jpt.jpa.eclipselink.core.context.persistence.customization.Customization; - -/** - * Entity - */ -public class Entity extends AbstractModel implements Cloneable, Serializable -{ - private String name; - private Customization parent; - - public static final String DESCRIPTOR_CUSTOMIZER_PROPERTY = Customization.DESCRIPTOR_CUSTOMIZER_PROPERTY; - - // ********** EclipseLink properties ********** - private String descriptorCustomizer; - - private static final long serialVersionUID = 1L; - - // ********** constructors ********** - public Entity(Customization parent, String name) { - this(parent); - this.initialize(name); - } - - private Entity(Customization parent) { - this.parent = parent; - } - - private void initialize(String name) { - if(StringTools.stringIsEmpty(name)) { - throw new IllegalArgumentException(); - } - this.name = name; - } - - // ********** behaviors ********** - @Override - public boolean equals(Object o) { - if(o == null) { - return false; - } - Entity customizer = (Entity) o; - return ( - (this.descriptorCustomizer == null ? - customizer.descriptorCustomizer == null : - this.descriptorCustomizer.equals(customizer.descriptorCustomizer))); - } - - @Override - public Entity clone() { - try { - return (Entity)super.clone(); - } - catch (CloneNotSupportedException ex) { - throw new InternalError(); - } - } - - public boolean isEmpty() { - return this.descriptorCustomizer == null; - } - - public boolean entityNameIsValid() { - return ! StringTools.stringIsEmpty(this.name); - } - - public Customization getParent() { - return this.parent; - } - - // ********** getter/setter ********** - public String getName() { - return this.name; - } - - protected String getDescriptorCustomizer() { - return this.descriptorCustomizer; - } - - protected void setDescriptorCustomizer(String descriptorCustomizer) { - String old = this.descriptorCustomizer; - this.descriptorCustomizer = descriptorCustomizer; - this.firePropertyChanged(DESCRIPTOR_CUSTOMIZER_PROPERTY, old, descriptorCustomizer); - } - - @Override - public void toString(StringBuilder sb) { - sb.append("name: "); //$NON-NLS-1$ - sb.append(this.name); - sb.append(", descriptorCustomizer: "); //$NON-NLS-1$ - sb.append(this.descriptorCustomizer); - } -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/persistence/general/EclipseLinkGeneralProperties.java b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/persistence/general/EclipseLinkGeneralProperties.java deleted file mode 100644 index ca9e314690..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/persistence/general/EclipseLinkGeneralProperties.java +++ /dev/null @@ -1,96 +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.persistence.general; - -import java.util.Map; - -import org.eclipse.jpt.jpa.core.context.persistence.PersistenceUnit; -import org.eclipse.jpt.jpa.eclipselink.core.context.persistence.general.GeneralProperties; -import org.eclipse.jpt.jpa.eclipselink.core.internal.context.persistence.EclipseLinkPersistenceUnitProperties; - -/** - * 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/logging/EclipseLinkLogging.java b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/persistence/logging/EclipseLinkLogging.java deleted file mode 100644 index f8fe7b22e7..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/persistence/logging/EclipseLinkLogging.java +++ /dev/null @@ -1,409 +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.logging; - -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.logging.Logger; -import org.eclipse.jpt.jpa.eclipselink.core.context.persistence.logging.Logging; -import org.eclipse.jpt.jpa.eclipselink.core.context.persistence.logging.LoggingLevel; -import org.eclipse.jpt.jpa.eclipselink.core.internal.context.persistence.EclipseLinkPersistenceUnitProperties; -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/options/EclipseLinkOptions.java b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/persistence/options/EclipseLinkOptions.java deleted file mode 100644 index d4fbfb788a..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/persistence/options/EclipseLinkOptions.java +++ /dev/null @@ -1,444 +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.options; - -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.Options; -import org.eclipse.jpt.jpa.eclipselink.core.context.persistence.options.TargetDatabase; -import org.eclipse.jpt.jpa.eclipselink.core.context.persistence.options.TargetServer; -import org.eclipse.jpt.jpa.eclipselink.core.internal.context.persistence.EclipseLinkPersistenceUnitProperties; -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/schema/generation/EclipseLinkSchemaGeneration.java b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/persistence/schema/generation/EclipseLinkSchemaGeneration.java deleted file mode 100644 index 671baa4fd6..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/persistence/schema/generation/EclipseLinkSchemaGeneration.java +++ /dev/null @@ -1,232 +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.schema.generation; - -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.schema.generation.DdlGenerationType; -import org.eclipse.jpt.jpa.eclipselink.core.context.persistence.schema.generation.OutputMode; -import org.eclipse.jpt.jpa.eclipselink.core.context.persistence.schema.generation.SchemaGeneration; -import org.eclipse.jpt.jpa.eclipselink.core.internal.context.persistence.EclipseLinkPersistenceUnitProperties; - -/** - * 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 0651a847d3..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/ddlgen/AbstractEclipseLinkDDLGenerator.java +++ /dev/null @@ -1,425 +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.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.resources.ResourcesPlugin; -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.internal.JptCoreMessages; -import org.eclipse.jpt.jpa.db.ConnectionProfile; -import org.eclipse.jpt.jpa.eclipselink.core.context.persistence.connection.Connection; -import org.eclipse.jpt.jpa.eclipselink.core.context.persistence.customization.Customization; -import org.eclipse.jpt.jpa.eclipselink.core.context.persistence.logging.Logging; -import org.eclipse.jpt.jpa.eclipselink.core.context.persistence.logging.LoggingLevel; -import org.eclipse.jpt.jpa.eclipselink.core.context.persistence.schema.generation.DdlGenerationType; -import org.eclipse.jpt.jpa.eclipselink.core.context.persistence.schema.generation.OutputMode; -import org.eclipse.jpt.jpa.eclipselink.core.context.persistence.schema.generation.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 String puName; - private JpaProject jpaProject; - - // ********** constructors ********** - - protected AbstractEclipseLinkDDLGenerator(String puName, JpaProject jpaProject) { - super(JavaCore.create(jpaProject.getProject())); - this.puName = puName; - this.jpaProject = jpaProject; - } - - // ********** 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.appendPuNameArgument(programArguments); - this.appendPropertiesFileArgument(programArguments); - this.appendDebugArgument(programArguments); - - this.launchConfig.setAttribute(IJavaLaunchConfigurationConstants.ATTR_PROGRAM_ARGUMENTS, programArguments.toString()); - } - - @Override - protected List<String> buildClasspath() throws CoreException { - List<String> classpath = new ArrayList<String>(); - // DDL_GEN jar - classpath.add(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()); - return classpath; - } - - // ********** behavior ********** - - //reconnect since we disconnected in preGenerate(); - //ensure the project is fully updated before validating - bug 277236 - protected void reconnect() { - getJpaProject().updateAndWait(); - ConnectionProfile cp = this.getConnectionProfile(); - if (cp != null) { - cp.connect(); - } - } - - protected void validateProject() { - IProject project = this.getJpaProject().getProject(); - ValidateJob job = new ValidateJob(project); - job.setRule(ResourcesPlugin.getWorkspace().getRuleFactory().modifyRule(project)); - job.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; - } - - - // ********** 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 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_TYPE, - DdlGenerationType.DROP_AND_CREATE_TABLES); - this.putProperty(properties, - SchemaGeneration.ECLIPSELINK_DDL_GENERATION_OUTPUT_MODE, - OutputMode.DATABASE); - } - - 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); - } - } - } - - /** - * Performs validation after tables have been generated - */ - private class ValidateJob extends Job - { - private IProject project; - - - public ValidateJob(IProject project) { - super(JptCoreMessages.VALIDATE_JOB); - this.project = project; - } - - - @Override - protected IStatus run(IProgressMonitor monitor) { - IStatus status = Status.OK_STATUS; - try { - ValidationFramework.getDefault().validate( - new IProject[] {this.project}, true, false, monitor); - } - catch (CoreException ce) { - status = Status.CANCEL_STATUS; - } - return status; - } - } - - private IPath buildJdbcJarPath() { - return new Path(this.getJpaProjectConnectionDriverJarList()); - } - - private String getJpaProjectConnectionDriverJarList() { - ConnectionProfile cp = this.getConnectionProfile(); - return (cp == null) ? "" : cp.getDriverJarList(); //$NON-NLS-1$ - } - - // ********** Main arguments ********** - - 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$ - } - - - // ********** Queries ********** - - protected JpaPlatform getPlatform() { - return this.getJpaProject().getJpaPlatform(); - } - - protected JpaProject getJpaProject() { - return this.jpaProject; - } - - - protected ConnectionProfile getConnectionProfile() { - return this.getJpaProject().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/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 b95c7ff507..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/ddlgen/EclipseLinkDDLGenerator.java +++ /dev/null @@ -1,62 +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.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.Connection; - -/** - * 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, IProgressMonitor monitor) { - if (puName == null || puName.length() == 0 || project == null) { - throw new NullPointerException(); - } - new EclipseLinkDDLGenerator(puName, project).generate(monitor); - } - - private EclipseLinkDDLGenerator(String puName, JpaProject jpaProject) { - super(puName, jpaProject); - } - - @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 1e302eb541..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/libval/EclipseLinkEclipseLinkBundlesLibraryValidator.java +++ /dev/null @@ -1,102 +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$ - } - 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 973fb5817d..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/libval/EclipseLinkUserLibraryValidator.java +++ /dev/null @@ -1,122 +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.core.runtime.Status; -import org.eclipse.jdt.core.IClasspathEntry; -import org.eclipse.jdt.core.ToolFactory; -import org.eclipse.jdt.core.util.IClassFileReader; -import org.eclipse.jdt.core.util.IFieldInfo; -import org.eclipse.jpt.common.core.libprov.JptLibraryProviderInstallOperationConfig; -import org.eclipse.jpt.common.core.libval.LibraryValidator; -import org.eclipse.jpt.common.utility.internal.StringTools; -import org.eclipse.jpt.jpa.core.internal.libprov.JpaUserLibraryProviderInstallOperationConfig; -import org.eclipse.jpt.jpa.core.platform.JpaPlatformDescription; -import org.eclipse.jpt.jpa.eclipselink.core.JptJpaEclipseLinkCorePlugin; -import org.eclipse.jpt.jpa.eclipselink.core.internal.JptEclipseLinkCoreMessages; -import org.eclipse.jpt.jpa.eclipselink.core.platform.EclipseLinkPlatform; -import org.eclipse.osgi.service.resolver.VersionRange; -import org.osgi.framework.Version; - -/** - * 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 { - - private final static String VERSION_CLASS_PATH = "org/eclipse/persistence/Version.class"; //$NON-NLS-1$ - - private final static String VERSION_FIELD_NAME = "version"; //$NON-NLS-1$ - - - 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$ - } - return validate(jpaConfig, versionRanges); - } - - protected IStatus validate( - JpaUserLibraryProviderInstallOperationConfig config, Set<VersionRange> versionRanges) { - - Version version = null; - for (IClasspathEntry cpe : config.resolve()) { - String versionString = null; - if (cpe.getEntryKind() == IClasspathEntry.CPE_LIBRARY) { - IClassFileReader classReader = - ToolFactory.createDefaultClassFileReader( - cpe.getPath().toFile().getAbsolutePath(), VERSION_CLASS_PATH, IClassFileReader.FIELD_INFOS); - if (classReader != null) { - for (IFieldInfo field : classReader.getFieldInfos()) { - if (StringTools.stringsAreEqual(field.getName(), VERSION_FIELD_NAME.toCharArray())) { - try { - versionString = field.getConstantValueAttribute().getConstantValue().getStringValue(); - } - catch (Exception e) { - // potentially a bit could go wrong with that last line, but if any - // assumptions aren't met, there's no value - } - break; - } - } - } - if (versionString != null) { - if (version != null) { - return new Status( - IStatus.ERROR, JptJpaEclipseLinkCorePlugin.PLUGIN_ID, - JptEclipseLinkCoreMessages.EclipseLinkLibraryValidator_multipleEclipseLinkVersions); - } - else { - version = new Version(versionString); - } - } - } - } - - if (version == null) { - return new Status( - IStatus.ERROR, JptJpaEclipseLinkCorePlugin.PLUGIN_ID, - JptEclipseLinkCoreMessages.EclipseLinkLibraryValidator_noEclipseLinkVersion); - } - - for (VersionRange versionRange : versionRanges) { - if (! versionRange.isIncluded(version)) { - return new Status( - IStatus.ERROR, JptJpaEclipseLinkCorePlugin.PLUGIN_ID, - JptEclipseLinkCoreMessages.EclipseLinkLibraryValidator_improperEclipseLinkVersion); - } - } - - return Status.OK_STATUS; - } -} 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 cf00b5a3b6..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/operations/EclipseLinkOrmFileCreationDataModelProvider.java +++ /dev/null @@ -1,86 +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.operations; - -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.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() { - if (getProject() == null) { - return null; - } - try { - return getJpaProject().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); - } - - @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/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 9253664076..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,62 +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.resource.java; - -import org.eclipse.jdt.core.IAnnotation; -import org.eclipse.jpt.common.core.utility.jdt.AnnotatedElement; -import org.eclipse.jpt.common.core.utility.jdt.Attribute; -import org.eclipse.jpt.jpa.core.resource.java.Annotation; -import org.eclipse.jpt.jpa.core.resource.java.AnnotationDefinition; -import org.eclipse.jpt.jpa.core.resource.java.JavaResourceAnnotatedElement; -import org.eclipse.jpt.jpa.core.resource.java.JavaResourcePersistentAttribute; -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((JavaResourcePersistentAttribute) parent, (Attribute) annotatedElement); - } - - public Annotation buildNullAnnotation(JavaResourceAnnotatedElement parent) { - throw new UnsupportedOperationException(); - } - - public Annotation buildAnnotation(JavaResourceAnnotatedElement parent, IAnnotation jdtAnnotation) { - return new BinaryEclipseLinkBasicCollectionAnnotation((JavaResourcePersistentAttribute) 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 7544577f4d..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,62 +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.resource.java; - -import org.eclipse.jdt.core.IAnnotation; -import org.eclipse.jpt.common.core.utility.jdt.AnnotatedElement; -import org.eclipse.jpt.common.core.utility.jdt.Attribute; -import org.eclipse.jpt.jpa.core.resource.java.Annotation; -import org.eclipse.jpt.jpa.core.resource.java.AnnotationDefinition; -import org.eclipse.jpt.jpa.core.resource.java.JavaResourceAnnotatedElement; -import org.eclipse.jpt.jpa.core.resource.java.JavaResourcePersistentAttribute; -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((JavaResourcePersistentAttribute) parent, (Attribute) annotatedElement); - } - - public Annotation buildNullAnnotation(JavaResourceAnnotatedElement parent) { - throw new UnsupportedOperationException(); - } - - public Annotation buildAnnotation(JavaResourceAnnotatedElement parent, IAnnotation jdtAnnotation) { - return new BinaryEclipseLinkBasicMapAnnotation((JavaResourcePersistentAttribute) 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 d6e4f20f60..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,62 +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.resource.java; - -import org.eclipse.jdt.core.IAnnotation; -import org.eclipse.jpt.common.core.utility.jdt.AnnotatedElement; -import org.eclipse.jpt.common.core.utility.jdt.Type; -import org.eclipse.jpt.jpa.core.resource.java.Annotation; -import org.eclipse.jpt.jpa.core.resource.java.AnnotationDefinition; -import org.eclipse.jpt.jpa.core.resource.java.JavaResourceAnnotatedElement; -import org.eclipse.jpt.jpa.core.resource.java.JavaResourcePersistentType; -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((JavaResourcePersistentType) parent, (Type) annotatedElement); - } - - public Annotation buildNullAnnotation(JavaResourceAnnotatedElement parent) { - return new NullEclipseLinkCacheAnnotation((JavaResourcePersistentType) parent); - } - - public Annotation buildAnnotation(JavaResourceAnnotatedElement parent, IAnnotation jdtAnnotation) { - return new BinaryEclipseLinkCacheAnnotation((JavaResourcePersistentType) 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 52ec667b6a..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,62 +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.resource.java; - -import org.eclipse.jdt.core.IAnnotation; -import org.eclipse.jpt.common.core.utility.jdt.AnnotatedElement; -import org.eclipse.jpt.common.core.utility.jdt.Type; -import org.eclipse.jpt.jpa.core.resource.java.Annotation; -import org.eclipse.jpt.jpa.core.resource.java.AnnotationDefinition; -import org.eclipse.jpt.jpa.core.resource.java.JavaResourceAnnotatedElement; -import org.eclipse.jpt.jpa.core.resource.java.JavaResourcePersistentType; -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((JavaResourcePersistentType) parent, (Type) annotatedElement); - } - - public Annotation buildNullAnnotation(JavaResourceAnnotatedElement parent) { - throw new UnsupportedOperationException(); - } - - public Annotation buildAnnotation(JavaResourceAnnotatedElement parent, IAnnotation jdtAnnotation) { - return new BinaryEclipseLinkChangeTrackingAnnotation((JavaResourcePersistentType) 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/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 1b8bd7e18a..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,62 +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.resource.java; - -import org.eclipse.jdt.core.IAnnotation; -import org.eclipse.jpt.common.core.utility.jdt.AnnotatedElement; -import org.eclipse.jpt.common.core.utility.jdt.Attribute; -import org.eclipse.jpt.jpa.core.resource.java.Annotation; -import org.eclipse.jpt.jpa.core.resource.java.AnnotationDefinition; -import org.eclipse.jpt.jpa.core.resource.java.JavaResourceAnnotatedElement; -import org.eclipse.jpt.jpa.core.resource.java.JavaResourcePersistentAttribute; -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((JavaResourcePersistentAttribute) parent, (Attribute) annotatedElement); - } - - public Annotation buildNullAnnotation(JavaResourceAnnotatedElement parent) { - throw new UnsupportedOperationException(); - } - - public Annotation buildAnnotation(JavaResourceAnnotatedElement parent, IAnnotation jdtAnnotation) { - return new BinaryEclipseLinkConvertAnnotation((JavaResourcePersistentAttribute) 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 7dbe056b84..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,62 +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.resource.java; - -import org.eclipse.jdt.core.IAnnotation; -import org.eclipse.jpt.common.core.utility.jdt.AnnotatedElement; -import org.eclipse.jpt.common.core.utility.jdt.Member; -import org.eclipse.jpt.jpa.core.resource.java.Annotation; -import org.eclipse.jpt.jpa.core.resource.java.AnnotationDefinition; -import org.eclipse.jpt.jpa.core.resource.java.JavaResourceAnnotatedElement; -import org.eclipse.jpt.jpa.core.resource.java.JavaResourcePersistentMember; -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.EclipseLinkConverterAnnotation; - -/** - * org.eclipse.persistence.annotations.Converter - */ -public class EclipseLinkConverterAnnotationDefinition - implements AnnotationDefinition -{ - // singleton - private static final AnnotationDefinition INSTANCE = new EclipseLinkConverterAnnotationDefinition(); - - /** - * Return the singleton. - */ - public static AnnotationDefinition instance() { - return INSTANCE; - } - - /** - * Ensure single instance. - */ - private EclipseLinkConverterAnnotationDefinition() { - super(); - } - - public Annotation buildAnnotation(JavaResourceAnnotatedElement parent, AnnotatedElement annotatedElement) { - return new SourceEclipseLinkConverterAnnotation((JavaResourcePersistentMember) parent, (Member) annotatedElement); - } - - public Annotation buildNullAnnotation(JavaResourceAnnotatedElement parent) { - throw new UnsupportedOperationException(); - } - - public Annotation buildAnnotation(JavaResourceAnnotatedElement parent, IAnnotation jdtAnnotation) { - return new BinaryEclipseLinkConverterAnnotation((JavaResourcePersistentMember) parent, jdtAnnotation); - } - - public String getAnnotationName() { - return EclipseLinkConverterAnnotation.ANNOTATION_NAME; - } - -} 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 688aa48a97..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,62 +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.resource.java; - -import org.eclipse.jdt.core.IAnnotation; -import org.eclipse.jpt.common.core.utility.jdt.AnnotatedElement; -import org.eclipse.jpt.common.core.utility.jdt.Type; -import org.eclipse.jpt.jpa.core.resource.java.Annotation; -import org.eclipse.jpt.jpa.core.resource.java.AnnotationDefinition; -import org.eclipse.jpt.jpa.core.resource.java.JavaResourceAnnotatedElement; -import org.eclipse.jpt.jpa.core.resource.java.JavaResourcePersistentType; -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((JavaResourcePersistentType) parent, (Type) annotatedElement); - } - - public Annotation buildNullAnnotation(JavaResourceAnnotatedElement parent) { - throw new UnsupportedOperationException(); - } - - public Annotation buildAnnotation(JavaResourceAnnotatedElement parent, IAnnotation jdtAnnotation) { - return new BinaryEclipseLinkCustomizerAnnotation((JavaResourcePersistentType) 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 7c6082f5fd..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,62 +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.resource.java; - -import org.eclipse.jdt.core.IAnnotation; -import org.eclipse.jpt.common.core.utility.jdt.AnnotatedElement; -import org.eclipse.jpt.common.core.utility.jdt.Type; -import org.eclipse.jpt.jpa.core.resource.java.Annotation; -import org.eclipse.jpt.jpa.core.resource.java.AnnotationDefinition; -import org.eclipse.jpt.jpa.core.resource.java.JavaResourceAnnotatedElement; -import org.eclipse.jpt.jpa.core.resource.java.JavaResourcePersistentType; -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((JavaResourcePersistentType) parent, (Type) annotatedElement); - } - - public Annotation buildNullAnnotation(JavaResourceAnnotatedElement parent) { - throw new UnsupportedOperationException(); - } - - public Annotation buildAnnotation(JavaResourceAnnotatedElement parent, IAnnotation jdtAnnotation) { - return new BinaryEclipseLinkExistenceCheckingAnnotation((JavaResourcePersistentType) 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 27e10db948..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,62 +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.resource.java; - -import org.eclipse.jdt.core.IAnnotation; -import org.eclipse.jpt.common.core.utility.jdt.AnnotatedElement; -import org.eclipse.jpt.common.core.utility.jdt.Attribute; -import org.eclipse.jpt.jpa.core.resource.java.Annotation; -import org.eclipse.jpt.jpa.core.resource.java.AnnotationDefinition; -import org.eclipse.jpt.jpa.core.resource.java.JavaResourceAnnotatedElement; -import org.eclipse.jpt.jpa.core.resource.java.JavaResourcePersistentAttribute; -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((JavaResourcePersistentAttribute) parent, (Attribute) annotatedElement); - } - - public Annotation buildNullAnnotation(JavaResourceAnnotatedElement parent) { - return new NullEclipseLinkJoinFetchAnnotation((JavaResourcePersistentAttribute) parent); - } - - public Annotation buildAnnotation(JavaResourceAnnotatedElement parent, IAnnotation jdtAnnotation) { - return new BinaryEclipseLinkJoinFetchAnnotation((JavaResourcePersistentAttribute) 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/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 2551510fd7..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,62 +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.resource.java; - -import org.eclipse.jdt.core.IAnnotation; -import org.eclipse.jpt.common.core.utility.jdt.AnnotatedElement; -import org.eclipse.jpt.common.core.utility.jdt.Attribute; -import org.eclipse.jpt.jpa.core.resource.java.Annotation; -import org.eclipse.jpt.jpa.core.resource.java.AnnotationDefinition; -import org.eclipse.jpt.jpa.core.resource.java.JavaResourceAnnotatedElement; -import org.eclipse.jpt.jpa.core.resource.java.JavaResourcePersistentAttribute; -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((JavaResourcePersistentAttribute) parent, (Attribute) annotatedElement); - } - - public Annotation buildNullAnnotation(JavaResourceAnnotatedElement parent) { - throw new UnsupportedOperationException(); - } - - public Annotation buildAnnotation(JavaResourceAnnotatedElement parent, IAnnotation jdtAnnotation) { - return new BinaryEclipseLinkMutableAnnotation((JavaResourcePersistentAttribute) 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 06a606f361..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,62 +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.resource.java; - -import org.eclipse.jdt.core.IAnnotation; -import org.eclipse.jpt.common.core.utility.jdt.AnnotatedElement; -import org.eclipse.jpt.common.core.utility.jdt.Member; -import org.eclipse.jpt.jpa.core.resource.java.Annotation; -import org.eclipse.jpt.jpa.core.resource.java.AnnotationDefinition; -import org.eclipse.jpt.jpa.core.resource.java.JavaResourceAnnotatedElement; -import org.eclipse.jpt.jpa.core.resource.java.JavaResourcePersistentMember; -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.EclipseLinkObjectTypeConverterAnnotation; - -/** - * org.eclipse.persistence.annotations.ObjectTypeConverter - */ -public class EclipseLinkObjectTypeConverterAnnotationDefinition - implements AnnotationDefinition -{ - // singleton - private static final AnnotationDefinition INSTANCE = new EclipseLinkObjectTypeConverterAnnotationDefinition(); - - /** - * Return the singleton. - */ - public static AnnotationDefinition instance() { - return INSTANCE; - } - - /** - * Ensure single instance. - */ - private EclipseLinkObjectTypeConverterAnnotationDefinition() { - super(); - } - - public Annotation buildAnnotation(JavaResourceAnnotatedElement parent, AnnotatedElement annotatedElement) { - return new SourceEclipseLinkObjectTypeConverterAnnotation((JavaResourcePersistentMember) parent, (Member) annotatedElement); - } - - public Annotation buildNullAnnotation(JavaResourceAnnotatedElement parent) { - throw new UnsupportedOperationException(); - } - - public Annotation buildAnnotation(JavaResourceAnnotatedElement parent, IAnnotation jdtAnnotation) { - return new BinaryEclipseLinkObjectTypeConverterAnnotation((JavaResourcePersistentMember) parent, jdtAnnotation); - } - - public String getAnnotationName() { - return EclipseLinkObjectTypeConverterAnnotation.ANNOTATION_NAME; - } - -} 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 5b856c3f5e..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,63 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010 Oracle. - * All rights reserved. This program and the accompanying materials are - * made available under the terms of the Eclipse Public License v1.0 which - * accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Oracle - initial API and implementation - *******************************************************************************/ -package org.eclipse.jpt.jpa.eclipselink.core.internal.resource.java; - -import org.eclipse.jdt.core.IAnnotation; -import org.eclipse.jpt.common.core.utility.jdt.AnnotatedElement; -import org.eclipse.jpt.common.core.utility.jdt.Type; -import org.eclipse.jpt.jpa.core.resource.java.Annotation; -import org.eclipse.jpt.jpa.core.resource.java.AnnotationDefinition; -import org.eclipse.jpt.jpa.core.resource.java.JavaResourceAnnotatedElement; -import org.eclipse.jpt.jpa.core.resource.java.JavaResourcePersistentType; -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((JavaResourcePersistentType) parent, (Type) annotatedElement); - } - - public Annotation buildNullAnnotation(JavaResourceAnnotatedElement parent) { - throw new UnsupportedOperationException(); - } - - public Annotation buildAnnotation(JavaResourceAnnotatedElement parent, IAnnotation jdtAnnotation) { - return new BinaryEclipseLinkPrimaryKeyAnnotation((JavaResourcePersistentType) 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 a5be825849..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,62 +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.resource.java; - -import org.eclipse.jdt.core.IAnnotation; -import org.eclipse.jpt.common.core.utility.jdt.AnnotatedElement; -import org.eclipse.jpt.common.core.utility.jdt.Attribute; -import org.eclipse.jpt.jpa.core.resource.java.Annotation; -import org.eclipse.jpt.jpa.core.resource.java.AnnotationDefinition; -import org.eclipse.jpt.jpa.core.resource.java.JavaResourceAnnotatedElement; -import org.eclipse.jpt.jpa.core.resource.java.JavaResourcePersistentAttribute; -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((JavaResourcePersistentAttribute) parent, (Attribute) annotatedElement); - } - - public Annotation buildNullAnnotation(JavaResourceAnnotatedElement parent) { - throw new UnsupportedOperationException(); - } - - public Annotation buildAnnotation(JavaResourceAnnotatedElement parent, IAnnotation jdtAnnotation) { - return new BinaryEclipseLinkPrivateOwnedAnnotation((JavaResourcePersistentAttribute) 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 722274893c..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,62 +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.resource.java; - -import org.eclipse.jdt.core.IAnnotation; -import org.eclipse.jpt.common.core.utility.jdt.AnnotatedElement; -import org.eclipse.jpt.common.core.utility.jdt.Type; -import org.eclipse.jpt.jpa.core.resource.java.Annotation; -import org.eclipse.jpt.jpa.core.resource.java.AnnotationDefinition; -import org.eclipse.jpt.jpa.core.resource.java.JavaResourceAnnotatedElement; -import org.eclipse.jpt.jpa.core.resource.java.JavaResourcePersistentType; -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((JavaResourcePersistentType) parent, (Type) annotatedElement); - } - - public Annotation buildNullAnnotation(JavaResourceAnnotatedElement parent) { - throw new UnsupportedOperationException(); - } - - public Annotation buildAnnotation(JavaResourceAnnotatedElement parent, IAnnotation jdtAnnotation) { - return new BinaryEclipseLinkReadOnlyAnnotation((JavaResourcePersistentType) 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 a7eb193291..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,62 +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.resource.java; - -import org.eclipse.jdt.core.IAnnotation; -import org.eclipse.jpt.common.core.utility.jdt.AnnotatedElement; -import org.eclipse.jpt.common.core.utility.jdt.Attribute; -import org.eclipse.jpt.jpa.core.resource.java.Annotation; -import org.eclipse.jpt.jpa.core.resource.java.AnnotationDefinition; -import org.eclipse.jpt.jpa.core.resource.java.JavaResourceAnnotatedElement; -import org.eclipse.jpt.jpa.core.resource.java.JavaResourcePersistentAttribute; -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((JavaResourcePersistentAttribute) parent, (Attribute) annotatedElement); - } - - public Annotation buildNullAnnotation(JavaResourceAnnotatedElement parent) { - throw new UnsupportedOperationException(); - } - - public Annotation buildAnnotation(JavaResourceAnnotatedElement parent, IAnnotation jdtAnnotation) { - return new BinaryEclipseLinkReadTransformerAnnotation((JavaResourcePersistentAttribute) 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 28d117085b..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,62 +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.resource.java; - -import org.eclipse.jdt.core.IAnnotation; -import org.eclipse.jpt.common.core.utility.jdt.AnnotatedElement; -import org.eclipse.jpt.common.core.utility.jdt.Member; -import org.eclipse.jpt.jpa.core.resource.java.Annotation; -import org.eclipse.jpt.jpa.core.resource.java.AnnotationDefinition; -import org.eclipse.jpt.jpa.core.resource.java.JavaResourceAnnotatedElement; -import org.eclipse.jpt.jpa.core.resource.java.JavaResourcePersistentMember; -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.EclipseLinkStructConverterAnnotation; - -/** - * org.eclipse.persistence.annotations.StructConverter - */ -public class EclipseLinkStructConverterAnnotationDefinition - implements AnnotationDefinition -{ - // singleton - private static final AnnotationDefinition INSTANCE = new EclipseLinkStructConverterAnnotationDefinition(); - - /** - * Return the singleton. - */ - public static AnnotationDefinition instance() { - return INSTANCE; - } - - /** - * Ensure single instance. - */ - private EclipseLinkStructConverterAnnotationDefinition() { - super(); - } - - public Annotation buildAnnotation(JavaResourceAnnotatedElement parent, AnnotatedElement annotatedElement) { - return new SourceEclipseLinkStructConverterAnnotation((JavaResourcePersistentMember) parent, (Member) annotatedElement); - } - - public Annotation buildNullAnnotation(JavaResourceAnnotatedElement parent) { - throw new UnsupportedOperationException(); - } - - public Annotation buildAnnotation(JavaResourceAnnotatedElement parent, IAnnotation jdtAnnotation) { - return new BinaryEclipseLinkStructConverterAnnotation((JavaResourcePersistentMember) parent, jdtAnnotation); - } - - public String getAnnotationName() { - return EclipseLinkStructConverterAnnotation.ANNOTATION_NAME; - } - -} 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 3db2d07b55..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,62 +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.resource.java; - -import org.eclipse.jdt.core.IAnnotation; -import org.eclipse.jpt.common.core.utility.jdt.AnnotatedElement; -import org.eclipse.jpt.common.core.utility.jdt.Attribute; -import org.eclipse.jpt.jpa.core.resource.java.Annotation; -import org.eclipse.jpt.jpa.core.resource.java.AnnotationDefinition; -import org.eclipse.jpt.jpa.core.resource.java.JavaResourceAnnotatedElement; -import org.eclipse.jpt.jpa.core.resource.java.JavaResourcePersistentAttribute; -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((JavaResourcePersistentAttribute) parent, (Attribute) annotatedElement); - } - - public Annotation buildNullAnnotation(JavaResourceAnnotatedElement parent) { - return new NullEclipseLinkTransformationAnnotation((JavaResourcePersistentAttribute) parent); - } - - public Annotation buildAnnotation(JavaResourceAnnotatedElement parent, IAnnotation jdtAnnotation) { - return new BinaryEclipseLinkTransformationAnnotation((JavaResourcePersistentAttribute) 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 313eba3fd7..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,62 +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.resource.java; - -import org.eclipse.jdt.core.IAnnotation; -import org.eclipse.jpt.common.core.utility.jdt.AnnotatedElement; -import org.eclipse.jpt.common.core.utility.jdt.Member; -import org.eclipse.jpt.jpa.core.resource.java.Annotation; -import org.eclipse.jpt.jpa.core.resource.java.AnnotationDefinition; -import org.eclipse.jpt.jpa.core.resource.java.JavaResourceAnnotatedElement; -import org.eclipse.jpt.jpa.core.resource.java.JavaResourcePersistentMember; -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.EclipseLinkTypeConverterAnnotation; - -/** - * org.eclipse.persistence.annotations.TypeConverter - */ -public class EclipseLinkTypeConverterAnnotationDefinition - implements AnnotationDefinition -{ - // singleton - private static final AnnotationDefinition INSTANCE = new EclipseLinkTypeConverterAnnotationDefinition(); - - /** - * Return the singleton. - */ - public static AnnotationDefinition instance() { - return INSTANCE; - } - - /** - * Ensure single instance. - */ - private EclipseLinkTypeConverterAnnotationDefinition() { - super(); - } - - public Annotation buildAnnotation(JavaResourceAnnotatedElement parent, AnnotatedElement annotatedElement) { - return new SourceEclipseLinkTypeConverterAnnotation((JavaResourcePersistentMember) parent, (Member) annotatedElement); - } - - public Annotation buildNullAnnotation(JavaResourceAnnotatedElement parent) { - throw new UnsupportedOperationException(); - } - - public Annotation buildAnnotation(JavaResourceAnnotatedElement parent, IAnnotation jdtAnnotation) { - return new BinaryEclipseLinkTypeConverterAnnotation((JavaResourcePersistentMember) parent, jdtAnnotation); - } - - public String getAnnotationName() { - return EclipseLinkTypeConverterAnnotation.ANNOTATION_NAME; - } - -} 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 cf11929d6c..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,62 +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.resource.java; - -import org.eclipse.jdt.core.IAnnotation; -import org.eclipse.jpt.common.core.utility.jdt.AnnotatedElement; -import org.eclipse.jpt.common.core.utility.jdt.Attribute; -import org.eclipse.jpt.jpa.core.resource.java.Annotation; -import org.eclipse.jpt.jpa.core.resource.java.AnnotationDefinition; -import org.eclipse.jpt.jpa.core.resource.java.JavaResourceAnnotatedElement; -import org.eclipse.jpt.jpa.core.resource.java.JavaResourcePersistentAttribute; -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((JavaResourcePersistentAttribute) parent, (Attribute) annotatedElement); - } - - public Annotation buildNullAnnotation(JavaResourceAnnotatedElement parent) { - throw new UnsupportedOperationException(); - } - - public Annotation buildAnnotation(JavaResourceAnnotatedElement parent, IAnnotation jdtAnnotation) { - return new BinaryEclipseLinkVariableOneToOneAnnotation((JavaResourcePersistentAttribute) 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 2c3b598303..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,62 +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.resource.java; - -import org.eclipse.jdt.core.IAnnotation; -import org.eclipse.jpt.common.core.utility.jdt.AnnotatedElement; -import org.eclipse.jpt.common.core.utility.jdt.Attribute; -import org.eclipse.jpt.jpa.core.resource.java.Annotation; -import org.eclipse.jpt.jpa.core.resource.java.AnnotationDefinition; -import org.eclipse.jpt.jpa.core.resource.java.JavaResourceAnnotatedElement; -import org.eclipse.jpt.jpa.core.resource.java.JavaResourcePersistentAttribute; -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((JavaResourcePersistentAttribute) parent, (Attribute) annotatedElement); - } - - public Annotation buildNullAnnotation(JavaResourceAnnotatedElement parent) { - throw new UnsupportedOperationException(); - } - - public Annotation buildAnnotation(JavaResourceAnnotatedElement parent, IAnnotation jdtAnnotation) { - return new BinaryEclipseLinkWriteTransformerAnnotation((JavaResourcePersistentAttribute) 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 ebc4569743..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,172 +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.resource.java; - -import org.eclipse.jdt.core.dom.CompilationUnit; -import org.eclipse.jpt.common.core.utility.TextRange; -import org.eclipse.jpt.jpa.core.internal.resource.java.NullAnnotation; -import org.eclipse.jpt.jpa.core.resource.java.JavaResourcePersistentType; -import org.eclipse.jpt.jpa.eclipselink.core.resource.java.CacheCoordinationType; -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(JavaResourcePersistentType 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(CompilationUnit astRoot) { - return null; - } - - // ***** size - public Integer getSize() { - return null; - } - - public void setSize(Integer size) { - if (size != null) { - this.addAnnotation().setSize(size); - } - } - - public TextRange getSizeTextRange(CompilationUnit astRoot) { - return null; - } - - // ***** shared - public Boolean getShared() { - return null; - } - - public void setShared(Boolean shared) { - if (shared != null) { - this.addAnnotation().setShared(shared); - } - } - - public TextRange getSharedTextRange(CompilationUnit astRoot) { - return null; - } - - // ***** always refresh - public Boolean getAlwaysRefresh() { - return null; - } - - public void setAlwaysRefresh(Boolean alwaysRefresh) { - if (alwaysRefresh != null) { - this.addAnnotation().setAlwaysRefresh(alwaysRefresh); - } - } - - public TextRange getAlwaysRefreshTextRange(CompilationUnit astRoot) { - 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(CompilationUnit astRoot) { - return null; - } - - // ***** disable hits - public Boolean getDisableHits() { - return null; - } - - public void setDisableHits(Boolean disableHits) { - if (disableHits != null) { - this.addAnnotation().setDisableHits(disableHits); - } - } - - public TextRange getDisablesHitsTextRange(CompilationUnit astRoot) { - return null; - } - - // ***** coordination type - public CacheCoordinationType getCoordinationType() { - return null; - } - - public void setCoordinationType(CacheCoordinationType coordinationType) { - if (coordinationType != null) { - this.addAnnotation().setCoordinationType(coordinationType); - } - } - - public TextRange getCoordinationTypeTextRange(CompilationUnit astRoot) { - return null; - } - - // ***** expiry - public Integer getExpiry() { - return null; - } - - public void setExpiry(Integer expiry) { - if (expiry != null) { - this.addAnnotation().setExpiry(expiry); - } - } - - public TextRange getExpiryTextRange(CompilationUnit astRoot) { - 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(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/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 3a5d19d1fb..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,48 +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.resource.java; - -import org.eclipse.jdt.core.dom.CompilationUnit; -import org.eclipse.jpt.common.core.utility.TextRange; -import org.eclipse.jpt.jpa.core.internal.resource.java.NullAnnotation; -import org.eclipse.jpt.jpa.core.resource.java.JavaResourcePersistentAttribute; -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(JavaResourcePersistentAttribute 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(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/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 42a8781aec..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,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.resource.java; - -import org.eclipse.jdt.core.dom.CompilationUnit; -import org.eclipse.jpt.common.core.utility.TextRange; -import org.eclipse.jpt.jpa.core.internal.resource.java.NullAnnotation; -import org.eclipse.jpt.jpa.core.resource.java.FetchType; -import org.eclipse.jpt.jpa.core.resource.java.JavaResourcePersistentAttribute; -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(JavaResourcePersistentAttribute 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(CompilationUnit astRoot) { - return null; - } - - // ***** optional - public Boolean getOptional() { - return null; - } - - public void setOptional(Boolean optional) { - if (optional != null) { - this.addAnnotation().setOptional(optional); - } - } - - public TextRange getOptionalTextRange(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/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/BinaryBaseEclipseLinkTypeConverterAnnotation.java b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/resource/java/binary/BinaryBaseEclipseLinkTypeConverterAnnotation.java deleted file mode 100644 index 471ae994b3..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/resource/java/binary/BinaryBaseEclipseLinkTypeConverterAnnotation.java +++ /dev/null @@ -1,104 +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.resource.java.binary; - -import org.eclipse.jdt.core.IAnnotation; -import org.eclipse.jdt.core.dom.CompilationUnit; -import org.eclipse.jpt.common.core.utility.TextRange; -import org.eclipse.jpt.jpa.core.resource.java.JavaResourcePersistentMember; -import org.eclipse.jpt.jpa.eclipselink.core.resource.java.BaseEclipseLinkTypeConverterAnnotation; - -/** - * org.eclipse.persistence.annotations.ObjectTypeConverter - * org.eclipse.persistence.annotations.TypeConverter - */ -abstract class BinaryBaseEclipseLinkTypeConverterAnnotation - extends BinaryEclipseLinkNamedConverterAnnotation - implements BaseEclipseLinkTypeConverterAnnotation -{ - String dataType; - String objectType; - - - BinaryBaseEclipseLinkTypeConverterAnnotation(JavaResourcePersistentMember 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(CompilationUnit astRoot) { - 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(CompilationUnit astRoot) { - 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 cd86377931..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) 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.resource.java.binary; - -import org.eclipse.jdt.core.IAnnotation; -import org.eclipse.jpt.jpa.core.internal.resource.java.binary.BinaryAnnotation; -import org.eclipse.jpt.jpa.core.resource.java.JavaResourcePersistentAttribute; -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(JavaResourcePersistentAttribute 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 3639d9d73b..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 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is 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.jpa.core.internal.resource.java.binary.BinaryAnnotation; -import org.eclipse.jpt.jpa.core.resource.java.JavaResourcePersistentAttribute; -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(JavaResourcePersistentAttribute 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 4e759a79b3..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,311 +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.resource.java.binary; - -import org.eclipse.jdt.core.IAnnotation; -import org.eclipse.jdt.core.dom.CompilationUnit; -import org.eclipse.jpt.common.core.utility.TextRange; -import org.eclipse.jpt.jpa.core.internal.resource.java.binary.BinaryAnnotation; -import org.eclipse.jpt.jpa.core.resource.java.JavaResourcePersistentType; -import org.eclipse.jpt.jpa.eclipselink.core.resource.java.CacheCoordinationType; -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; - -/** - * org.eclipse.persistence.annotations.Cache - */ -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; - - - public BinaryEclipseLinkCacheAnnotation(JavaResourcePersistentType 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(); - } - - 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()); - } - - - // ********** 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(CompilationUnit astRoot) { - 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(CompilationUnit astRoot) { - 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(CompilationUnit astRoot) { - 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(CompilationUnit astRoot) { - 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(CompilationUnit astRoot) { - 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(CompilationUnit astRoot) { - 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(CompilationUnit astRoot) { - 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 getDisablesHitsTextRange(CompilationUnit astRoot) { - 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(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/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 999ecb000d..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,73 +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.resource.java.binary; - -import org.eclipse.jdt.core.IAnnotation; -import org.eclipse.jdt.core.dom.CompilationUnit; -import org.eclipse.jpt.common.core.utility.TextRange; -import org.eclipse.jpt.jpa.core.internal.resource.java.binary.BinaryAnnotation; -import org.eclipse.jpt.jpa.core.resource.java.JavaResourcePersistentType; -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; - -/** - * org.eclipse.persistence.annotations.ChangeTracking - */ -public final class BinaryEclipseLinkChangeTrackingAnnotation - extends BinaryAnnotation - implements EclipseLinkChangeTrackingAnnotation -{ - private ChangeTrackingType value; - - - public BinaryEclipseLinkChangeTrackingAnnotation(JavaResourcePersistentType 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(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/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 a1433a2b2a..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,97 +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.resource.java.binary; - -import org.eclipse.jdt.core.IAnnotation; -import org.eclipse.jdt.core.dom.CompilationUnit; -import org.eclipse.jpt.common.core.utility.TextRange; -import org.eclipse.jpt.jpa.core.internal.resource.java.binary.BinaryAnnotation; -import org.eclipse.jpt.jpa.core.resource.java.JavaResourceNode; -import org.eclipse.jpt.jpa.eclipselink.core.resource.java.EclipseLink; -import org.eclipse.jpt.jpa.eclipselink.core.resource.java.EclipseLinkConversionValueAnnotation; - -/** - * org.eclipse.persistence.annotations.ConversionValue - */ -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(CompilationUnit astRoot) { - 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(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/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 3fc1071924..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,74 +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.resource.java.binary; - -import org.eclipse.jdt.core.IAnnotation; -import org.eclipse.jdt.core.dom.CompilationUnit; -import org.eclipse.jpt.common.core.utility.TextRange; -import org.eclipse.jpt.jpa.core.internal.resource.java.binary.BinaryAnnotation; -import org.eclipse.jpt.jpa.core.resource.java.JavaResourcePersistentAttribute; -import org.eclipse.jpt.jpa.eclipselink.core.resource.java.EclipseLink; -import org.eclipse.jpt.jpa.eclipselink.core.resource.java.EclipseLinkConvertAnnotation; - -/** - * org.eclipse.persistence.annotations.Convert - */ -public final class BinaryEclipseLinkConvertAnnotation - extends BinaryAnnotation - implements EclipseLinkConvertAnnotation -{ - private String value; - - public BinaryEclipseLinkConvertAnnotation(JavaResourcePersistentAttribute 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()); - } - - - // ********** 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(EclipseLink.CONVERT__VALUE); - } - - public TextRange getValueTextRange(CompilationUnit astRoot) { - throw new UnsupportedOperationException(); - } - - public boolean valueTouches(int pos, 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/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 e95bf85644..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,85 +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.resource.java.binary; - -import org.eclipse.jdt.core.IAnnotation; -import org.eclipse.jdt.core.dom.CompilationUnit; -import org.eclipse.jpt.common.core.utility.TextRange; -import org.eclipse.jpt.jpa.core.resource.java.JavaResourcePersistentMember; -import org.eclipse.jpt.jpa.eclipselink.core.resource.java.EclipseLink; -import org.eclipse.jpt.jpa.eclipselink.core.resource.java.EclipseLinkConverterAnnotation; - -/** - * org.eclipse.persistence.annotations.Converter - */ -public final class BinaryEclipseLinkConverterAnnotation - extends BinaryEclipseLinkNamedConverterAnnotation - implements EclipseLinkConverterAnnotation -{ - private String converterClass; - - - public BinaryEclipseLinkConverterAnnotation(JavaResourcePersistentMember 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(CompilationUnit astRoot) { - 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 8cca3d697c..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,80 +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.resource.java.binary; - -import org.eclipse.jdt.core.IAnnotation; -import org.eclipse.jdt.core.dom.CompilationUnit; -import org.eclipse.jpt.common.core.utility.TextRange; -import org.eclipse.jpt.jpa.core.internal.resource.java.binary.BinaryAnnotation; -import org.eclipse.jpt.jpa.core.resource.java.JavaResourcePersistentType; -import org.eclipse.jpt.jpa.eclipselink.core.resource.java.EclipseLink; -import org.eclipse.jpt.jpa.eclipselink.core.resource.java.EclipseLinkCustomizerAnnotation; - -/** - * org.eclipse.persistence.annotations.Customizer - */ -public final class BinaryEclipseLinkCustomizerAnnotation - extends BinaryAnnotation - implements EclipseLinkCustomizerAnnotation -{ - private String value; - - - public BinaryEclipseLinkCustomizerAnnotation(JavaResourcePersistentType 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(CompilationUnit astRoot) { - 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 659e886ec6..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,72 +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.resource.java.binary; - -import org.eclipse.jdt.core.IAnnotation; -import org.eclipse.jdt.core.dom.CompilationUnit; -import org.eclipse.jpt.common.core.utility.TextRange; -import org.eclipse.jpt.jpa.core.internal.resource.java.binary.BinaryAnnotation; -import org.eclipse.jpt.jpa.core.resource.java.JavaResourcePersistentType; -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; - -/** - * org.eclipse.persistence.annotations.ExistenceChecking - */ -public final class BinaryEclipseLinkExistenceCheckingAnnotation - extends BinaryAnnotation - implements EclipseLinkExistenceCheckingAnnotation -{ - private ExistenceType value; - - - public BinaryEclipseLinkExistenceCheckingAnnotation(JavaResourcePersistentType 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(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/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 206d9cbfea..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,72 +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.resource.java.binary; - -import org.eclipse.jdt.core.IAnnotation; -import org.eclipse.jdt.core.dom.CompilationUnit; -import org.eclipse.jpt.common.core.utility.TextRange; -import org.eclipse.jpt.jpa.core.internal.resource.java.binary.BinaryAnnotation; -import org.eclipse.jpt.jpa.core.resource.java.JavaResourcePersistentAttribute; -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; - -/** - * org.eclipse.persistence.annotations.JoinFetch - */ -public final class BinaryEclipseLinkJoinFetchAnnotation - extends BinaryAnnotation - implements EclipseLinkJoinFetchAnnotation -{ - private JoinFetchType value; - - - public BinaryEclipseLinkJoinFetchAnnotation(JavaResourcePersistentAttribute 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(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 8fc629e086..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,71 +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.resource.java.binary; - -import org.eclipse.jdt.core.IAnnotation; -import org.eclipse.jdt.core.dom.CompilationUnit; -import org.eclipse.jpt.common.core.utility.TextRange; -import org.eclipse.jpt.jpa.core.internal.resource.java.binary.BinaryAnnotation; -import org.eclipse.jpt.jpa.core.resource.java.JavaResourcePersistentAttribute; -import org.eclipse.jpt.jpa.eclipselink.core.resource.java.EclipseLink; -import org.eclipse.jpt.jpa.eclipselink.core.resource.java.EclipseLinkMutableAnnotation; - -/** - * org.eclipse.persistence.annotations.Mutable - */ -public final class BinaryEclipseLinkMutableAnnotation - extends BinaryAnnotation - implements EclipseLinkMutableAnnotation -{ - private Boolean value; - - - public BinaryEclipseLinkMutableAnnotation(JavaResourcePersistentAttribute 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(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/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 0f6e7351f7..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,75 +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.resource.java.binary; - -import org.eclipse.jdt.core.IAnnotation; -import org.eclipse.jdt.core.dom.CompilationUnit; -import org.eclipse.jpt.common.core.utility.TextRange; -import org.eclipse.jpt.jpa.core.internal.resource.java.binary.BinaryAnnotation; -import org.eclipse.jpt.jpa.core.resource.java.JavaResourcePersistentMember; -import org.eclipse.jpt.jpa.eclipselink.core.resource.java.EclipseLinkNamedConverterAnnotation; - -/** - * org.eclipse.persistence.annotations.Converter - * org.eclipse.persistence.annotations.StructConverter - * org.eclipse.persistence.annotations.TypeConverter - * org.eclipse.persistence.annotations.ObjectTypeConverter - */ -abstract class BinaryEclipseLinkNamedConverterAnnotation - extends BinaryAnnotation - implements EclipseLinkNamedConverterAnnotation -{ - String name; - - BinaryEclipseLinkNamedConverterAnnotation(JavaResourcePersistentMember 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(CompilationUnit astRoot) { - 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 fa97d872a5..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,140 +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.resource.java.binary; - -import java.util.ListIterator; -import java.util.Vector; - -import org.eclipse.jdt.core.IAnnotation; -import org.eclipse.jdt.core.dom.CompilationUnit; -import org.eclipse.jpt.common.core.utility.TextRange; -import org.eclipse.jpt.common.utility.internal.iterators.CloneListIterator; -import org.eclipse.jpt.jpa.core.resource.java.JavaResourcePersistentMember; -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; - -/** - * org.eclipse.persistence.annotations.ObjectTypeConverter - */ -public final class BinaryEclipseLinkObjectTypeConverterAnnotation - extends BinaryBaseEclipseLinkTypeConverterAnnotation - implements EclipseLinkObjectTypeConverterAnnotation -{ - private String defaultObjectValue; - private final Vector<EclipseLinkConversionValueAnnotation> conversionValues; - - - public BinaryEclipseLinkObjectTypeConverterAnnotation(JavaResourcePersistentMember 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(CompilationUnit astRoot) { - throw new UnsupportedOperationException(); - } - - // ***** conversion values - public ListIterator<EclipseLinkConversionValueAnnotation> conversionValues() { - return new CloneListIterator<EclipseLinkConversionValueAnnotation>(this.conversionValues); - } - - public int conversionValuesSize() { - return this.conversionValues.size(); - } - - public EclipseLinkConversionValueAnnotation conversionValueAt(int index) { - return this.conversionValues.get(index); - } - - public int indexOfConversionValue(EclipseLinkConversionValueAnnotation conversionValue) { - return this.conversionValues.indexOf(conversionValue); - } - - 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 7938d291e7..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 Oracle. - * All rights reserved. This program and the accompanying materials are - * made available under the terms of the Eclipse Public License v1.0 which - * accompanies this distribution, and is 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.jpa.core.internal.resource.java.binary.BinaryAnnotation; -import org.eclipse.jpt.jpa.core.resource.java.JavaResourcePersistentType; -import org.eclipse.jpt.jpa.eclipselink.core.resource.java.EclipseLinkPrimaryKeyAnnotation; - -/** - * org.eclipse.persistence.annotations.PrimaryKey - */ -public class BinaryEclipseLinkPrimaryKeyAnnotation - extends BinaryAnnotation - implements EclipseLinkPrimaryKeyAnnotation -{ - public BinaryEclipseLinkPrimaryKeyAnnotation(JavaResourcePersistentType 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 e7d4ea2416..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 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is 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.jpa.core.internal.resource.java.binary.BinaryAnnotation; -import org.eclipse.jpt.jpa.core.resource.java.JavaResourcePersistentAttribute; -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(JavaResourcePersistentAttribute 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 f60cd10575..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 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is 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.jpa.core.internal.resource.java.binary.BinaryAnnotation; -import org.eclipse.jpt.jpa.core.resource.java.JavaResourcePersistentType; -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(JavaResourcePersistentType 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 f67de78a79..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 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is 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.jpa.core.resource.java.JavaResourcePersistentAttribute; -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(JavaResourcePersistentAttribute 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 2622f9201d..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,78 +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.resource.java.binary; - -import org.eclipse.jdt.core.IAnnotation; -import org.eclipse.jdt.core.dom.CompilationUnit; -import org.eclipse.jpt.common.core.utility.TextRange; -import org.eclipse.jpt.jpa.core.resource.java.JavaResourcePersistentMember; -import org.eclipse.jpt.jpa.eclipselink.core.resource.java.EclipseLink; -import org.eclipse.jpt.jpa.eclipselink.core.resource.java.EclipseLinkStructConverterAnnotation; - -/** - * org.eclipse.persistence.annotations.StructConverter - */ -public final class BinaryEclipseLinkStructConverterAnnotation - extends BinaryEclipseLinkNamedConverterAnnotation - implements EclipseLinkStructConverterAnnotation -{ - private String converter; - - - public BinaryEclipseLinkStructConverterAnnotation(JavaResourcePersistentMember 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(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/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 ab1def9d03..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,149 +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.resource.java.binary; - -import org.eclipse.jdt.core.IAnnotation; -import org.eclipse.jdt.core.dom.CompilationUnit; -import org.eclipse.jpt.common.core.utility.TextRange; -import org.eclipse.jpt.jpa.core.internal.resource.java.binary.BinaryAnnotation; -import org.eclipse.jpt.jpa.core.resource.java.JavaResourceNode; -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 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(CompilationUnit astRoot) { - 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(CompilationUnit astRoot) { - 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(CompilationUnit astRoot) { - 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(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/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 f65b3c4c90..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,98 +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.resource.java.binary; - -import org.eclipse.jdt.core.IAnnotation; -import org.eclipse.jdt.core.dom.CompilationUnit; -import org.eclipse.jpt.common.core.utility.TextRange; -import org.eclipse.jpt.jpa.core.internal.resource.java.binary.BinaryAnnotation; -import org.eclipse.jpt.jpa.core.resource.java.FetchType; -import org.eclipse.jpt.jpa.core.resource.java.JavaResourcePersistentAttribute; -import org.eclipse.jpt.jpa.eclipselink.core.resource.java.EclipseLink; -import org.eclipse.jpt.jpa.eclipselink.core.resource.java.EclipseLinkTransformationAnnotation; - -/** - * org.eclipse.persistence.annotations.Transformation - */ -public class BinaryEclipseLinkTransformationAnnotation - extends BinaryAnnotation - implements EclipseLinkTransformationAnnotation -{ - private FetchType fetch; - private Boolean optional; - - - public BinaryEclipseLinkTransformationAnnotation(JavaResourcePersistentAttribute 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(CompilationUnit astRoot) { - 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(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/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 109a8d4d46..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 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is 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.utility.TextRange; -import org.eclipse.jpt.jpa.core.internal.resource.java.binary.BinaryAnnotation; -import org.eclipse.jpt.jpa.core.resource.java.JavaResourcePersistentAttribute; -import org.eclipse.jpt.jpa.eclipselink.core.resource.java.EclipseLinkTransformerAnnotation; - -/** - * org.eclipse.persistence.annotations.ReadTransformer - * org.eclipse.persistence.annotations.WriteTransformer - */ -abstract class BinaryEclipseLinkTransformerAnnotation - extends BinaryAnnotation - implements EclipseLinkTransformerAnnotation -{ - private String transformerClass; - private String method; - - - BinaryEclipseLinkTransformerAnnotation(JavaResourcePersistentAttribute 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(CompilationUnit astRoot) { - 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(CompilationUnit astRoot) { - 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 4e417dffb3..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,53 +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.resource.java.binary; - -import org.eclipse.jdt.core.IAnnotation; -import org.eclipse.jpt.jpa.core.resource.java.JavaResourcePersistentMember; -import org.eclipse.jpt.jpa.eclipselink.core.resource.java.EclipseLink; -import org.eclipse.jpt.jpa.eclipselink.core.resource.java.EclipseLinkTypeConverterAnnotation; - -/** - * org.eclipse.persistence.annotations.TypeConverter - */ -public final class BinaryEclipseLinkTypeConverterAnnotation - extends BinaryBaseEclipseLinkTypeConverterAnnotation - implements EclipseLinkTypeConverterAnnotation -{ - public BinaryEclipseLinkTypeConverterAnnotation(JavaResourcePersistentMember 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 8407a8ae67..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 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is 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.jpa.core.internal.resource.java.binary.BinaryAnnotation; -import org.eclipse.jpt.jpa.core.resource.java.JavaResourcePersistentAttribute; -import org.eclipse.jpt.jpa.eclipselink.core.resource.java.EclipseLinkVariableOneToOneAnnotation; - -/** - * org.eclipse.persistence.annotations.VariableOneToOne - */ -public class BinaryEclipseLinkVariableOneToOneAnnotation - extends BinaryAnnotation - implements EclipseLinkVariableOneToOneAnnotation -{ - public BinaryEclipseLinkVariableOneToOneAnnotation(JavaResourcePersistentAttribute 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 508ca3ddbb..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,124 +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.resource.java.binary; - -import org.eclipse.jdt.core.IAnnotation; -import org.eclipse.jdt.core.dom.CompilationUnit; -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.core.resource.java.JavaResourcePersistentAttribute; -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; - -/** - * org.eclipse.persistence.annotations.ReadTransformer - */ -public class BinaryEclipseLinkWriteTransformerAnnotation - extends BinaryEclipseLinkTransformerAnnotation - implements EclipseLinkWriteTransformerAnnotation -{ - private ColumnAnnotation column; - private final ColumnAnnotation nullColumn; - - - public BinaryEclipseLinkWriteTransformerAnnotation(JavaResourcePersistentAttribute 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(CompilationUnit astRoot) { - 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/SourceBaseEclipseLinkTypeConverterAnnotation.java b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/resource/java/source/SourceBaseEclipseLinkTypeConverterAnnotation.java deleted file mode 100644 index 2766cdde48..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/resource/java/source/SourceBaseEclipseLinkTypeConverterAnnotation.java +++ /dev/null @@ -1,199 +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.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.utility.TextRange; -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.Member; -import org.eclipse.jpt.jpa.core.resource.java.JavaResourcePersistentMember; -import org.eclipse.jpt.jpa.eclipselink.core.resource.java.BaseEclipseLinkTypeConverterAnnotation; - -/** - * org.eclipse.persistence.annotations.TypeConverter - * org.eclipse.persistence.annotations.ObjectTypeConverter - */ -abstract class SourceBaseEclipseLinkTypeConverterAnnotation - extends SourceEclipseLinkNamedConverterAnnotation - implements BaseEclipseLinkTypeConverterAnnotation -{ - final DeclarationAnnotationElementAdapter<String> dataTypeDeclarationAdapter; - final AnnotationElementAdapter<String> dataTypeAdapter; - String dataType; - - /** - * @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; - - /** - * @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; - - - SourceBaseEclipseLinkTypeConverterAnnotation(JavaResourcePersistentMember parent, Member member, DeclarationAnnotationAdapter daa) { - super(parent, member, daa); - 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.objectType = this.buildObjectType(astRoot); - } - - @Override - public void synchronizeWith(CompilationUnit astRoot) { - super.synchronizeWith(astRoot); - this.syncDataType(this.buildDataType(astRoot)); - this.syncObjectType(this.buildObjectType(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(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(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 c245fce5ea..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, 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.source; - -import org.eclipse.jdt.core.dom.CompilationUnit; -import org.eclipse.jpt.common.core.internal.utility.jdt.SimpleDeclarationAnnotationAdapter; -import org.eclipse.jpt.common.core.utility.jdt.Attribute; -import org.eclipse.jpt.common.core.utility.jdt.DeclarationAnnotationAdapter; -import org.eclipse.jpt.jpa.core.internal.resource.java.source.SourceAnnotation; -import org.eclipse.jpt.jpa.core.resource.java.JavaResourcePersistentAttribute; -import org.eclipse.jpt.jpa.eclipselink.core.resource.java.EclipseLinkBasicCollectionAnnotation; - -/** - * org.eclipse.persistence.annotations.BasicCollection - */ -public final class SourceEclipseLinkBasicCollectionAnnotation - extends SourceAnnotation<Attribute> - implements EclipseLinkBasicCollectionAnnotation -{ - private static final DeclarationAnnotationAdapter DECLARATION_ANNOTATION_ADAPTER = new SimpleDeclarationAnnotationAdapter(ANNOTATION_NAME); - - - public SourceEclipseLinkBasicCollectionAnnotation(JavaResourcePersistentAttribute parent, Attribute attribute) { - super(parent, attribute, 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 3e8b6c3298..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, 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.source; - -import org.eclipse.jdt.core.dom.CompilationUnit; -import org.eclipse.jpt.common.core.internal.utility.jdt.SimpleDeclarationAnnotationAdapter; -import org.eclipse.jpt.common.core.utility.jdt.Attribute; -import org.eclipse.jpt.common.core.utility.jdt.DeclarationAnnotationAdapter; -import org.eclipse.jpt.jpa.core.internal.resource.java.source.SourceAnnotation; -import org.eclipse.jpt.jpa.core.resource.java.JavaResourcePersistentAttribute; -import org.eclipse.jpt.jpa.eclipselink.core.resource.java.EclipseLinkBasicMapAnnotation; - -/** - * org.eclipse.persistence.annotations.BasicMap - */ -public final class SourceEclipseLinkBasicMapAnnotation - extends SourceAnnotation<Attribute> - implements EclipseLinkBasicMapAnnotation -{ - private static final DeclarationAnnotationAdapter DECLARATION_ANNOTATION_ADAPTER = new SimpleDeclarationAnnotationAdapter(ANNOTATION_NAME); - - - public SourceEclipseLinkBasicMapAnnotation(JavaResourcePersistentAttribute parent, Attribute attribute) { - super(parent, attribute, 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 9162cd97aa..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,448 +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.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.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.utility.TextRange; -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.Type; -import org.eclipse.jpt.jpa.core.internal.resource.java.source.SourceAnnotation; -import org.eclipse.jpt.jpa.core.resource.java.JavaResourcePersistentType; -import org.eclipse.jpt.jpa.eclipselink.core.resource.java.CacheCoordinationType; -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; - -/** - * org.eclipse.persistence.annotations.Cache - */ -public final class SourceEclipseLinkCacheAnnotation - extends SourceAnnotation<Type> - 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 static final DeclarationAnnotationElementAdapter<Integer> SIZE_ADAPTER = buildSizeAdapter(); - private final AnnotationElementAdapter<Integer> sizeAdapter; - private Integer size; - - private static final DeclarationAnnotationElementAdapter<Boolean> SHARED_ADAPTER = buildSharedAdapter(); - private final AnnotationElementAdapter<Boolean> sharedAdapter; - private Boolean shared; - - private static final DeclarationAnnotationElementAdapter<Boolean> ALWAYS_REFRESH_ADAPTER = buildAlwaysRefreshAdapter(); - private final AnnotationElementAdapter<Boolean> alwaysRefreshAdapter; - private Boolean alwaysRefresh; - - private static final DeclarationAnnotationElementAdapter<Boolean> REFRESH_ONLY_IF_NEWER_ADAPTER = buildRefreshOnlyIfNewerAdapter(); - private final AnnotationElementAdapter<Boolean> refreshOnlyIfNewerAdapter; - private Boolean refreshOnlyIfNewer; - - private static final DeclarationAnnotationElementAdapter<Boolean> DISABLE_HITS_ADAPTER = buildDisableHitsAdapter(); - private final AnnotationElementAdapter<Boolean> disableHitsAdapter; - private Boolean disableHits; - - private static final DeclarationAnnotationElementAdapter<String> COORDINATION_TYPE_ADAPTER = buildCoordinationTypeAdapter(); - private final AnnotationElementAdapter<String> coordinationTypeAdapter; - private CacheCoordinationType coordinationType; - - private static final DeclarationAnnotationElementAdapter<Integer> EXPIRY_ADAPTER = buildExpiryAdapter(); - private final AnnotationElementAdapter<Integer> expiryAdapter; - private Integer expiry; - - private static final NestedDeclarationAnnotationAdapter EXPIRY_TIME_OF_DAY_ADAPTER = buildExpiryTimeOfDayAdapter(); - private final ElementAnnotationAdapter expiryTimeOfDayAdapter; - private EclipseLinkTimeOfDayAnnotation expiryTimeOfDay; - - - public SourceEclipseLinkCacheAnnotation(JavaResourcePersistentType parent, Type type) { - super(parent, type, DECLARATION_ANNOTATION_ADAPTER); - this.typeAdapter = new AnnotatedElementAnnotationElementAdapter<String>(type, TYPE_ADAPTER); - this.sizeAdapter = new AnnotatedElementAnnotationElementAdapter<Integer>(type, SIZE_ADAPTER); - this.sharedAdapter = new AnnotatedElementAnnotationElementAdapter<Boolean>(type, SHARED_ADAPTER); - this.alwaysRefreshAdapter = new AnnotatedElementAnnotationElementAdapter<Boolean>(type, ALWAYS_REFRESH_ADAPTER); - this.refreshOnlyIfNewerAdapter = new AnnotatedElementAnnotationElementAdapter<Boolean>(type, REFRESH_ONLY_IF_NEWER_ADAPTER); - this.disableHitsAdapter = new AnnotatedElementAnnotationElementAdapter<Boolean>(type, DISABLE_HITS_ADAPTER); - this.coordinationTypeAdapter = new AnnotatedElementAnnotationElementAdapter<String>(type, COORDINATION_TYPE_ADAPTER); - this.expiryAdapter = new AnnotatedElementAnnotationElementAdapter<Integer>(type, EXPIRY_ADAPTER); - this.expiryTimeOfDayAdapter = new ElementAnnotationAdapter(type, EXPIRY_TIME_OF_DAY_ADAPTER); - } - - public String getAnnotationName() { - return ANNOTATION_NAME; - } - - public void initialize(CompilationUnit astRoot) { - this.type = this.buildType(astRoot); - this.size = this.buildSize(astRoot); - this.shared = this.buildShared(astRoot); - this.alwaysRefresh = this.buildAlwaysRefresh(astRoot); - this.refreshOnlyIfNewer = this.buildRefreshOnlyIfNewer(astRoot); - this.disableHits = this.buildDisableHits(astRoot); - this.coordinationType = this.buildCoordinationType(astRoot); - this.expiry = this.buildExpiry(astRoot); - this.initializeExpiryTimeOfDay(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.syncSize(this.buildSize(astRoot)); - this.syncShared(this.buildShared(astRoot)); - this.syncAlwaysRefresh(this.buildAlwaysRefresh(astRoot)); - this.syncRefreshOnlyIfNewer(this.buildRefreshOnlyIfNewer(astRoot)); - this.syncDisableHits(this.buildDisableHits(astRoot)); - this.syncCoordinationType(this.buildCoordinationType(astRoot)); - this.syncExpiry(this.buildExpiry(astRoot)); - this.syncExpiryTimeOfDay(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); - } - - @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(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(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(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(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(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 getDisablesHitsTextRange(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(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(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(CompilationUnit astRoot) { - return this.getTextRange(this.expiryTimeOfDayAdapter.getAstNode(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); - } - -} 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 a70a592954..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,105 +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.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.EnumDeclarationAnnotationElementAdapter; -import org.eclipse.jpt.common.core.internal.utility.jdt.SimpleDeclarationAnnotationAdapter; -import org.eclipse.jpt.common.core.utility.TextRange; -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.Type; -import org.eclipse.jpt.jpa.core.internal.resource.java.source.SourceAnnotation; -import org.eclipse.jpt.jpa.core.resource.java.JavaResourcePersistentType; -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; - -/** - * org.eclipse.persistence.annotations.ChangeTracking - */ -public final class SourceEclipseLinkChangeTrackingAnnotation - extends SourceAnnotation<Type> - 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; - - - public SourceEclipseLinkChangeTrackingAnnotation(JavaResourcePersistentType parent, Type type) { - super(parent, type, DECLARATION_ANNOTATION_ADAPTER); - this.valueAdapter = new AnnotatedElementAnnotationElementAdapter<String>(type, 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); - } - - - // ********** 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(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/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 7e32b6dfbf..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,196 +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.resource.java.source; - -import java.util.Map; -import org.eclipse.jdt.core.dom.CompilationUnit; -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.utility.TextRange; -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.IndexedDeclarationAnnotationAdapter; -import org.eclipse.jpt.common.core.utility.jdt.Member; -import org.eclipse.jpt.jpa.core.internal.resource.java.source.SourceAnnotation; -import org.eclipse.jpt.jpa.eclipselink.core.resource.java.EclipseLink; -import org.eclipse.jpt.jpa.eclipselink.core.resource.java.EclipseLinkObjectTypeConverterAnnotation; -import org.eclipse.jpt.jpa.eclipselink.core.resource.java.NestableEclipseLinkConversionValueAnnotation; - -/** - * <code>org.eclipse.persistence.annotations.ConversionValue</code> - */ -final class SourceEclipseLinkConversionValueAnnotation - extends SourceAnnotation<Member> - implements NestableEclipseLinkConversionValueAnnotation -{ - private DeclarationAnnotationElementAdapter<String> dataValueDeclarationAdapter; - private AnnotationElementAdapter<String> dataValueAdapter; - private String dataValue; - - private DeclarationAnnotationElementAdapter<String> objectValueDeclarationAdapter; - private AnnotationElementAdapter<String> objectValueAdapter; - private String objectValue; - - - SourceEclipseLinkConversionValueAnnotation(EclipseLinkObjectTypeConverterAnnotation parent, Member member, IndexedDeclarationAnnotationAdapter idaa) { - super(parent, member, idaa, new ElementIndexedAnnotationAdapter(member, 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.objectValue = this.buildObjectValue(astRoot); - } - - public void synchronizeWith(CompilationUnit astRoot) { - this.syncDataValue(this.buildDataValue(astRoot)); - this.syncObjectValue(this.buildObjectValue(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(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(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); - } - - - //************ NestableAnnotation implementation - - public void moveAnnotation(int newIndex) { - this.getIndexedAnnotationAdapter().moveAnnotation(newIndex); - } - - - // ********** misc ********** - - @Override - public boolean isUnset() { - return super.isUnset() && - (this.dataValue == null) && - (this.objectValue == null); - } - - @Override - protected void rebuildAdapters() { - super.rebuildAdapters(); - this.dataValueDeclarationAdapter = this.buildDataValueDeclarationAdapter(); - this.dataValueAdapter = this.buildDataValueAdapter(); - this.objectValueDeclarationAdapter = this.buildObjectValueDeclarationAdapter(); - this.objectValueAdapter = this.buildObjectValueAdapter(); - } - - @Override - public void storeOn(Map<String, Object> map) { - super.storeOn(map); - map.put(DATA_VALUE_PROPERTY, this.dataValue); - this.dataValue = null; - map.put(OBJECT_VALUE_PROPERTY, this.objectValue); - this.objectValue = null; - } - - @Override - public void restoreFrom(Map<String, Object> map) { - super.restoreFrom(map); - this.setDataValue((String) map.get(DATA_VALUE_PROPERTY)); - this.setObjectValue((String) map.get(OBJECT_VALUE_PROPERTY)); - } - - @Override - public void toString(StringBuilder sb) { - sb.append(this.dataValue); - sb.append("=>"); //$NON-NLS-1$ - sb.append(this.objectValue); - } - - - // ********** static methods ********** - - static NestableEclipseLinkConversionValueAnnotation createConversionValue(EclipseLinkObjectTypeConverterAnnotation parent, Member member, DeclarationAnnotationAdapter daa, int index) { - return new SourceEclipseLinkConversionValueAnnotation(parent, member, buildConversionValueAnnotationAdapter(daa, index)); - } - - private static IndexedDeclarationAnnotationAdapter buildConversionValueAnnotationAdapter(DeclarationAnnotationAdapter daa, int index) { - return new NestedIndexedDeclarationAnnotationAdapter(daa, EclipseLink.OBJECT_TYPE_CONVERTER__CONVERSION_VALUES, index, ANNOTATION_NAME); - } -} 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 81b5c90d4c..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,109 +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.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.ConversionDeclarationAnnotationElementAdapter; -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.utility.TextRange; -import org.eclipse.jpt.common.core.utility.jdt.AnnotationElementAdapter; -import org.eclipse.jpt.common.core.utility.jdt.Attribute; -import org.eclipse.jpt.common.core.utility.jdt.DeclarationAnnotationAdapter; -import org.eclipse.jpt.common.core.utility.jdt.DeclarationAnnotationElementAdapter; -import org.eclipse.jpt.jpa.core.internal.resource.java.source.SourceAnnotation; -import org.eclipse.jpt.jpa.core.resource.java.JavaResourcePersistentAttribute; -import org.eclipse.jpt.jpa.eclipselink.core.resource.java.EclipseLink; -import org.eclipse.jpt.jpa.eclipselink.core.resource.java.EclipseLinkConvertAnnotation; - -/** - * org.eclipse.persistence.annotations.Convert - */ -public final class SourceEclipseLinkConvertAnnotation - extends SourceAnnotation<Attribute> - implements EclipseLinkConvertAnnotation -{ - 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; - - - public SourceEclipseLinkConvertAnnotation(JavaResourcePersistentAttribute parent, Attribute attribute) { - super(parent, attribute, DECLARATION_ANNOTATION_ADAPTER); - this.valueAdapter = new AnnotatedElementAnnotationElementAdapter<String>(attribute, 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); - } - - - // ********** 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(CompilationUnit astRoot) { - return this.getElementTextRange(VALUE_ADAPTER, astRoot); - } - - public boolean valueTouches(int pos, CompilationUnit astRoot) { - return this.elementTouches(VALUE_ADAPTER, pos, astRoot); - } - - - // ********** static methods ********** - - private static DeclarationAnnotationElementAdapter<String> buildValueAdapter() { - return new ConversionDeclarationAnnotationElementAdapter<String>(DECLARATION_ANNOTATION_ADAPTER, EclipseLink.CONVERT__VALUE, StringExpressionConverter.instance()); - } - -} 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 21621ab867..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,148 +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.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.SimpleDeclarationAnnotationAdapter; -import org.eclipse.jpt.common.core.internal.utility.jdt.SimpleTypeStringExpressionConverter; -import org.eclipse.jpt.common.core.utility.TextRange; -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.Member; -import org.eclipse.jpt.jpa.core.resource.java.JavaResourcePersistentMember; -import org.eclipse.jpt.jpa.eclipselink.core.resource.java.EclipseLink; -import org.eclipse.jpt.jpa.eclipselink.core.resource.java.EclipseLinkConverterAnnotation; - -/** - * org.eclipse.persistence.annotations.Converter - */ -public final class SourceEclipseLinkConverterAnnotation - extends SourceEclipseLinkNamedConverterAnnotation - implements EclipseLinkConverterAnnotation -{ - private static final DeclarationAnnotationAdapter DECLARATION_ANNOTATION_ADAPTER = new SimpleDeclarationAnnotationAdapter(ANNOTATION_NAME); - - private static final DeclarationAnnotationElementAdapter<String> CONVERTER_CLASS_ADAPTER = buildConverterClassAdapter(); - private final AnnotationElementAdapter<String> converterClassAdapter; - private String converterClass; - - /** - * @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 SourceEclipseLinkConverterAnnotation(JavaResourcePersistentMember parent, Member member) { - super(parent, member, DECLARATION_ANNOTATION_ADAPTER); - this.converterClassAdapter = new AnnotatedElementAnnotationElementAdapter<String>(member, CONVERTER_CLASS_ADAPTER); - } - - public String getAnnotationName() { - return ANNOTATION_NAME; - } - - @Override - public void initialize(CompilationUnit astRoot) { - super.initialize(astRoot); - this.converterClass = this.buildConverterClass(astRoot); - } - - @Override - public void synchronizeWith(CompilationUnit astRoot) { - super.synchronizeWith(astRoot); - this.syncConverterClass(this.buildConverterClass(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(CompilationUnit astRoot) { - return this.getElementTextRange(CONVERTER_CLASS_ADAPTER, astRoot); - } - - 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 DeclarationAnnotationElementAdapter<String> buildConverterClassAdapter() { - return new ConversionDeclarationAnnotationElementAdapter<String>(DECLARATION_ANNOTATION_ADAPTER, EclipseLink.CONVERTER__CONVERTER_CLASS, SimpleTypeStringExpressionConverter.instance()); - } - -} 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 7c27c900f1..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,144 +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.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.SimpleDeclarationAnnotationAdapter; -import org.eclipse.jpt.common.core.internal.utility.jdt.SimpleTypeStringExpressionConverter; -import org.eclipse.jpt.common.core.utility.TextRange; -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.Type; -import org.eclipse.jpt.jpa.core.internal.resource.java.source.SourceAnnotation; -import org.eclipse.jpt.jpa.core.resource.java.JavaResourcePersistentType; -import org.eclipse.jpt.jpa.eclipselink.core.resource.java.EclipseLink; -import org.eclipse.jpt.jpa.eclipselink.core.resource.java.EclipseLinkCustomizerAnnotation; - -/** - * org.eclipse.persistence.annotations.Customizer - */ -public final class SourceEclipseLinkCustomizerAnnotation - extends SourceAnnotation<Type> - 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; - - /** - * @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(JavaResourcePersistentType parent, Type type) { - super(parent, type, DECLARATION_ANNOTATION_ADAPTER); - this.valueAdapter = new AnnotatedElementAnnotationElementAdapter<String>(type, 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); - } - - - // ********** 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(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 43f6d3e158..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,105 +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.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.EnumDeclarationAnnotationElementAdapter; -import org.eclipse.jpt.common.core.internal.utility.jdt.SimpleDeclarationAnnotationAdapter; -import org.eclipse.jpt.common.core.utility.TextRange; -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.Type; -import org.eclipse.jpt.jpa.core.internal.resource.java.source.SourceAnnotation; -import org.eclipse.jpt.jpa.core.resource.java.JavaResourcePersistentType; -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; - -/** - * org.eclipse.persistence.annotations.ExistenceChecking - */ -public final class SourceEclipseLinkExistenceCheckingAnnotation - extends SourceAnnotation<Type> - 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; - - - public SourceEclipseLinkExistenceCheckingAnnotation(JavaResourcePersistentType parent, Type type) { - super(parent, type, DECLARATION_ANNOTATION_ADAPTER); - this.valueAdapter = new AnnotatedElementAnnotationElementAdapter<String>(type, 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); - } - - - // ********** 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(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 adc9b53f4e..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,105 +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.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.EnumDeclarationAnnotationElementAdapter; -import org.eclipse.jpt.common.core.internal.utility.jdt.SimpleDeclarationAnnotationAdapter; -import org.eclipse.jpt.common.core.utility.TextRange; -import org.eclipse.jpt.common.core.utility.jdt.AnnotationElementAdapter; -import org.eclipse.jpt.common.core.utility.jdt.Attribute; -import org.eclipse.jpt.common.core.utility.jdt.DeclarationAnnotationAdapter; -import org.eclipse.jpt.common.core.utility.jdt.DeclarationAnnotationElementAdapter; -import org.eclipse.jpt.jpa.core.internal.resource.java.source.SourceAnnotation; -import org.eclipse.jpt.jpa.core.resource.java.JavaResourcePersistentAttribute; -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; - -/** - * org.eclipse.persistence.annotations.JoinFetch - */ -public final class SourceEclipseLinkJoinFetchAnnotation - extends SourceAnnotation<Attribute> - 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; - - - public SourceEclipseLinkJoinFetchAnnotation(JavaResourcePersistentAttribute parent, Attribute attribute) { - super(parent, attribute, DECLARATION_ANNOTATION_ADAPTER); - this.valueAdapter = new AnnotatedElementAnnotationElementAdapter<String>(attribute, 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); - } - - - // ********** 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(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/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 931e3d50f4..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,105 +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.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.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.utility.TextRange; -import org.eclipse.jpt.common.core.utility.jdt.AnnotationElementAdapter; -import org.eclipse.jpt.common.core.utility.jdt.Attribute; -import org.eclipse.jpt.common.core.utility.jdt.DeclarationAnnotationAdapter; -import org.eclipse.jpt.common.core.utility.jdt.DeclarationAnnotationElementAdapter; -import org.eclipse.jpt.jpa.core.internal.resource.java.source.SourceAnnotation; -import org.eclipse.jpt.jpa.core.resource.java.JavaResourcePersistentAttribute; -import org.eclipse.jpt.jpa.eclipselink.core.resource.java.EclipseLink; -import org.eclipse.jpt.jpa.eclipselink.core.resource.java.EclipseLinkMutableAnnotation; - -/** - * org.eclipse.persistence.annotations.Mutable - */ -public final class SourceEclipseLinkMutableAnnotation - extends SourceAnnotation<Attribute> - 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; - - - public SourceEclipseLinkMutableAnnotation(JavaResourcePersistentAttribute parent, Attribute attribute) { - super(parent, attribute, DECLARATION_ANNOTATION_ADAPTER); - this.valueAdapter = new AnnotatedElementAnnotationElementAdapter<Boolean>(attribute, 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); - } - - - // ********** 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(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 d5dce61a30..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,102 +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.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.ConversionDeclarationAnnotationElementAdapter; -import org.eclipse.jpt.common.core.utility.TextRange; -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.Member; -import org.eclipse.jpt.jpa.core.internal.resource.java.source.SourceAnnotation; -import org.eclipse.jpt.jpa.core.resource.java.JavaResourceNode; -import org.eclipse.jpt.jpa.core.resource.java.OverrideAnnotation; -import org.eclipse.jpt.jpa.eclipselink.core.resource.java.EclipseLinkNamedConverterAnnotation; - -/** - * org.eclipse.persistence.annotations.Converter - * org.eclipse.persistence.annotations.StructConverter - * org.eclipse.persistence.annotations.TypeConverter - * org.eclipse.persistence.annotations.ObjectTypeConverter - */ -abstract class SourceEclipseLinkNamedConverterAnnotation - extends SourceAnnotation<Member> - implements EclipseLinkNamedConverterAnnotation -{ - final DeclarationAnnotationElementAdapter<String> nameDeclarationAdapter; - final AnnotationElementAdapter<String> nameAdapter; - String name; - - - // ********** construction/initialization ********** - - SourceEclipseLinkNamedConverterAnnotation(JavaResourceNode parent, Member member, DeclarationAnnotationAdapter daa) { - super(parent, member, daa); - 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); - } - - public void synchronizeWith(CompilationUnit astRoot) { - this.syncName(this.buildName(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(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 e5f5cad4cb..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,269 +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.resource.java.source; - -import java.util.ListIterator; -import java.util.Vector; - -import org.eclipse.jdt.core.dom.Annotation; -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.ConversionDeclarationAnnotationElementAdapter; -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.utility.TextRange; -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.Member; -import org.eclipse.jpt.common.utility.internal.CollectionTools; -import org.eclipse.jpt.common.utility.internal.StringTools; -import org.eclipse.jpt.common.utility.internal.iterables.LiveCloneIterable; -import org.eclipse.jpt.common.utility.internal.iterators.CloneListIterator; -import org.eclipse.jpt.jpa.core.internal.resource.java.source.AnnotationContainerTools; -import org.eclipse.jpt.jpa.core.resource.java.AnnotationContainer; -import org.eclipse.jpt.jpa.core.resource.java.JavaResourcePersistentMember; -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; -import org.eclipse.jpt.jpa.eclipselink.core.resource.java.NestableEclipseLinkConversionValueAnnotation; - -/** - * org.eclipse.persistence.annotations.ObjectTypeConverter - */ -public final class SourceEclipseLinkObjectTypeConverterAnnotation - extends SourceBaseEclipseLinkTypeConverterAnnotation - implements EclipseLinkObjectTypeConverterAnnotation -{ - private static final DeclarationAnnotationAdapter DECLARATION_ANNOTATION_ADAPTER = new SimpleDeclarationAnnotationAdapter(ANNOTATION_NAME); - - private static final DeclarationAnnotationElementAdapter<String> DEFAULT_OBJECT_VALUE_ADAPTER = buildDefaultObjectValueAdapter(); - private final AnnotationElementAdapter<String> defaultObjectValueAdapter; - private String defaultObjectValue; - - private final Vector<NestableEclipseLinkConversionValueAnnotation> conversionValues = new Vector<NestableEclipseLinkConversionValueAnnotation>(); - private final ConversionValuesAnnotationContainer conversionValuesContainer = new ConversionValuesAnnotationContainer(); - - - public SourceEclipseLinkObjectTypeConverterAnnotation(JavaResourcePersistentMember parent, Member member) { - super(parent, member, DECLARATION_ANNOTATION_ADAPTER); - this.defaultObjectValueAdapter = new AnnotatedElementAnnotationElementAdapter<String>(member, DEFAULT_OBJECT_VALUE_ADAPTER); - } - - public String getAnnotationName() { - return ANNOTATION_NAME; - } - - @Override - public void initialize(CompilationUnit astRoot) { - super.initialize(astRoot); - this.defaultObjectValue = this.buildDefaultObjectValue(astRoot); - AnnotationContainerTools.initialize(this.conversionValuesContainer, astRoot); - } - - @Override - public void synchronizeWith(CompilationUnit astRoot) { - super.synchronizeWith(astRoot); - this.syncDefaultObjectValue(this.buildDefaultObjectValue(astRoot)); - AnnotationContainerTools.synchronize(this.conversionValuesContainer, astRoot); - } - - @Override - public boolean isUnset() { - return super.isUnset() && - (this.defaultObjectValue == null) && - this.conversionValues.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(CompilationUnit astRoot) { - return this.getElementTextRange(DEFAULT_OBJECT_VALUE_ADAPTER, astRoot); - } - - // ***** conversion values - public ListIterator<EclipseLinkConversionValueAnnotation> conversionValues() { - return new CloneListIterator<EclipseLinkConversionValueAnnotation>(this.conversionValues); - } - - Iterable<NestableEclipseLinkConversionValueAnnotation> getNestableConversionValues() { - return new LiveCloneIterable<NestableEclipseLinkConversionValueAnnotation>(this.conversionValues); - } - - public int conversionValuesSize() { - return this.conversionValues.size(); - } - - public NestableEclipseLinkConversionValueAnnotation conversionValueAt(int index) { - return this.conversionValues.get(index); - } - - public int indexOfConversionValue(EclipseLinkConversionValueAnnotation conversionValue) { - return this.conversionValues.indexOf(conversionValue); - } - - public NestableEclipseLinkConversionValueAnnotation addConversionValue(int index) { - return (NestableEclipseLinkConversionValueAnnotation) AnnotationContainerTools.addNestedAnnotation(index, this.conversionValuesContainer); - } - - NestableEclipseLinkConversionValueAnnotation addConversionValue_() { - return this.addConversionValue_(this.conversionValues.size()); - } - - private NestableEclipseLinkConversionValueAnnotation addConversionValue_(int index) { - NestableEclipseLinkConversionValueAnnotation conversionValue = this.buildConversionValue(index); - this.conversionValues.add(index, conversionValue); - return conversionValue; - } - - void syncAddConversionValue(org.eclipse.jdt.core.dom.Annotation astAnnotation) { - int index = this.conversionValues.size(); - NestableEclipseLinkConversionValueAnnotation conversionValue = this.addConversionValue_(index); - conversionValue.initialize((CompilationUnit) astAnnotation.getRoot()); - this.fireItemAdded(CONVERSION_VALUES_LIST, index, conversionValue); - } - - private NestableEclipseLinkConversionValueAnnotation buildConversionValue(int index) { - return SourceEclipseLinkConversionValueAnnotation.createConversionValue(this, this.annotatedElement, this.daa, index); - } - - void conversionValueAdded(int index, NestableEclipseLinkConversionValueAnnotation conversionValue) { - this.fireItemAdded(CONVERSION_VALUES_LIST, index, conversionValue); - } - - public void moveConversionValue(int targetIndex, int sourceIndex) { - AnnotationContainerTools.moveNestedAnnotation(targetIndex, sourceIndex, this.conversionValuesContainer); - } - - NestableEclipseLinkConversionValueAnnotation moveConversionValue_(int targetIndex, int sourceIndex) { - return CollectionTools.move(this.conversionValues, targetIndex, sourceIndex).get(targetIndex); - } - - public void removeConversionValue(int index) { - AnnotationContainerTools.removeNestedAnnotation(index, this.conversionValuesContainer); - } - - NestableEclipseLinkConversionValueAnnotation removeConversionValue_(int index) { - return this.conversionValues.remove(index); - } - - void syncRemoveConversionValues(int index) { - this.removeItemsFromList(index, this.conversionValues, CONVERSION_VALUES_LIST); - } - - - // ********** static methods ********** - - private static DeclarationAnnotationElementAdapter<String> buildDefaultObjectValueAdapter() { - return new ConversionDeclarationAnnotationElementAdapter<String>(DECLARATION_ANNOTATION_ADAPTER, EclipseLink.OBJECT_TYPE_CONVERTER__DEFAULT_OBJECT_VALUE, StringExpressionConverter.instance()); - } - - - // ********** conversion value container ********** - - /** - * adapt the AnnotationContainer interface to the object type converter's - * conversion values - */ - class ConversionValuesAnnotationContainer - implements AnnotationContainer<NestableEclipseLinkConversionValueAnnotation> - { - public org.eclipse.jdt.core.dom.Annotation getAstAnnotation(CompilationUnit astRoot) { - return SourceEclipseLinkObjectTypeConverterAnnotation.this.getAstAnnotation(astRoot); - } - - public String getElementName() { - return EclipseLink.OBJECT_TYPE_CONVERTER__CONVERSION_VALUES; - } - - public String getNestedAnnotationName() { - return EclipseLinkConversionValueAnnotation.ANNOTATION_NAME; - } - - public Iterable<NestableEclipseLinkConversionValueAnnotation> getNestedAnnotations() { - return SourceEclipseLinkObjectTypeConverterAnnotation.this.getNestableConversionValues(); - } - - public int getNestedAnnotationsSize() { - return SourceEclipseLinkObjectTypeConverterAnnotation.this.conversionValuesSize(); - } - - public NestableEclipseLinkConversionValueAnnotation addNestedAnnotation() { - return SourceEclipseLinkObjectTypeConverterAnnotation.this.addConversionValue_(); - } - - public void syncAddNestedAnnotation(Annotation astAnnotation) { - SourceEclipseLinkObjectTypeConverterAnnotation.this.syncAddConversionValue(astAnnotation); - } - - public NestableEclipseLinkConversionValueAnnotation moveNestedAnnotation(int targetIndex, int sourceIndex) { - return SourceEclipseLinkObjectTypeConverterAnnotation.this.moveConversionValue_(targetIndex, sourceIndex); - } - - public NestableEclipseLinkConversionValueAnnotation removeNestedAnnotation(int index) { - return SourceEclipseLinkObjectTypeConverterAnnotation.this.removeConversionValue_(index); - } - - public void syncRemoveNestedAnnotations(int index) { - SourceEclipseLinkObjectTypeConverterAnnotation.this.syncRemoveConversionValues(index); - } - - @Override - public String toString() { - return StringTools.buildToStringFor(this); - } - - } - -} 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 027e704bf6..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 Oracle. - * All rights reserved. This program and the accompanying materials are - * made available under the terms of the Eclipse Public License v1.0 which - * accompanies this distribution, and is 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.SimpleDeclarationAnnotationAdapter; -import org.eclipse.jpt.common.core.utility.jdt.DeclarationAnnotationAdapter; -import org.eclipse.jpt.common.core.utility.jdt.Type; -import org.eclipse.jpt.jpa.core.internal.resource.java.source.SourceAnnotation; -import org.eclipse.jpt.jpa.core.resource.java.JavaResourcePersistentType; -import org.eclipse.jpt.jpa.eclipselink.core.resource.java.EclipseLinkPrimaryKeyAnnotation; - -/** - * org.eclipse.persistence.annotations.PrimaryKey - */ -public class SourceEclipseLinkPrimaryKeyAnnotation - extends SourceAnnotation<Type> - implements EclipseLinkPrimaryKeyAnnotation -{ - private static final DeclarationAnnotationAdapter DECLARATION_ANNOTATION_ADAPTER - = new SimpleDeclarationAnnotationAdapter(ANNOTATION_NAME); - - - public SourceEclipseLinkPrimaryKeyAnnotation(JavaResourcePersistentType parent, Type type) { - super(parent, type, 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 adb9ca3f14..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, 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.source; - -import org.eclipse.jdt.core.dom.CompilationUnit; -import org.eclipse.jpt.common.core.internal.utility.jdt.SimpleDeclarationAnnotationAdapter; -import org.eclipse.jpt.common.core.utility.jdt.Attribute; -import org.eclipse.jpt.common.core.utility.jdt.DeclarationAnnotationAdapter; -import org.eclipse.jpt.jpa.core.internal.resource.java.source.SourceAnnotation; -import org.eclipse.jpt.jpa.core.resource.java.JavaResourcePersistentAttribute; -import org.eclipse.jpt.jpa.eclipselink.core.resource.java.EclipseLinkPrivateOwnedAnnotation; - -/** - * org.eclipse.persistence.annotations.PrivateOwned - */ -public final class SourceEclipseLinkPrivateOwnedAnnotation - extends SourceAnnotation<Attribute> - implements EclipseLinkPrivateOwnedAnnotation -{ - private static final DeclarationAnnotationAdapter DECLARATION_ANNOTATION_ADAPTER = new SimpleDeclarationAnnotationAdapter(ANNOTATION_NAME); - - - public SourceEclipseLinkPrivateOwnedAnnotation(JavaResourcePersistentAttribute parent, Attribute attribute) { - super(parent, attribute, 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 a358497079..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, 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.source; - -import org.eclipse.jdt.core.dom.CompilationUnit; -import org.eclipse.jpt.common.core.internal.utility.jdt.SimpleDeclarationAnnotationAdapter; -import org.eclipse.jpt.common.core.utility.jdt.DeclarationAnnotationAdapter; -import org.eclipse.jpt.common.core.utility.jdt.Type; -import org.eclipse.jpt.jpa.core.internal.resource.java.source.SourceAnnotation; -import org.eclipse.jpt.jpa.core.resource.java.JavaResourcePersistentType; -import org.eclipse.jpt.jpa.eclipselink.core.resource.java.EclipseLinkReadOnlyAnnotation; - -/** - * org.eclipse.persistence.annotations.ReadOnly - */ -public final class SourceEclipseLinkReadOnlyAnnotation - extends SourceAnnotation<Type> - implements EclipseLinkReadOnlyAnnotation -{ - private static final DeclarationAnnotationAdapter DECLARATION_ANNOTATION_ADAPTER = new SimpleDeclarationAnnotationAdapter(ANNOTATION_NAME); - - - public SourceEclipseLinkReadOnlyAnnotation(JavaResourcePersistentType parent, Type type) { - super(parent, type, 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 72f2171bb1..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, 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.resource.java.source; - -import org.eclipse.jpt.common.core.internal.utility.jdt.SimpleDeclarationAnnotationAdapter; -import org.eclipse.jpt.common.core.utility.jdt.Attribute; -import org.eclipse.jpt.common.core.utility.jdt.DeclarationAnnotationAdapter; -import org.eclipse.jpt.jpa.core.resource.java.JavaResourcePersistentAttribute; -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(JavaResourcePersistentAttribute parent, Attribute attribute) { - super(parent, attribute, 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 36cc7fe059..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,110 +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.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.ConversionDeclarationAnnotationElementAdapter; -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.utility.TextRange; -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.Member; -import org.eclipse.jpt.jpa.core.resource.java.JavaResourcePersistentMember; -import org.eclipse.jpt.jpa.eclipselink.core.resource.java.EclipseLink; -import org.eclipse.jpt.jpa.eclipselink.core.resource.java.EclipseLinkStructConverterAnnotation; - -/** - * org.eclipse.persistence.annotations.StructConverter - */ -public final class SourceEclipseLinkStructConverterAnnotation - extends SourceEclipseLinkNamedConverterAnnotation - implements EclipseLinkStructConverterAnnotation -{ - private static final DeclarationAnnotationAdapter DECLARATION_ANNOTATION_ADAPTER = new SimpleDeclarationAnnotationAdapter(ANNOTATION_NAME); - - private static final DeclarationAnnotationElementAdapter<String> CONVERTER_ADAPTER = buildConverterAdapter(); - private final AnnotationElementAdapter<String> converterAdapter; - private String converter; - - - public SourceEclipseLinkStructConverterAnnotation(JavaResourcePersistentMember parent, Member member) { - super(parent, member, DECLARATION_ANNOTATION_ADAPTER); - this.converterAdapter = new AnnotatedElementAnnotationElementAdapter<String>(member, CONVERTER_ADAPTER); - } - - public String getAnnotationName() { - return ANNOTATION_NAME; - } - - @Override - public void initialize(CompilationUnit astRoot) { - super.initialize(astRoot); - this.converter = this.buildConverter(astRoot); - } - - @Override - public void synchronizeWith(CompilationUnit astRoot) { - super.synchronizeWith(astRoot); - this.syncConverter(this.buildConverter(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(CompilationUnit astRoot) { - return this.getElementTextRange(CONVERTER_ADAPTER, astRoot); - } - - // ********** static methods ********** - - private static DeclarationAnnotationElementAdapter<String> buildConverterAdapter() { - return new ConversionDeclarationAnnotationElementAdapter<String>(DECLARATION_ANNOTATION_ADAPTER, EclipseLink.STRUCT_CONVERTER__CONVERTER, StringExpressionConverter.instance()); - } - -} 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 be8ecf9661..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,215 +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.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.ConversionDeclarationAnnotationElementAdapter; -import org.eclipse.jpt.common.core.internal.utility.jdt.NumberIntegerExpressionConverter; -import org.eclipse.jpt.common.core.utility.TextRange; -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.Type; -import org.eclipse.jpt.jpa.core.internal.resource.java.source.SourceAnnotation; -import org.eclipse.jpt.jpa.core.resource.java.JavaResourceNode; -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<Type> - implements EclipseLinkTimeOfDayAnnotation -{ - private final DeclarationAnnotationElementAdapter<Integer> hourDeclarationAdapter; - private final AnnotationElementAdapter<Integer> hourAdapter; - private Integer hour; - - private final DeclarationAnnotationElementAdapter<Integer> minuteDeclarationAdapter; - private final AnnotationElementAdapter<Integer> minuteAdapter; - private Integer minute; - - private final DeclarationAnnotationElementAdapter<Integer> secondDeclarationAdapter; - private final AnnotationElementAdapter<Integer> secondAdapter; - private Integer second; - - private final DeclarationAnnotationElementAdapter<Integer> millisecondDeclarationAdapter; - private final AnnotationElementAdapter<Integer> millisecondAdapter; - private Integer millisecond; - - - public SourceEclipseLinkTimeOfDayAnnotation(JavaResourceNode parent, Type type, DeclarationAnnotationAdapter daa) { - super(parent, type, daa); - this.hourDeclarationAdapter = buildHourAdapter(daa); - this.hourAdapter = new AnnotatedElementAnnotationElementAdapter<Integer>(type, this.hourDeclarationAdapter); - this.minuteDeclarationAdapter = buildMinuteAdapter(daa); - this.minuteAdapter = new AnnotatedElementAnnotationElementAdapter<Integer>(type, this.minuteDeclarationAdapter); - this.secondDeclarationAdapter = buildSecondAdapter(daa); - this.secondAdapter = new AnnotatedElementAnnotationElementAdapter<Integer>(type, this.secondDeclarationAdapter); - this.millisecondDeclarationAdapter = buildMillisecondAdapter(daa); - this.millisecondAdapter = new AnnotatedElementAnnotationElementAdapter<Integer>(type, this.millisecondDeclarationAdapter); - } - - public String getAnnotationName() { - return ANNOTATION_NAME; - } - - public void initialize(CompilationUnit astRoot) { - this.hour = this.buildHour(astRoot); - this.minute = this.buildMinute(astRoot); - this.second = this.buildSecond(astRoot); - this.millisecond = this.buildMillisecond(astRoot); - } - - public void synchronizeWith(CompilationUnit astRoot) { - this.syncHour(this.buildHour(astRoot)); - this.syncMinute(this.buildMinute(astRoot)); - this.syncSecond(this.buildSecond(astRoot)); - this.syncMillisecond(this.buildMillisecond(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(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(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(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(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 a2e82744e8..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,145 +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.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.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.utility.TextRange; -import org.eclipse.jpt.common.core.utility.jdt.AnnotationElementAdapter; -import org.eclipse.jpt.common.core.utility.jdt.Attribute; -import org.eclipse.jpt.common.core.utility.jdt.DeclarationAnnotationAdapter; -import org.eclipse.jpt.common.core.utility.jdt.DeclarationAnnotationElementAdapter; -import org.eclipse.jpt.jpa.core.internal.resource.java.source.SourceAnnotation; -import org.eclipse.jpt.jpa.core.resource.java.FetchType; -import org.eclipse.jpt.jpa.core.resource.java.JavaResourcePersistentAttribute; -import org.eclipse.jpt.jpa.eclipselink.core.resource.java.EclipseLink; -import org.eclipse.jpt.jpa.eclipselink.core.resource.java.EclipseLinkTransformationAnnotation; - -/** - * org.eclipse.persistence.annotations.Transformation - */ -public final class SourceEclipseLinkTransformationAnnotation - extends SourceAnnotation<Attribute> - 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 static final DeclarationAnnotationElementAdapter<Boolean> OPTIONAL_ADAPTER = buildOptionalAdapter(); - private final AnnotationElementAdapter<Boolean> optionalAdapter; - private Boolean optional; - - - public SourceEclipseLinkTransformationAnnotation(JavaResourcePersistentAttribute parent, Attribute attribute) { - super(parent, attribute, DECLARATION_ANNOTATION_ADAPTER); - this.fetchAdapter = new AnnotatedElementAnnotationElementAdapter<String>(attribute, FETCH_ADAPTER); - this.optionalAdapter = new AnnotatedElementAnnotationElementAdapter<Boolean>(attribute, OPTIONAL_ADAPTER); - } - - public String getAnnotationName() { - return ANNOTATION_NAME; - } - - public void initialize(CompilationUnit astRoot) { - this.fetch = this.buildFetch(astRoot); - this.optional = this.buildOptional(astRoot); - } - - public void synchronizeWith(CompilationUnit astRoot) { - this.syncFetch(this.buildFetch(astRoot)); - this.syncOptional(this.buildOptional(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(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(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 b3be21dff8..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,132 +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.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.ConversionDeclarationAnnotationElementAdapter; -import org.eclipse.jpt.common.core.internal.utility.jdt.SimpleTypeStringExpressionConverter; -import org.eclipse.jpt.common.core.utility.TextRange; -import org.eclipse.jpt.common.core.utility.jdt.AnnotationElementAdapter; -import org.eclipse.jpt.common.core.utility.jdt.Attribute; -import org.eclipse.jpt.common.core.utility.jdt.DeclarationAnnotationAdapter; -import org.eclipse.jpt.common.core.utility.jdt.DeclarationAnnotationElementAdapter; -import org.eclipse.jpt.jpa.core.internal.resource.java.source.SourceAnnotation; -import org.eclipse.jpt.jpa.core.resource.java.JavaResourcePersistentAttribute; -import org.eclipse.jpt.jpa.eclipselink.core.resource.java.EclipseLinkTransformerAnnotation; - -/** - * org.eclipse.persistence.annotations.ReadTransformer - * org.eclipse.persistence.annotations.WriteTransformer - */ -abstract class SourceEclipseLinkTransformerAnnotation - extends SourceAnnotation<Attribute> - implements EclipseLinkTransformerAnnotation -{ - final DeclarationAnnotationElementAdapter<String> transformerClassDeclarationAdapter; - final AnnotationElementAdapter<String> transformerClassAdapter; - String transformerClass; - - final DeclarationAnnotationElementAdapter<String> methodDeclarationAdapter; - final AnnotationElementAdapter<String> methodAdapter; - String method; - - - SourceEclipseLinkTransformerAnnotation(JavaResourcePersistentAttribute parent, Attribute attribute, DeclarationAnnotationAdapter daa) { - super(parent, attribute, daa); - this.transformerClassDeclarationAdapter = new ConversionDeclarationAnnotationElementAdapter<String>(daa, this.getTransformerClassElementName(), SimpleTypeStringExpressionConverter.instance()); - this.transformerClassAdapter = new AnnotatedElementAnnotationElementAdapter<String>(attribute, this.transformerClassDeclarationAdapter); - - this.methodDeclarationAdapter = ConversionDeclarationAnnotationElementAdapter.forStrings(daa, this.getMethodElementName()); - this.methodAdapter = new AnnotatedElementAnnotationElementAdapter<String>(attribute, this.methodDeclarationAdapter); - } - - public void initialize(CompilationUnit astRoot) { - this.transformerClass = this.buildTransformerClass(astRoot); - this.method = this.buildMethod(astRoot); - } - - public void synchronizeWith(CompilationUnit astRoot) { - this.syncTransformerClass(this.buildTransformerClass(astRoot)); - this.syncMethod(this.buildMethod(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(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(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 0f5869f74b..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,58 +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.resource.java.source; - -import org.eclipse.jpt.common.core.internal.utility.jdt.SimpleDeclarationAnnotationAdapter; -import org.eclipse.jpt.common.core.utility.jdt.DeclarationAnnotationAdapter; -import org.eclipse.jpt.common.core.utility.jdt.Member; -import org.eclipse.jpt.jpa.core.resource.java.JavaResourcePersistentMember; -import org.eclipse.jpt.jpa.eclipselink.core.resource.java.EclipseLink; -import org.eclipse.jpt.jpa.eclipselink.core.resource.java.EclipseLinkTypeConverterAnnotation; - -/** - * org.eclipse.persistence.annotations.TypeConverter - */ -public final class SourceEclipseLinkTypeConverterAnnotation - extends SourceBaseEclipseLinkTypeConverterAnnotation - implements EclipseLinkTypeConverterAnnotation -{ - private static final DeclarationAnnotationAdapter DECLARATION_ANNOTATION_ADAPTER = new SimpleDeclarationAnnotationAdapter(ANNOTATION_NAME); - - - public SourceEclipseLinkTypeConverterAnnotation(JavaResourcePersistentMember parent, Member member) { - super(parent, member, DECLARATION_ANNOTATION_ADAPTER); - } - - 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; - } - -} 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 1a2b3f974b..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, 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.source; - -import org.eclipse.jdt.core.dom.CompilationUnit; -import org.eclipse.jpt.common.core.internal.utility.jdt.SimpleDeclarationAnnotationAdapter; -import org.eclipse.jpt.common.core.utility.jdt.Attribute; -import org.eclipse.jpt.common.core.utility.jdt.DeclarationAnnotationAdapter; -import org.eclipse.jpt.jpa.core.internal.resource.java.source.SourceAnnotation; -import org.eclipse.jpt.jpa.core.resource.java.JavaResourcePersistentAttribute; -import org.eclipse.jpt.jpa.eclipselink.core.resource.java.EclipseLinkVariableOneToOneAnnotation; - -/** - * org.eclipse.persistence.annotations.VariableOneToOne - */ -public final class SourceEclipseLinkVariableOneToOneAnnotation - extends SourceAnnotation<Attribute> - implements EclipseLinkVariableOneToOneAnnotation -{ - private static final DeclarationAnnotationAdapter DECLARATION_ANNOTATION_ADAPTER = new SimpleDeclarationAnnotationAdapter(ANNOTATION_NAME); - - - public SourceEclipseLinkVariableOneToOneAnnotation(JavaResourcePersistentAttribute parent, Attribute attribute) { - super(parent, attribute, 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 38755f4f79..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,159 +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.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.utility.TextRange; -import org.eclipse.jpt.common.core.utility.jdt.Attribute; -import org.eclipse.jpt.common.core.utility.jdt.DeclarationAnnotationAdapter; -import org.eclipse.jpt.common.core.utility.jdt.Member; -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.core.resource.java.JavaResourceNode; -import org.eclipse.jpt.jpa.core.resource.java.JavaResourcePersistentAttribute; -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; - -/** - * org.eclipse.persistence.annotations.WriteTransformer - */ -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; - - - public SourceEclipseLinkWriteTransformerAnnotation(JavaResourcePersistentAttribute parent, Attribute attribute) { - super(parent, attribute, 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); - } - } - - @Override - public void synchronizeWith(CompilationUnit astRoot) { - super.synchronizeWith(astRoot); - this.syncColumn(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(CompilationUnit astRoot) { - if (this.column != null) { - return this.column.getTextRange(astRoot); - } - return 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, Member member, DeclarationAnnotationAdapter writeTransformerAnnotationAdapter) { - return new SourceColumnAnnotation(parent, member, 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 d327917afe..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,84 +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.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.AccessType; -import org.eclipse.jpt.jpa.core.resource.orm.OrmFactory; -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); - - AccessType defaultAccess = (AccessType) dataModel.getProperty(DEFAULT_ACCESS); - if (defaultAccess != null) { - XmlPersistenceUnitMetadata puMetadata = EclipseLinkOrmFactory.eINSTANCE.createXmlPersistenceUnitMetadata(); - entityMappings.setPersistenceUnitMetadata(puMetadata); - XmlPersistenceUnitDefaults puDefaults = OrmFactory.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/v1_1/EclipseLink1_1JpaPlatformFactory.java b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/v1_1/EclipseLink1_1JpaPlatformFactory.java deleted file mode 100644 index 784389128c..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/v1_1/EclipseLink1_1JpaPlatformFactory.java +++ /dev/null @@ -1,72 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2007, 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.v1_1; - -import org.eclipse.jpt.jpa.core.JpaAnnotationProvider; -import org.eclipse.jpt.jpa.core.JpaFacet; -import org.eclipse.jpt.jpa.core.JpaPlatform; -import org.eclipse.jpt.jpa.core.JpaPlatformFactory; -import org.eclipse.jpt.jpa.core.JpaPlatformVariation; -import org.eclipse.jpt.jpa.core.internal.GenericJpaAnnotationDefinitionProvider; -import org.eclipse.jpt.jpa.core.internal.GenericJpaAnnotationProvider; -import org.eclipse.jpt.jpa.core.internal.GenericJpaPlatform; -import org.eclipse.jpt.jpa.eclipselink.core.JptJpaEclipseLinkCorePlugin; -import org.eclipse.jpt.jpa.eclipselink.core.internal.EclipseLinkJpaAnnotationDefinitionProvider; -import org.eclipse.jpt.jpa.eclipselink.core.internal.EclipseLinkJpaFactory; -import org.eclipse.jpt.jpa.eclipselink.core.internal.EclipseLinkJpaPlatformFactory.EclipseLinkVersion; - -/** - * 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(), - buildJpaAnnotationProvider(), - EclipseLink1_1JpaPlatformProvider.instance(), - buildJpaPlatformVariation()); - } - - protected JpaAnnotationProvider buildJpaAnnotationProvider() { - return new GenericJpaAnnotationProvider( - GenericJpaAnnotationDefinitionProvider.instance(), - EclipseLinkJpaAnnotationDefinitionProvider.instance()); - } - - protected JpaPlatformVariation buildJpaPlatformVariation() { - return new JpaPlatformVariation() { - public Supported getTablePerConcreteClassInheritanceIsSupported() { - return Supported.YES; - } - public boolean isJoinTableOverridable() { - return false; - } - }; - } - - private JpaPlatform.Version buildJpaVersion() { - return new EclipseLinkVersion( - JptJpaEclipseLinkCorePlugin.ECLIPSELINK_PLATFORM_VERSION_1_1, - JpaFacet.VERSION_1_0.getVersionString()); - } -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/v1_1/EclipseLink1_1JpaPlatformProvider.java b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/v1_1/EclipseLink1_1JpaPlatformProvider.java deleted file mode 100644 index 36276c5817..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/v1_1/EclipseLink1_1JpaPlatformProvider.java +++ /dev/null @@ -1,188 +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.v1_1; - -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.JavaEmbeddableDefinition; -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.JavaEntityDefinition; -import org.eclipse.jpt.jpa.core.internal.context.java.JavaMappedSuperclassDefinition; -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.EclipseLinkOrmResourceModelProvider; -import org.eclipse.jpt.jpa.eclipselink.core.internal.context.java.JavaEclipseLinkBasicCollectionMappingDefinition; -import org.eclipse.jpt.jpa.eclipselink.core.internal.context.java.JavaEclipseLinkBasicMapMappingDefinition; -import org.eclipse.jpt.jpa.eclipselink.core.internal.context.java.JavaEclipseLinkBasicMappingDefinition; -import org.eclipse.jpt.jpa.eclipselink.core.internal.context.java.JavaEclipseLinkIdMappingDefinition; -import org.eclipse.jpt.jpa.eclipselink.core.internal.context.java.JavaEclipseLinkManyToManyMappingDefinition; -import org.eclipse.jpt.jpa.eclipselink.core.internal.context.java.JavaEclipseLinkManyToOneMappingDefinition; -import org.eclipse.jpt.jpa.eclipselink.core.internal.context.java.JavaEclipseLinkOneToManyMappingDefinition; -import org.eclipse.jpt.jpa.eclipselink.core.internal.context.java.JavaEclipseLinkOneToOneMappingDefinition; -import org.eclipse.jpt.jpa.eclipselink.core.internal.context.java.JavaEclipseLinkTransformationMappingDefinition; -import org.eclipse.jpt.jpa.eclipselink.core.internal.context.java.JavaEclipseLinkVariableOneToOneMappingDefinition; -import org.eclipse.jpt.jpa.eclipselink.core.internal.context.java.JavaEclipseLinkVersionMappingDefinition; -import org.eclipse.jpt.jpa.eclipselink.core.internal.context.orm.EclipseLinkOrmXmlDefinition; -import org.eclipse.jpt.jpa.eclipselink.core.internal.context.persistence.EclipseLinkPersistenceXmlDefinition; -import org.eclipse.jpt.jpa.eclipselink.core.internal.v1_1.context.orm.EclipseLinkOrmXml1_1Definition; - -/** - * 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[] { - JavaEntityDefinition.instance(), - JavaEmbeddableDefinition.instance(), - JavaMappedSuperclassDefinition.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(), - JavaEclipseLinkOneToManyMappingDefinition.instance(), - JavaEclipseLinkOneToOneMappingDefinition.instance(), - JavaEclipseLinkVariableOneToOneMappingDefinition.instance(), - JavaEclipseLinkBasicMappingDefinition.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(), - JavaEclipseLinkBasicCollectionMappingDefinition.instance(), - JavaEclipseLinkBasicMapMappingDefinition.instance(), - JavaEclipseLinkIdMappingDefinition.instance(), - JavaEclipseLinkVersionMappingDefinition.instance(), - JavaEclipseLinkBasicMappingDefinition.instance(), - JavaEmbeddedMappingDefinition.instance(), - JavaEmbeddedIdMappingDefinition.instance(), - JavaEclipseLinkTransformationMappingDefinition.instance(), - JavaEclipseLinkManyToManyMappingDefinition.instance(), - JavaEclipseLinkManyToOneMappingDefinition.instance(), - JavaEclipseLinkOneToManyMappingDefinition.instance(), - JavaEclipseLinkOneToOneMappingDefinition.instance(), - JavaEclipseLinkVariableOneToOneMappingDefinition.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/v1_1/context/AbstractEclipseLinkTypeMappingValidator.java b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/v1_1/context/AbstractEclipseLinkTypeMappingValidator.java deleted file mode 100644 index 773a6f80ac..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/v1_1/context/AbstractEclipseLinkTypeMappingValidator.java +++ /dev/null @@ -1,50 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010 Oracle. - * All rights reserved. This program and the accompanying materials are - * made available under the terms of the Eclipse Public License v1.0 which - * accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Oracle - initial API and implementation - *******************************************************************************/ -package org.eclipse.jpt.jpa.eclipselink.core.internal.v1_1.context; - -import java.util.List; -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.core.resource.java.JavaResourcePersistentType; -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> -{ - public AbstractEclipseLinkTypeMappingValidator(T typeMapping, JavaResourcePersistentType jrpt, TypeMappingTextRangeResolver textRangeResolver) { - super(typeMapping, jrpt, 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/v1_1/context/EclipseLinkEntityPrimaryKeyValidator.java b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/v1_1/context/EclipseLinkEntityPrimaryKeyValidator.java deleted file mode 100644 index 14690345c8..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/v1_1/context/EclipseLinkEntityPrimaryKeyValidator.java +++ /dev/null @@ -1,65 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010 Oracle. - * All rights reserved. This program and the accompanying materials are - * made available under the terms of the Eclipse Public License v1.0 which - * accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Oracle - initial API and implementation - *******************************************************************************/ -package org.eclipse.jpt.jpa.eclipselink.core.internal.v1_1.context; - -import java.util.List; -import org.eclipse.jpt.jpa.core.context.TypeMapping; -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(); - } - - @Override - protected boolean specifiesIdClass() { - return super.specifiesIdClass() || definesIdClass(typeMapping()); - } -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/v1_1/context/EclipseLinkMappedSuperclassPrimaryKeyValidator.java b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/v1_1/context/EclipseLinkMappedSuperclassPrimaryKeyValidator.java deleted file mode 100644 index cf433cd9c1..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/v1_1/context/EclipseLinkMappedSuperclassPrimaryKeyValidator.java +++ /dev/null @@ -1,73 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010 Oracle. - * All rights reserved. This program and the accompanying materials are - * made available under the terms of the Eclipse Public License v1.0 which - * accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Oracle - initial API and implementation - *******************************************************************************/ -package org.eclipse.jpt.jpa.eclipselink.core.internal.v1_1.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(); - } -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/v1_1/context/EclipseLinkMappedSuperclassValidator.java b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/v1_1/context/EclipseLinkMappedSuperclassValidator.java deleted file mode 100644 index ac9d810331..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/v1_1/context/EclipseLinkMappedSuperclassValidator.java +++ /dev/null @@ -1,35 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010 Oracle. - * All rights reserved. This program and the accompanying materials are - * made available under the terms of the Eclipse Public License v1.0 which - * accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Oracle - initial API and implementation - *******************************************************************************/ -package org.eclipse.jpt.jpa.eclipselink.core.internal.v1_1.context; - -import java.util.List; -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.jpt.jpa.core.resource.java.JavaResourcePersistentType; -import org.eclipse.wst.validation.internal.provisional.core.IMessage; - -public class EclipseLinkMappedSuperclassValidator - extends AbstractEclipseLinkTypeMappingValidator<MappedSuperclass> -{ - public EclipseLinkMappedSuperclassValidator(MappedSuperclass mappedSuperclass, JavaResourcePersistentType jrpt, TypeMappingTextRangeResolver textRangeResolver) { - super(mappedSuperclass, jrpt, 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/v1_1/context/EclipseLinkPersistentAttributeValidator.java b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/v1_1/context/EclipseLinkPersistentAttributeValidator.java deleted file mode 100644 index ac49376dcd..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/v1_1/context/EclipseLinkPersistentAttributeValidator.java +++ /dev/null @@ -1,34 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010 Oracle. - * All rights reserved. This program and the accompanying materials are - * made available under the terms of the Eclipse Public License v1.0 which - * accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Oracle - initial API and implementation - *******************************************************************************/ -package org.eclipse.jpt.jpa.eclipselink.core.internal.v1_1.context; - -import java.util.List; -import org.eclipse.jpt.jpa.core.context.PersistentAttribute; -import org.eclipse.jpt.jpa.core.context.java.JavaPersistentAttribute; -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( - PersistentAttribute persistentAttribute, JavaPersistentAttribute javaPersistentAttribute, PersistentAttributeTextRangeResolver textRangeResolver) - { - super(persistentAttribute, javaPersistentAttribute, textRangeResolver); - } - - @Override - protected void validateAttribute(List<IMessage> messages) { - return; - } - -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/v1_1/context/EclipseLinkTypeMappingValidator.java b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/v1_1/context/EclipseLinkTypeMappingValidator.java deleted file mode 100644 index 4f1340fd6d..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/v1_1/context/EclipseLinkTypeMappingValidator.java +++ /dev/null @@ -1,23 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010 Oracle. - * All rights reserved. This program and the accompanying materials are - * made available under the terms of the Eclipse Public License v1.0 which - * accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Oracle - initial API and implementation - *******************************************************************************/ -package org.eclipse.jpt.jpa.eclipselink.core.internal.v1_1.context; - -import org.eclipse.jpt.jpa.core.context.TypeMapping; -import org.eclipse.jpt.jpa.core.internal.context.TypeMappingTextRangeResolver; -import org.eclipse.jpt.jpa.core.resource.java.JavaResourcePersistentType; - -public class EclipseLinkTypeMappingValidator - extends AbstractEclipseLinkTypeMappingValidator<TypeMapping> -{ - public EclipseLinkTypeMappingValidator(TypeMapping typeMapping, JavaResourcePersistentType jrpt, TypeMappingTextRangeResolver textRangeResolver) { - super(typeMapping, jrpt, textRangeResolver); - } -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/v1_1/context/orm/EclipseLinkOrmXml1_1ContextNodeFactory.java b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/v1_1/context/orm/EclipseLinkOrmXml1_1ContextNodeFactory.java deleted file mode 100644 index 71ddb2c0ed..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/v1_1/context/orm/EclipseLinkOrmXml1_1ContextNodeFactory.java +++ /dev/null @@ -1,27 +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.v1_1.context.orm; - -import org.eclipse.jpt.jpa.core.context.orm.OrmPersistentAttribute; -import org.eclipse.jpt.jpa.core.context.orm.OrmPersistentType; -import org.eclipse.jpt.jpa.eclipselink.core.internal.context.orm.EclipseLinkOrmXmlContextNodeFactory; -import org.eclipse.jpt.jpa.eclipselink.core.resource.orm.XmlAttributeMapping; - - -public class EclipseLinkOrmXml1_1ContextNodeFactory extends EclipseLinkOrmXmlContextNodeFactory -{ - - // ********** EclipseLink1.1-specific ORM Context Model ********** - - @Override - public OrmPersistentAttribute buildOrmPersistentAttribute(OrmPersistentType parent, org.eclipse.jpt.jpa.core.resource.orm.XmlAttributeMapping resourceMapping) { - return new OrmEclipseLinkPersistentAttribute1_1(parent, (XmlAttributeMapping) resourceMapping); - } -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/v1_1/context/orm/EclipseLinkOrmXml1_1Definition.java b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/v1_1/context/orm/EclipseLinkOrmXml1_1Definition.java deleted file mode 100644 index 4e742ce06f..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/v1_1/context/orm/EclipseLinkOrmXml1_1Definition.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.v1_1.context.orm; - -import org.eclipse.jpt.common.core.JptResourceType; -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; -import org.eclipse.jpt.jpa.eclipselink.core.internal.context.orm.AbstractEclipseLinkOrmXmlDefinition; - -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 new EclipseLinkOrmXml1_1ContextNodeFactory(); - } - -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/v1_1/context/orm/OrmEclipseLinkPersistentAttribute1_1.java b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/v1_1/context/orm/OrmEclipseLinkPersistentAttribute1_1.java deleted file mode 100644 index 7a2d24c7cc..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/v1_1/context/orm/OrmEclipseLinkPersistentAttribute1_1.java +++ /dev/null @@ -1,78 +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.v1_1.context.orm; - -import org.eclipse.jpt.jpa.core.context.AccessType; -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.internal.v1_1.context.EclipseLinkPersistentAttributeValidator; -import org.eclipse.jpt.jpa.eclipselink.core.resource.orm.XmlAttributeMapping; - -/** - * EclipseLink 1.1 - * <code>orm.xml</code> persistent attribute - */ -public class OrmEclipseLinkPersistentAttribute1_1 - extends SpecifiedOrmPersistentAttribute -{ - protected AccessType specifiedAccess; - - - public OrmEclipseLinkPersistentAttribute1_1(OrmPersistentType parent, XmlAttributeMapping xmlMapping) { - super(parent, xmlMapping); - this.specifiedAccess = this.buildSpecifiedAccess(); - } - - - // ********** synchronize/update ********** - - @Override - public void synchronizeWithResourceModel() { - super.synchronizeWithResourceModel(); - this.setSpecifiedAccess_(this.buildSpecifiedAccess()); - } - - - // ********** access ********** - - @Override - public AccessType getSpecifiedAccess() { - return this.specifiedAccess; - } - - public void setSpecifiedAccess(AccessType access) { - this.setSpecifiedAccess_(access); - this.getXmlAttributeMapping().setAccess(AccessType.toOrmResourceModel(access)); - } - - protected void setSpecifiedAccess_(AccessType access) { - AccessType old = this.specifiedAccess; - this.specifiedAccess = access; - this.firePropertyChanged(SPECIFIED_ACCESS_PROPERTY, old, access); - } - - protected AccessType buildSpecifiedAccess() { - return AccessType.fromOrmResourceModel(this.getXmlAttributeMapping().getAccess()); - } - - @Override - protected XmlAttributeMapping getXmlAttributeMapping() { - return (XmlAttributeMapping) super.getXmlAttributeMapping(); - } - - - // ********** validation ********** - - @Override - protected JptValidator buildAttibuteValidator() { - return new EclipseLinkPersistentAttributeValidator(this, this.getJavaPersistentAttribute(), this.buildTextRangeResolver()); - } -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/v1_2/EclipseLink1_2JpaAnnotationDefinitionProvider.java b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/v1_2/EclipseLink1_2JpaAnnotationDefinitionProvider.java deleted file mode 100644 index af93c08674..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/v1_2/EclipseLink1_2JpaAnnotationDefinitionProvider.java +++ /dev/null @@ -1,61 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.eclipselink.core.internal.v1_2; - -import java.util.ArrayList; -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; -import org.eclipse.jpt.jpa.core.resource.java.AnnotationDefinition; - -/** - * 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 addTypeAnnotationDefinitionsTo(ArrayList<AnnotationDefinition> definitions) { - definitions.add(Access2_0AnnotationDefinition.instance()); - } - - @Override - protected void addTypeMappingAnnotationDefinitionsTo(ArrayList<AnnotationDefinition> definitions) { - // nothing new for EclipseLink 1.2 - } - - @Override - protected void addAttributeAnnotationDefinitionsTo(ArrayList<AnnotationDefinition> definitions) { - // nothing new for EclipseLink 1.2 - } - - @Override - protected void addPackageAnnotationDefinitionsTo(ArrayList<AnnotationDefinition> definitions) { - // no package annotations - } -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/v1_2/EclipseLink1_2JpaFactory.java b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/v1_2/EclipseLink1_2JpaFactory.java deleted file mode 100644 index e99f456150..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/v1_2/EclipseLink1_2JpaFactory.java +++ /dev/null @@ -1,31 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - *******************************************************************************/ -package org.eclipse.jpt.jpa.eclipselink.core.internal.v1_2; - -import org.eclipse.jpt.jpa.core.context.PersistentType.Owner; -import org.eclipse.jpt.jpa.core.context.java.JavaPersistentType; -import org.eclipse.jpt.jpa.core.resource.java.JavaResourcePersistentType; -import org.eclipse.jpt.jpa.eclipselink.core.internal.EclipseLinkJpaFactory; -import org.eclipse.jpt.jpa.eclipselink.core.internal.v1_2.context.java.EclipseLinkJavaPersistentType1_2; - -public class EclipseLink1_2JpaFactory - extends EclipseLinkJpaFactory -{ - public EclipseLink1_2JpaFactory() { - super(); - } - - // ********** Java Context Model ********** - - @Override - public JavaPersistentType buildJavaPersistentType(Owner owner, JavaResourcePersistentType jrpt) { - return new EclipseLinkJavaPersistentType1_2(owner, jrpt); - } -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/v1_2/EclipseLink1_2JpaPlatformFactory.java b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/v1_2/EclipseLink1_2JpaPlatformFactory.java deleted file mode 100644 index d36164faa2..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/v1_2/EclipseLink1_2JpaPlatformFactory.java +++ /dev/null @@ -1,72 +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.v1_2; - -import org.eclipse.jpt.jpa.core.JpaAnnotationProvider; -import org.eclipse.jpt.jpa.core.JpaFacet; -import org.eclipse.jpt.jpa.core.JpaPlatform; -import org.eclipse.jpt.jpa.core.JpaPlatformFactory; -import org.eclipse.jpt.jpa.core.JpaPlatformVariation; -import org.eclipse.jpt.jpa.core.internal.GenericJpaAnnotationDefinitionProvider; -import org.eclipse.jpt.jpa.core.internal.GenericJpaAnnotationProvider; -import org.eclipse.jpt.jpa.core.internal.GenericJpaPlatform; -import org.eclipse.jpt.jpa.eclipselink.core.JptJpaEclipseLinkCorePlugin; -import org.eclipse.jpt.jpa.eclipselink.core.internal.EclipseLinkJpaAnnotationDefinitionProvider; -import org.eclipse.jpt.jpa.eclipselink.core.internal.EclipseLinkJpaPlatformFactory.EclipseLinkVersion; - -/** - * 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 EclipseLink1_2JpaFactory(), - buildJpaAnnotationProvider(), - EclipseLink1_2JpaPlatformProvider.instance(), - buildJpaPlatformVariation()); - } - - protected JpaAnnotationProvider buildJpaAnnotationProvider() { - return new GenericJpaAnnotationProvider( - GenericJpaAnnotationDefinitionProvider.instance(), - EclipseLinkJpaAnnotationDefinitionProvider.instance(), - EclipseLink1_2JpaAnnotationDefinitionProvider.instance()); - } - - protected JpaPlatformVariation buildJpaPlatformVariation() { - return new JpaPlatformVariation() { - public Supported getTablePerConcreteClassInheritanceIsSupported() { - return Supported.YES; - } - public boolean isJoinTableOverridable() { - return false; - } - }; - } - - private JpaPlatform.Version buildJpaVersion() { - return new EclipseLinkVersion( - JptJpaEclipseLinkCorePlugin.ECLIPSELINK_PLATFORM_VERSION_1_2, - JpaFacet.VERSION_1_0.getVersionString()); - } -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/v1_2/EclipseLink1_2JpaPlatformProvider.java b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/v1_2/EclipseLink1_2JpaPlatformProvider.java deleted file mode 100644 index 7070b84b78..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/v1_2/EclipseLink1_2JpaPlatformProvider.java +++ /dev/null @@ -1,191 +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.v1_2; - -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.JavaEmbeddableDefinition; -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.JavaEntityDefinition; -import org.eclipse.jpt.jpa.core.internal.context.java.JavaMappedSuperclassDefinition; -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.EclipseLinkOrmResourceModelProvider; -import org.eclipse.jpt.jpa.eclipselink.core.internal.context.java.JavaEclipseLinkBasicCollectionMappingDefinition; -import org.eclipse.jpt.jpa.eclipselink.core.internal.context.java.JavaEclipseLinkBasicMapMappingDefinition; -import org.eclipse.jpt.jpa.eclipselink.core.internal.context.java.JavaEclipseLinkBasicMappingDefinition; -import org.eclipse.jpt.jpa.eclipselink.core.internal.context.java.JavaEclipseLinkIdMappingDefinition; -import org.eclipse.jpt.jpa.eclipselink.core.internal.context.java.JavaEclipseLinkManyToManyMappingDefinition; -import org.eclipse.jpt.jpa.eclipselink.core.internal.context.java.JavaEclipseLinkManyToOneMappingDefinition; -import org.eclipse.jpt.jpa.eclipselink.core.internal.context.java.JavaEclipseLinkOneToManyMappingDefinition; -import org.eclipse.jpt.jpa.eclipselink.core.internal.context.java.JavaEclipseLinkOneToOneMappingDefinition; -import org.eclipse.jpt.jpa.eclipselink.core.internal.context.java.JavaEclipseLinkTransformationMappingDefinition; -import org.eclipse.jpt.jpa.eclipselink.core.internal.context.java.JavaEclipseLinkVariableOneToOneMappingDefinition; -import org.eclipse.jpt.jpa.eclipselink.core.internal.context.java.JavaEclipseLinkVersionMappingDefinition; -import org.eclipse.jpt.jpa.eclipselink.core.internal.context.orm.EclipseLinkOrmXmlDefinition; -import org.eclipse.jpt.jpa.eclipselink.core.internal.context.persistence.EclipseLinkPersistenceXmlDefinition; -import org.eclipse.jpt.jpa.eclipselink.core.internal.v1_1.context.orm.EclipseLinkOrmXml1_1Definition; -import org.eclipse.jpt.jpa.eclipselink.core.internal.v1_2.context.orm.EclipseLinkOrmXml1_2Definition; - -/** - * 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[] { - JavaEntityDefinition.instance(), - JavaEmbeddableDefinition.instance(), - JavaMappedSuperclassDefinition.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(), - JavaEclipseLinkOneToManyMappingDefinition.instance(), - JavaEclipseLinkOneToOneMappingDefinition.instance(), - JavaEclipseLinkVariableOneToOneMappingDefinition.instance(), - JavaEclipseLinkBasicMappingDefinition.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(), - JavaEclipseLinkBasicCollectionMappingDefinition.instance(), - JavaEclipseLinkBasicMapMappingDefinition.instance(), - JavaEclipseLinkIdMappingDefinition.instance(), - JavaEclipseLinkVersionMappingDefinition.instance(), - JavaBasicMappingDefinition.instance(), - JavaEmbeddedMappingDefinition.instance(), - JavaEmbeddedIdMappingDefinition.instance(), - JavaEclipseLinkTransformationMappingDefinition.instance(), - JavaEclipseLinkManyToManyMappingDefinition.instance(), - JavaEclipseLinkManyToOneMappingDefinition.instance(), - JavaEclipseLinkOneToManyMappingDefinition.instance(), - JavaEclipseLinkOneToOneMappingDefinition.instance(), - JavaEclipseLinkVariableOneToOneMappingDefinition.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/v1_2/context/java/EclipseLinkJavaPersistentType1_2.java b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/v1_2/context/java/EclipseLinkJavaPersistentType1_2.java deleted file mode 100644 index 84ce179b71..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/v1_2/context/java/EclipseLinkJavaPersistentType1_2.java +++ /dev/null @@ -1,78 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.eclipselink.core.internal.v1_2.context.java; - -import java.util.Iterator; - -import org.eclipse.jpt.jpa.core.context.AccessType; -import org.eclipse.jpt.jpa.core.context.PersistentType; -import org.eclipse.jpt.jpa.core.internal.context.java.AbstractJavaPersistentType; -import org.eclipse.jpt.jpa.core.jpa2.resource.java.Access2_0Annotation; -import org.eclipse.jpt.jpa.core.resource.java.JavaResourcePersistentAttribute; -import org.eclipse.jpt.jpa.core.resource.java.JavaResourcePersistentType; - -/** - * EclipseLink Java 1.2 - * Support for specified access. - */ -public class EclipseLinkJavaPersistentType1_2 - extends AbstractJavaPersistentType -{ - public EclipseLinkJavaPersistentType1_2(PersistentType.Owner parent, JavaResourcePersistentType jrpt) { - super(parent, jrpt); - } - - - // ********** access annotation ********** - - protected Access2_0Annotation getAccessAnnotation() { - return (Access2_0Annotation) this.resourcePersistentType.getNonNullAnnotation(this.getAccessAnnotationName()); - } - - protected void removeAccessAnnotationIfUnset() { - if (this.getAccessAnnotation().isUnset()) { - this.removeAccessAnnotation(); - } - } - - protected void removeAccessAnnotation() { - this.resourcePersistentType.removeAnnotation(this.getAccessAnnotationName()); - } - - protected String getAccessAnnotationName() { - return Access2_0Annotation.ANNOTATION_NAME; - } - - - // ********** access ********** - - public void setSpecifiedAccess(AccessType access) { - if (this.valuesAreDifferent(this.specifiedAccess, access)) { - this.getAccessAnnotation().setValue(AccessType.toJavaResourceModel(access)); - this.removeAccessAnnotationIfUnset(); - this.setSpecifiedAccess_(access); - } - } - - @Override - protected AccessType buildSpecifiedAccess() { - return AccessType.fromJavaResourceModel(this.getAccessAnnotation().getValue()); - } - - - // ********** attributes ********** - - @Override - protected Iterator<JavaResourcePersistentAttribute> resourceAttributes() { - return (this.specifiedAccess == null) ? - super.resourceAttributes() : - this.resourcePersistentType.persistableAttributes(AccessType.toJavaResourceModel(this.specifiedAccess)); - } -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/v1_2/context/orm/EclipseLinkOrmXml1_2Definition.java b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/v1_2/context/orm/EclipseLinkOrmXml1_2Definition.java deleted file mode 100644 index 0b2d295e1a..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/v1_2/context/orm/EclipseLinkOrmXml1_2Definition.java +++ /dev/null @@ -1,48 +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.v1_2.context.orm; - -import org.eclipse.jpt.common.core.JptResourceType; -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; -import org.eclipse.jpt.jpa.eclipselink.core.internal.context.orm.AbstractEclipseLinkOrmXmlDefinition; -import org.eclipse.jpt.jpa.eclipselink.core.internal.v1_1.context.orm.EclipseLinkOrmXml1_1ContextNodeFactory; - -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 new EclipseLinkOrmXml1_1ContextNodeFactory(); - } - -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/v2_0/AbstractEclipseLink2_0JpaPlatformProvider.java b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/v2_0/AbstractEclipseLink2_0JpaPlatformProvider.java deleted file mode 100644 index a1d2d2c98c..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/v2_0/AbstractEclipseLink2_0JpaPlatformProvider.java +++ /dev/null @@ -1,181 +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.v2_0; - -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.JavaEmbeddableDefinition; -import org.eclipse.jpt.jpa.core.internal.context.java.JavaEmbeddedIdMappingDefinition; -import org.eclipse.jpt.jpa.core.internal.context.java.JavaEntityDefinition; -import org.eclipse.jpt.jpa.core.internal.context.java.JavaMappedSuperclassDefinition; -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.java.JavaEmbeddedMappingDefinition2_0; -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.EclipseLinkOrmResourceModelProvider; -import org.eclipse.jpt.jpa.eclipselink.core.internal.context.java.JavaEclipseLinkBasicCollectionMappingDefinition; -import org.eclipse.jpt.jpa.eclipselink.core.internal.context.java.JavaEclipseLinkBasicMapMappingDefinition; -import org.eclipse.jpt.jpa.eclipselink.core.internal.context.java.JavaEclipseLinkBasicMappingDefinition; -import org.eclipse.jpt.jpa.eclipselink.core.internal.context.java.JavaEclipseLinkTransformationMappingDefinition; -import org.eclipse.jpt.jpa.eclipselink.core.internal.context.java.JavaEclipseLinkVariableOneToOneMappingDefinition; -import org.eclipse.jpt.jpa.eclipselink.core.internal.context.java.JavaEclipseLinkVersionMappingDefinition; -import org.eclipse.jpt.jpa.eclipselink.core.internal.context.orm.EclipseLinkOrmXmlDefinition; -import org.eclipse.jpt.jpa.eclipselink.core.internal.context.persistence.EclipseLinkPersistenceXmlDefinition; -import org.eclipse.jpt.jpa.eclipselink.core.internal.v1_1.context.orm.EclipseLinkOrmXml1_1Definition; -import org.eclipse.jpt.jpa.eclipselink.core.internal.v1_2.context.orm.EclipseLinkOrmXml1_2Definition; -import org.eclipse.jpt.jpa.eclipselink.core.internal.v2_0.context.java.JavaEclipseLinkElementCollectionMappingDefinition2_0; -import org.eclipse.jpt.jpa.eclipselink.core.internal.v2_0.context.java.JavaEclipseLinkIdMappingDefinition2_0; -import org.eclipse.jpt.jpa.eclipselink.core.internal.v2_0.context.java.JavaEclipseLinkManyToManyMappingDefinition2_0; -import org.eclipse.jpt.jpa.eclipselink.core.internal.v2_0.context.java.JavaEclipseLinkManyToOneMappingDefinition2_0; -import org.eclipse.jpt.jpa.eclipselink.core.internal.v2_0.context.java.JavaEclipseLinkOneToManyMappingDefinition2_0; -import org.eclipse.jpt.jpa.eclipselink.core.internal.v2_0.context.java.JavaEclipseLinkOneToOneMappingDefinition2_0; -import org.eclipse.jpt.jpa.eclipselink.core.internal.v2_0.context.orm.EclipseLinkOrmXml2_0Definition; -import org.eclipse.jpt.jpa.eclipselink.core.internal.v2_0.context.persistence.EclipseLink2_0PersistenceXmlDefinition; - -/** - * 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[] { - JavaEntityDefinition.instance(), - JavaEmbeddableDefinition.instance(), - JavaMappedSuperclassDefinition.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[] { - JavaEmbeddedMappingDefinition2_0.instance(), - JavaEclipseLinkOneToManyMappingDefinition2_0.instance(), - JavaEclipseLinkOneToOneMappingDefinition2_0.instance(), - JavaEclipseLinkVariableOneToOneMappingDefinition.instance(), - JavaEclipseLinkBasicMappingDefinition.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(), - JavaEclipseLinkBasicCollectionMappingDefinition.instance(), - JavaEclipseLinkBasicMapMappingDefinition.instance(), - JavaEclipseLinkElementCollectionMappingDefinition2_0.instance(), - JavaEclipseLinkIdMappingDefinition2_0.instance(), - JavaEclipseLinkVersionMappingDefinition.instance(), - JavaEclipseLinkBasicMappingDefinition.instance(), - JavaEmbeddedMappingDefinition2_0.instance(), - JavaEmbeddedIdMappingDefinition.instance(), - JavaEclipseLinkTransformationMappingDefinition.instance(), - JavaEclipseLinkManyToManyMappingDefinition2_0.instance(), - JavaEclipseLinkManyToOneMappingDefinition2_0.instance(), - JavaEclipseLinkOneToManyMappingDefinition2_0.instance(), - JavaEclipseLinkOneToOneMappingDefinition2_0.instance(), - JavaEclipseLinkVariableOneToOneMappingDefinition.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/v2_0/EclipseLink2_0JpaFactory.java b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/v2_0/EclipseLink2_0JpaFactory.java deleted file mode 100644 index d41a838e9c..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/v2_0/EclipseLink2_0JpaFactory.java +++ /dev/null @@ -1,151 +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.v2_0; - -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.JavaJpaContextNode; -import org.eclipse.jpt.jpa.core.context.java.JavaNamedColumn; -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.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.JavaResourcePersistentType; -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.EclipseLinkJpaFactory; -import org.eclipse.jpt.jpa.eclipselink.core.internal.v2_0.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, JavaResourcePersistentType jrpt) { - return new GenericJavaPersistentType2_0(owner, jrpt); - } - - @Override - public JavaSequenceGenerator buildJavaSequenceGenerator(JavaJpaContextNode 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); - } - - public JavaNamedQuery buildJavaNamedQuery(JavaJpaContextNode parent, NamedQuery2_0Annotation annotation) { - return new GenericJavaNamedQuery2_0(parent, annotation); - } - - public JavaCollectionTable2_0 buildJavaCollectionTable(JavaElementCollectionMapping2_0 parent, Table.Owner owner) { - return new GenericJavaCollectionTable2_0(parent, owner); - } - - public JavaOrderColumn2_0 buildJavaOrderColumn(JavaOrderable2_0 parent, JavaNamedColumn.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/v2_0/EclipseLink2_0JpaPlatformFactory.java b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/v2_0/EclipseLink2_0JpaPlatformFactory.java deleted file mode 100644 index ee2110a4ce..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/v2_0/EclipseLink2_0JpaPlatformFactory.java +++ /dev/null @@ -1,71 +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.v2_0; - -import org.eclipse.jpt.jpa.core.JpaAnnotationProvider; -import org.eclipse.jpt.jpa.core.JpaFacet; -import org.eclipse.jpt.jpa.core.JpaPlatform; -import org.eclipse.jpt.jpa.core.JpaPlatformFactory; -import org.eclipse.jpt.jpa.core.JpaPlatformVariation; -import org.eclipse.jpt.jpa.core.internal.GenericJpaAnnotationProvider; -import org.eclipse.jpt.jpa.core.internal.GenericJpaPlatform; -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.EclipseLinkJpaAnnotationDefinitionProvider; -import org.eclipse.jpt.jpa.eclipselink.core.internal.EclipseLinkJpaPlatformFactory.EclipseLinkVersion; - -/** - * 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.buildJpaAnnotationProvider(), - EclipseLink2_0JpaPlatformProvider.instance(), - this.buildJpaVariation()); - } - - protected JpaPlatform.Version buildJpaVersion() { - return new EclipseLinkVersion( - JptJpaEclipseLinkCorePlugin.ECLIPSELINK_PLATFORM_VERSION_2_0, - JpaFacet.VERSION_2_0.getVersionString()); - } - - protected JpaAnnotationProvider buildJpaAnnotationProvider() { - return new GenericJpaAnnotationProvider( - Generic2_0JpaAnnotationDefinitionProvider.instance(), - EclipseLinkJpaAnnotationDefinitionProvider.instance()); - } - - protected JpaPlatformVariation buildJpaVariation() { - return new JpaPlatformVariation() { - public Supported getTablePerConcreteClassInheritanceIsSupported() { - return Supported.YES; - } - public boolean isJoinTableOverridable() { - return true; - } - }; - } - -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/v2_0/EclipseLink2_0JpaPlatformProvider.java b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/v2_0/EclipseLink2_0JpaPlatformProvider.java deleted file mode 100644 index e1b9dd89ef..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/v2_0/EclipseLink2_0JpaPlatformProvider.java +++ /dev/null @@ -1,38 +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.v2_0; - -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/v2_0/context/java/JavaEclipseLinkElementCollectionMapping2_0.java b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/v2_0/context/java/JavaEclipseLinkElementCollectionMapping2_0.java deleted file mode 100644 index d74fb0976f..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/v2_0/context/java/JavaEclipseLinkElementCollectionMapping2_0.java +++ /dev/null @@ -1,64 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.eclipselink.core.internal.v2_0.context.java; - -import java.util.List; -import org.eclipse.jdt.core.dom.CompilationUnit; -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.EclipseLinkJoinFetch; -import org.eclipse.jpt.jpa.eclipselink.core.internal.context.java.JavaEclipseLinkJoinFetch; -import org.eclipse.jpt.jpa.eclipselink.core.v2_0.context.EclipseLinkElementCollectionMapping2_0; -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 -{ - protected final JavaEclipseLinkJoinFetch joinFetch; - - - public JavaEclipseLinkElementCollectionMapping2_0(JavaPersistentAttribute parent) { - super(parent); - this.joinFetch = new JavaEclipseLinkJoinFetch(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, 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/v2_0/context/java/JavaEclipseLinkElementCollectionMappingDefinition2_0.java b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/v2_0/context/java/JavaEclipseLinkElementCollectionMappingDefinition2_0.java deleted file mode 100644 index fc8aacebe5..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/v2_0/context/java/JavaEclipseLinkElementCollectionMappingDefinition2_0.java +++ /dev/null @@ -1,53 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.eclipselink.core.internal.v2_0.context.java; - -import org.eclipse.jpt.common.utility.internal.ArrayTools; -import org.eclipse.jpt.common.utility.internal.iterables.ArrayIterable; -import org.eclipse.jpt.jpa.core.context.java.JavaAttributeMappingDefinition; -import org.eclipse.jpt.jpa.core.internal.jpa2.context.java.AbstractJavaElementCollectionMappingDefinition2_0; -import org.eclipse.jpt.jpa.eclipselink.core.resource.java.EclipseLinkJoinFetchAnnotation; - -public class JavaEclipseLinkElementCollectionMappingDefinition2_0 - extends AbstractJavaElementCollectionMappingDefinition2_0 -{ - // singleton - private static final JavaAttributeMappingDefinition INSTANCE = new JavaEclipseLinkElementCollectionMappingDefinition2_0(); - - /** - * Return the singleton. - */ - public static JavaAttributeMappingDefinition instance() { - return INSTANCE; - } - - - /** - * Enforce singleton usage - */ - private JavaEclipseLinkElementCollectionMappingDefinition2_0() { - super(); - } - - @Override - public Iterable<String> getSupportingAnnotationNames() { - return COMBINED_SUPPORTING_ANNOTATION_NAMES; - } - - protected static final String[] ECLIPSE_LINK_SUPPORTING_ANNOTATION_NAMES_ARRAY = new String[] { - EclipseLinkJoinFetchAnnotation.ANNOTATION_NAME - }; - - protected static final String[] COMBINED_SUPPORTING_ANNOTATION_NAMES_ARRAY = ArrayTools.concatenate( - SUPPORTING_ANNOTATION_NAMES_ARRAY, - ECLIPSE_LINK_SUPPORTING_ANNOTATION_NAMES_ARRAY - ); - protected static final Iterable<String> COMBINED_SUPPORTING_ANNOTATION_NAMES = new ArrayIterable<String>(COMBINED_SUPPORTING_ANNOTATION_NAMES_ARRAY); -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/v2_0/context/java/JavaEclipseLinkIdMappingDefinition2_0.java b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/v2_0/context/java/JavaEclipseLinkIdMappingDefinition2_0.java deleted file mode 100644 index 72900f4511..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/v2_0/context/java/JavaEclipseLinkIdMappingDefinition2_0.java +++ /dev/null @@ -1,69 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.eclipselink.core.internal.v2_0.context.java; - -import org.eclipse.jpt.common.utility.internal.ArrayTools; -import org.eclipse.jpt.common.utility.internal.Tools; -import org.eclipse.jpt.common.utility.internal.iterables.ArrayIterable; -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.jpa2.context.java.AbstractJavaIdMappingDefinition2_0; -import org.eclipse.jpt.jpa.eclipselink.core.internal.context.java.JavaEclipseLinkBasicMappingDefinition; - -public class JavaEclipseLinkIdMappingDefinition2_0 - extends AbstractJavaIdMappingDefinition2_0 -{ - // singleton - private static final JavaAttributeMappingDefinition INSTANCE = new JavaEclipseLinkIdMappingDefinition2_0(); - - /** - * Return the singleton. - */ - public static JavaAttributeMappingDefinition instance() { - return INSTANCE; - } - - - /** - * Enforce singleton usage - */ - private JavaEclipseLinkIdMappingDefinition2_0() { - super(); - } - - /** - * EclipseLink supports default M:1 mappings. - */ - @Override - protected boolean attributeHasManyToOneMapping(JavaPersistentAttribute persistentAttribute) { - return super.attributeHasManyToOneMapping(persistentAttribute) || - Tools.valuesAreEqual(persistentAttribute.getDefaultMappingKey(), JavaEclipseLinkManyToOneMappingDefinition2_0.instance().getKey()); - } - - /** - * EclipseLink supports default 1:1 mappings. - */ - @Override - protected boolean attributeHasOneToOneMapping(JavaPersistentAttribute persistentAttribute) { - return super.attributeHasOneToOneMapping(persistentAttribute) || - Tools.valuesAreEqual(persistentAttribute.getDefaultMappingKey(), JavaEclipseLinkOneToOneMappingDefinition2_0.instance().getKey()); - } - - @Override - public Iterable<String> getSupportingAnnotationNames() { - return COMBINED_SUPPORTING_ANNOTATION_NAMES; - } - - protected static final String[] COMBINED_SUPPORTING_ANNOTATION_NAMES_ARRAY = ArrayTools.concatenate( - SUPPORTING_ANNOTATION_NAMES_ARRAY, - JavaEclipseLinkBasicMappingDefinition.ECLIPSE_LINK_SUPPORTING_ANNOTATION_NAMES_ARRAY - ); - protected static final Iterable<String> COMBINED_SUPPORTING_ANNOTATION_NAMES = new ArrayIterable<String>(COMBINED_SUPPORTING_ANNOTATION_NAMES_ARRAY); -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/v2_0/context/java/JavaEclipseLinkManyToManyMappingDefinition2_0.java b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/v2_0/context/java/JavaEclipseLinkManyToManyMappingDefinition2_0.java deleted file mode 100644 index ca4fabedc1..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/v2_0/context/java/JavaEclipseLinkManyToManyMappingDefinition2_0.java +++ /dev/null @@ -1,51 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.eclipselink.core.internal.v2_0.context.java; - -import org.eclipse.jpt.common.utility.internal.ArrayTools; -import org.eclipse.jpt.common.utility.internal.iterables.ArrayIterable; -import org.eclipse.jpt.jpa.core.context.java.JavaAttributeMappingDefinition; -import org.eclipse.jpt.jpa.core.internal.context.java.AbstractJavaManyToManyMappingDefinition; -import org.eclipse.jpt.jpa.core.internal.jpa2.context.java.JavaManyToManyMappingDefinition2_0; -import org.eclipse.jpt.jpa.eclipselink.core.internal.context.java.JavaEclipseLinkManyToManyMappingDefinition; - -public class JavaEclipseLinkManyToManyMappingDefinition2_0 - extends AbstractJavaManyToManyMappingDefinition -{ - // singleton - private static final JavaAttributeMappingDefinition INSTANCE = new JavaEclipseLinkManyToManyMappingDefinition2_0(); - - /** - * Return the singleton. - */ - public static JavaAttributeMappingDefinition instance() { - return INSTANCE; - } - - - /** - * Enforce singleton usage - */ - private JavaEclipseLinkManyToManyMappingDefinition2_0() { - super(); - } - - @Override - public Iterable<String> getSupportingAnnotationNames() { - return COMBINED_SUPPORTING_ANNOTATION_NAMES; - } - - protected static final String[] COMBINED_SUPPORTING_ANNOTATION_NAMES_ARRAY = ArrayTools.concatenate( - SUPPORTING_ANNOTATION_NAMES_ARRAY, - JavaManyToManyMappingDefinition2_0.SUPPORTING_ANNOTATION_NAMES_ARRAY_2_0, - JavaEclipseLinkManyToManyMappingDefinition.ECLIPSE_LINK_SUPPORTING_ANNOTATION_NAMES_ARRAY - ); - protected static final Iterable<String> COMBINED_SUPPORTING_ANNOTATION_NAMES = new ArrayIterable<String>(COMBINED_SUPPORTING_ANNOTATION_NAMES_ARRAY); -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/v2_0/context/java/JavaEclipseLinkManyToOneMappingDefinition2_0.java b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/v2_0/context/java/JavaEclipseLinkManyToOneMappingDefinition2_0.java deleted file mode 100644 index 3781e58a4c..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/v2_0/context/java/JavaEclipseLinkManyToOneMappingDefinition2_0.java +++ /dev/null @@ -1,51 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.eclipselink.core.internal.v2_0.context.java; - -import org.eclipse.jpt.common.utility.internal.ArrayTools; -import org.eclipse.jpt.common.utility.internal.iterables.ArrayIterable; -import org.eclipse.jpt.jpa.core.context.java.JavaAttributeMappingDefinition; -import org.eclipse.jpt.jpa.core.internal.context.java.AbstractJavaManyToOneMappingDefinition; -import org.eclipse.jpt.jpa.core.internal.jpa2.context.java.JavaManyToOneMappingDefinition2_0; -import org.eclipse.jpt.jpa.eclipselink.core.internal.context.java.JavaEclipseLinkManyToOneMappingDefinition; - -public class JavaEclipseLinkManyToOneMappingDefinition2_0 - extends AbstractJavaManyToOneMappingDefinition -{ - // singleton - private static final JavaAttributeMappingDefinition INSTANCE = new JavaEclipseLinkManyToOneMappingDefinition2_0(); - - /** - * Return the singleton. - */ - public static JavaAttributeMappingDefinition instance() { - return INSTANCE; - } - - - /** - * Enforce singleton usage - */ - private JavaEclipseLinkManyToOneMappingDefinition2_0() { - super(); - } - - @Override - public Iterable<String> getSupportingAnnotationNames() { - return COMBINED_SUPPORTING_ANNOTATION_NAMES; - } - - protected static final String[] COMBINED_SUPPORTING_ANNOTATION_NAMES_ARRAY = ArrayTools.concatenate( - SUPPORTING_ANNOTATION_NAMES_ARRAY, - JavaManyToOneMappingDefinition2_0.SUPPORTING_ANNOTATION_NAMES_ARRAY_2_0, - JavaEclipseLinkManyToOneMappingDefinition.ECLIPSE_LINK_SUPPORTING_ANNOTATION_NAMES_ARRAY - ); - protected static final Iterable<String> COMBINED_SUPPORTING_ANNOTATION_NAMES = new ArrayIterable<String>(COMBINED_SUPPORTING_ANNOTATION_NAMES_ARRAY); -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/v2_0/context/java/JavaEclipseLinkOneToManyMappingDefinition2_0.java b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/v2_0/context/java/JavaEclipseLinkOneToManyMappingDefinition2_0.java deleted file mode 100644 index e752edbdf9..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/v2_0/context/java/JavaEclipseLinkOneToManyMappingDefinition2_0.java +++ /dev/null @@ -1,57 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.eclipselink.core.internal.v2_0.context.java; - -import org.eclipse.jpt.common.utility.internal.ArrayTools; -import org.eclipse.jpt.common.utility.internal.iterables.ArrayIterable; -import org.eclipse.jpt.jpa.core.context.java.DefaultJavaAttributeMappingDefinition; -import org.eclipse.jpt.jpa.core.context.java.JavaPersistentAttribute; -import org.eclipse.jpt.jpa.core.internal.context.java.AbstractJavaOneToManyMappingDefinition; -import org.eclipse.jpt.jpa.core.internal.jpa2.context.java.JavaOneToManyMappingDefinition2_0; -import org.eclipse.jpt.jpa.eclipselink.core.internal.context.java.JavaEclipseLinkOneToManyMappingDefinition; - -public class JavaEclipseLinkOneToManyMappingDefinition2_0 - extends AbstractJavaOneToManyMappingDefinition - implements DefaultJavaAttributeMappingDefinition -{ - // singleton - private static final DefaultJavaAttributeMappingDefinition INSTANCE = new JavaEclipseLinkOneToManyMappingDefinition2_0(); - - /** - * Return the singleton. - */ - public static DefaultJavaAttributeMappingDefinition instance() { - return INSTANCE; - } - - - /** - * Enforce singleton usage - */ - private JavaEclipseLinkOneToManyMappingDefinition2_0() { - super(); - } - - @Override - public Iterable<String> getSupportingAnnotationNames() { - return COMBINED_SUPPORTING_ANNOTATION_NAMES; - } - - protected static final String[] COMBINED_SUPPORTING_ANNOTATION_NAMES_ARRAY = ArrayTools.concatenate( - SUPPORTING_ANNOTATION_NAMES_ARRAY, - JavaOneToManyMappingDefinition2_0.SUPPORTING_ANNOTATION_NAMES_ARRAY_2_0, - JavaEclipseLinkOneToManyMappingDefinition.ECLIPSE_LINK_SUPPORTING_ANNOTATION_NAMES_ARRAY - ); - protected static final Iterable<String> COMBINED_SUPPORTING_ANNOTATION_NAMES = new ArrayIterable<String>(COMBINED_SUPPORTING_ANNOTATION_NAMES_ARRAY); - - public boolean isDefault(JavaPersistentAttribute persistentAttribute) { - return JavaEclipseLinkOneToManyMappingDefinition.instance().isDefault(persistentAttribute); - } -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/v2_0/context/java/JavaEclipseLinkOneToOneMappingDefinition2_0.java b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/v2_0/context/java/JavaEclipseLinkOneToOneMappingDefinition2_0.java deleted file mode 100644 index 9c0479cd32..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/v2_0/context/java/JavaEclipseLinkOneToOneMappingDefinition2_0.java +++ /dev/null @@ -1,57 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.eclipselink.core.internal.v2_0.context.java; - -import org.eclipse.jpt.common.utility.internal.ArrayTools; -import org.eclipse.jpt.common.utility.internal.iterables.ArrayIterable; -import org.eclipse.jpt.jpa.core.context.java.DefaultJavaAttributeMappingDefinition; -import org.eclipse.jpt.jpa.core.context.java.JavaPersistentAttribute; -import org.eclipse.jpt.jpa.core.internal.context.java.AbstractJavaOneToOneMappingDefinition; -import org.eclipse.jpt.jpa.core.internal.jpa2.context.java.JavaOneToOneMappingDefinition2_0; -import org.eclipse.jpt.jpa.eclipselink.core.internal.context.java.JavaEclipseLinkOneToOneMappingDefinition; - -public class JavaEclipseLinkOneToOneMappingDefinition2_0 - extends AbstractJavaOneToOneMappingDefinition - implements DefaultJavaAttributeMappingDefinition -{ - // singleton - private static final DefaultJavaAttributeMappingDefinition INSTANCE = new JavaEclipseLinkOneToOneMappingDefinition2_0(); - - /** - * Return the singleton. - */ - public static DefaultJavaAttributeMappingDefinition instance() { - return INSTANCE; - } - - - /** - * Enforce singleton usage - */ - private JavaEclipseLinkOneToOneMappingDefinition2_0() { - super(); - } - - @Override - public Iterable<String> getSupportingAnnotationNames() { - return COMBINED_SUPPORTING_ANNOTATION_NAMES; - } - - protected static final String[] COMBINED_SUPPORTING_ANNOTATION_NAMES_ARRAY = ArrayTools.concatenate( - SUPPORTING_ANNOTATION_NAMES_ARRAY, - JavaOneToOneMappingDefinition2_0.SUPPORTING_ANNOTATION_NAMES_ARRAY_2_0, - JavaEclipseLinkOneToOneMappingDefinition.ECLIPSE_LINK_SUPPORTING_ANNOTATION_NAMES_ARRAY - ); - protected static final Iterable<String> COMBINED_SUPPORTING_ANNOTATION_NAMES = new ArrayIterable<String>(COMBINED_SUPPORTING_ANNOTATION_NAMES_ARRAY); - - public boolean isDefault(JavaPersistentAttribute persistentAttribute) { - return JavaEclipseLinkOneToOneMappingDefinition.instance().isDefault(persistentAttribute); - } -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/v2_0/context/orm/EclipseLinkOrmXml2_0ContextNodeFactory.java b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/v2_0/context/orm/EclipseLinkOrmXml2_0ContextNodeFactory.java deleted file mode 100644 index 4b48c65b03..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/v2_0/context/orm/EclipseLinkOrmXml2_0ContextNodeFactory.java +++ /dev/null @@ -1,107 +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.v2_0.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.OrmPersistentType; -import org.eclipse.jpt.jpa.core.context.orm.OrmSequenceGenerator; -import org.eclipse.jpt.jpa.core.context.orm.OrmAssociationOverrideContainer.Owner; -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.GenericOrmElementCollectionMapping2_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.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.XmlElementCollection; -import org.eclipse.jpt.jpa.core.resource.orm.XmlNamedQuery; -import org.eclipse.jpt.jpa.eclipselink.core.internal.context.orm.EclipseLinkOrmXmlContextNodeFactory; -import org.eclipse.jpt.jpa.eclipselink.core.internal.v1_1.context.orm.OrmEclipseLinkPersistentAttribute1_1; -import org.eclipse.jpt.jpa.eclipselink.core.resource.orm.XmlAttributeMapping; - -public class EclipseLinkOrmXml2_0ContextNodeFactory - extends EclipseLinkOrmXmlContextNodeFactory - implements OrmXml2_0ContextNodeFactory -{ - - @Override - public OrmPersistentAttribute buildOrmPersistentAttribute(OrmPersistentType parent, org.eclipse.jpt.jpa.core.resource.orm.XmlAttributeMapping resourceMapping) { - return new OrmEclipseLinkPersistentAttribute1_1(parent, (XmlAttributeMapping) resourceMapping); - } - - public OrmAssociationOverrideContainer buildOrmAssociationOverrideContainer(OrmEmbeddedMapping2_0 parent, 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, XmlElementCollection resourceMapping) { - return new GenericOrmElementCollectionMapping2_0(parent, 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/v2_0/context/orm/EclipseLinkOrmXml2_0Definition.java b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/v2_0/context/orm/EclipseLinkOrmXml2_0Definition.java deleted file mode 100644 index dd0488b986..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/v2_0/context/orm/EclipseLinkOrmXml2_0Definition.java +++ /dev/null @@ -1,120 +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.v2_0.context.orm; - -import java.util.ArrayList; -import org.eclipse.emf.ecore.EFactory; -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.OrmTypeMappingDefinition; -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.AbstractOrmXmlDefinition; -import org.eclipse.jpt.jpa.core.internal.context.orm.OrmBasicMappingDefinition; -import org.eclipse.jpt.jpa.core.internal.context.orm.OrmEmbeddableDefinition; -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.OrmEntityDefinition; -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.OrmMappedSuperclassDefinition; -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.context.orm.OrmEclipseLinkBasicCollectionMappingDefinition; -import org.eclipse.jpt.jpa.eclipselink.core.internal.context.orm.OrmEclipseLinkBasicMapMappingDefinition; -import org.eclipse.jpt.jpa.eclipselink.core.internal.context.orm.OrmEclipseLinkTransformationMappingDefinition; -import org.eclipse.jpt.jpa.eclipselink.core.internal.context.orm.OrmEclipseLinkVariableOneToOneMappingDefinition; -import org.eclipse.jpt.jpa.eclipselink.core.internal.v2_0.EclipseLink2_0JpaPlatformProvider; -import org.eclipse.jpt.jpa.eclipselink.core.resource.orm.EclipseLinkOrmFactory; - -public class EclipseLinkOrmXml2_0Definition - extends AbstractOrmXmlDefinition -{ - // singleton - private static final OrmXmlDefinition INSTANCE = new EclipseLinkOrmXml2_0Definition(); - - /** - * Return the singleton. - */ - public static OrmXmlDefinition instance() { - return INSTANCE; - } - - - /** - * Enforce singleton usage - */ - protected EclipseLinkOrmXml2_0Definition() { - super(); - } - - public JptResourceType getResourceType() { - return JptJpaEclipseLinkCorePlugin.ECLIPSELINK_ORM_XML_2_0_RESOURCE_TYPE; - } - - public EFactory getResourceNodeFactory() { - return EclipseLinkOrmFactory.eINSTANCE; - } - - @Override - protected OrmXmlContextNodeFactory buildContextNodeFactory() { - return new EclipseLinkOrmXml2_0ContextNodeFactory(); - } - - @Override - protected void addTypeMappingDefinitionsTo(ArrayList<OrmTypeMappingDefinition> definitions) { - CollectionTools.addAll(definitions, TYPE_MAPPING_DEFINITIONS); - } - - /** - * Order should not matter here; but we'll use the same order as for Java. - * @see EclipseLink2_0JpaPlatformProvider - */ - protected static final OrmTypeMappingDefinition[] TYPE_MAPPING_DEFINITIONS = new OrmTypeMappingDefinition[] { - OrmEntityDefinition.instance(), - OrmEmbeddableDefinition.instance(), - OrmMappedSuperclassDefinition.instance() - }; - - @Override - protected void addAttributeMappingDefinitionsTo(ArrayList<OrmAttributeMappingDefinition> definitions) { - CollectionTools.addAll(definitions, 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[] 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/v2_0/context/persistence/EclipseLink2_0PersistenceXmlContextNodeFactory.java b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/v2_0/context/persistence/EclipseLink2_0PersistenceXmlContextNodeFactory.java deleted file mode 100644 index b0bcb8392a..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/v2_0/context/persistence/EclipseLink2_0PersistenceXmlContextNodeFactory.java +++ /dev/null @@ -1,56 +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.v2_0.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.EclipseLinkPersistenceXmlContextNodeFactory; -import org.eclipse.jpt.jpa.eclipselink.core.internal.context.persistence.EclipseLinkJarFileRef; -import org.eclipse.jpt.jpa.eclipselink.core.internal.context.persistence.EclipseLinkPersistenceUnit; -import org.eclipse.jpt.jpa.eclipselink.core.internal.v2_0.context.persistence.connection.EclipseLinkConnection2_0; -import org.eclipse.jpt.jpa.eclipselink.core.internal.v2_0.context.persistence.logging.EclipseLinkLogging2_0; -import org.eclipse.jpt.jpa.eclipselink.core.internal.v2_0.context.persistence.options.EclipseLinkOptions2_0; - - -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/v2_0/context/persistence/EclipseLink2_0PersistenceXmlDefinition.java b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/v2_0/context/persistence/EclipseLink2_0PersistenceXmlDefinition.java deleted file mode 100644 index 1ecb71ad1f..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/v2_0/context/persistence/EclipseLink2_0PersistenceXmlDefinition.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.v2_0.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/v2_0/context/persistence/connection/EclipseLinkConnection2_0.java b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/v2_0/context/persistence/connection/EclipseLinkConnection2_0.java deleted file mode 100644 index 73c94659ed..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/v2_0/context/persistence/connection/EclipseLinkConnection2_0.java +++ /dev/null @@ -1,153 +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.v2_0.context.persistence.connection; - -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.Connection; -import org.eclipse.jpt.jpa.eclipselink.core.internal.context.persistence.connection.EclipseLinkConnection; -import org.eclipse.jpt.jpa.eclipselink.core.v2_0.context.persistence.connection.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/v2_0/context/persistence/logging/EclipseLinkLogging2_0.java b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/v2_0/context/persistence/logging/EclipseLinkLogging2_0.java deleted file mode 100644 index 58ac0a7bf4..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/v2_0/context/persistence/logging/EclipseLinkLogging2_0.java +++ /dev/null @@ -1,329 +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.v2_0.context.persistence.logging; - -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.logging.LoggingLevel; -import org.eclipse.jpt.jpa.eclipselink.core.internal.context.persistence.logging.EclipseLinkLogging; -import org.eclipse.jpt.jpa.eclipselink.core.v2_0.context.persistence.logging.Logging2_0; - -/** - * 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/v2_0/context/persistence/options/EclipseLinkOptions2_0.java b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/v2_0/context/persistence/options/EclipseLinkOptions2_0.java deleted file mode 100644 index 4a369d6962..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/v2_0/context/persistence/options/EclipseLinkOptions2_0.java +++ /dev/null @@ -1,350 +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.v2_0.context.persistence.options; - -import java.util.List; -import java.util.ListIterator; -import java.util.Map; - -import org.eclipse.jpt.common.utility.internal.iterators.CloneListIterator; -import org.eclipse.jpt.jpa.core.jpa2.context.persistence.PersistenceUnit2_0; -import org.eclipse.jpt.jpa.eclipselink.core.internal.context.persistence.options.EclipseLinkOptions; -import org.eclipse.jpt.jpa.eclipselink.core.v2_0.context.persistence.options.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 ListIterator<String> validationGroupPrePersists(){ - return new CloneListIterator<String>(this.validationGroupPrePersists); - } - - public int validationGroupPrePersistsSize(){ - 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 ( ListIterator<String> i = this.validationGroupPrePersists(); i.hasNext();) { - String validationGroupPrePersist = i.next(); - 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 ListIterator<String> validationGroupPreUpdates(){ - return new CloneListIterator<String>(this.validationGroupPreUpdates); - } - - public int validationGroupPreUpdatesSize(){ - 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(ListIterator<String> i = this.validationGroupPreUpdates(); i.hasNext();) { - String validationGroupPreUpdate = i.next(); - 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 ListIterator<String> validationGroupPreRemoves(){ - return new CloneListIterator<String>(this.validationGroupPreRemoves); - } - - public int validationGroupPreRemovesSize(){ - 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(ListIterator<String> i = this.validationGroupPreRemoves(); i.hasNext();) { - String validationGroupPreRemove = i.next(); - 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/v2_0/ddlgen/EclipseLink2_0DDLGenerator.java b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/v2_0/ddlgen/EclipseLink2_0DDLGenerator.java deleted file mode 100644 index 819eacac5e..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/v2_0/ddlgen/EclipseLink2_0DDLGenerator.java +++ /dev/null @@ -1,85 +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.v2_0.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.Customization; -import org.eclipse.jpt.jpa.eclipselink.core.internal.ddlgen.AbstractEclipseLinkDDLGenerator; - -/** - * 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, IProgressMonitor monitor) { - if (puName == null || puName.length() == 0 || project == null) { - throw new NullPointerException(); - } - new EclipseLink2_0DDLGenerator(puName, project).generate(monitor); - } - - private EclipseLink2_0DDLGenerator(String puName, JpaProject jpaProject) { - super(puName, jpaProject); - } - - // ********** 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/v2_1/AbstractEclipseLink2_1JpaPlatformProvider.java b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/v2_1/AbstractEclipseLink2_1JpaPlatformProvider.java deleted file mode 100644 index 215b1d2095..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/v2_1/AbstractEclipseLink2_1JpaPlatformProvider.java +++ /dev/null @@ -1,46 +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.v2_1; - -import java.util.ArrayList; -import org.eclipse.core.runtime.content.IContentType; -import org.eclipse.jpt.common.core.JptResourceType; -import org.eclipse.jpt.jpa.core.ResourceDefinition; -import org.eclipse.jpt.jpa.eclipselink.core.JptJpaEclipseLinkCorePlugin; -import org.eclipse.jpt.jpa.eclipselink.core.internal.v2_0.AbstractEclipseLink2_0JpaPlatformProvider; -import org.eclipse.jpt.jpa.eclipselink.core.internal.v2_1.context.orm.EclipseLinkOrmXml2_1Definition; - -public abstract class AbstractEclipseLink2_1JpaPlatformProvider - extends AbstractEclipseLink2_0JpaPlatformProvider -{ - protected AbstractEclipseLink2_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/v2_1/EclipseLink2_1JpaAnnotationDefinitionProvider.java b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/v2_1/EclipseLink2_1JpaAnnotationDefinitionProvider.java deleted file mode 100644 index f805af9411..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/v2_1/EclipseLink2_1JpaAnnotationDefinitionProvider.java +++ /dev/null @@ -1,112 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.eclipselink.core.internal.v2_1; - -import java.util.ArrayList; -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.core.resource.java.AnnotationDefinition; -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; -import org.eclipse.jpt.jpa.eclipselink.core.internal.v2_1.resource.java.EclipseLinkClassExtractor2_1AnnotationDefinition; - -/** - * Provides annotations for 1.0 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 addTypeAnnotationDefinitionsTo(ArrayList<AnnotationDefinition> definitions) { - CollectionTools.addAll(definitions, TYPE_ANNOTATION_DEFINITIONS); - } - - protected static final AnnotationDefinition[] TYPE_ANNOTATION_DEFINITIONS = new AnnotationDefinition[] { - EclipseLinkCacheAnnotationDefinition.instance(), - EclipseLinkChangeTrackingAnnotationDefinition.instance(), - EclipseLinkClassExtractor2_1AnnotationDefinition.instance(), - EclipseLinkConverterAnnotationDefinition.instance(), - EclipseLinkCustomizerAnnotationDefinition.instance(), - EclipseLinkExistenceCheckingAnnotationDefinition.instance(), - EclipseLinkObjectTypeConverterAnnotationDefinition.instance(), - EclipseLinkPrimaryKeyAnnotationDefinition.instance(), - EclipseLinkReadOnlyAnnotationDefinition.instance(), - EclipseLinkStructConverterAnnotationDefinition.instance(), - EclipseLinkTypeConverterAnnotationDefinition.instance() - }; - - @Override - protected void addTypeMappingAnnotationDefinitionsTo(ArrayList<AnnotationDefinition> definitions) { - // nothing new for EclipseLink 2.1 - } - - @Override - protected void addAttributeAnnotationDefinitionsTo(ArrayList<AnnotationDefinition> definitions) { - CollectionTools.addAll(definitions, ATTRIBUTE_ANNOTATION_DEFINITIONS); - } - - protected static final AnnotationDefinition[] ATTRIBUTE_ANNOTATION_DEFINITIONS = new AnnotationDefinition[] { - EclipseLinkBasicCollectionAnnotationDefinition.instance(), - EclipseLinkBasicMapAnnotationDefinition.instance(), - EclipseLinkConvertAnnotationDefinition.instance(), - EclipseLinkConverterAnnotationDefinition.instance(), - EclipseLinkJoinFetchAnnotationDefinition.instance(), - EclipseLinkMutableAnnotationDefinition.instance(), - EclipseLinkObjectTypeConverterAnnotationDefinition.instance(), - EclipseLinkPrivateOwnedAnnotationDefinition.instance(), - EclipseLinkReadTransformerAnnotationDefinition.instance(), - EclipseLinkStructConverterAnnotationDefinition.instance(), - EclipseLinkTransformationAnnotationDefinition.instance(), - EclipseLinkTypeConverterAnnotationDefinition.instance(), - EclipseLinkVariableOneToOneAnnotationDefinition.instance(), - EclipseLinkWriteTransformerAnnotationDefinition.instance() - }; - - @Override - protected void addPackageAnnotationDefinitionsTo(ArrayList<AnnotationDefinition> definitions) { - // no package annotations - } -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/v2_1/EclipseLink2_1JpaPlatformFactory.java b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/v2_1/EclipseLink2_1JpaPlatformFactory.java deleted file mode 100644 index 3057b5c970..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/v2_1/EclipseLink2_1JpaPlatformFactory.java +++ /dev/null @@ -1,72 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010 Oracle. - * All rights reserved. This program and the accompanying materials are - * made available under the terms of the Eclipse Public License v1.0 which - * accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Oracle - initial API and implementation - *******************************************************************************/ -package org.eclipse.jpt.jpa.eclipselink.core.internal.v2_1; - -import org.eclipse.jpt.jpa.core.JpaAnnotationProvider; -import org.eclipse.jpt.jpa.core.JpaFacet; -import org.eclipse.jpt.jpa.core.JpaPlatform; -import org.eclipse.jpt.jpa.core.internal.GenericJpaAnnotationProvider; -import org.eclipse.jpt.jpa.core.internal.GenericJpaPlatform; -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.jpt.jpa.eclipselink.core.internal.v2_0.EclipseLink2_0JpaFactory; -import org.eclipse.jpt.jpa.eclipselink.core.internal.v2_0.EclipseLink2_0JpaPlatformFactory; - -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.buildJpaAnnotationProvider(), - EclipseLink2_1JpaPlatformProvider.instance(), - this.buildJpaVariation()); - } - - @Override - protected JpaPlatform.Version buildJpaVersion() { - return new EclipseLinkVersion( - JptJpaEclipseLinkCorePlugin.ECLIPSELINK_PLATFORM_VERSION_2_1, - JpaFacet.VERSION_2_0.getVersionString()); - } - - @Override - protected JpaAnnotationProvider buildJpaAnnotationProvider() { - return new GenericJpaAnnotationProvider( - Generic2_0JpaAnnotationDefinitionProvider.instance(), - EclipseLink2_1JpaAnnotationDefinitionProvider.instance()); - } - -// @Override -// protected JpaPlatformVariation buildJpaVariation() { -// return new JpaPlatformVariation() { -// public Supported getTablePerConcreteClassInheritanceIsSupported() { -// return Supported.YES; -// } -// -// public boolean isJoinTableOverridable() { -// return true; -// } -// }; -// } -}
\ 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/v2_1/EclipseLink2_1JpaPlatformProvider.java b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/v2_1/EclipseLink2_1JpaPlatformProvider.java deleted file mode 100644 index e2bc1f0063..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/v2_1/EclipseLink2_1JpaPlatformProvider.java +++ /dev/null @@ -1,38 +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.v2_1; - -import org.eclipse.jpt.jpa.core.JpaPlatformProvider; - -/** - * EclipseLink 2.1 platform config - */ -public class EclipseLink2_1JpaPlatformProvider - extends AbstractEclipseLink2_1JpaPlatformProvider -{ - // 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(); - } -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/v2_1/context/orm/EclipseLinkOrmElementCollectionMapping2_1.java b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/v2_1/context/orm/EclipseLinkOrmElementCollectionMapping2_1.java deleted file mode 100644 index 1ec55abca7..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/v2_1/context/orm/EclipseLinkOrmElementCollectionMapping2_1.java +++ /dev/null @@ -1,64 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.eclipselink.core.internal.v2_1.context.orm; - -import java.util.List; -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.context.EclipseLinkJoinFetch; -import org.eclipse.jpt.jpa.eclipselink.core.internal.context.orm.OrmEclipseLinkJoinFetch; -import org.eclipse.jpt.jpa.eclipselink.core.resource.orm.XmlElementCollection; -import org.eclipse.jpt.jpa.eclipselink.core.v2_0.context.EclipseLinkElementCollectionMapping2_0; -import org.eclipse.wst.validation.internal.provisional.core.IMessage; -import org.eclipse.wst.validation.internal.provisional.core.IReporter; - -public class EclipseLinkOrmElementCollectionMapping2_1 - extends AbstractOrmElementCollectionMapping2_0<XmlElementCollection> - implements EclipseLinkElementCollectionMapping2_0 -{ - protected final OrmEclipseLinkJoinFetch joinFetch; - - - public EclipseLinkOrmElementCollectionMapping2_1(OrmPersistentAttribute parent, XmlElementCollection resourceMapping) { - super(parent, resourceMapping); - 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/v2_1/context/orm/EclipseLinkOrmXml2_1ContextNodeFactory.java b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/v2_1/context/orm/EclipseLinkOrmXml2_1ContextNodeFactory.java deleted file mode 100644 index f50c523054..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/v2_1/context/orm/EclipseLinkOrmXml2_1ContextNodeFactory.java +++ /dev/null @@ -1,38 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.eclipselink.core.internal.v2_1.context.orm; - -import org.eclipse.jpt.jpa.core.context.orm.OrmPersistentAttribute; -import org.eclipse.jpt.jpa.core.jpa2.context.orm.OrmElementCollectionMapping2_0; -import org.eclipse.jpt.jpa.eclipselink.core.internal.context.orm.AbstractOrmEclipseLinkBasicCollectionMapping; -import org.eclipse.jpt.jpa.eclipselink.core.internal.context.orm.AbstractOrmEclipseLinkBasicMapMapping; -import org.eclipse.jpt.jpa.eclipselink.core.internal.v2_0.context.orm.EclipseLinkOrmXml2_0ContextNodeFactory; -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.XmlElementCollection; - -public class EclipseLinkOrmXml2_1ContextNodeFactory - extends EclipseLinkOrmXml2_0ContextNodeFactory -{ - @Override - public OrmElementCollectionMapping2_0 buildOrmElementCollectionMapping2_0(OrmPersistentAttribute parent, org.eclipse.jpt.jpa.core.resource.orm.XmlElementCollection resourceMapping) { - return new EclipseLinkOrmElementCollectionMapping2_1(parent, (XmlElementCollection) resourceMapping); - } - - @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/v2_1/context/orm/EclipseLinkOrmXml2_1Definition.java b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/v2_1/context/orm/EclipseLinkOrmXml2_1Definition.java deleted file mode 100644 index d0687ec0a5..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/v2_1/context/orm/EclipseLinkOrmXml2_1Definition.java +++ /dev/null @@ -1,48 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.eclipselink.core.internal.v2_1.context.orm; - -import org.eclipse.jpt.common.core.JptResourceType; -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; -import org.eclipse.jpt.jpa.eclipselink.core.internal.v2_0.context.orm.EclipseLinkOrmXml2_0Definition; - -public class EclipseLinkOrmXml2_1Definition - extends EclipseLinkOrmXml2_0Definition -{ - // singleton - private static final OrmXmlDefinition INSTANCE = new EclipseLinkOrmXml2_1Definition(); - - /** - * Return the singleton. - */ - public static OrmXmlDefinition instance() { - return INSTANCE; - } - - - /** - * Enforce singleton usage - */ - protected EclipseLinkOrmXml2_1Definition() { - super(); - } - - @Override - public JptResourceType getResourceType() { - return JptJpaEclipseLinkCorePlugin.ECLIPSELINK_ORM_XML_2_1_RESOURCE_TYPE; - } - - @Override - protected OrmXmlContextNodeFactory buildContextNodeFactory() { - return new EclipseLinkOrmXml2_1ContextNodeFactory(); - } -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/v2_1/context/orm/OrmEclipseLinkBasicCollectionMapping2_1.java b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/v2_1/context/orm/OrmEclipseLinkBasicCollectionMapping2_1.java deleted file mode 100644 index 276e1b0253..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/v2_1/context/orm/OrmEclipseLinkBasicCollectionMapping2_1.java +++ /dev/null @@ -1,43 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.eclipselink.core.internal.v2_1.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.internal.context.orm.AbstractOrmEclipseLinkBasicCollectionMapping; -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); - if ( ! this.isVirtual()) { // if virtual the underlying java annotation will have a java deprecation warning - 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/v2_1/context/orm/OrmEclipseLinkBasicMapMapping2_1.java b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/v2_1/context/orm/OrmEclipseLinkBasicMapMapping2_1.java deleted file mode 100644 index 66e1fc798f..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/v2_1/context/orm/OrmEclipseLinkBasicMapMapping2_1.java +++ /dev/null @@ -1,43 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.eclipselink.core.internal.v2_1.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.internal.context.orm.AbstractOrmEclipseLinkBasicMapMapping; -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); - if ( ! this.isVirtual()) { //if virtual the underlying java annotation will have a java deprecation warning - 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/v2_1/resource/java/EclipseLinkClassExtractor2_1AnnotationDefinition.java b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/v2_1/resource/java/EclipseLinkClassExtractor2_1AnnotationDefinition.java deleted file mode 100644 index 79ef56ae10..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/v2_1/resource/java/EclipseLinkClassExtractor2_1AnnotationDefinition.java +++ /dev/null @@ -1,62 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.eclipselink.core.internal.v2_1.resource.java; - -import org.eclipse.jdt.core.IAnnotation; -import org.eclipse.jpt.common.core.utility.jdt.AnnotatedElement; -import org.eclipse.jpt.common.core.utility.jdt.Type; -import org.eclipse.jpt.jpa.core.resource.java.Annotation; -import org.eclipse.jpt.jpa.core.resource.java.AnnotationDefinition; -import org.eclipse.jpt.jpa.core.resource.java.JavaResourceAnnotatedElement; -import org.eclipse.jpt.jpa.core.resource.java.JavaResourcePersistentType; -import org.eclipse.jpt.jpa.eclipselink.core.internal.v2_1.resource.java.binary.BinaryEclipseLinkClassExtractorAnnotation2_1; -import org.eclipse.jpt.jpa.eclipselink.core.internal.v2_1.resource.java.source.SourceEclipseLinkClassExtractorAnnotation2_1; -import org.eclipse.jpt.jpa.eclipselink.core.v2_0.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((JavaResourcePersistentType) parent, (Type) annotatedElement); - } - - public Annotation buildNullAnnotation(JavaResourceAnnotatedElement parent) { - throw new UnsupportedOperationException(); - } - - public Annotation buildAnnotation(JavaResourceAnnotatedElement parent, IAnnotation jdtAnnotation) { - return new BinaryEclipseLinkClassExtractorAnnotation2_1((JavaResourcePersistentType) 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/v2_1/resource/java/binary/BinaryEclipseLinkClassExtractorAnnotation2_1.java b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/v2_1/resource/java/binary/BinaryEclipseLinkClassExtractorAnnotation2_1.java deleted file mode 100644 index e301c8c690..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/v2_1/resource/java/binary/BinaryEclipseLinkClassExtractorAnnotation2_1.java +++ /dev/null @@ -1,78 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.eclipselink.core.internal.v2_1.resource.java.binary; - -import org.eclipse.jdt.core.IAnnotation; -import org.eclipse.jdt.core.dom.CompilationUnit; -import org.eclipse.jpt.common.core.utility.TextRange; -import org.eclipse.jpt.jpa.core.internal.resource.java.binary.BinaryAnnotation; -import org.eclipse.jpt.jpa.core.resource.java.JavaResourcePersistentType; -import org.eclipse.jpt.jpa.eclipselink.core.v2_0.resource.java.EclipseLink2_1; -import org.eclipse.jpt.jpa.eclipselink.core.v2_0.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(JavaResourcePersistentType 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(EclipseLink2_1.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/v2_1/resource/java/source/SourceEclipseLinkClassExtractorAnnotation2_1.java b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/v2_1/resource/java/source/SourceEclipseLinkClassExtractorAnnotation2_1.java deleted file mode 100644 index 8cc162b57b..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/v2_1/resource/java/source/SourceEclipseLinkClassExtractorAnnotation2_1.java +++ /dev/null @@ -1,138 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.eclipselink.core.internal.v2_1.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.SimpleDeclarationAnnotationAdapter; -import org.eclipse.jpt.common.core.internal.utility.jdt.SimpleTypeStringExpressionConverter; -import org.eclipse.jpt.common.core.utility.TextRange; -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.Type; -import org.eclipse.jpt.jpa.core.internal.resource.java.source.SourceAnnotation; -import org.eclipse.jpt.jpa.core.resource.java.JavaResourcePersistentType; -import org.eclipse.jpt.jpa.eclipselink.core.v2_0.resource.java.EclipseLink2_1; -import org.eclipse.jpt.jpa.eclipselink.core.v2_0.resource.java.EclipseLinkClassExtractorAnnotation2_1; - -/** - * org.eclipse.persistence.annotations.ClassExtractor - */ -public final class SourceEclipseLinkClassExtractorAnnotation2_1 - extends SourceAnnotation<Type> - 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(JavaResourcePersistentType parent, Type type) { - super(parent, type, DECLARATION_ANNOTATION_ADAPTER); - this.valueAdapter = new AnnotatedElementAnnotationElementAdapter<String>(type, 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, EclipseLink2_1.CLASS_EXTRACTOR__VALUE, SimpleTypeStringExpressionConverter.instance()); - } - -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/v2_2/EclipseLink2_2JpaPlatformFactory.java b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/v2_2/EclipseLink2_2JpaPlatformFactory.java deleted file mode 100644 index 9cb5c9e2b2..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/v2_2/EclipseLink2_2JpaPlatformFactory.java +++ /dev/null @@ -1,73 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010 Oracle. - * All rights reserved. This program and the accompanying materials are - * made available under the terms of the Eclipse Public License v1.0 which - * accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Oracle - initial API and implementation - *******************************************************************************/ -package org.eclipse.jpt.jpa.eclipselink.core.internal.v2_2; - -import org.eclipse.jpt.jpa.core.JpaAnnotationProvider; -import org.eclipse.jpt.jpa.core.JpaFacet; -import org.eclipse.jpt.jpa.core.JpaPlatform; -import org.eclipse.jpt.jpa.core.internal.GenericJpaAnnotationProvider; -import org.eclipse.jpt.jpa.core.internal.GenericJpaPlatform; -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.jpt.jpa.eclipselink.core.internal.v2_0.EclipseLink2_0JpaFactory; -import org.eclipse.jpt.jpa.eclipselink.core.internal.v2_0.EclipseLink2_0JpaPlatformFactory; -import org.eclipse.jpt.jpa.eclipselink.core.internal.v2_1.EclipseLink2_1JpaAnnotationDefinitionProvider; - -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.buildJpaAnnotationProvider(), - EclipseLink2_2JpaPlatformProvider.instance(), - this.buildJpaVariation()); - } - - @Override - protected JpaPlatform.Version buildJpaVersion() { - return new EclipseLinkVersion( - JptJpaEclipseLinkCorePlugin.ECLIPSELINK_PLATFORM_VERSION_2_2, - JpaFacet.VERSION_2_0.getVersionString()); - } - - @Override - protected JpaAnnotationProvider buildJpaAnnotationProvider() { - return new GenericJpaAnnotationProvider( - Generic2_0JpaAnnotationDefinitionProvider.instance(), - EclipseLink2_1JpaAnnotationDefinitionProvider.instance()); - } - -// @Override -// protected JpaPlatformVariation buildJpaVariation() { -// return new JpaPlatformVariation() { -// public Supported getTablePerConcreteClassInheritanceIsSupported() { -// return Supported.YES; -// } -// -// public boolean isJoinTableOverridable() { -// return true; -// } -// }; -// } -}
\ 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/v2_2/EclipseLink2_2JpaPlatformProvider.java b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/v2_2/EclipseLink2_2JpaPlatformProvider.java deleted file mode 100644 index 5e5776793a..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/v2_2/EclipseLink2_2JpaPlatformProvider.java +++ /dev/null @@ -1,62 +0,0 @@ -/******************************************************************************* -* Copyright (c) 2010 Oracle. All rights reserved. -* This program and the accompanying materials are made available under the -* terms of the Eclipse Public License v1.0, which accompanies this distribution -* and is available at http://www.eclipse.org/legal/epl-v10.html. -* -* Contributors: -* Oracle - initial API and implementation -*******************************************************************************/ -package org.eclipse.jpt.jpa.eclipselink.core.internal.v2_2; - -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.v2_1.AbstractEclipseLink2_1JpaPlatformProvider; -import org.eclipse.jpt.jpa.eclipselink.core.internal.v2_2.context.orm.EclipseLinkOrmXml2_2Definition; - -public class EclipseLink2_2JpaPlatformProvider - extends AbstractEclipseLink2_1JpaPlatformProvider -{ - // 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); - definitions.add(EclipseLinkOrmXml2_2Definition.instance()); - } -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/v2_2/context/orm/EclipseLinkOrmXml2_2Definition.java b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/v2_2/context/orm/EclipseLinkOrmXml2_2Definition.java deleted file mode 100644 index 96825cf109..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/v2_2/context/orm/EclipseLinkOrmXml2_2Definition.java +++ /dev/null @@ -1,98 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010 Oracle. - * All rights reserved. This program and the accompanying materials are - * made available under the terms of the Eclipse Public License v1.0 which - * accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Oracle - initial API and implementation - *******************************************************************************/ -package org.eclipse.jpt.jpa.eclipselink.core.internal.v2_2.context.orm; - -import org.eclipse.jpt.common.core.JptResourceType; -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; -import org.eclipse.jpt.jpa.eclipselink.core.internal.v2_1.context.orm.EclipseLinkOrmXml2_1ContextNodeFactory; -import org.eclipse.jpt.jpa.eclipselink.core.internal.v2_1.context.orm.EclipseLinkOrmXml2_1Definition; - -public class EclipseLinkOrmXml2_2Definition - extends EclipseLinkOrmXml2_1Definition -{ - // 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 -// public EFactory getResourceNodeFactory() { -// return EclipseLinkOrmFactory.eINSTANCE; -// } - - @Override - protected OrmXmlContextNodeFactory buildContextNodeFactory() { - return new EclipseLinkOrmXml2_1ContextNodeFactory(); - } - - @Override - public JptResourceType getResourceType() { - return JptJpaEclipseLinkCorePlugin.ECLIPSELINK_ORM_XML_2_2_RESOURCE_TYPE; - } - - - // ********* ORM type mappings ********* - -// @Override -// protected OrmTypeMappingDefinition[] buildOrmTypeMappingDefinitions() { -// // order should not matter here, but we'll use the same order as for java -// // @see {@link EclipseLink1_1JpaPlatformProvider} -// // NOTE: no new type mapping providers from eclipselink 1.0 to 1.1 -// return new OrmTypeMappingDefinition[] { -// OrmEntityDefinition.instance(), -// OrmEmbeddableDefinition.instance(), -// OrmMappedSuperclassDefinition.instance()}; -// } - - - // ********** ORM attribute mappings ********** - -// @Override -// protected OrmAttributeMappingDefinition[] buildOrmAttributeMappingDefinitions() { -// // order should not matter here, but we'll use the same order as for java -// // @see {@link EclipseLink1_1JpaPlatformProvider} -// return 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()}; -// } -} |