diff options
Diffstat (limited to 'jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/java')
43 files changed, 0 insertions, 5630 deletions
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/java/EclipseLinkJavaBasicCollectionMappingDefinition.java b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/java/EclipseLinkJavaBasicCollectionMappingDefinition.java deleted file mode 100644 index ba2342c574..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/java/EclipseLinkJavaBasicCollectionMappingDefinition.java +++ /dev/null @@ -1,66 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2008, 2011 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.eclipselink.core.internal.context.java; - -import org.eclipse.jpt.common.utility.internal.iterables.EmptyIterable; -import org.eclipse.jpt.jpa.core.JpaFactory; -import org.eclipse.jpt.jpa.core.context.java.JavaAttributeMapping; -import org.eclipse.jpt.jpa.core.context.java.JavaAttributeMappingDefinition; -import org.eclipse.jpt.jpa.core.context.java.JavaPersistentAttribute; -import org.eclipse.jpt.jpa.eclipselink.core.EclipseLinkMappingKeys; -import org.eclipse.jpt.jpa.eclipselink.core.internal.EclipseLinkJpaFactory; -import org.eclipse.jpt.jpa.eclipselink.core.resource.java.EclipseLinkBasicCollectionAnnotation; - -public class EclipseLinkJavaBasicCollectionMappingDefinition - implements JavaAttributeMappingDefinition -{ - // singleton - private static final JavaAttributeMappingDefinition INSTANCE = new EclipseLinkJavaBasicCollectionMappingDefinition(); - - /** - * Return the singleton. - */ - public static JavaAttributeMappingDefinition instance() { - return INSTANCE; - } - - - /** - * Enforce singleton usage - */ - private EclipseLinkJavaBasicCollectionMappingDefinition() { - super(); - } - - public String getKey() { - return EclipseLinkMappingKeys.BASIC_COLLECTION_ATTRIBUTE_MAPPING_KEY; - } - - public String getAnnotationName() { - return EclipseLinkBasicCollectionAnnotation.ANNOTATION_NAME; - } - - public boolean isSpecified(JavaPersistentAttribute persistentAttribute) { - return persistentAttribute.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/EclipseLinkJavaBasicMapMappingDefinition.java b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/java/EclipseLinkJavaBasicMapMappingDefinition.java deleted file mode 100644 index 9fb520b36d..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/java/EclipseLinkJavaBasicMapMappingDefinition.java +++ /dev/null @@ -1,66 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2008, 2011 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.eclipselink.core.internal.context.java; - -import org.eclipse.jpt.common.utility.internal.iterables.EmptyIterable; -import org.eclipse.jpt.jpa.core.JpaFactory; -import org.eclipse.jpt.jpa.core.context.java.JavaAttributeMapping; -import org.eclipse.jpt.jpa.core.context.java.JavaAttributeMappingDefinition; -import org.eclipse.jpt.jpa.core.context.java.JavaPersistentAttribute; -import org.eclipse.jpt.jpa.eclipselink.core.EclipseLinkMappingKeys; -import org.eclipse.jpt.jpa.eclipselink.core.internal.EclipseLinkJpaFactory; -import org.eclipse.jpt.jpa.eclipselink.core.resource.java.EclipseLinkBasicMapAnnotation; - -public class EclipseLinkJavaBasicMapMappingDefinition - implements JavaAttributeMappingDefinition -{ - // singleton - private static final JavaAttributeMappingDefinition INSTANCE = new EclipseLinkJavaBasicMapMappingDefinition(); - - /** - * Return the singleton. - */ - public static JavaAttributeMappingDefinition instance() { - return INSTANCE; - } - - - /** - * Enforce singleton usage - */ - private EclipseLinkJavaBasicMapMappingDefinition() { - super(); - } - - public String getKey() { - return EclipseLinkMappingKeys.BASIC_MAP_ATTRIBUTE_MAPPING_KEY; - } - - public String getAnnotationName() { - return EclipseLinkBasicMapAnnotation.ANNOTATION_NAME; - } - - public boolean isSpecified(JavaPersistentAttribute persistentAttribute) { - return persistentAttribute.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/EclipseLinkJavaBasicMappingDefinition.java b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/java/EclipseLinkJavaBasicMappingDefinition.java deleted file mode 100644 index 2c0ab5a74a..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/java/EclipseLinkJavaBasicMappingDefinition.java +++ /dev/null @@ -1,65 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010, 2011 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.eclipselink.core.internal.context.java; - -import org.eclipse.jpt.common.utility.internal.iterables.ArrayIterable; -import org.eclipse.jpt.common.utility.internal.iterables.CompositeIterable; -import org.eclipse.jpt.jpa.core.context.java.DefaultJavaAttributeMappingDefinition; -import org.eclipse.jpt.jpa.core.internal.context.java.DefaultJavaAttributeMappingDefinitionWrapper; -import org.eclipse.jpt.jpa.core.internal.context.java.JavaBasicMappingDefinition; -import org.eclipse.jpt.jpa.eclipselink.core.resource.java.EclipseLinkConvertAnnotation; -import org.eclipse.jpt.jpa.eclipselink.core.resource.java.EclipseLinkMutableAnnotation; - -public class EclipseLinkJavaBasicMappingDefinition - extends DefaultJavaAttributeMappingDefinitionWrapper -{ - private static final DefaultJavaAttributeMappingDefinition DELEGATE = JavaBasicMappingDefinition.instance(); - - // singleton - private static final DefaultJavaAttributeMappingDefinition INSTANCE = new EclipseLinkJavaBasicMappingDefinition(); - - /** - * Return the singleton. - */ - public static DefaultJavaAttributeMappingDefinition instance() { - return INSTANCE; - } - - - /** - * Enforce singleton usage - */ - private EclipseLinkJavaBasicMappingDefinition() { - super(); - } - - @Override - protected DefaultJavaAttributeMappingDefinition getDelegate() { - return DELEGATE; - } - - @Override - public Iterable<String> getSupportingAnnotationNames() { - return COMBINED_SUPPORTING_ANNOTATION_NAMES; - } - - private static final String[] ECLIPSE_LINK_SUPPORTING_ANNOTATION_NAMES_ARRAY = new String[] { - EclipseLinkMutableAnnotation.ANNOTATION_NAME, - EclipseLinkConvertAnnotation.ANNOTATION_NAME, - }; - // 'public' because the EclipseLink Id and Version mappings also support these annotations - public static final Iterable<String> ECLIPSE_LINK_SUPPORTING_ANNOTATION_NAMES = new ArrayIterable<String>(ECLIPSE_LINK_SUPPORTING_ANNOTATION_NAMES_ARRAY); - - @SuppressWarnings("unchecked") - private static final Iterable<String> COMBINED_SUPPORTING_ANNOTATION_NAMES = new CompositeIterable<String>( - DELEGATE.getSupportingAnnotationNames(), - ECLIPSE_LINK_SUPPORTING_ANNOTATION_NAMES - ); -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/java/EclipseLinkJavaIdMappingDefinition.java b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/java/EclipseLinkJavaIdMappingDefinition.java deleted file mode 100644 index 7bbfb2547b..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/java/EclipseLinkJavaIdMappingDefinition.java +++ /dev/null @@ -1,55 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010, 2011 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.eclipselink.core.internal.context.java; - -import org.eclipse.jpt.common.utility.internal.iterables.CompositeIterable; -import org.eclipse.jpt.jpa.core.context.java.JavaAttributeMappingDefinition; -import org.eclipse.jpt.jpa.core.internal.context.java.JavaAttributeMappingDefinitionWrapper; -import org.eclipse.jpt.jpa.core.internal.context.java.JavaIdMappingDefinition; - -public class EclipseLinkJavaIdMappingDefinition - extends JavaAttributeMappingDefinitionWrapper -{ - private static final JavaAttributeMappingDefinition DELEGATE = JavaIdMappingDefinition.instance(); - - // singleton - private static final JavaAttributeMappingDefinition INSTANCE = new EclipseLinkJavaIdMappingDefinition(); - - /** - * Return the singleton. - */ - public static JavaAttributeMappingDefinition instance() { - return INSTANCE; - } - - - /** - * Enforce singleton usage - */ - private EclipseLinkJavaIdMappingDefinition() { - super(); - } - - @Override - protected JavaAttributeMappingDefinition getDelegate() { - return DELEGATE; - } - - @Override - public Iterable<String> getSupportingAnnotationNames() { - return COMBINED_SUPPORTING_ANNOTATION_NAMES; - } - - @SuppressWarnings("unchecked") - private static final Iterable<String> COMBINED_SUPPORTING_ANNOTATION_NAMES = new CompositeIterable<String>( - DELEGATE.getSupportingAnnotationNames(), - EclipseLinkJavaBasicMappingDefinition.ECLIPSE_LINK_SUPPORTING_ANNOTATION_NAMES - ); -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/java/EclipseLinkJavaManyToManyMappingDefinition.java b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/java/EclipseLinkJavaManyToManyMappingDefinition.java deleted file mode 100644 index 2fb4b88c87..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/java/EclipseLinkJavaManyToManyMappingDefinition.java +++ /dev/null @@ -1,62 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010, 2011 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.eclipselink.core.internal.context.java; - -import org.eclipse.jpt.common.utility.internal.iterables.ArrayIterable; -import org.eclipse.jpt.common.utility.internal.iterables.CompositeIterable; -import org.eclipse.jpt.jpa.core.context.java.JavaAttributeMappingDefinition; -import org.eclipse.jpt.jpa.core.internal.context.java.JavaAttributeMappingDefinitionWrapper; -import org.eclipse.jpt.jpa.core.internal.context.java.JavaManyToManyMappingDefinition; -import org.eclipse.jpt.jpa.eclipselink.core.resource.java.EclipseLinkJoinFetchAnnotation; - -public class EclipseLinkJavaManyToManyMappingDefinition - extends JavaAttributeMappingDefinitionWrapper -{ - private static final JavaAttributeMappingDefinition DELEGATE = JavaManyToManyMappingDefinition.instance(); - - // singleton - private static final JavaAttributeMappingDefinition INSTANCE = new EclipseLinkJavaManyToManyMappingDefinition(); - - /** - * Return the singleton. - */ - public static JavaAttributeMappingDefinition instance() { - return INSTANCE; - } - - - /** - * Enforce singleton usage - */ - private EclipseLinkJavaManyToManyMappingDefinition() { - super(); - } - - @Override - protected JavaAttributeMappingDefinition getDelegate() { - return DELEGATE; - } - - @Override - public Iterable<String> getSupportingAnnotationNames() { - return COMBINED_SUPPORTING_ANNOTATION_NAMES; - } - - public static final String[] ECLIPSE_LINK_SUPPORTING_ANNOTATION_NAMES_ARRAY = new String[] { - EclipseLinkJoinFetchAnnotation.ANNOTATION_NAME - }; - public static final Iterable<String> ECLIPSE_LINK_SUPPORTING_ANNOTATION_NAMES = new ArrayIterable<String>(ECLIPSE_LINK_SUPPORTING_ANNOTATION_NAMES_ARRAY); - - @SuppressWarnings("unchecked") - private static final Iterable<String> COMBINED_SUPPORTING_ANNOTATION_NAMES = new CompositeIterable<String>( - DELEGATE.getSupportingAnnotationNames(), - ECLIPSE_LINK_SUPPORTING_ANNOTATION_NAMES - ); -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/java/EclipseLinkJavaManyToOneMappingDefinition.java b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/java/EclipseLinkJavaManyToOneMappingDefinition.java deleted file mode 100644 index ecbf7312e0..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/java/EclipseLinkJavaManyToOneMappingDefinition.java +++ /dev/null @@ -1,62 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010, 2011 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.eclipselink.core.internal.context.java; - -import org.eclipse.jpt.common.utility.internal.iterables.ArrayIterable; -import org.eclipse.jpt.common.utility.internal.iterables.CompositeIterable; -import org.eclipse.jpt.jpa.core.context.java.JavaAttributeMappingDefinition; -import org.eclipse.jpt.jpa.core.internal.context.java.JavaAttributeMappingDefinitionWrapper; -import org.eclipse.jpt.jpa.core.internal.context.java.JavaManyToOneMappingDefinition; -import org.eclipse.jpt.jpa.eclipselink.core.resource.java.EclipseLinkJoinFetchAnnotation; - -public class EclipseLinkJavaManyToOneMappingDefinition - extends JavaAttributeMappingDefinitionWrapper -{ - private static final JavaAttributeMappingDefinition DELEGATE = JavaManyToOneMappingDefinition.instance(); - - // singleton - private static final JavaAttributeMappingDefinition INSTANCE = new EclipseLinkJavaManyToOneMappingDefinition(); - - /** - * Return the singleton. - */ - public static JavaAttributeMappingDefinition instance() { - return INSTANCE; - } - - - /** - * Enforce singleton usage - */ - private EclipseLinkJavaManyToOneMappingDefinition() { - super(); - } - - @Override - protected JavaAttributeMappingDefinition getDelegate() { - return DELEGATE; - } - - @Override - public Iterable<String> getSupportingAnnotationNames() { - return COMBINED_SUPPORTING_ANNOTATION_NAMES; - } - - private static final String[] ECLIPSE_LINK_SUPPORTING_ANNOTATION_NAMES_ARRAY = new String[] { - EclipseLinkJoinFetchAnnotation.ANNOTATION_NAME - }; - public static final Iterable<String> ECLIPSE_LINK_SUPPORTING_ANNOTATION_NAMES = new ArrayIterable<String>(ECLIPSE_LINK_SUPPORTING_ANNOTATION_NAMES_ARRAY); - - @SuppressWarnings("unchecked") - private static final Iterable<String> COMBINED_SUPPORTING_ANNOTATION_NAMES = new CompositeIterable<String>( - DELEGATE.getSupportingAnnotationNames(), - ECLIPSE_LINK_SUPPORTING_ANNOTATION_NAMES - ); -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/java/EclipseLinkJavaOneToManyMappingDefinition.java b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/java/EclipseLinkJavaOneToManyMappingDefinition.java deleted file mode 100644 index eb09de2581..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/java/EclipseLinkJavaOneToManyMappingDefinition.java +++ /dev/null @@ -1,73 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2008, 2011 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.eclipselink.core.internal.context.java; - -import org.eclipse.jpt.common.utility.internal.iterables.ArrayIterable; -import org.eclipse.jpt.common.utility.internal.iterables.CompositeIterable; -import org.eclipse.jpt.jpa.core.context.java.DefaultJavaAttributeMappingDefinition; -import org.eclipse.jpt.jpa.core.context.java.JavaAttributeMappingDefinition; -import org.eclipse.jpt.jpa.core.context.java.JavaPersistentAttribute; -import org.eclipse.jpt.jpa.core.internal.context.java.JavaAttributeMappingDefinitionWrapper; -import org.eclipse.jpt.jpa.core.internal.context.java.JavaOneToManyMappingDefinition; -import org.eclipse.jpt.jpa.eclipselink.core.resource.java.EclipseLinkJoinFetchAnnotation; -import org.eclipse.jpt.jpa.eclipselink.core.resource.java.EclipseLinkPrivateOwnedAnnotation; - -public class EclipseLinkJavaOneToManyMappingDefinition - extends JavaAttributeMappingDefinitionWrapper - implements DefaultJavaAttributeMappingDefinition -{ - private static final JavaAttributeMappingDefinition DELEGATE = JavaOneToManyMappingDefinition.instance(); - - // singleton - private static final DefaultJavaAttributeMappingDefinition INSTANCE = new EclipseLinkJavaOneToManyMappingDefinition(); - - /** - * Return the singleton. - */ - public static DefaultJavaAttributeMappingDefinition instance() { - return INSTANCE; - } - - - /** - * Enforce singleton usage - */ - private EclipseLinkJavaOneToManyMappingDefinition() { - super(); - } - - @Override - protected JavaAttributeMappingDefinition getDelegate() { - return DELEGATE; - } - - @Override - public Iterable<String> getSupportingAnnotationNames() { - return COMBINED_SUPPORTING_ANNOTATION_NAMES; - } - - private static final String[] ECLIPSE_LINK_SUPPORTING_ANNOTATION_NAMES_ARRAY = new String[] { - EclipseLinkJoinFetchAnnotation.ANNOTATION_NAME, - EclipseLinkPrivateOwnedAnnotation.ANNOTATION_NAME - }; - public static final Iterable<String> ECLIPSE_LINK_SUPPORTING_ANNOTATION_NAMES = new ArrayIterable<String>(ECLIPSE_LINK_SUPPORTING_ANNOTATION_NAMES_ARRAY); - - @SuppressWarnings("unchecked") - private static final Iterable<String> COMBINED_SUPPORTING_ANNOTATION_NAMES = new CompositeIterable<String>( - DELEGATE.getSupportingAnnotationNames(), - ECLIPSE_LINK_SUPPORTING_ANNOTATION_NAMES - ); - - public boolean isDefault(JavaPersistentAttribute persistentAttribute) { - String targetEntity = persistentAttribute.getMultiReferenceTargetTypeName(); - return (targetEntity != null) - && (persistentAttribute.getPersistenceUnit().getEntity(targetEntity) != null); - } -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/java/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/EclipseLinkJavaOneToOneMappingDefinition.java b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/java/EclipseLinkJavaOneToOneMappingDefinition.java deleted file mode 100644 index fa78682973..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/java/EclipseLinkJavaOneToOneMappingDefinition.java +++ /dev/null @@ -1,73 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2008, 2011 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.eclipselink.core.internal.context.java; - -import org.eclipse.jpt.common.utility.internal.iterables.ArrayIterable; -import org.eclipse.jpt.common.utility.internal.iterables.CompositeIterable; -import org.eclipse.jpt.jpa.core.context.java.DefaultJavaAttributeMappingDefinition; -import org.eclipse.jpt.jpa.core.context.java.JavaAttributeMappingDefinition; -import org.eclipse.jpt.jpa.core.context.java.JavaPersistentAttribute; -import org.eclipse.jpt.jpa.core.internal.context.java.JavaAttributeMappingDefinitionWrapper; -import org.eclipse.jpt.jpa.core.internal.context.java.JavaOneToOneMappingDefinition; -import org.eclipse.jpt.jpa.eclipselink.core.resource.java.EclipseLinkJoinFetchAnnotation; -import org.eclipse.jpt.jpa.eclipselink.core.resource.java.EclipseLinkPrivateOwnedAnnotation; - -public class EclipseLinkJavaOneToOneMappingDefinition - extends JavaAttributeMappingDefinitionWrapper - implements DefaultJavaAttributeMappingDefinition -{ - private static final JavaAttributeMappingDefinition DELEGATE = JavaOneToOneMappingDefinition.instance(); - - // singleton - private static final DefaultJavaAttributeMappingDefinition INSTANCE = new EclipseLinkJavaOneToOneMappingDefinition(); - - /** - * Return the singleton. - */ - public static DefaultJavaAttributeMappingDefinition instance() { - return INSTANCE; - } - - - /** - * Enforce singleton usage - */ - private EclipseLinkJavaOneToOneMappingDefinition() { - super(); - } - - @Override - protected JavaAttributeMappingDefinition getDelegate() { - return DELEGATE; - } - - @Override - public Iterable<String> getSupportingAnnotationNames() { - return COMBINED_SUPPORTING_ANNOTATION_NAMES; - } - - private static final String[] ECLIPSE_LINK_SUPPORTING_ANNOTATION_NAMES_ARRAY = new String[] { - EclipseLinkJoinFetchAnnotation.ANNOTATION_NAME, - EclipseLinkPrivateOwnedAnnotation.ANNOTATION_NAME - }; - public static final Iterable<String> ECLIPSE_LINK_SUPPORTING_ANNOTATION_NAMES = new ArrayIterable<String>(ECLIPSE_LINK_SUPPORTING_ANNOTATION_NAMES_ARRAY); - - @SuppressWarnings("unchecked") - private static final Iterable<String> COMBINED_SUPPORTING_ANNOTATION_NAMES = new CompositeIterable<String>( - DELEGATE.getSupportingAnnotationNames(), - ECLIPSE_LINK_SUPPORTING_ANNOTATION_NAMES - ); - - public boolean isDefault(JavaPersistentAttribute persistentAttribute) { - String targetEntity = persistentAttribute.getSingleReferenceTargetTypeName(); - return (targetEntity != null) - && (persistentAttribute.getPersistenceUnit().getEntity(targetEntity) != null); - } -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/java/EclipseLinkJavaTimeOfDay.java b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/java/EclipseLinkJavaTimeOfDay.java deleted file mode 100644 index d04f0dc00b..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/java/EclipseLinkJavaTimeOfDay.java +++ /dev/null @@ -1,147 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2008, 2011 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.eclipselink.core.internal.context.java; - -import org.eclipse.jdt.core.dom.CompilationUnit; -import org.eclipse.jpt.common.core.utility.TextRange; -import org.eclipse.jpt.jpa.core.internal.context.java.AbstractJavaJpaContextNode; -import org.eclipse.jpt.jpa.eclipselink.core.context.EclipseLinkTimeOfDay; -import org.eclipse.jpt.jpa.eclipselink.core.context.java.JavaEclipseLinkCaching; -import org.eclipse.jpt.jpa.eclipselink.core.resource.java.EclipseLinkTimeOfDayAnnotation; - -public class EclipseLinkJavaTimeOfDay - extends AbstractJavaJpaContextNode - implements EclipseLinkTimeOfDay -{ - protected final EclipseLinkTimeOfDayAnnotation todAnnotation; - - protected Integer hour; - protected Integer minute; - protected Integer second; - protected Integer millisecond; - - - public EclipseLinkJavaTimeOfDay(JavaEclipseLinkCaching parent, EclipseLinkTimeOfDayAnnotation todAnnotation) { - super(parent); - this.todAnnotation = todAnnotation; - this.hour = todAnnotation.getHour(); - this.minute = todAnnotation.getMinute(); - this.second = todAnnotation.getSecond(); - this.millisecond = todAnnotation.getMillisecond(); - } - - - // ********** synchronize/update ********** - - @Override - public void synchronizeWithResourceModel() { - super.synchronizeWithResourceModel(); - this.setHour_(this.todAnnotation.getHour()); - this.setMinute_(this.todAnnotation.getMinute()); - this.setSecond_(this.todAnnotation.getSecond()); - this.setMillisecond_(this.todAnnotation.getMillisecond()); - } - - - // ********** hour ********** - - public Integer getHour() { - return this.hour; - } - - public void setHour(Integer hour) { - this.todAnnotation.setHour(hour); - this.setHour_(hour); - } - - protected void setHour_(Integer hour) { - Integer old = this.hour; - this.hour = hour; - this.firePropertyChanged(HOUR_PROPERTY, old, hour); - } - - - // ********** minute ********** - - public Integer getMinute() { - return this.minute; - } - - public void setMinute(Integer minute) { - this.todAnnotation.setMinute(minute); - this.setMinute_(minute); - } - - protected void setMinute_(Integer minute) { - Integer old = this.minute; - this.minute = minute; - this.firePropertyChanged(MINUTE_PROPERTY, old, minute); - } - - - // ********** second ********** - - public Integer getSecond() { - return this.second; - } - - public void setSecond(Integer second) { - this.todAnnotation.setSecond(second); - this.setSecond_(second); - } - - protected void setSecond_(Integer second) { - Integer old = this.second; - this.second = second; - this.firePropertyChanged(SECOND_PROPERTY, old, second); - } - - - // ********** millisecond ********** - - public Integer getMillisecond() { - return this.millisecond; - } - - public void setMillisecond(Integer millisecond) { - this.todAnnotation.setMillisecond(millisecond); - this.setMillisecond_(millisecond); - } - - protected void setMillisecond_(Integer millisecond) { - Integer old = this.millisecond; - this.millisecond = millisecond; - this.firePropertyChanged(MILLISECOND_PROPERTY, old, millisecond); - } - - - // ********** misc ********** - - @Override - public JavaEclipseLinkCaching getParent() { - return (JavaEclipseLinkCaching) super.getParent(); - } - - public JavaEclipseLinkCaching getCaching() { - return this.getParent(); - } - - public EclipseLinkTimeOfDayAnnotation getTimeOfDayAnnotation() { - return this.todAnnotation; - } - - - // ********** validation ********** - - public TextRange getValidationTextRange(CompilationUnit astRoot) { - TextRange textRange = this.todAnnotation.getTextRange(astRoot); - return (textRange != null) ? textRange : this.getCaching().getValidationTextRange(astRoot); - } -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/java/EclipseLinkJavaTransformationMappingDefinition.java b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/java/EclipseLinkJavaTransformationMappingDefinition.java deleted file mode 100644 index f20f2d8037..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/java/EclipseLinkJavaTransformationMappingDefinition.java +++ /dev/null @@ -1,66 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2008, 2011 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.eclipselink.core.internal.context.java; - -import org.eclipse.jpt.common.utility.internal.iterables.EmptyIterable; -import org.eclipse.jpt.jpa.core.JpaFactory; -import org.eclipse.jpt.jpa.core.context.java.JavaAttributeMapping; -import org.eclipse.jpt.jpa.core.context.java.JavaAttributeMappingDefinition; -import org.eclipse.jpt.jpa.core.context.java.JavaPersistentAttribute; -import org.eclipse.jpt.jpa.eclipselink.core.EclipseLinkMappingKeys; -import org.eclipse.jpt.jpa.eclipselink.core.internal.EclipseLinkJpaFactory; -import org.eclipse.jpt.jpa.eclipselink.core.resource.java.EclipseLinkTransformationAnnotation; - -public class EclipseLinkJavaTransformationMappingDefinition - implements JavaAttributeMappingDefinition -{ - // singleton - private static final JavaAttributeMappingDefinition INSTANCE = new EclipseLinkJavaTransformationMappingDefinition(); - - /** - * Return the singleton. - */ - public static JavaAttributeMappingDefinition instance() { - return INSTANCE; - } - - - /** - * Enforce singleton usage - */ - private EclipseLinkJavaTransformationMappingDefinition() { - super(); - } - - public String getKey() { - return EclipseLinkMappingKeys.TRANSFORMATION_ATTRIBUTE_MAPPING_KEY; - } - - public String getAnnotationName() { - return EclipseLinkTransformationAnnotation.ANNOTATION_NAME; - } - - public boolean isSpecified(JavaPersistentAttribute persistentAttribute) { - return persistentAttribute.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/EclipseLinkJavaVariableOneToOneMappingDefinition.java b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/java/EclipseLinkJavaVariableOneToOneMappingDefinition.java deleted file mode 100644 index f95b071d27..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/java/EclipseLinkJavaVariableOneToOneMappingDefinition.java +++ /dev/null @@ -1,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 EclipseLinkJavaVariableOneToOneMappingDefinition - implements DefaultJavaAttributeMappingDefinition -{ - // singleton - private static final DefaultJavaAttributeMappingDefinition INSTANCE = new EclipseLinkJavaVariableOneToOneMappingDefinition(); - - /** - * Return the singleton. - */ - public static DefaultJavaAttributeMappingDefinition instance() { - return INSTANCE; - } - - - /** - * Enforce singleton usage - */ - private EclipseLinkJavaVariableOneToOneMappingDefinition() { - super(); - } - - public String getKey() { - return EclipseLinkMappingKeys.VARIABLE_ONE_TO_ONE_ATTRIBUTE_MAPPING_KEY; - } - - public String getAnnotationName() { - return EclipseLinkVariableOneToOneAnnotation.ANNOTATION_NAME; - } - - public boolean isSpecified(JavaPersistentAttribute persistentAttribute) { - return persistentAttribute.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/EclipseLinkJavaVersionMappingDefinition.java b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/java/EclipseLinkJavaVersionMappingDefinition.java deleted file mode 100644 index 71d233c1ec..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/java/EclipseLinkJavaVersionMappingDefinition.java +++ /dev/null @@ -1,55 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010, 2011 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.eclipselink.core.internal.context.java; - -import org.eclipse.jpt.common.utility.internal.iterables.CompositeIterable; -import org.eclipse.jpt.jpa.core.context.java.JavaAttributeMappingDefinition; -import org.eclipse.jpt.jpa.core.internal.context.java.JavaAttributeMappingDefinitionWrapper; -import org.eclipse.jpt.jpa.core.internal.context.java.JavaVersionMappingDefinition; - -public class EclipseLinkJavaVersionMappingDefinition - extends JavaAttributeMappingDefinitionWrapper -{ - private static final JavaAttributeMappingDefinition DELEGATE = JavaVersionMappingDefinition.instance(); - - // singleton - private static final JavaAttributeMappingDefinition INSTANCE = new EclipseLinkJavaVersionMappingDefinition(); - - /** - * Return the singleton. - */ - public static JavaAttributeMappingDefinition instance() { - return INSTANCE; - } - - - /** - * Enforce singleton usage - */ - private EclipseLinkJavaVersionMappingDefinition() { - super(); - } - - @Override - protected JavaAttributeMappingDefinition getDelegate() { - return DELEGATE; - } - - @Override - public Iterable<String> getSupportingAnnotationNames() { - return COMBINED_SUPPORTING_ANNOTATION_NAMES; - } - - @SuppressWarnings("unchecked") - private static final Iterable<String> COMBINED_SUPPORTING_ANNOTATION_NAMES = new CompositeIterable<String>( - DELEGATE.getSupportingAnnotationNames(), - EclipseLinkJavaBasicMappingDefinition.ECLIPSE_LINK_SUPPORTING_ANNOTATION_NAMES - ); -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/java/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/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/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/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 64a913015a..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/java/JavaEclipseLinkChangeTracking.java +++ /dev/null @@ -1,142 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2008, 2011 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.eclipselink.core.internal.context.java; - -import org.eclipse.jdt.core.dom.CompilationUnit; -import org.eclipse.jpt.common.core.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) { - TextRange textRange = this.getAnnotationTextRange(astRoot); - return (textRange != null) ? textRange : this.getTypeMapping().getValidationTextRange(astRoot); - } - - protected TextRange getAnnotationTextRange(CompilationUnit astRoot) { - EclipseLinkChangeTrackingAnnotation annotation = this.getChangeTrackingAnnotation(); - return (annotation == null) ? null : annotation.getTextRange(astRoot); - } -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/java/JavaEclipseLinkConversionValue.java b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/java/JavaEclipseLinkConversionValue.java deleted file mode 100644 index d54092d149..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,141 +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; - } - - - // ********** 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) - ) - ); - } - } - - protected TextRange getDataValueTextRange(CompilationUnit astRoot) { - return this.getValidationTextRange(this.conversionValueAnnotation.getDataValueTextRange(astRoot), astRoot); - } - - protected TextRange getObjectValueTextRange(CompilationUnit astRoot) { - return this.getValidationTextRange(this.conversionValueAnnotation.getObjectValueTextRange(astRoot), astRoot); - } - - public TextRange getValidationTextRange(CompilationUnit astRoot) { - TextRange textRange = this.conversionValueAnnotation.getTextRange(astRoot); - return (textRange != null) ? textRange : this.getObjectTypeConverter().getValidationTextRange(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 dffb14d720..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,358 +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.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.context.persistence.EclipseLinkPersistenceUnit; -import org.eclipse.jpt.jpa.eclipselink.core.internal.DefaultEclipseLinkJpaValidationMessages; -import org.eclipse.jpt.jpa.eclipselink.core.internal.EclipseLinkJpaValidationMessages; -import org.eclipse.jpt.jpa.eclipselink.core.resource.java.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) - ) - ); - } - - @Override - protected TextRange getAnnotationTextRange(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 788762cb7d..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,262 +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.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.context.persistence.EclipseLinkPersistenceUnit; -import org.eclipse.jpt.jpa.eclipselink.core.internal.DefaultEclipseLinkJpaValidationMessages; -import org.eclipse.jpt.jpa.eclipselink.core.internal.EclipseLinkJpaValidationMessages; -import org.eclipse.jpt.jpa.eclipselink.core.resource.java.EclipseLinkNamedConverterAnnotation; -import org.eclipse.wst.validation.internal.provisional.core.IMessage; -import org.eclipse.wst.validation.internal.provisional.core.IReporter; - -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 ********** - - @Override - public JavaJpaContextNode getParent() { - return (JavaJpaContextNode) super.getParent(); - } - - public A getConverterAnnotation() { - return this.converterAnnotation; - } - - @Override - public EclipseLinkPersistenceUnit getPersistenceUnit() { - return (EclipseLinkPersistenceUnit) super.getPersistenceUnit(); - } - - public char getEnclosingTypeSeparator() { - return '.'; - } - - @Override - public void toString(StringBuilder sb) { - sb.append(this.name); - } - - - // ********** validation ********** - - 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) { - TextRange textRange = this.converterAnnotation.getTextRange(astRoot); - return (textRange != null) ? textRange : this.getParent().getValidationTextRange(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 this.getValidationTextRange(this.getConverterAnnotation().getNameTextRange(astRoot), 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){ - if (StringTools.stringIsEmpty(this.name)) { - messages.add( - DefaultEclipseLinkJpaValidationMessages.buildMessage( - IMessage.HIGH_SEVERITY, - EclipseLinkJpaValidationMessages.CONVERTER_NAME_UNDEFINED, - EMPTY_STRING_ARRAY, - 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(this.name)){ - messages.add( - DefaultEclipseLinkJpaValidationMessages.buildMessage( - IMessage.HIGH_SEVERITY, - EclipseLinkJpaValidationMessages.CONVERTER_DUPLICATE_NAME, - new String[] {this.name}, - this, - this.getNameTextRange(astRoot) - )); - reportedNames.add(this.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 f5a90336b7..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,341 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2008, 2011 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.eclipselink.core.internal.context.java; - -import java.util.List; -import org.eclipse.jdt.core.dom.CompilationUnit; -import org.eclipse.jpt.common.core.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) { - TextRange textRange = this.getResourcePersistentType().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/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 e9b61f9204..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, 2011 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.eclipselink.core.internal.context.java; - -import java.util.List; -import org.eclipse.jdt.core.dom.CompilationUnit; -import org.eclipse.jpt.common.core.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.getValidationTextRange(this.converterAnnotation.getConverterClassTextRange(astRoot), 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 47e0b3d25a..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,203 +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.IJavaProject; -import org.eclipse.jdt.core.dom.CompilationUnit; -import org.eclipse.jpt.common.core.internal.utility.JDTTools; -import org.eclipse.jpt.common.core.utility.TextRange; -import org.eclipse.jpt.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.validateCustomizerClass(messages, astRoot); - } - - protected void validateCustomizerClass(List<IMessage> messages,CompilationUnit astRoot) { - IJavaProject javaProject = getPersistenceUnit().getJpaProject().getJavaProject(); - EclipseLinkCustomizerAnnotation annotation = this.getCustomizerAnnotation(); - if (annotation != null && annotation.getValue() != null) { - if (!JDTTools.classHasPublicZeroArgConstructor(javaProject, this.getFullyQualifiedCustomizerClass())) { - messages.add( - DefaultEclipseLinkJpaValidationMessages.buildMessage( - IMessage.HIGH_SEVERITY, - EclipseLinkJpaValidationMessages.DESCRIPTOR_CUSTOMIZER_CLASS_NOT_VALID, - new String[] {this.getFullyQualifiedCustomizerClass()}, - this, - this.getCustomizerClassTextRange(astRoot) - ) - ); - } else if (!annotation.customizerClassImplementsInterface(ECLIPSELINK_DESCRIPTOR_CUSTOMIZER_CLASS_NAME, astRoot)) { - messages.add( - DefaultEclipseLinkJpaValidationMessages.buildMessage( - IMessage.HIGH_SEVERITY, - EclipseLinkJpaValidationMessages.DESCRIPTOR_CUSTOMIZER_CLASS_IMPLEMENTS_DESCRIPTOR_CUSTOMIZER, - new String[] {this.getFullyQualifiedCustomizerClass()}, - this, - this.getCustomizerClassTextRange(astRoot) - ) - ); - } - } - } - - protected TextRange getCustomizerClassTextRange(CompilationUnit astRoot) { - return this.getValidationTextRange(this.getCustomizerAnnotation().getValueTextRange(astRoot), astRoot); - } - - public TextRange getValidationTextRange(CompilationUnit astRoot) { - TextRange textRange = this.getCustomizerAnnotation().getTextRange(astRoot); - return (textRange != null) ? textRange : this.getTypeMapping().getValidationTextRange(astRoot); - } -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/java/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/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 bb0854ab43..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/java/JavaEclipseLinkJoinFetch.java +++ /dev/null @@ -1,136 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2008, 2011 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.eclipselink.core.internal.context.java; - -import org.eclipse.jdt.core.dom.CompilationUnit; -import org.eclipse.jpt.common.core.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) { - TextRange textRange = this.getAnnotationTextRange(astRoot); - return (textRange != null) ? textRange : this.getAttributeMapping().getValidationTextRange(astRoot); - } - - protected TextRange getAnnotationTextRange(CompilationUnit astRoot) { - EclipseLinkJoinFetchAnnotation annotation = this.getJoinFetchAnnotation(); - return (annotation == null) ? null : annotation.getTextRange(astRoot); - } -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/java/JavaEclipseLinkManyToManyMapping.java b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/java/JavaEclipseLinkManyToManyMapping.java deleted file mode 100644 index 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/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/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 6ea6d02a2b..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,174 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2008, 2011 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.eclipselink.core.internal.context.java; - -import org.eclipse.jdt.core.dom.CompilationUnit; -import org.eclipse.jpt.common.core.utility.TextRange; -import org.eclipse.jpt.jpa.core.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.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) { - TextRange textRange = this.getAnnotationTextRange(astRoot); - return (textRange != null) ? textRange : this.getAttributeMapping().getValidationTextRange(astRoot); - } - - protected TextRange getAnnotationTextRange(CompilationUnit astRoot) { - EclipseLinkMutableAnnotation annotation = this.getMutableAnnotation(); - return (annotation == null) ? null : annotation.getTextRange(astRoot); - } -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/java/JavaEclipseLinkObjectTypeConverter.java b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/java/JavaEclipseLinkObjectTypeConverter.java deleted file mode 100644 index 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/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/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 8807f5c2d3..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/java/JavaEclipseLinkPrivateOwned.java +++ /dev/null @@ -1,122 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2008, 2011 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.eclipselink.core.internal.context.java; - -import org.eclipse.jdt.core.dom.CompilationUnit; -import org.eclipse.jpt.common.core.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) { - TextRange textRange = this.getAnnotationTextRange(astRoot); - return (textRange != null) ? textRange : this.getAttributeMapping().getValidationTextRange(astRoot); - } - - protected TextRange getAnnotationTextRange(CompilationUnit astRoot) { - EclipseLinkPrivateOwnedAnnotation annotation = this.getPrivateOwnedAnnotation(); - return (annotation == null) ? null : annotation.getTextRange(astRoot); - } -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/java/JavaEclipseLinkReadOnly.java b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/java/JavaEclipseLinkReadOnly.java deleted file mode 100644 index f9531590f4..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/java/JavaEclipseLinkReadOnly.java +++ /dev/null @@ -1,136 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2008, 2011 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.eclipselink.core.internal.context.java; - -import org.eclipse.jdt.core.dom.CompilationUnit; -import org.eclipse.jpt.common.core.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) { - TextRange textRange = this.getAnnotationTextRange(astRoot); - return (textRange != null) ? textRange : this.getTypeMapping().getValidationTextRange(astRoot); - } - - protected TextRange getAnnotationTextRange(CompilationUnit astRoot) { - EclipseLinkReadOnlyAnnotation annotation = this.getReadOnlyAnnotation(); - return (annotation == null) ? null : annotation.getTextRange(astRoot); - } -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/java/JavaEclipseLinkStructConverter.java b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/java/JavaEclipseLinkStructConverter.java deleted file mode 100644 index dff0a1ddb1..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,164 +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.IJavaProject; -import org.eclipse.jdt.core.dom.CompilationUnit; -import org.eclipse.jpt.common.core.internal.utility.JDTTools; -import org.eclipse.jpt.common.core.utility.TextRange; -import org.eclipse.jpt.common.utility.internal.StringTools; -import org.eclipse.jpt.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_STRUCT_CONVERTER_CLASS_NAME)) { - messages.add( - DefaultEclipseLinkJpaValidationMessages.buildMessage( - IMessage.HIGH_SEVERITY, - EclipseLinkJpaValidationMessages.STRUCT_CONVERTER_CLASS_IMPLEMENTS_STRUCT_CONVERTER, - new String[] {this.converterClass}, - this, - getConverterClassTextRange(astRoot) - ) - ); - } - } - - private boolean converterClassExists(IJavaProject javaProject) { - return (this.converterClass != null) && - (JDTTools.findType(javaProject, this.converterClass) != null); - } - - private boolean converterClassImplementsInterface(IJavaProject javaProject, String interfaceName) { - return (this.converterClass != null) && - JDTTools.typeNamedImplementsInterfaceNamed(javaProject, this.converterClass, interfaceName); - } - - protected TextRange getConverterClassTextRange(CompilationUnit astRoot) { - return this.getValidationTextRange(this.converterAnnotation.getConverterTextRange(astRoot), 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/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/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 99d795de4e..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,94 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2008, 2011 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.eclipselink.core.internal.context.java; - -import java.util.List; -import org.eclipse.jdt.core.dom.CompilationUnit; -import org.eclipse.jpt.common.utility.internal.ArrayTools; -import org.eclipse.jpt.common.utility.internal.iterables.CompositeIterable; -import org.eclipse.jpt.jpa.core.context.java.JavaConverter; -import org.eclipse.jpt.jpa.core.context.java.JavaPersistentAttribute; -import org.eclipse.jpt.jpa.core.internal.context.java.AbstractJavaVersionMapping; -import org.eclipse.jpt.jpa.eclipselink.core.context.EclipseLinkMutable; -import org.eclipse.jpt.jpa.eclipselink.core.context.EclipseLinkVersionMapping; -import org.eclipse.jpt.jpa.eclipselink.core.internal.DefaultEclipseLinkJpaValidationMessages; -import org.eclipse.jpt.jpa.eclipselink.core.internal.EclipseLinkJpaValidationMessages; -import org.eclipse.wst.validation.internal.provisional.core.IMessage; -import org.eclipse.wst.validation.internal.provisional.core.IReporter; - -public class JavaEclipseLinkVersionMapping - extends AbstractJavaVersionMapping - implements EclipseLinkVersionMapping -{ - 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); - } - - @Override - protected void validateAttributeType(List<IMessage> messages, CompilationUnit astRoot) { - if (!ArrayTools.contains(VERSION_MAPPING_SUPPORTED_TYPES, this.getPersistentAttribute().getTypeName())) { - messages.add( - DefaultEclipseLinkJpaValidationMessages.buildMessage( - IMessage.HIGH_SEVERITY, - EclipseLinkJpaValidationMessages.PERSISTENT_ATTRIBUTE_INVALID_VERSION_MAPPING_TYPE, - new String[] {this.getName()}, - this, - this.getValidationTextRange(astRoot) - ) - ); - } - } -} |