diff options
Diffstat (limited to 'jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context')
112 files changed, 0 insertions, 15976 deletions
diff --git a/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/java/JavaEclipseLinkBasicCollectionMapping.java b/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/java/JavaEclipseLinkBasicCollectionMapping.java deleted file mode 100644 index a55a364f44..0000000000 --- a/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/java/JavaEclipseLinkBasicCollectionMapping.java +++ /dev/null @@ -1,34 +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.eclipselink.core.internal.context.java; - -import org.eclipse.jpt.core.context.java.JavaPersistentAttribute; -import org.eclipse.jpt.core.internal.context.java.AbstractJavaAttributeMapping; -import org.eclipse.jpt.eclipselink.core.EclipseLinkMappingKeys; -import org.eclipse.jpt.eclipselink.core.context.EclipseLinkBasicCollectionMapping; -import org.eclipse.jpt.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; - } - - public String getAnnotationName() { - return EclipseLinkBasicCollectionAnnotation.ANNOTATION_NAME; - } -} diff --git a/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/java/JavaEclipseLinkBasicCollectionMappingDefinition.java b/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/java/JavaEclipseLinkBasicCollectionMappingDefinition.java deleted file mode 100644 index acfa0d8526..0000000000 --- a/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/java/JavaEclipseLinkBasicCollectionMappingDefinition.java +++ /dev/null @@ -1,56 +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.eclipselink.core.internal.context.java; - -import org.eclipse.jpt.core.JpaFactory; -import org.eclipse.jpt.core.context.java.JavaAttributeMapping; -import org.eclipse.jpt.core.context.java.JavaAttributeMappingDefinition; -import org.eclipse.jpt.core.context.java.JavaPersistentAttribute; -import org.eclipse.jpt.core.internal.context.java.AbstractJavaAttributeMappingDefinition; -import org.eclipse.jpt.eclipselink.core.EclipseLinkMappingKeys; -import org.eclipse.jpt.eclipselink.core.internal.EclipseLinkJpaFactory; -import org.eclipse.jpt.eclipselink.core.resource.java.EclipseLinkBasicCollectionAnnotation; - -public class JavaEclipseLinkBasicCollectionMappingDefinition - extends AbstractJavaAttributeMappingDefinition -{ - // singleton - private static final JavaEclipseLinkBasicCollectionMappingDefinition INSTANCE = - new JavaEclipseLinkBasicCollectionMappingDefinition(); - - - /** - * Return the singleton. - */ - public static JavaAttributeMappingDefinition instance() { - return INSTANCE; - } - - - /** - * Enforce singleton usage - */ - private JavaEclipseLinkBasicCollectionMappingDefinition() { - super(); - } - - - public String getKey() { - return EclipseLinkMappingKeys.BASIC_COLLECTION_ATTRIBUTE_MAPPING_KEY; - } - - public String getAnnotationName() { - return EclipseLinkBasicCollectionAnnotation.ANNOTATION_NAME; - } - - public JavaAttributeMapping buildMapping(JavaPersistentAttribute parent, JpaFactory factory) { - return ((EclipseLinkJpaFactory) factory).buildJavaEclipseLinkBasicCollectionMapping(parent); - } -} diff --git a/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/java/JavaEclipseLinkBasicMapMapping.java b/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/java/JavaEclipseLinkBasicMapMapping.java deleted file mode 100644 index f47d1728eb..0000000000 --- a/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/java/JavaEclipseLinkBasicMapMapping.java +++ /dev/null @@ -1,34 +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.eclipselink.core.internal.context.java; - -import org.eclipse.jpt.core.context.java.JavaPersistentAttribute; -import org.eclipse.jpt.core.internal.context.java.AbstractJavaAttributeMapping; -import org.eclipse.jpt.eclipselink.core.EclipseLinkMappingKeys; -import org.eclipse.jpt.eclipselink.core.context.EclipseLinkBasicMapMapping; -import org.eclipse.jpt.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; - } - - public String getAnnotationName() { - return EclipseLinkBasicMapAnnotation.ANNOTATION_NAME; - } -} diff --git a/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/java/JavaEclipseLinkBasicMapMappingDefinition.java b/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/java/JavaEclipseLinkBasicMapMappingDefinition.java deleted file mode 100644 index a80ce1ed46..0000000000 --- a/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/java/JavaEclipseLinkBasicMapMappingDefinition.java +++ /dev/null @@ -1,56 +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.eclipselink.core.internal.context.java; - -import org.eclipse.jpt.core.JpaFactory; -import org.eclipse.jpt.core.context.java.JavaAttributeMapping; -import org.eclipse.jpt.core.context.java.JavaAttributeMappingDefinition; -import org.eclipse.jpt.core.context.java.JavaPersistentAttribute; -import org.eclipse.jpt.core.internal.context.java.AbstractJavaAttributeMappingDefinition; -import org.eclipse.jpt.eclipselink.core.EclipseLinkMappingKeys; -import org.eclipse.jpt.eclipselink.core.internal.EclipseLinkJpaFactory; -import org.eclipse.jpt.eclipselink.core.resource.java.EclipseLinkBasicMapAnnotation; - -public class JavaEclipseLinkBasicMapMappingDefinition - extends AbstractJavaAttributeMappingDefinition -{ - // singleton - private static final JavaEclipseLinkBasicMapMappingDefinition INSTANCE = - new JavaEclipseLinkBasicMapMappingDefinition(); - - - /** - * Return the singleton. - */ - public static JavaAttributeMappingDefinition instance() { - return INSTANCE; - } - - - /** - * Enforce singleton usage - */ - private JavaEclipseLinkBasicMapMappingDefinition() { - super(); - } - - - public String getKey() { - return EclipseLinkMappingKeys.BASIC_MAP_ATTRIBUTE_MAPPING_KEY; - } - - public String getAnnotationName() { - return EclipseLinkBasicMapAnnotation.ANNOTATION_NAME; - } - - public JavaAttributeMapping buildMapping(JavaPersistentAttribute parent, JpaFactory factory) { - return ((EclipseLinkJpaFactory) factory).buildJavaEclipseLinkBasicMapMapping(parent); - } -} diff --git a/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/java/JavaEclipseLinkBasicMapping.java b/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/java/JavaEclipseLinkBasicMapping.java deleted file mode 100644 index a055d6a65f..0000000000 --- a/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/java/JavaEclipseLinkBasicMapping.java +++ /dev/null @@ -1,119 +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.eclipselink.core.internal.context.java; - -import java.util.Iterator; -import java.util.List; -import java.util.Vector; - -import org.eclipse.jdt.core.dom.CompilationUnit; -import org.eclipse.jpt.core.context.java.JavaConverter; -import org.eclipse.jpt.core.context.java.JavaPersistentAttribute; -import org.eclipse.jpt.core.internal.context.java.AbstractJavaBasicMapping; -import org.eclipse.jpt.eclipselink.core.context.EclipseLinkBasicMapping; -import org.eclipse.jpt.eclipselink.core.context.EclipseLinkConvert; -import org.eclipse.jpt.eclipselink.core.context.EclipseLinkMutable; -import org.eclipse.jpt.eclipselink.core.resource.java.EclipseLink; -import org.eclipse.jpt.eclipselink.core.resource.java.EclipseLinkConvertAnnotation; -import org.eclipse.jpt.utility.Filter; -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); - } - - //************** JavaAttributeMapping implementation *************** - - @Override - protected void addSupportingAnnotationNamesTo(Vector<String> names) { - super.addSupportingAnnotationNamesTo(names); - names.add(EclipseLink.MUTABLE); - names.add(EclipseLink.CONVERT); - } - - //************** AbstractJavaBasicMapping implementation *************** - - @Override - protected JavaConverter buildSpecifiedConverter(String converterType) { - JavaConverter javaConverter = super.buildSpecifiedConverter(converterType); - if (javaConverter != null) { - return javaConverter; - } - if (converterType == EclipseLinkConvert.ECLIPSE_LINK_CONVERTER) { - return new JavaEclipseLinkConvert(this, this.getResourcePersistentAttribute()); - } - return null; - } - - @Override - protected String getResourceConverterType() { - //check @Convert first, this is the order that EclipseLink searches - if (this.getResourcePersistentAttribute().getAnnotation(EclipseLinkConvertAnnotation.ANNOTATION_NAME) != null) { - return EclipseLinkConvert.ECLIPSE_LINK_CONVERTER; - } - return super.getResourceConverterType(); - } - - //************ EclipselinkJavaBasicMapping implementation **************** - - public EclipseLinkMutable getMutable() { - return this.mutable; - } - - - //************ initialization/update **************** - - @Override - protected void initialize() { - super.initialize(); - this.mutable.initialize(this.getResourcePersistentAttribute()); - } - - @Override - protected void update() { - super.update(); - this.mutable.update(this.getResourcePersistentAttribute()); - } - - // ********** code assist ********** - - @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 (getConverter() != null) { - result = getConverter().javaCompletionProposals(pos, filter, astRoot); - if (result != null) { - return result; - } - } - return null; - } - - - //************ validation **************** - - @Override - public void validate(List<IMessage> messages, IReporter reporter, CompilationUnit astRoot) { - super.validate(messages, reporter, astRoot); - this.mutable.validate(messages, reporter, astRoot); - } -} diff --git a/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/java/JavaEclipseLinkCachingImpl.java b/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/java/JavaEclipseLinkCachingImpl.java deleted file mode 100644 index a6416c3132..0000000000 --- a/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/java/JavaEclipseLinkCachingImpl.java +++ /dev/null @@ -1,597 +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.eclipselink.core.internal.context.java; - -import java.util.List; -import org.eclipse.jdt.core.dom.CompilationUnit; -import org.eclipse.jpt.core.context.PersistentType; -import org.eclipse.jpt.core.context.java.JavaTypeMapping; -import org.eclipse.jpt.core.internal.context.java.AbstractJavaJpaContextNode; -import org.eclipse.jpt.core.jpa2.JpaFactory2_0; -import org.eclipse.jpt.core.jpa2.context.CacheableHolder2_0; -import org.eclipse.jpt.core.jpa2.context.java.JavaCacheable2_0; -import org.eclipse.jpt.core.jpa2.context.java.JavaCacheableHolder2_0; -import org.eclipse.jpt.core.jpa2.context.persistence.PersistenceUnit2_0; -import org.eclipse.jpt.core.resource.java.JavaResourcePersistentType; -import org.eclipse.jpt.core.utility.TextRange; -import org.eclipse.jpt.eclipselink.core.context.EclipseLinkCacheCoordinationType; -import org.eclipse.jpt.eclipselink.core.context.EclipseLinkCacheType; -import org.eclipse.jpt.eclipselink.core.context.EclipseLinkCaching; -import org.eclipse.jpt.eclipselink.core.context.EclipseLinkExistenceType; -import org.eclipse.jpt.eclipselink.core.context.EclipseLinkExpiryTimeOfDay; -import org.eclipse.jpt.eclipselink.core.context.java.JavaEclipseLinkCaching; -import org.eclipse.jpt.eclipselink.core.internal.DefaultEclipseLinkJpaValidationMessages; -import org.eclipse.jpt.eclipselink.core.internal.EclipseLinkJpaValidationMessages; -import org.eclipse.jpt.eclipselink.core.resource.java.EclipseLinkCacheAnnotation; -import org.eclipse.jpt.eclipselink.core.resource.java.EclipseLinkExistenceCheckingAnnotation; -import org.eclipse.jpt.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 boolean existenceChecking; - protected EclipseLinkExistenceType specifiedExistenceType; - protected EclipseLinkExistenceType defaultExistenceType; - - protected EclipseLinkCacheCoordinationType specifiedCoordinationType; - - protected Integer expiry; - protected JavaEclipseLinkExpiryTimeOfDay expiryTimeOfDay; - - protected final JavaCacheable2_0 cacheable; - - protected JavaResourcePersistentType resourcePersistentType; - - public JavaEclipseLinkCachingImpl(JavaTypeMapping parent) { - super(parent); - this.cacheable = ((JpaFactory2_0) this.getJpaFactory()).buildJavaCacheable(this); - } - - @Override - public JavaTypeMapping getParent() { - return (JavaTypeMapping) super.getParent(); - } - - - //query for the cache annotation every time on setters. - //call one setter and the CacheAnnotation could change. - //You could call more than one setter before this object has received any notification - //from the java resource model - protected EclipseLinkCacheAnnotation getCacheAnnotation() { - return (EclipseLinkCacheAnnotation) this.resourcePersistentType. - getNonNullAnnotation(getCacheAnnotationName()); - } - - protected EclipseLinkExistenceCheckingAnnotation getExistenceCheckingAnnotation() { - return (EclipseLinkExistenceCheckingAnnotation) this.resourcePersistentType. - getAnnotation(getExistenceCheckingAnnotationName()); - } - - protected String getCacheAnnotationName() { - return EclipseLinkCacheAnnotation.ANNOTATION_NAME; - } - - protected String getExistenceCheckingAnnotationName() { - return EclipseLinkExistenceCheckingAnnotation.ANNOTATION_NAME; - } - - public EclipseLinkCacheType getType() { - return (this.getSpecifiedType() == null) ? this.getDefaultType() : this.getSpecifiedType(); - } - - public EclipseLinkCacheType getDefaultType() { - return DEFAULT_TYPE; - } - - public EclipseLinkCacheType getSpecifiedType() { - return this.specifiedType; - } - - public void setSpecifiedType(EclipseLinkCacheType newSpecifiedType) { - EclipseLinkCacheType oldSpecifiedType = this.specifiedType; - this.specifiedType = newSpecifiedType; - this.getCacheAnnotation().setType(EclipseLinkCacheType.toJavaResourceModel(newSpecifiedType)); - firePropertyChanged(SPECIFIED_TYPE_PROPERTY, oldSpecifiedType, newSpecifiedType); - } - - /** - * internal setter used only for updating from the resource model. - * There were problems with InvalidThreadAccess exceptions in the UI - * when you set a value from the UI and the annotation doesn't exist yet. - * Adding the annotation causes an update to occur and then the exception. - */ - protected void setSpecifiedType_(EclipseLinkCacheType newSpecifiedType) { - EclipseLinkCacheType oldSpecifiedType = this.specifiedType; - this.specifiedType = newSpecifiedType; - firePropertyChanged(SPECIFIED_TYPE_PROPERTY, oldSpecifiedType, newSpecifiedType); - } - - public int getSize() { - return (this.getSpecifiedSize() == null) ? getDefaultSize() : this.getSpecifiedSize().intValue(); - } - - public int getDefaultSize() { - return EclipseLinkCaching.DEFAULT_SIZE; - } - - public Integer getSpecifiedSize() { - return this.specifiedSize; - } - - public void setSpecifiedSize(Integer newSpecifiedSize) { - Integer oldSpecifiedSize = this.specifiedSize; - this.specifiedSize = newSpecifiedSize; - getCacheAnnotation().setSize(newSpecifiedSize); - firePropertyChanged(SPECIFIED_SIZE_PROPERTY, oldSpecifiedSize, newSpecifiedSize); - } - - protected void setSpecifiedSize_(Integer newSpecifiedSize) { - Integer oldSpecifiedSize = this.specifiedSize; - this.specifiedSize = newSpecifiedSize; - firePropertyChanged(SPECIFIED_SIZE_PROPERTY, oldSpecifiedSize, newSpecifiedSize); - } - - - public boolean isShared() { - return (this.specifiedShared == null) ? this.isDefaultShared() : this.specifiedShared.booleanValue(); - } - - public boolean isDefaultShared() { - return EclipseLinkCaching.DEFAULT_SHARED; - } - - public Boolean getSpecifiedShared() { - return this.specifiedShared; - } - - public void setSpecifiedShared(Boolean newSpecifiedShared) { - Boolean oldShared = this.specifiedShared; - this.specifiedShared = newSpecifiedShared; - this.getCacheAnnotation().setShared(newSpecifiedShared); - firePropertyChanged(EclipseLinkCaching.SPECIFIED_SHARED_PROPERTY, oldShared, newSpecifiedShared); - - if (newSpecifiedShared == Boolean.FALSE) { - setSpecifiedType(null); - setSpecifiedSize(null); - setSpecifiedAlwaysRefresh(null); - setSpecifiedRefreshOnlyIfNewer(null); - setSpecifiedDisableHits(null); - setSpecifiedCoordinationType(null); - setExpiry(null); - if (this.expiryTimeOfDay != null) { - removeExpiryTimeOfDay(); - } - } - } - - protected void setSpecifiedShared_(Boolean newSpecifiedShared) { - Boolean oldSpecifiedShared = this.specifiedShared; - this.specifiedShared = newSpecifiedShared; - firePropertyChanged(EclipseLinkCaching.SPECIFIED_SHARED_PROPERTY, oldSpecifiedShared, newSpecifiedShared); - } - - public boolean isAlwaysRefresh() { - return (this.specifiedAlwaysRefresh == null) ? this.isDefaultAlwaysRefresh() : this.specifiedAlwaysRefresh.booleanValue(); - } - - public boolean isDefaultAlwaysRefresh() { - return EclipseLinkCaching.DEFAULT_ALWAYS_REFRESH; - } - - public Boolean getSpecifiedAlwaysRefresh() { - return this.specifiedAlwaysRefresh; - } - - public void setSpecifiedAlwaysRefresh(Boolean newSpecifiedAlwaysRefresh) { - Boolean oldAlwaysRefresh = this.specifiedAlwaysRefresh; - this.specifiedAlwaysRefresh = newSpecifiedAlwaysRefresh; - this.getCacheAnnotation().setAlwaysRefresh(newSpecifiedAlwaysRefresh); - firePropertyChanged(EclipseLinkCaching.SPECIFIED_ALWAYS_REFRESH_PROPERTY, oldAlwaysRefresh, newSpecifiedAlwaysRefresh); - } - - protected void setSpecifiedAlwaysRefresh_(Boolean newSpecifiedAlwaysRefresh) { - Boolean oldAlwaysRefresh = this.specifiedAlwaysRefresh; - this.specifiedAlwaysRefresh = newSpecifiedAlwaysRefresh; - firePropertyChanged(EclipseLinkCaching.SPECIFIED_ALWAYS_REFRESH_PROPERTY, oldAlwaysRefresh, newSpecifiedAlwaysRefresh); - } - - public boolean isRefreshOnlyIfNewer() { - return (this.specifiedRefreshOnlyIfNewer == null) ? this.isDefaultRefreshOnlyIfNewer() : this.specifiedRefreshOnlyIfNewer.booleanValue(); - } - - public boolean isDefaultRefreshOnlyIfNewer() { - return EclipseLinkCaching.DEFAULT_REFRESH_ONLY_IF_NEWER; - } - - public Boolean getSpecifiedRefreshOnlyIfNewer() { - return this.specifiedRefreshOnlyIfNewer; - } - - public void setSpecifiedRefreshOnlyIfNewer(Boolean newSpecifiedRefreshOnlyIfNewer) { - Boolean oldRefreshOnlyIfNewer = this.specifiedRefreshOnlyIfNewer; - this.specifiedRefreshOnlyIfNewer = newSpecifiedRefreshOnlyIfNewer; - this.getCacheAnnotation().setRefreshOnlyIfNewer(newSpecifiedRefreshOnlyIfNewer); - firePropertyChanged(EclipseLinkCaching.SPECIFIED_REFRESH_ONLY_IF_NEWER_PROPERTY, oldRefreshOnlyIfNewer, newSpecifiedRefreshOnlyIfNewer); - } - - protected void setSpecifiedRefreshOnlyIfNewer_(Boolean newSpecifiedRefreshOnlyIfNewer) { - Boolean oldRefreshOnlyIfNewer = this.specifiedRefreshOnlyIfNewer; - this.specifiedRefreshOnlyIfNewer = newSpecifiedRefreshOnlyIfNewer; - firePropertyChanged(EclipseLinkCaching.SPECIFIED_REFRESH_ONLY_IF_NEWER_PROPERTY, oldRefreshOnlyIfNewer, newSpecifiedRefreshOnlyIfNewer); - } - - public boolean isDisableHits() { - return (this.specifiedDisableHits == null) ? this.isDefaultDisableHits() : this.specifiedDisableHits.booleanValue(); - } - - public boolean isDefaultDisableHits() { - return EclipseLinkCaching.DEFAULT_DISABLE_HITS; - } - - public Boolean getSpecifiedDisableHits() { - return this.specifiedDisableHits; - } - - public void setSpecifiedDisableHits(Boolean newSpecifiedDisableHits) { - Boolean oldDisableHits = this.specifiedDisableHits; - this.specifiedDisableHits = newSpecifiedDisableHits; - this.getCacheAnnotation().setDisableHits(newSpecifiedDisableHits); - firePropertyChanged(EclipseLinkCaching.SPECIFIED_DISABLE_HITS_PROPERTY, oldDisableHits, newSpecifiedDisableHits); - } - - protected void setSpecifiedDisableHits_(Boolean newSpecifiedDisableHits) { - Boolean oldDisableHits = this.specifiedDisableHits; - this.specifiedDisableHits = newSpecifiedDisableHits; - firePropertyChanged(EclipseLinkCaching.SPECIFIED_DISABLE_HITS_PROPERTY, oldDisableHits, newSpecifiedDisableHits); - } - - public EclipseLinkCacheCoordinationType getCoordinationType() { - return (this.getSpecifiedCoordinationType() == null) ? this.getDefaultCoordinationType() : this.getSpecifiedCoordinationType(); - } - - public EclipseLinkCacheCoordinationType getDefaultCoordinationType() { - return DEFAULT_COORDINATION_TYPE; - } - - public EclipseLinkCacheCoordinationType getSpecifiedCoordinationType() { - return this.specifiedCoordinationType; - } - - public void setSpecifiedCoordinationType(EclipseLinkCacheCoordinationType newSpecifiedCoordinationType) { - EclipseLinkCacheCoordinationType oldSpecifiedCoordinationType = this.specifiedCoordinationType; - this.specifiedCoordinationType = newSpecifiedCoordinationType; - this.getCacheAnnotation().setCoordinationType(EclipseLinkCacheCoordinationType.toJavaResourceModel(newSpecifiedCoordinationType)); - firePropertyChanged(SPECIFIED_COORDINATION_TYPE_PROPERTY, oldSpecifiedCoordinationType, newSpecifiedCoordinationType); - } - - /** - * internal setter used only for updating from the resource model. - * There were problems with InvalidThreadAccess exceptions in the UI - * when you set a value from the UI and the annotation doesn't exist yet. - * Adding the annotation causes an update to occur and then the exception. - */ - protected void setSpecifiedCoordinationType_(EclipseLinkCacheCoordinationType newSpecifiedCoordinationType) { - EclipseLinkCacheCoordinationType oldSpecifiedCoordinationType = this.specifiedCoordinationType; - this.specifiedCoordinationType = newSpecifiedCoordinationType; - firePropertyChanged(SPECIFIED_COORDINATION_TYPE_PROPERTY, oldSpecifiedCoordinationType, newSpecifiedCoordinationType); - } - - public boolean hasExistenceChecking() { - return this.existenceChecking; - } - - public void setExistenceChecking(boolean newExistenceChecking) { - boolean oldExistenceChecking = this.existenceChecking; - this.existenceChecking = newExistenceChecking; - if (newExistenceChecking) { - this.resourcePersistentType.addAnnotation(getExistenceCheckingAnnotationName()); - } - else { - this.resourcePersistentType.removeAnnotation(getExistenceCheckingAnnotationName()); - } - firePropertyChanged(EXISTENCE_CHECKING_PROPERTY, oldExistenceChecking, newExistenceChecking); - setDefaultExistenceType(caclulateDefaultExistenceType()); - } - - protected void setExistenceChecking_(boolean newExistenceChecking) { - boolean oldExistenceChecking = this.existenceChecking; - this.existenceChecking = newExistenceChecking; - firePropertyChanged(EXISTENCE_CHECKING_PROPERTY, oldExistenceChecking, newExistenceChecking); - } - - protected EclipseLinkExistenceType caclulateDefaultExistenceType() { - if (hasExistenceChecking()) { - return EclipseLinkExistenceType.CHECK_CACHE; - } - return DEFAULT_EXISTENCE_TYPE; - } - - public EclipseLinkExistenceType getExistenceType() { - return (this.getSpecifiedExistenceType() == null) ? this.getDefaultExistenceType() : this.getSpecifiedExistenceType(); - } - - public EclipseLinkExistenceType getDefaultExistenceType() { - return this.defaultExistenceType; - } - - protected void setDefaultExistenceType(EclipseLinkExistenceType newDefaultExistenceType) { - EclipseLinkExistenceType oldDefaultExistenceType = this.defaultExistenceType; - this.defaultExistenceType = newDefaultExistenceType; - firePropertyChanged(DEFAULT_EXISTENCE_TYPE_PROPERTY, oldDefaultExistenceType, newDefaultExistenceType); - } - - public EclipseLinkExistenceType getSpecifiedExistenceType() { - return this.specifiedExistenceType; - } - - public void setSpecifiedExistenceType(EclipseLinkExistenceType newSpecifiedExistenceType) { - if (!hasExistenceChecking()) { - if (newSpecifiedExistenceType != null) { - setExistenceChecking(true); - } - else { - return; - } - } - EclipseLinkExistenceType oldSpecifiedExistenceType = this.specifiedExistenceType; - this.specifiedExistenceType = newSpecifiedExistenceType; - this.getExistenceCheckingAnnotation().setValue(EclipseLinkExistenceType.toJavaResourceModel(newSpecifiedExistenceType)); - firePropertyChanged(SPECIFIED_EXISTENCE_TYPE_PROPERTY, oldSpecifiedExistenceType, newSpecifiedExistenceType); - } - - /** - * internal setter used only for updating from the resource model. - * There were problems with InvalidThreadAccess exceptions in the UI - * when you set a value from the UI and the annotation doesn't exist yet. - * Adding the annotation causes an update to occur and then the exception. - */ - protected void setSpecifiedExistenceType_(EclipseLinkExistenceType newSpecifiedExistenceType) { - EclipseLinkExistenceType oldSpecifiedExistenceType = this.specifiedExistenceType; - this.specifiedExistenceType = newSpecifiedExistenceType; - firePropertyChanged(SPECIFIED_EXISTENCE_TYPE_PROPERTY, oldSpecifiedExistenceType, newSpecifiedExistenceType); - } - - public Integer getExpiry() { - return this.expiry; - } - - public void setExpiry(Integer newExpiry) { - Integer oldExpiry = this.expiry; - this.expiry = newExpiry; - getCacheAnnotation().setExpiry(newExpiry); - firePropertyChanged(EXPIRY_PROPERTY, oldExpiry, newExpiry); - if (newExpiry != null && this.expiryTimeOfDay != null) { - removeExpiryTimeOfDay(); - } - } - - protected void setExpiry_(Integer newExpiry) { - Integer oldExpiry = this.expiry; - this.expiry = newExpiry; - firePropertyChanged(EXPIRY_PROPERTY, oldExpiry, newExpiry); - } - - public EclipseLinkExpiryTimeOfDay getExpiryTimeOfDay() { - return this.expiryTimeOfDay; - } - - public EclipseLinkExpiryTimeOfDay addExpiryTimeOfDay() { - if (this.expiryTimeOfDay != null) { - throw new IllegalStateException("expiryTimeOfDay already exists, use getExpiryTimeOfDay()"); //$NON-NLS-1$ - } - if (this.resourcePersistentType.getAnnotation(getCacheAnnotationName()) == null) { - this.resourcePersistentType.addAnnotation(getCacheAnnotationName()); - } - JavaEclipseLinkExpiryTimeOfDay newExpiryTimeOfDay = new JavaEclipseLinkExpiryTimeOfDay(this); - this.expiryTimeOfDay = newExpiryTimeOfDay; - EclipseLinkTimeOfDayAnnotation timeOfDayAnnotation = getCacheAnnotation().addExpiryTimeOfDay(); - newExpiryTimeOfDay.initialize(timeOfDayAnnotation); - firePropertyChanged(EXPIRY_TIME_OF_DAY_PROPERTY, null, newExpiryTimeOfDay); - setExpiry(null); - return newExpiryTimeOfDay; - } - - public void removeExpiryTimeOfDay() { - if (this.expiryTimeOfDay == null) { - throw new IllegalStateException("timeOfDayExpiry does not exist"); //$NON-NLS-1$ - } - EclipseLinkExpiryTimeOfDay oldExpiryTimeOfDay = this.expiryTimeOfDay; - this.expiryTimeOfDay = null; - getCacheAnnotation().removeExpiryTimeOfDay(); - firePropertyChanged(EXPIRY_TIME_OF_DAY_PROPERTY, oldExpiryTimeOfDay, null); - } - - protected void setExpiryTimeOfDay(JavaEclipseLinkExpiryTimeOfDay newExpiryTimeOfDay) { - JavaEclipseLinkExpiryTimeOfDay oldExpiryTimeOfDay = this.expiryTimeOfDay; - this.expiryTimeOfDay = newExpiryTimeOfDay; - firePropertyChanged(EXPIRY_TIME_OF_DAY_PROPERTY, oldExpiryTimeOfDay, newExpiryTimeOfDay); - } - - public JavaCacheable2_0 getCacheable() { - return this.cacheable; - } - - public boolean calculateDefaultCacheable() { - CacheableHolder2_0 cacheableHolder = getCacheableSuperPersistentType(getParent().getPersistentType()); - if (cacheableHolder != null) { - return cacheableHolder.getCacheable().isCacheable(); - } - return ((PersistenceUnit2_0) getPersistenceUnit()).calculateDefaultCacheable(); - } - - protected CacheableHolder2_0 getCacheableSuperPersistentType(PersistentType persistentType) { - PersistentType superPersistentType = persistentType.getSuperPersistentType(); - if (superPersistentType != null) { - if (superPersistentType.getMapping() instanceof CacheableHolder2_0) { - return (CacheableHolder2_0) superPersistentType.getMapping(); - } - return getCacheableSuperPersistentType(superPersistentType); - } - return null; - } - - public void initialize(JavaResourcePersistentType resourcePersistentType) { - this.resourcePersistentType = resourcePersistentType; - initialize(getCacheAnnotation()); - initialize(getExistenceCheckingAnnotation()); - this.cacheable.initialize(resourcePersistentType); - } - - protected void initialize(EclipseLinkCacheAnnotation cache) { - this.specifiedType = this.specifiedType(cache); - this.specifiedSize = this.specifiedSize(cache); - this.specifiedShared = this.specifiedShared(cache); - this.specifiedAlwaysRefresh = this.specifiedAlwaysRefresh(cache); - this.specifiedRefreshOnlyIfNewer = this.specifiedRefreshOnlyIfNewer(cache); - this.specifiedDisableHits = this.specifiedDisableHits(cache); - this.specifiedCoordinationType = this.specifiedCoordinationType(cache); - this.initializeExpiry(cache); - } - - protected void initialize(EclipseLinkExistenceCheckingAnnotation existenceChecking) { - this.existenceChecking = existenceChecking != null; - this.specifiedExistenceType = specifiedExistenceType(existenceChecking); - this.defaultExistenceType = this.caclulateDefaultExistenceType(); - } - - protected void initializeExpiry(EclipseLinkCacheAnnotation cache) { - if (cache.getExpiryTimeOfDay() == null) { - this.expiry = cache.getExpiry(); - } - else { - if (cache.getExpiry() == null) { //handle with validation if both expiry and expiryTimeOfDay are set - this.expiryTimeOfDay = new JavaEclipseLinkExpiryTimeOfDay(this); - this.expiryTimeOfDay.initialize(cache.getExpiryTimeOfDay()); - } - } - } - - public void update(JavaResourcePersistentType resourcePersistentType) { - this.resourcePersistentType = resourcePersistentType; - update(getCacheAnnotation()); - update(getExistenceCheckingAnnotation()); - updateExpiry(getCacheAnnotation()); - this.cacheable.update(resourcePersistentType); - } - - protected void update(EclipseLinkCacheAnnotation cache) { - setSpecifiedType_(this.specifiedType(cache)); - setSpecifiedSize_(this.specifiedSize(cache)); - setSpecifiedShared_(this.specifiedShared(cache)); - setSpecifiedAlwaysRefresh_(this.specifiedAlwaysRefresh(cache)); - setSpecifiedRefreshOnlyIfNewer_(this.specifiedRefreshOnlyIfNewer(cache)); - setSpecifiedDisableHits_(this.specifiedDisableHits(cache)); - setSpecifiedCoordinationType_(this.specifiedCoordinationType(cache)); - } - - protected void update(EclipseLinkExistenceCheckingAnnotation existenceChecking) { - setExistenceChecking_(existenceChecking != null); - setSpecifiedExistenceType_(specifiedExistenceType(existenceChecking)); - setDefaultExistenceType(caclulateDefaultExistenceType()); - } - - protected void updateExpiry(EclipseLinkCacheAnnotation cache) { - if (cache.getExpiryTimeOfDay() == null) { - setExpiryTimeOfDay(null); - setExpiry_(cache.getExpiry()); - } - else { - if (this.expiryTimeOfDay != null) { - this.expiryTimeOfDay.update(cache.getExpiryTimeOfDay()); - } - else if (cache.getExpiry() == null){ - setExpiryTimeOfDay(new JavaEclipseLinkExpiryTimeOfDay(this)); - this.expiryTimeOfDay.initialize(cache.getExpiryTimeOfDay()); - } - else { //handle with validation if both expiry and expiryTimeOfDay are set - setExpiryTimeOfDay(null); - } - } - } - - protected EclipseLinkCacheType specifiedType(EclipseLinkCacheAnnotation cache) { - return EclipseLinkCacheType.fromJavaResourceModel(cache.getType()); - } - - protected Integer specifiedSize(EclipseLinkCacheAnnotation cache) { - return cache.getSize(); - } - - protected Boolean specifiedShared(EclipseLinkCacheAnnotation cache) { - return cache.getShared(); - } - - protected Boolean specifiedAlwaysRefresh(EclipseLinkCacheAnnotation cache) { - return cache.getAlwaysRefresh(); - } - - protected Boolean specifiedRefreshOnlyIfNewer(EclipseLinkCacheAnnotation cache) { - return cache.getRefreshOnlyIfNewer(); - } - - protected Boolean specifiedDisableHits(EclipseLinkCacheAnnotation cache) { - return cache.getDisableHits(); - } - - protected EclipseLinkCacheCoordinationType specifiedCoordinationType(EclipseLinkCacheAnnotation cache) { - return EclipseLinkCacheCoordinationType.fromJavaResourceModel(cache.getCoordinationType()); - } - - protected Integer expiry(EclipseLinkCacheAnnotation cache) { - return cache.getExpiry(); - } - - protected EclipseLinkExistenceType specifiedExistenceType(EclipseLinkExistenceCheckingAnnotation existenceChecking) { - if (existenceChecking == null) { - return null; - } - return EclipseLinkExistenceType.fromJavaResourceModel(existenceChecking.getValue()); - } - - - public TextRange getValidationTextRange(CompilationUnit astRoot) { - TextRange textRange = getCacheAnnotation().getTextRange(astRoot); - return (textRange != null) ? textRange : this.getParent().getValidationTextRange(astRoot); - } - - @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) { - EclipseLinkCacheAnnotation cache = getCacheAnnotation(); - if (cache.getExpiry() != null && cache.getExpiryTimeOfDay() != null) { - messages.add( - DefaultEclipseLinkJpaValidationMessages.buildMessage( - IMessage.HIGH_SEVERITY, - EclipseLinkJpaValidationMessages.CACHE_EXPIRY_AND_EXPIRY_TIME_OF_DAY_BOTH_SPECIFIED, - new String[] {this.getParent().getPersistentType().getName()}, - this, - getValidationTextRange(astRoot) - ) - ); - } - } -} diff --git a/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/java/JavaEclipseLinkChangeTracking.java b/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/java/JavaEclipseLinkChangeTracking.java deleted file mode 100644 index 1a8428fa99..0000000000 --- a/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/java/JavaEclipseLinkChangeTracking.java +++ /dev/null @@ -1,134 +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.eclipselink.core.internal.context.java; - -import org.eclipse.jdt.core.dom.CompilationUnit; -import org.eclipse.jpt.core.context.java.JavaTypeMapping; -import org.eclipse.jpt.core.internal.context.java.AbstractJavaJpaContextNode; -import org.eclipse.jpt.core.resource.java.JavaResourcePersistentType; -import org.eclipse.jpt.core.utility.TextRange; -import org.eclipse.jpt.eclipselink.core.context.EclipseLinkChangeTracking; -import org.eclipse.jpt.eclipselink.core.context.EclipseLinkChangeTrackingType; -import org.eclipse.jpt.eclipselink.core.internal.EclipseLinkJpaFactory; -import org.eclipse.jpt.eclipselink.core.resource.java.EclipseLinkChangeTrackingAnnotation; - -public class JavaEclipseLinkChangeTracking extends AbstractJavaJpaContextNode implements EclipseLinkChangeTracking -{ - protected JavaResourcePersistentType resourcePersistentType; - - protected EclipseLinkChangeTrackingType specifiedType; - - - public JavaEclipseLinkChangeTracking(JavaTypeMapping parent) { - super(parent); - } - - @Override - public JavaTypeMapping getParent() { - return (JavaTypeMapping) super.getParent(); - } - - @Override - protected EclipseLinkJpaFactory getJpaFactory() { - return (EclipseLinkJpaFactory) super.getJpaFactory(); - } - - protected String getChangeTrackingAnnotationName() { - return EclipseLinkChangeTrackingAnnotation.ANNOTATION_NAME; - } - - protected EclipseLinkChangeTrackingAnnotation getChangeTrackingAnnotation() { - return (EclipseLinkChangeTrackingAnnotation) this.resourcePersistentType.getAnnotation(getChangeTrackingAnnotationName()); - } - - protected void addChangeTrackingAnnotation() { - this.resourcePersistentType.addAnnotation(getChangeTrackingAnnotationName()); - } - - protected void removeChangeTrackingAnnotation() { - this.resourcePersistentType.removeAnnotation(getChangeTrackingAnnotationName()); - } - - public EclipseLinkChangeTrackingType getType() { - return (this.getSpecifiedType() != null) ? this.getSpecifiedType() : this.getDefaultType(); - } - - public EclipseLinkChangeTrackingType getDefaultType() { - return DEFAULT_TYPE; - } - - public EclipseLinkChangeTrackingType getSpecifiedType() { - return this.specifiedType; - } - - public void setSpecifiedType(EclipseLinkChangeTrackingType newSpecifiedType) { - if (this.specifiedType == newSpecifiedType) { - return; - } - - EclipseLinkChangeTrackingType oldSpecifiedType = this.specifiedType; - this.specifiedType = newSpecifiedType; - - if (newSpecifiedType != null) { - if (getChangeTrackingAnnotation() == null) { - addChangeTrackingAnnotation(); - } - getChangeTrackingAnnotation().setValue(EclipseLinkChangeTrackingType.toJavaResourceModel(newSpecifiedType)); - } - else { - if (getChangeTrackingAnnotation() != null) { - removeChangeTrackingAnnotation(); - } - } - firePropertyChanged(SPECIFIED_TYPE_PROPERTY, oldSpecifiedType, newSpecifiedType); - } - - /** - * internal setter used only for updating from the resource model. - * There were problems with InvalidThreadAccess exceptions in the UI - * when you set a value from the UI and the annotation doesn't exist yet. - * Adding the annotation causes an update to occur and then the exception. - */ - protected void setSpecifiedType_(EclipseLinkChangeTrackingType newSpecifiedType) { - EclipseLinkChangeTrackingType oldSpecifiedType = this.specifiedType; - this.specifiedType = newSpecifiedType; - firePropertyChanged(SPECIFIED_TYPE_PROPERTY, oldSpecifiedType, newSpecifiedType); - } - - public void initialize(JavaResourcePersistentType resourcePersistentType) { - this.resourcePersistentType = resourcePersistentType; - EclipseLinkChangeTrackingAnnotation changeTrackingAnnotation = this.getChangeTrackingAnnotation(); - this.specifiedType = changeTrackingType(changeTrackingAnnotation); - } - - public void update(JavaResourcePersistentType resourcePersistentType) { - this.resourcePersistentType = resourcePersistentType; - EclipseLinkChangeTrackingAnnotation changeTrackingAnnotation = this.getChangeTrackingAnnotation(); - this.setSpecifiedType_(changeTrackingType(changeTrackingAnnotation)); - } - - protected EclipseLinkChangeTrackingType changeTrackingType(EclipseLinkChangeTrackingAnnotation changeTracking) { - if (changeTracking == null) { - return null; - } - else if (changeTracking.getValue() == null) { - return EclipseLinkChangeTracking.DEFAULT_TYPE; - } - else { - return EclipseLinkChangeTrackingType.fromJavaResourceModel(changeTracking.getValue()); - } - } - - public TextRange getValidationTextRange(CompilationUnit astRoot) { - EclipseLinkChangeTrackingAnnotation changeTrackingAnnotation = getChangeTrackingAnnotation(); - TextRange textRange = changeTrackingAnnotation == null ? null : changeTrackingAnnotation.getTextRange(astRoot); - return (textRange != null) ? textRange : this.getParent().getValidationTextRange(astRoot); - } -}
\ No newline at end of file diff --git a/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/java/JavaEclipseLinkConversionValue.java b/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/java/JavaEclipseLinkConversionValue.java deleted file mode 100644 index 2cc8b86a3d..0000000000 --- a/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/java/JavaEclipseLinkConversionValue.java +++ /dev/null @@ -1,132 +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.eclipselink.core.internal.context.java; - -import java.util.List; -import org.eclipse.jdt.core.dom.CompilationUnit; -import org.eclipse.jpt.core.internal.context.java.AbstractJavaJpaContextNode; -import org.eclipse.jpt.core.utility.TextRange; -import org.eclipse.jpt.eclipselink.core.context.EclipseLinkConversionValue; -import org.eclipse.jpt.eclipselink.core.internal.DefaultEclipseLinkJpaValidationMessages; -import org.eclipse.jpt.eclipselink.core.internal.EclipseLinkJpaValidationMessages; -import org.eclipse.jpt.eclipselink.core.resource.java.EclipseLinkConversionValueAnnotation; -import org.eclipse.jpt.utility.internal.CollectionTools; -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 EclipseLinkConversionValueAnnotation resourceConversionValue; - - private String dataValue; - - private String objectValue; - - public JavaEclipseLinkConversionValue(JavaEclipseLinkObjectTypeConverter parent) { - super(parent); - } - - @Override - public JavaEclipseLinkObjectTypeConverter getParent() { - return (JavaEclipseLinkObjectTypeConverter) super.getParent(); - } - - protected String getAnnotationName() { - return EclipseLinkConversionValueAnnotation.ANNOTATION_NAME; - } - - public TextRange getValidationTextRange(CompilationUnit astRoot) { - return this.resourceConversionValue.getTextRange(astRoot); - } - - public String getDataValue() { - return this.dataValue; - } - - public void setDataValue(String newDataValue) { - String oldDataValue = this.dataValue; - this.dataValue = newDataValue; - this.resourceConversionValue.setDataValue(newDataValue); - firePropertyChanged(DATA_VALUE_PROPERTY, oldDataValue, newDataValue); - } - - protected void setDataValue_(String newDataValue) { - String oldDataValue = this.dataValue; - this.dataValue = newDataValue; - firePropertyChanged(DATA_VALUE_PROPERTY, oldDataValue, newDataValue); - } - - public String getObjectValue() { - return this.objectValue; - } - - public void setObjectValue(String newObjectValue) { - String oldObjectValue = this.objectValue; - this.objectValue = newObjectValue; - this.resourceConversionValue.setObjectValue(newObjectValue); - firePropertyChanged(OBJECT_VALUE_PROPERTY, oldObjectValue, newObjectValue); - } - - protected void setObjectValue_(String newObjectValue) { - String oldObjectValue = this.objectValue; - this.objectValue = newObjectValue; - firePropertyChanged(OBJECT_VALUE_PROPERTY, oldObjectValue, newObjectValue); - } - - public void initialize(EclipseLinkConversionValueAnnotation resourceConversionValue) { - this.resourceConversionValue = resourceConversionValue; - this.dataValue = this.dataValue(); - this.objectValue = this.objectValue(); - } - - public void update(EclipseLinkConversionValueAnnotation resourceConversionValue) { - this.resourceConversionValue = resourceConversionValue; - this.setDataValue_(this.dataValue()); - this.setObjectValue_(this.objectValue()); - } - - protected String dataValue() { - return this.resourceConversionValue.getDataValue(); - } - - protected String objectValue() { - return this.resourceConversionValue.getObjectValue(); - } - - public TextRange getDataValueTextRange(CompilationUnit astRoot) { - return this.resourceConversionValue.getDataValueTextRange(astRoot); - } - - public TextRange getObjectValueTextRange(CompilationUnit astRoot) { - return this.resourceConversionValue.getObjectValueTextRange(astRoot); - } - - @Override - public void validate(List<IMessage> messages, IReporter reporter, CompilationUnit astRoot) { - super.validate(messages, reporter, astRoot); - validateDataValuesUnique(messages, astRoot); - } - - protected void validateDataValuesUnique(List<IMessage> messages, CompilationUnit astRoot) { - List<String> dataValues = CollectionTools.list(getParent().dataValues()); - dataValues.remove(this.dataValue); - if (dataValues.contains(this.dataValue)) { - messages.add( - DefaultEclipseLinkJpaValidationMessages.buildMessage( - IMessage.HIGH_SEVERITY, - EclipseLinkJpaValidationMessages.MULTIPLE_OBJECT_VALUES_FOR_DATA_VALUE, - new String[] {this.dataValue}, - this, - this.getDataValueTextRange(astRoot) - ) - ); - } - } -} diff --git a/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/java/JavaEclipseLinkConvert.java b/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/java/JavaEclipseLinkConvert.java deleted file mode 100644 index cad2f639f2..0000000000 --- a/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/java/JavaEclipseLinkConvert.java +++ /dev/null @@ -1,276 +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.eclipselink.core.internal.context.java; - -import java.util.Iterator; -import java.util.List; -import org.eclipse.jdt.core.dom.CompilationUnit; -import org.eclipse.jpt.core.context.java.JavaAttributeMapping; -import org.eclipse.jpt.core.context.java.JavaConverter; -import org.eclipse.jpt.core.internal.context.java.AbstractJavaJpaContextNode; -import org.eclipse.jpt.core.resource.java.JavaResourcePersistentAttribute; -import org.eclipse.jpt.core.utility.TextRange; -import org.eclipse.jpt.eclipselink.core.context.EclipseLinkConvert; -import org.eclipse.jpt.eclipselink.core.context.EclipseLinkConverter; -import org.eclipse.jpt.eclipselink.core.internal.context.persistence.EclipseLinkPersistenceUnit; -import org.eclipse.jpt.eclipselink.core.resource.java.EclipseLinkConvertAnnotation; -import org.eclipse.jpt.eclipselink.core.resource.java.EclipseLinkConverterAnnotation; -import org.eclipse.jpt.eclipselink.core.resource.java.EclipseLinkObjectTypeConverterAnnotation; -import org.eclipse.jpt.eclipselink.core.resource.java.EclipseLinkStructConverterAnnotation; -import org.eclipse.jpt.eclipselink.core.resource.java.EclipseLinkTypeConverterAnnotation; -import org.eclipse.jpt.utility.Filter; -import org.eclipse.jpt.utility.internal.CollectionTools; -import org.eclipse.jpt.utility.internal.StringTools; -import org.eclipse.jpt.utility.internal.iterators.EmptyIterator; -import org.eclipse.jpt.utility.internal.iterators.FilteringIterator; -import org.eclipse.wst.validation.internal.provisional.core.IMessage; -import org.eclipse.wst.validation.internal.provisional.core.IReporter; - -public class JavaEclipseLinkConvert extends AbstractJavaJpaContextNode implements EclipseLinkConvert, JavaConverter -{ - private String specifiedConverterName; - - private JavaResourcePersistentAttribute resourcePersistentAttribute; - - private JavaEclipseLinkConverter converter; - - public JavaEclipseLinkConvert(JavaAttributeMapping parent, JavaResourcePersistentAttribute jrpa) { - super(parent); - this.initialize(jrpa); - } - - @Override - public JavaAttributeMapping getParent() { - return (JavaAttributeMapping) super.getParent(); - } - - public String getType() { - return EclipseLinkConvert.ECLIPSE_LINK_CONVERTER; - } - - protected String getAnnotationName() { - return EclipseLinkConvertAnnotation.ANNOTATION_NAME; - } - - public void addToResourceModel() { - this.resourcePersistentAttribute.addAnnotation(getAnnotationName()); - } - - public void removeFromResourceModel() { - this.resourcePersistentAttribute.removeAnnotation(getAnnotationName()); - if (getConverter() != null) { - this.resourcePersistentAttribute.removeAnnotation(getConverter().getAnnotationName()); - } - } - - public TextRange getValidationTextRange(CompilationUnit astRoot) { - return getResourceConvert().getTextRange(astRoot); - } - - protected EclipseLinkConvertAnnotation getResourceConvert() { - return (EclipseLinkConvertAnnotation) this.resourcePersistentAttribute.getAnnotation(getAnnotationName()); - } - - public String getConverterName() { - return getSpecifiedConverterName() == null ? getDefaultConverterName() : getSpecifiedConverterName(); - } - - public String getDefaultConverterName() { - return DEFAULT_CONVERTER_NAME; - } - - public String getSpecifiedConverterName() { - return this.specifiedConverterName; - } - - public void setSpecifiedConverterName(String newSpecifiedConverterName) { - String oldSpecifiedConverterName = this.specifiedConverterName; - this.specifiedConverterName = newSpecifiedConverterName; - getResourceConvert().setValue(newSpecifiedConverterName); - firePropertyChanged(SPECIFIED_CONVERTER_NAME_PROPERTY, oldSpecifiedConverterName, newSpecifiedConverterName); - } - - protected void setSpecifiedConverterName_(String newSpecifiedConverterName) { - String oldSpecifiedConverterName = this.specifiedConverterName; - this.specifiedConverterName = newSpecifiedConverterName; - firePropertyChanged(SPECIFIED_CONVERTER_NAME_PROPERTY, oldSpecifiedConverterName, newSpecifiedConverterName); - } - - public JavaEclipseLinkConverter getConverter() { - return this.converter; - } - - protected String getConverterType() { - if (this.converter == null) { - return EclipseLinkConverter.NO_CONVERTER; - } - return this.converter.getType(); - } - - public void setConverter(String converterType) { - if (getConverterType() == converterType) { - return; - } - JavaEclipseLinkConverter oldConverter = this.converter; - JavaEclipseLinkConverter newConverter = buildConverter(converterType); - this.converter = null; - if (oldConverter != null) { - this.resourcePersistentAttribute.removeAnnotation(oldConverter.getAnnotationName()); - } - this.converter = newConverter; - if (newConverter != null) { - this.resourcePersistentAttribute.addAnnotation(newConverter.getAnnotationName()); - } - firePropertyChanged(CONVERTER_PROPERTY, oldConverter, newConverter); - } - - protected void setConverter(JavaEclipseLinkConverter newConverter) { - JavaEclipseLinkConverter oldConverter = this.converter; - this.converter = newConverter; - firePropertyChanged(CONVERTER_PROPERTY, oldConverter, newConverter); - } - - protected void initialize(JavaResourcePersistentAttribute jrpa) { - this.resourcePersistentAttribute = jrpa; - this.specifiedConverterName = this.getResourceConverterName(); - this.converter = this.buildConverter(this.getResourceConverterType()); - } - - public void update(JavaResourcePersistentAttribute jrpa) { - this.resourcePersistentAttribute = jrpa; - this.setSpecifiedConverterName_(this.getResourceConverterName()); - if (getResourceConverterType() == getConverterType()) { - getConverter().update(this.resourcePersistentAttribute); - } - else { - JavaEclipseLinkConverter javaConverter = buildConverter(getResourceConverterType()); - setConverter(javaConverter); - } - } - - protected String getResourceConverterName() { - EclipseLinkConvertAnnotation resourceConvert = getResourceConvert(); - return resourceConvert == null ? null : resourceConvert.getValue(); - } - - - protected JavaEclipseLinkConverter buildConverter(String converterType) { - if (converterType == EclipseLinkConverter.NO_CONVERTER) { - return null; - } - if (converterType == EclipseLinkConverter.CUSTOM_CONVERTER) { - return buildCustomConverter(); - } - else if (converterType == EclipseLinkConverter.TYPE_CONVERTER) { - return buildTypeConverter(); - } - else if (converterType == EclipseLinkConverter.OBJECT_TYPE_CONVERTER) { - return buildObjectTypeConverter(); - } - else if (converterType == EclipseLinkConverter.STRUCT_CONVERTER) { - return buildStructConverter(); - } - return null; - } - - protected JavaEclipseLinkCustomConverter buildCustomConverter() { - JavaEclipseLinkCustomConverter contextConverter = new JavaEclipseLinkCustomConverter(this); - contextConverter.initialize(this.resourcePersistentAttribute); - return contextConverter; - } - - protected JavaEclipseLinkTypeConverter buildTypeConverter() { - JavaEclipseLinkTypeConverter contextConverter = new JavaEclipseLinkTypeConverter(this); - contextConverter.initialize(this.resourcePersistentAttribute); - return contextConverter; - } - - protected JavaEclipseLinkObjectTypeConverter buildObjectTypeConverter() { - JavaEclipseLinkObjectTypeConverter contextConverter = new JavaEclipseLinkObjectTypeConverter(this); - contextConverter.initialize(this.resourcePersistentAttribute); - return contextConverter; - } - - protected JavaEclipseLinkStructConverter buildStructConverter() { - JavaEclipseLinkStructConverter contextConverter = new JavaEclipseLinkStructConverter(this); - contextConverter.initialize(this.resourcePersistentAttribute); - return contextConverter; - } - - protected String getResourceConverterType() { - if (this.resourcePersistentAttribute.getAnnotation(EclipseLinkConverterAnnotation.ANNOTATION_NAME) != null) { - return EclipseLinkConverter.CUSTOM_CONVERTER; - } - else if (this.resourcePersistentAttribute.getAnnotation(EclipseLinkTypeConverterAnnotation.ANNOTATION_NAME) != null) { - return EclipseLinkConverter.TYPE_CONVERTER; - } - else if (this.resourcePersistentAttribute.getAnnotation(EclipseLinkObjectTypeConverterAnnotation.ANNOTATION_NAME) != null) { - return EclipseLinkConverter.OBJECT_TYPE_CONVERTER; - } - else if (this.resourcePersistentAttribute.getAnnotation(EclipseLinkStructConverterAnnotation.ANNOTATION_NAME) != null) { - return EclipseLinkConverter.STRUCT_CONVERTER; - } - - return null; - } - - //*************** code assist ****************** - - @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.persistenceConvertersNames(filter); - if (result != null) { - return result; - } - } - return null; - } - - protected boolean convertValueTouches(int pos, CompilationUnit astRoot) { - if (getResourceConvert() != null) { - return this.getResourceConvert().valueTouches(pos, astRoot); - } - return false; - } - - protected Iterator<String> persistenceConvertersNames() { - if(this.getEclipseLinkPersistenceUnit().convertersSize() == 0) { - return EmptyIterator.<String> instance(); - } - return CollectionTools.iterator(this.getEclipseLinkPersistenceUnit().uniqueConverterNames()); - } - - private Iterator<String> convertersNames(Filter<String> filter) { - return new FilteringIterator<String, String>(this.persistenceConvertersNames(), filter); - } - - protected Iterator<String> persistenceConvertersNames(Filter<String> filter) { - return StringTools.convertToJavaStringLiterals(this.convertersNames(filter)); - } - - 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 (getConverter() != null) { - getConverter().validate(messages, reporter, astRoot); - } - } - -} diff --git a/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/java/JavaEclipseLinkConverter.java b/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/java/JavaEclipseLinkConverter.java deleted file mode 100644 index 85da0c2a56..0000000000 --- a/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/java/JavaEclipseLinkConverter.java +++ /dev/null @@ -1,107 +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.eclipselink.core.internal.context.java; - -import org.eclipse.jdt.core.dom.CompilationUnit; -import org.eclipse.jpt.core.context.java.JavaJpaContextNode; -import org.eclipse.jpt.core.internal.context.java.AbstractJavaJpaContextNode; -import org.eclipse.jpt.core.resource.java.JavaResourcePersistentMember; -import org.eclipse.jpt.core.utility.TextRange; -import org.eclipse.jpt.eclipselink.core.context.EclipseLinkConverter; -import org.eclipse.jpt.eclipselink.core.internal.context.persistence.EclipseLinkPersistenceUnit; -import org.eclipse.jpt.eclipselink.core.resource.java.EclipseLinkNamedConverterAnnotation; -import org.eclipse.jpt.utility.internal.StringTools; - -public abstract class JavaEclipseLinkConverter extends AbstractJavaJpaContextNode - implements EclipseLinkConverter -{ - private JavaResourcePersistentMember resourcePersistentMember; - - private String name; - - - protected JavaEclipseLinkConverter(JavaJpaContextNode parent) { - super(parent); - } - - - protected EclipseLinkNamedConverterAnnotation getAnnotation() { - return (EclipseLinkNamedConverterAnnotation) this.resourcePersistentMember.getAnnotation(getAnnotationName()); - } - - protected abstract String getAnnotationName(); - - @Override - public EclipseLinkPersistenceUnit getPersistenceUnit() { - return (EclipseLinkPersistenceUnit) super.getPersistenceUnit(); - } - - public char getEnclosingTypeSeparator() { - return '.'; - } - - // **************** name *************************************************** - - public String getName() { - return this.name; - } - - public void setName(String newName) { - String oldName = this.name; - this.name = newName; - getAnnotation().setName(newName); - firePropertyChanged(NAME_PROPERTY, oldName, newName); - } - - protected void setName_(String newName) { - String oldName = this.name; - this.name = newName; - firePropertyChanged(NAME_PROPERTY, oldName, newName); - } - - - // **************** resource interaction *********************************** - - protected void initialize(JavaResourcePersistentMember jrpm) { - this.resourcePersistentMember = jrpm; - this.name = this.name(getAnnotation()); - } - - protected void update(JavaResourcePersistentMember jrpm) { - this.resourcePersistentMember = jrpm; - this.setName_(this.name(getAnnotation())); - getPersistenceUnit().addConverter(this); - } - - protected String name(EclipseLinkNamedConverterAnnotation resourceConverter) { - return resourceConverter == null ? null : resourceConverter.getName(); - } - - - // **************** validation ********************************************* - - public boolean overrides(EclipseLinkConverter converter) { - // java is at the base of the tree - return false; - } - - public boolean duplicates(EclipseLinkConverter converter) { - return (this != converter) - && ! StringTools.stringIsEmpty(this.name) - && this.name.equals(converter.getName()) - && ! this.overrides(converter) - && ! converter.overrides(this); - } - - public TextRange getValidationTextRange(CompilationUnit astRoot) { - return getAnnotation().getTextRange(astRoot); - } -} diff --git a/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/java/JavaEclipseLinkConverterHolderImpl.java b/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/java/JavaEclipseLinkConverterHolderImpl.java deleted file mode 100644 index e26c0d7f6d..0000000000 --- a/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/java/JavaEclipseLinkConverterHolderImpl.java +++ /dev/null @@ -1,369 +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.eclipselink.core.internal.context.java; - -import java.util.List; -import org.eclipse.jdt.core.dom.CompilationUnit; -import org.eclipse.jpt.core.context.java.JavaTypeMapping; -import org.eclipse.jpt.core.internal.context.java.AbstractJavaJpaContextNode; -import org.eclipse.jpt.core.resource.java.JavaResourcePersistentType; -import org.eclipse.jpt.core.utility.TextRange; -import org.eclipse.jpt.eclipselink.core.context.EclipseLinkCustomConverter; -import org.eclipse.jpt.eclipselink.core.context.EclipseLinkObjectTypeConverter; -import org.eclipse.jpt.eclipselink.core.context.EclipseLinkStructConverter; -import org.eclipse.jpt.eclipselink.core.context.EclipseLinkTypeConverter; -import org.eclipse.jpt.eclipselink.core.context.java.JavaEclipseLinkConverterHolder; -import org.eclipse.jpt.eclipselink.core.resource.java.EclipseLinkConverterAnnotation; -import org.eclipse.jpt.eclipselink.core.resource.java.EclipseLinkObjectTypeConverterAnnotation; -import org.eclipse.jpt.eclipselink.core.resource.java.EclipseLinkStructConverterAnnotation; -import org.eclipse.jpt.eclipselink.core.resource.java.EclipseLinkTypeConverterAnnotation; -import org.eclipse.wst.validation.internal.provisional.core.IMessage; -import org.eclipse.wst.validation.internal.provisional.core.IReporter; - -public class JavaEclipseLinkConverterHolderImpl extends AbstractJavaJpaContextNode implements JavaEclipseLinkConverterHolder -{ - protected JavaResourcePersistentType resourcePersistentType; - - protected JavaEclipseLinkCustomConverter customConverter; - protected JavaEclipseLinkObjectTypeConverter objectTypeConverter; - protected JavaEclipseLinkStructConverter structConverter; - protected JavaEclipseLinkTypeConverter typeConverter; - - public JavaEclipseLinkConverterHolderImpl(JavaTypeMapping parent) { - super(parent); - } - - //************** converter ************* - public EclipseLinkCustomConverter getCustomConverter() { - return this.customConverter; - } - - public EclipseLinkCustomConverter addCustomConverter() { - if (this.customConverter != null) { - throw new IllegalStateException("custom converter already exists"); //$NON-NLS-1$ - } - this.customConverter = buildCustomConverter(); - this.resourcePersistentType.addAnnotation(this.customConverter.getAnnotationName()); - firePropertyChanged(CUSTOM_CONVERTER_PROPERTY, null, this.customConverter); - return this.customConverter; - } - - protected void addCustomConverter_() { - this.customConverter = buildCustomConverter(); - firePropertyChanged(CUSTOM_CONVERTER_PROPERTY, null, this.customConverter); - } - - public void removeCustomConverter() { - if (this.customConverter == null) { - throw new IllegalStateException("converter is null"); //$NON-NLS-1$ - } - JavaEclipseLinkCustomConverter oldConverter = this.customConverter; - this.customConverter = null; - this.resourcePersistentType.removeAnnotation(oldConverter.getAnnotationName()); - firePropertyChanged(CUSTOM_CONVERTER_PROPERTY, oldConverter, null); - } - - protected void removeCustomConverter_() { - this.customConverter = null; - firePropertyChanged(CUSTOM_CONVERTER_PROPERTY, this.customConverter, null); - } - - protected String getConverterAnnotationName() { - return EclipseLinkConverterAnnotation.ANNOTATION_NAME; - } - - protected EclipseLinkConverterAnnotation getResourceConverter() { - return (EclipseLinkConverterAnnotation) this.resourcePersistentType.getAnnotation(getConverterAnnotationName()); - } - - - //************** object type converter ************* - public EclipseLinkObjectTypeConverter getObjectTypeConverter() { - return this.objectTypeConverter; - } - - public EclipseLinkObjectTypeConverter addObjectTypeConverter() { - if (this.objectTypeConverter != null) { - throw new IllegalStateException("object type converter already exists"); //$NON-NLS-1$ - } - this.objectTypeConverter = buildObjectTypeConverter(); - this.resourcePersistentType.addAnnotation(this.objectTypeConverter.getAnnotationName()); - firePropertyChanged(OBJECT_TYPE_CONVERTER_PROPERTY, null, this.objectTypeConverter); - return this.objectTypeConverter; - } - - protected void addObjectTypeConverter_() { - this.objectTypeConverter = buildObjectTypeConverter(); - firePropertyChanged(OBJECT_TYPE_CONVERTER_PROPERTY, null, this.objectTypeConverter); - } - - public void removeObjectTypeConverter() { - if (this.objectTypeConverter == null) { - throw new IllegalStateException("object type converter is null"); //$NON-NLS-1$ - } - JavaEclipseLinkObjectTypeConverter oldConverter = this.objectTypeConverter; - this.objectTypeConverter = null; - this.resourcePersistentType.removeAnnotation(oldConverter.getAnnotationName()); - firePropertyChanged(OBJECT_TYPE_CONVERTER_PROPERTY, oldConverter, null); - } - - protected void removeObjectTypeConverter_() { - EclipseLinkObjectTypeConverter oldConverter = this.objectTypeConverter; - this.objectTypeConverter = null; - firePropertyChanged(OBJECT_TYPE_CONVERTER_PROPERTY, oldConverter, null); - } - - protected String getObjectTypeConverterAnnotationName() { - return EclipseLinkObjectTypeConverterAnnotation.ANNOTATION_NAME; - } - - protected EclipseLinkObjectTypeConverterAnnotation getResourceObjectTypeConverter() { - return (EclipseLinkObjectTypeConverterAnnotation) this.resourcePersistentType.getAnnotation(getObjectTypeConverterAnnotationName()); - } - - - //************** type converter ************* - public EclipseLinkTypeConverter getTypeConverter() { - return this.typeConverter; - } - - public EclipseLinkTypeConverter addTypeConverter() { - if (this.typeConverter != null) { - throw new IllegalStateException("type converter already exists"); //$NON-NLS-1$ - } - this.typeConverter = buildTypeConverter(); - this.resourcePersistentType.addAnnotation(this.typeConverter.getAnnotationName()); - firePropertyChanged(TYPE_CONVERTER_PROPERTY, null, this.typeConverter); - return this.typeConverter; - } - - protected void addTypeConverter_() { - this.typeConverter = buildTypeConverter(); - firePropertyChanged(TYPE_CONVERTER_PROPERTY, null, this.typeConverter); - } - - public void removeTypeConverter() { - if (this.typeConverter == null) { - throw new IllegalStateException("type converter is null"); //$NON-NLS-1$ - } - JavaEclipseLinkTypeConverter oldConverter = this.typeConverter; - this.typeConverter = null; - this.resourcePersistentType.removeAnnotation(oldConverter.getAnnotationName()); - firePropertyChanged(TYPE_CONVERTER_PROPERTY, oldConverter, null); - } - - protected void removeTypeConverter_() { - EclipseLinkTypeConverter oldConverter = this.typeConverter; - this.typeConverter = null; - firePropertyChanged(TYPE_CONVERTER_PROPERTY, oldConverter, null); - } - - protected String getTypeConverterAnnotationName() { - return EclipseLinkTypeConverterAnnotation.ANNOTATION_NAME; - } - - protected EclipseLinkTypeConverterAnnotation getResourceTypeConverter() { - return (EclipseLinkTypeConverterAnnotation) this.resourcePersistentType.getAnnotation(getTypeConverterAnnotationName()); - } - - - //************** struct converter ************* - public EclipseLinkStructConverter getStructConverter() { - return this.structConverter; - } - - public EclipseLinkStructConverter addStructConverter() { - if (this.structConverter != null) { - throw new IllegalStateException("struct converter already exists"); //$NON-NLS-1$ - } - this.structConverter = buildStructConverter(); - this.resourcePersistentType.addAnnotation(this.structConverter.getAnnotationName()); - firePropertyChanged(STRUCT_CONVERTER_PROPERTY, null, this.structConverter); - return this.structConverter; - } - - protected void addStructConverter_() { - this.structConverter = buildStructConverter(); - firePropertyChanged(STRUCT_CONVERTER_PROPERTY, null, this.structConverter); - } - - public void removeStructConverter() { - if (this.structConverter == null) { - throw new IllegalStateException("struct converter is null"); //$NON-NLS-1$ - } - JavaEclipseLinkStructConverter oldConverter = this.structConverter; - this.structConverter = null; - this.resourcePersistentType.removeAnnotation(oldConverter.getAnnotationName()); - firePropertyChanged(STRUCT_CONVERTER_PROPERTY, oldConverter, null); - } - - protected void removeStructConverter_() { - EclipseLinkStructConverter oldConverter = this.structConverter; - this.structConverter = null; - firePropertyChanged(STRUCT_CONVERTER_PROPERTY, oldConverter, null); - } - - protected String getStructConverterAnnotationName() { - return EclipseLinkStructConverterAnnotation.ANNOTATION_NAME; - } - - protected EclipseLinkStructConverterAnnotation getResourceStructConverter() { - return (EclipseLinkStructConverterAnnotation) this.resourcePersistentType.getAnnotation(getStructConverterAnnotationName()); - } - - public void update(JavaResourcePersistentType jrpt) { - this.resourcePersistentType = jrpt; - this.updateCustomConverter(); - this.updateObjectTypeConverter(); - this.updateTypeConverter(); - this.updateStructConverter(); - } - - protected void updateCustomConverter() { - if (getResourceConverter() != null) { - if (this.customConverter != null) { - this.customConverter.update(this.resourcePersistentType); - } - else { - addCustomConverter_(); - } - } - else { - if (this.customConverter != null) { - removeCustomConverter_(); - } - } - } - - protected void updateObjectTypeConverter() { - if (getResourceObjectTypeConverter() != null) { - if (this.objectTypeConverter != null) { - this.objectTypeConverter.update(this.resourcePersistentType); - } - else { - addObjectTypeConverter_(); - } - } - else { - if (this.objectTypeConverter != null) { - removeObjectTypeConverter_(); - } - } - } - - protected void updateTypeConverter() { - if (getResourceTypeConverter() != null) { - if (this.typeConverter != null) { - this.typeConverter.update(this.resourcePersistentType); - } - else { - addTypeConverter_(); - } - } - else { - if (this.typeConverter != null) { - removeTypeConverter(); - } - } - } - - protected void updateStructConverter() { - if (getResourceStructConverter() != null) { - if (this.structConverter != null) { - this.structConverter.update(this.resourcePersistentType); - } - else { - addStructConverter_(); - } - } - else { - if (this.structConverter != null) { - removeStructConverter_(); - } - } - } - - public void initialize(JavaResourcePersistentType jrpt) { - this.resourcePersistentType = jrpt; - this.initializeCustomConverter(); - this.initializeObjectTypeConverter(); - this.initializeTypeConverter(); - this.initializeStructConverter(); - } - - protected void initializeCustomConverter() { - if (getResourceConverter() != null) { - this.customConverter = buildCustomConverter(); - } - } - - protected void initializeObjectTypeConverter() { - if (getResourceObjectTypeConverter() != null) { - this.objectTypeConverter = buildObjectTypeConverter(); - } - } - - protected void initializeTypeConverter() { - if (getResourceTypeConverter() != null) { - this.typeConverter = buildTypeConverter(); - } - } - - protected void initializeStructConverter() { - if (getResourceStructConverter() != null) { - this.structConverter = buildStructConverter(); - } - } - protected JavaEclipseLinkCustomConverter buildCustomConverter() { - JavaEclipseLinkCustomConverter contextConverter = new JavaEclipseLinkCustomConverter(this); - contextConverter.initialize(this.resourcePersistentType); - return contextConverter; - } - - protected JavaEclipseLinkTypeConverter buildTypeConverter() { - JavaEclipseLinkTypeConverter contextConverter = new JavaEclipseLinkTypeConverter(this); - contextConverter.initialize(this.resourcePersistentType); - return contextConverter; - } - - protected JavaEclipseLinkObjectTypeConverter buildObjectTypeConverter() { - JavaEclipseLinkObjectTypeConverter contextConverter = new JavaEclipseLinkObjectTypeConverter(this); - contextConverter.initialize(this.resourcePersistentType); - return contextConverter; - } - - protected JavaEclipseLinkStructConverter buildStructConverter() { - JavaEclipseLinkStructConverter contextConverter = new JavaEclipseLinkStructConverter(this); - contextConverter.initialize(this.resourcePersistentType); - return contextConverter; - } - - public TextRange getValidationTextRange(CompilationUnit astRoot) { - return this.resourcePersistentType.getTextRange(astRoot); - } - - @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); - } - } - -} diff --git a/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/java/JavaEclipseLinkCustomConverter.java b/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/java/JavaEclipseLinkCustomConverter.java deleted file mode 100644 index 3990805281..0000000000 --- a/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/java/JavaEclipseLinkCustomConverter.java +++ /dev/null @@ -1,118 +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.eclipselink.core.internal.context.java; - -import java.util.List; -import org.eclipse.jdt.core.dom.CompilationUnit; -import org.eclipse.jpt.core.context.java.JavaJpaContextNode; -import org.eclipse.jpt.core.resource.java.JavaResourcePersistentMember; -import org.eclipse.jpt.core.utility.TextRange; -import org.eclipse.jpt.eclipselink.core.context.EclipseLinkCustomConverter; -import org.eclipse.jpt.eclipselink.core.context.EclipseLinkConverter; -import org.eclipse.jpt.eclipselink.core.internal.DefaultEclipseLinkJpaValidationMessages; -import org.eclipse.jpt.eclipselink.core.internal.EclipseLinkJpaValidationMessages; -import org.eclipse.jpt.eclipselink.core.resource.java.EclipseLinkConverterAnnotation; -import org.eclipse.wst.validation.internal.provisional.core.IMessage; -import org.eclipse.wst.validation.internal.provisional.core.IReporter; - -public class JavaEclipseLinkCustomConverter extends JavaEclipseLinkConverter - implements EclipseLinkCustomConverter -{ - private String converterClass; - - public JavaEclipseLinkCustomConverter(JavaJpaContextNode parent) { - super(parent); - } - - - public String getType() { - return EclipseLinkConverter.CUSTOM_CONVERTER; - } - - @Override - public String getAnnotationName() { - return EclipseLinkConverterAnnotation.ANNOTATION_NAME; - } - - @Override - protected EclipseLinkConverterAnnotation getAnnotation() { - return (EclipseLinkConverterAnnotation) super.getAnnotation(); - } - - - // **************** converter class **************************************** - - public String getConverterClass() { - return this.converterClass; - } - - public void setConverterClass(String newConverterClass) { - String oldConverterClass = this.converterClass; - this.converterClass = newConverterClass; - getAnnotation().setConverterClass(newConverterClass); - firePropertyChanged(CONVERTER_CLASS_PROPERTY, oldConverterClass, newConverterClass); - } - - protected void setConverterClass_(String newConverterClass) { - String oldConverterClass = this.converterClass; - this.converterClass = newConverterClass; - firePropertyChanged(CONVERTER_CLASS_PROPERTY, oldConverterClass, newConverterClass); - } - - - // **************** resource interaction *********************************** - - @Override - protected void initialize(JavaResourcePersistentMember jrpm) { - super.initialize(jrpm); - this.converterClass = this.converterClass(getAnnotation()); - } - - @Override - public void update(JavaResourcePersistentMember jrpm) { - super.update(jrpm); - this.setConverterClass_(this.converterClass(getAnnotation())); - } - - protected String converterClass(EclipseLinkConverterAnnotation resourceConverter) { - return resourceConverter == null ? null : resourceConverter.getConverterClass(); - } - - public TextRange getConverterClassTextRange(CompilationUnit astRoot) { - return getAnnotation().getConverterClassTextRange(astRoot); - } - - - //************ validation *************** - - @Override - public void validate(List<IMessage> messages, IReporter reporter, CompilationUnit astRoot) { - super.validate(messages, reporter, astRoot); - 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 (! getAnnotation().converterClassImplementsInterface(ECLIPSELINK_CONVERTER_CLASS_NAME, astRoot)) { - messages.add( - DefaultEclipseLinkJpaValidationMessages.buildMessage( - IMessage.HIGH_SEVERITY, - EclipseLinkJpaValidationMessages.CONVERTER_CLASS_IMPLEMENTS_CONVERTER, - new String[] {this.converterClass}, - this, - getConverterClassTextRange(astRoot) - ) - ); - } - } -} diff --git a/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/java/JavaEclipseLinkCustomizer.java b/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/java/JavaEclipseLinkCustomizer.java deleted file mode 100644 index 5bf19b59dd..0000000000 --- a/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/java/JavaEclipseLinkCustomizer.java +++ /dev/null @@ -1,143 +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.eclipselink.core.internal.context.java; - -import java.util.List; -import org.eclipse.jdt.core.dom.CompilationUnit; -import org.eclipse.jpt.core.context.java.JavaJpaContextNode; -import org.eclipse.jpt.core.internal.context.java.AbstractJavaJpaContextNode; -import org.eclipse.jpt.core.resource.java.JavaResourcePersistentType; -import org.eclipse.jpt.core.utility.TextRange; -import org.eclipse.jpt.eclipselink.core.context.EclipseLinkCustomizer; -import org.eclipse.jpt.eclipselink.core.internal.DefaultEclipseLinkJpaValidationMessages; -import org.eclipse.jpt.eclipselink.core.internal.EclipseLinkJpaFactory; -import org.eclipse.jpt.eclipselink.core.internal.EclipseLinkJpaValidationMessages; -import org.eclipse.jpt.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 JavaResourcePersistentType resourcePersistentType; - - private String customizerClass; - - public JavaEclipseLinkCustomizer(JavaJpaContextNode parent) { - super(parent); - } - - public char getCustomizerClassEnclosingTypeSeparator() { - return '.'; - } - - @Override - protected EclipseLinkJpaFactory getJpaFactory() { - return (EclipseLinkJpaFactory) super.getJpaFactory(); - } - - protected String getAnnotationName() { - return EclipseLinkCustomizerAnnotation.ANNOTATION_NAME; - } - - protected void addResourceCustomizer() { - this.resourcePersistentType.addAnnotation(getAnnotationName()); - } - - protected void removeResourceCustomizer() { - this.resourcePersistentType.removeAnnotation(getAnnotationName()); - } - - public TextRange getValidationTextRange(CompilationUnit astRoot) { - return getResourceCustomizer().getTextRange(astRoot); - } - - protected EclipseLinkCustomizerAnnotation getResourceCustomizer() { - return (EclipseLinkCustomizerAnnotation) this.resourcePersistentType.getAnnotation(getAnnotationName()); - } - - public String getCustomizerClass() { - return getSpecifiedCustomizerClass(); - } - - public String getDefaultCustomizerClass() { - return null; - } - - public String getSpecifiedCustomizerClass() { - return this.customizerClass; - } - - public void setSpecifiedCustomizerClass(String newCustomizerClass) { - if (attributeValueHasNotChanged(this.customizerClass, newCustomizerClass)) { - return; - } - String oldCustomizerClass = this.customizerClass; - this.customizerClass = newCustomizerClass; - if (this.customizerClass != null) { - addResourceCustomizer(); - } - else { - removeResourceCustomizer(); - } - if (newCustomizerClass != null) { - getResourceCustomizer().setValue(newCustomizerClass); - } - firePropertyChanged(SPECIFIED_CUSTOMIZER_CLASS_PROPERTY, oldCustomizerClass, newCustomizerClass); - } - - protected void setCustomizerClass_(String newCustomizerClass) { - String oldCustomizerClass = this.customizerClass; - this.customizerClass = newCustomizerClass; - firePropertyChanged(SPECIFIED_CUSTOMIZER_CLASS_PROPERTY, oldCustomizerClass, newCustomizerClass); - } - - public void initialize(JavaResourcePersistentType jrpt) { - this.resourcePersistentType = jrpt; - EclipseLinkCustomizerAnnotation resourceCustomizer = getResourceCustomizer(); - this.customizerClass = this.customizerClass(resourceCustomizer); - } - - public void update(JavaResourcePersistentType jrpt) { - this.resourcePersistentType = jrpt; - EclipseLinkCustomizerAnnotation resourceCustomizer = getResourceCustomizer(); - this.setCustomizerClass_(this.customizerClass(resourceCustomizer)); - } - - protected String customizerClass(EclipseLinkCustomizerAnnotation resourceCustomizer) { - return resourceCustomizer == null ? null : resourceCustomizer.getValue(); - } - - public TextRange getCustomizerClassTextRange(CompilationUnit astRoot) { - return getResourceCustomizer().getValueTextRange(astRoot); - } - - //************ validation *************** - - @Override - public void validate(List<IMessage> messages, IReporter reporter, CompilationUnit astRoot) { - super.validate(messages, reporter, astRoot); - validateConverterClass(messages, astRoot); - } - - protected void validateConverterClass(List<IMessage> messages, CompilationUnit astRoot) { - EclipseLinkCustomizerAnnotation resourceCustomizer = getResourceCustomizer(); - if (resourceCustomizer != null && !resourceCustomizer.customizerClassImplementsInterface(ECLIPSELINK_DESCRIPTOR_CUSTOMIZER_CLASS_NAME, astRoot)) { - messages.add( - DefaultEclipseLinkJpaValidationMessages.buildMessage( - IMessage.HIGH_SEVERITY, - EclipseLinkJpaValidationMessages.CUSTOMIZER_CLASS_IMPLEMENTS_DESCRIPTOR_CUSTOMIZER, - new String[] {this.customizerClass}, - this, - getCustomizerClassTextRange(astRoot) - ) - ); - } - } -} diff --git a/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/java/JavaEclipseLinkEmbeddableImpl.java b/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/java/JavaEclipseLinkEmbeddableImpl.java deleted file mode 100644 index 664cf47a0a..0000000000 --- a/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/java/JavaEclipseLinkEmbeddableImpl.java +++ /dev/null @@ -1,78 +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.eclipselink.core.internal.context.java; - -import java.util.List; -import org.eclipse.jdt.core.dom.CompilationUnit; -import org.eclipse.jpt.core.context.java.JavaPersistentType; -import org.eclipse.jpt.core.internal.context.java.AbstractJavaEmbeddable; -import org.eclipse.jpt.core.resource.java.JavaResourcePersistentType; -import org.eclipse.jpt.eclipselink.core.context.EclipseLinkChangeTracking; -import org.eclipse.jpt.eclipselink.core.context.EclipseLinkCustomizer; -import org.eclipse.jpt.eclipselink.core.context.java.JavaEclipseLinkConverterHolder; -import org.eclipse.jpt.eclipselink.core.context.java.JavaEclipseLinkEmbeddable; -import org.eclipse.wst.validation.internal.provisional.core.IMessage; -import org.eclipse.wst.validation.internal.provisional.core.IReporter; - -public class JavaEclipseLinkEmbeddableImpl extends AbstractJavaEmbeddable implements JavaEclipseLinkEmbeddable -{ - - protected final JavaEclipseLinkConverterHolder converterHolder; - - protected final JavaEclipseLinkCustomizer customizer; - - protected final JavaEclipseLinkChangeTracking changeTracking; - - public JavaEclipseLinkEmbeddableImpl(JavaPersistentType parent) { - super(parent); - this.converterHolder = new JavaEclipseLinkConverterHolderImpl(this); - this.customizer = new JavaEclipseLinkCustomizer(this); - this.changeTracking = new JavaEclipseLinkChangeTracking(this); - } - - public JavaEclipseLinkConverterHolder getConverterHolder() { - return this.converterHolder; - } - - public EclipseLinkCustomizer getCustomizer() { - return this.customizer; - } - - public EclipseLinkChangeTracking getChangeTracking() { - return this.changeTracking; - } - - @Override - public void initialize(JavaResourcePersistentType jrpt) { - super.initialize(jrpt); - this.converterHolder.initialize(jrpt); - this.customizer.initialize(jrpt); - this.changeTracking.initialize(jrpt); - } - - @Override - public void update(JavaResourcePersistentType jrpt) { - super.update(jrpt); - this.converterHolder.update(jrpt); - this.customizer.update(jrpt); - this.changeTracking.update(jrpt); - } - - - //********** Validation ******************************************** - - @Override - public void validate(List<IMessage> messages, IReporter reporter, CompilationUnit astRoot) { - super.validate(messages, reporter, astRoot); - this.converterHolder.validate(messages, reporter, astRoot); - this.customizer.validate(messages, reporter, astRoot); - this.changeTracking.validate(messages, reporter, astRoot); - } -} diff --git a/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/java/JavaEclipseLinkEntityImpl.java b/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/java/JavaEclipseLinkEntityImpl.java deleted file mode 100644 index a1b336a394..0000000000 --- a/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/java/JavaEclipseLinkEntityImpl.java +++ /dev/null @@ -1,109 +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.eclipselink.core.internal.context.java; - -import java.util.List; -import org.eclipse.jdt.core.dom.CompilationUnit; -import org.eclipse.jpt.core.context.java.JavaPersistentType; -import org.eclipse.jpt.core.internal.context.java.AbstractJavaEntity; -import org.eclipse.jpt.core.jpa2.context.java.JavaCacheable2_0; -import org.eclipse.jpt.core.jpa2.context.java.JavaCacheableHolder2_0; -import org.eclipse.jpt.core.resource.java.JavaResourcePersistentType; -import org.eclipse.jpt.eclipselink.core.context.EclipseLinkChangeTracking; -import org.eclipse.jpt.eclipselink.core.context.EclipseLinkCustomizer; -import org.eclipse.jpt.eclipselink.core.context.EclipseLinkReadOnly; -import org.eclipse.jpt.eclipselink.core.context.java.JavaEclipseLinkConverterHolder; -import org.eclipse.jpt.eclipselink.core.context.java.JavaEclipseLinkEntity; -import org.eclipse.jpt.eclipselink.core.context.java.JavaEclipseLinkCaching; -import org.eclipse.wst.validation.internal.provisional.core.IMessage; -import org.eclipse.wst.validation.internal.provisional.core.IReporter; - -public class JavaEclipseLinkEntityImpl extends AbstractJavaEntity implements JavaEclipseLinkEntity -{ - protected final JavaEclipseLinkCaching eclipseLinkCaching; - - protected final JavaEclipseLinkConverterHolder converterHolder; - - protected final JavaEclipseLinkReadOnly readOnly; - - protected final JavaEclipseLinkCustomizer customizer; - - protected final JavaEclipseLinkChangeTracking changeTracking; - - public JavaEclipseLinkEntityImpl(JavaPersistentType parent) { - super(parent); - this.eclipseLinkCaching = new JavaEclipseLinkCachingImpl(this); - this.converterHolder = new JavaEclipseLinkConverterHolderImpl(this); - this.readOnly = new JavaEclipseLinkReadOnly(this); - this.changeTracking = new JavaEclipseLinkChangeTracking(this); - this.customizer = new JavaEclipseLinkCustomizer(this); - } - - public JavaEclipseLinkCaching getCaching() { - return this.eclipseLinkCaching; - } - - public JavaEclipseLinkConverterHolder getConverterHolder() { - return this.converterHolder; - } - - public EclipseLinkReadOnly getReadOnly() { - return this.readOnly; - } - - public EclipseLinkCustomizer getCustomizer() { - return this.customizer; - } - - public EclipseLinkChangeTracking getChangeTracking() { - return this.changeTracking; - } - - public JavaCacheable2_0 getCacheable() { - return ((JavaCacheableHolder2_0) getCaching()).getCacheable(); - } - - public boolean calculateDefaultCacheable() { - return ((JavaCacheableHolder2_0) getCaching()).calculateDefaultCacheable(); - } - - @Override - public void initialize(JavaResourcePersistentType jrpt) { - super.initialize(jrpt); - this.eclipseLinkCaching.initialize(jrpt); - this.converterHolder.initialize(jrpt); - this.readOnly.initialize(jrpt); - this.customizer.initialize(jrpt); - this.changeTracking.initialize(jrpt); - } - - @Override - public void update(JavaResourcePersistentType jrpt) { - super.update(jrpt); - this.eclipseLinkCaching.update(jrpt); - this.converterHolder.update(jrpt); - this.readOnly.update(jrpt); - this.customizer.update(jrpt); - this.changeTracking.update(jrpt); - } - - - //********** Validation ******************************************** - - @Override - public void validate(List<IMessage> messages, IReporter reporter, CompilationUnit astRoot) { - super.validate(messages, reporter, astRoot); - this.eclipseLinkCaching.validate(messages, reporter, astRoot); - this.converterHolder.validate(messages, reporter, astRoot); - this.readOnly.validate(messages, reporter, astRoot); - this.customizer.validate(messages, reporter, astRoot); - this.changeTracking.validate(messages, reporter, astRoot); - } -} diff --git a/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/java/JavaEclipseLinkExpiryTimeOfDay.java b/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/java/JavaEclipseLinkExpiryTimeOfDay.java deleted file mode 100644 index dc80e07078..0000000000 --- a/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/java/JavaEclipseLinkExpiryTimeOfDay.java +++ /dev/null @@ -1,137 +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.eclipselink.core.internal.context.java; - -import org.eclipse.jdt.core.dom.CompilationUnit; -import org.eclipse.jpt.core.internal.context.java.AbstractJavaJpaContextNode; -import org.eclipse.jpt.core.utility.TextRange; -import org.eclipse.jpt.eclipselink.core.context.EclipseLinkCaching; -import org.eclipse.jpt.eclipselink.core.context.EclipseLinkExpiryTimeOfDay; -import org.eclipse.jpt.eclipselink.core.resource.java.EclipseLinkTimeOfDayAnnotation; - -public class JavaEclipseLinkExpiryTimeOfDay extends AbstractJavaJpaContextNode - implements EclipseLinkExpiryTimeOfDay -{ - - protected Integer hour; - protected Integer minute; - protected Integer second; - protected Integer millisecond; - - protected EclipseLinkTimeOfDayAnnotation timeOfDay; - - public JavaEclipseLinkExpiryTimeOfDay(EclipseLinkCaching parent) { - super(parent); - } - - public Integer getHour() { - return this.hour; - } - - public void setHour(Integer newHour) { - Integer oldHour = this.hour; - this.hour = newHour; - this.timeOfDay.setHour(newHour); - firePropertyChanged(HOUR_PROPERTY, oldHour, newHour); - } - - protected void setHour_(Integer newHour) { - Integer oldHour = this.hour; - this.hour = newHour; - firePropertyChanged(HOUR_PROPERTY, oldHour, newHour); - } - - public Integer getMinute() { - return this.minute; - } - - public void setMinute(Integer newMinute) { - Integer oldMinute = this.minute; - this.minute = newMinute; - this.timeOfDay.setMinute(newMinute); - firePropertyChanged(MINUTE_PROPERTY, oldMinute, newMinute); - } - - protected void setMinute_(Integer newMinute) { - Integer oldMinute = this.minute; - this.minute = newMinute; - firePropertyChanged(MINUTE_PROPERTY, oldMinute, newMinute); - } - - public Integer getSecond() { - return this.second; - } - - public void setSecond(Integer newSecond) { - Integer oldSecond = this.second; - this.second = newSecond; - this.timeOfDay.setSecond(newSecond); - firePropertyChanged(SECOND_PROPERTY, oldSecond, newSecond); - } - - protected void setSecond_(Integer newSecond) { - Integer oldSecond = this.second; - this.second = newSecond; - firePropertyChanged(SECOND_PROPERTY, oldSecond, newSecond); - } - - public Integer getMillisecond() { - return this.millisecond; - } - - public void setMillisecond(Integer newMillisecond) { - Integer oldMillisecond = this.millisecond; - this.millisecond = newMillisecond; - this.timeOfDay.setMillisecond(newMillisecond); - firePropertyChanged(MILLISECOND_PROPERTY, oldMillisecond, newMillisecond); - } - - protected void setMillisecond_(Integer newMillisecond) { - Integer oldMillisecond = this.millisecond; - this.millisecond = newMillisecond; - firePropertyChanged(MILLISECOND_PROPERTY, oldMillisecond, newMillisecond); - } - - public TextRange getValidationTextRange(CompilationUnit astRoot) { - return this.timeOfDay.getTextRange(astRoot); - } - - public void initialize(EclipseLinkTimeOfDayAnnotation timeOfDay) { - this.timeOfDay = timeOfDay; - this.hour = getHour(timeOfDay); - this.minute = getMinute(timeOfDay); - this.second = getSecond(timeOfDay); - this.millisecond = getMillisecond(timeOfDay); - } - - public void update(EclipseLinkTimeOfDayAnnotation timeOfDay) { - this.timeOfDay = timeOfDay; - this.setHour_(getHour(timeOfDay)); - this.setMinute_(getMinute(timeOfDay)); - this.setSecond_(getSecond(timeOfDay)); - this.setMillisecond_(getMillisecond(timeOfDay)); - } - - protected Integer getHour(EclipseLinkTimeOfDayAnnotation timeOfDay) { - return timeOfDay.getHour(); - } - - protected Integer getMinute(EclipseLinkTimeOfDayAnnotation timeOfDay) { - return timeOfDay.getMinute(); - } - - protected Integer getSecond(EclipseLinkTimeOfDayAnnotation timeOfDay) { - return timeOfDay.getSecond(); - } - - protected Integer getMillisecond(EclipseLinkTimeOfDayAnnotation timeOfDay) { - return timeOfDay.getMillisecond(); - } -} diff --git a/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/java/JavaEclipseLinkIdMapping.java b/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/java/JavaEclipseLinkIdMapping.java deleted file mode 100644 index ab75c4740a..0000000000 --- a/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/java/JavaEclipseLinkIdMapping.java +++ /dev/null @@ -1,119 +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.eclipselink.core.internal.context.java; - -import java.util.Iterator; -import java.util.List; -import java.util.Vector; - -import org.eclipse.jdt.core.dom.CompilationUnit; -import org.eclipse.jpt.core.context.java.JavaConverter; -import org.eclipse.jpt.core.context.java.JavaPersistentAttribute; -import org.eclipse.jpt.core.internal.context.java.AbstractJavaIdMapping; -import org.eclipse.jpt.eclipselink.core.context.EclipseLinkConvert; -import org.eclipse.jpt.eclipselink.core.context.EclipseLinkIdMapping; -import org.eclipse.jpt.eclipselink.core.context.EclipseLinkMutable; -import org.eclipse.jpt.eclipselink.core.resource.java.EclipseLink; -import org.eclipse.jpt.eclipselink.core.resource.java.EclipseLinkConvertAnnotation; -import org.eclipse.jpt.utility.Filter; -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); - } - - //************** JavaAttributeMapping implementation *************** - - @Override - protected void addSupportingAnnotationNamesTo(Vector<String> names) { - super.addSupportingAnnotationNamesTo(names); - names.add(EclipseLink.MUTABLE); - names.add(EclipseLink.CONVERT); - } - - - //************** AbstractJavaIdMapping overrides *************** - - @Override - protected JavaConverter buildSpecifiedConverter(String converterType) { - JavaConverter javaConverter = super.buildSpecifiedConverter(converterType); - if (javaConverter != null) { - return javaConverter; - } - if (converterType == EclipseLinkConvert.ECLIPSE_LINK_CONVERTER) { - return new JavaEclipseLinkConvert(this, this.getResourcePersistentAttribute()); - } - return null; - } - - @Override - protected String getResourceConverterType() { - //check @Convert first, this is the order that EclipseLink searches - if (this.getResourcePersistentAttribute().getAnnotation(EclipseLinkConvertAnnotation.ANNOTATION_NAME) != null) { - return EclipseLinkConvert.ECLIPSE_LINK_CONVERTER; - } - return super.getResourceConverterType(); - } - - - //************ EclipselinkIdMapping implementation **************** - - public EclipseLinkMutable getMutable() { - return this.mutable; - } - - - //************ initialization/update **************** - - @Override - protected void initialize() { - super.initialize(); - this.mutable.initialize(this.getResourcePersistentAttribute()); - } - - @Override - protected void update() { - super.update(); - this.mutable.update(this.getResourcePersistentAttribute()); - } - - // ********** code assist ********** - - @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 (getConverter() != null) { - result = getConverter().javaCompletionProposals(pos, filter, astRoot); - if (result != null) { - return result; - } - } - return null; - } - - //************ validation **************** - - @Override - public void validate(List<IMessage> messages, IReporter reporter, CompilationUnit astRoot) { - super.validate(messages, reporter, astRoot); - this.mutable.validate(messages, reporter, astRoot); - } -} diff --git a/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/java/JavaEclipseLinkJoinFetch.java b/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/java/JavaEclipseLinkJoinFetch.java deleted file mode 100644 index 45aac07dae..0000000000 --- a/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/java/JavaEclipseLinkJoinFetch.java +++ /dev/null @@ -1,120 +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.eclipselink.core.internal.context.java; - -import org.eclipse.jdt.core.dom.CompilationUnit; -import org.eclipse.jpt.core.context.java.JavaAttributeMapping; -import org.eclipse.jpt.core.internal.context.java.AbstractJavaJpaContextNode; -import org.eclipse.jpt.core.resource.java.JavaResourcePersistentAttribute; -import org.eclipse.jpt.core.utility.TextRange; -import org.eclipse.jpt.eclipselink.core.context.EclipseLinkJoinFetch; -import org.eclipse.jpt.eclipselink.core.context.EclipseLinkJoinFetchType; -import org.eclipse.jpt.eclipselink.core.resource.java.EclipseLinkJoinFetchAnnotation; - -public class JavaEclipseLinkJoinFetch - extends AbstractJavaJpaContextNode - implements EclipseLinkJoinFetch -{ - protected EclipseLinkJoinFetchType joinFetchValue; - - protected JavaResourcePersistentAttribute resourcePersistentAttribute; - - - public JavaEclipseLinkJoinFetch(JavaAttributeMapping parent) { - super(parent); - } - - - protected String getJoinFetchAnnotationName() { - return EclipseLinkJoinFetchAnnotation.ANNOTATION_NAME; - } - - protected EclipseLinkJoinFetchAnnotation getResourceJoinFetch() { - return (EclipseLinkJoinFetchAnnotation) this.resourcePersistentAttribute.getAnnotation(getJoinFetchAnnotationName()); - } - - protected void addResourceJoinFetch() { - this.resourcePersistentAttribute.addAnnotation(getJoinFetchAnnotationName()); - } - - protected void removeResourceJoinFetch() { - this.resourcePersistentAttribute.removeAnnotation(getJoinFetchAnnotationName()); - } - - public EclipseLinkJoinFetchType getValue() { - return this.joinFetchValue; - } - - protected EclipseLinkJoinFetchType getDefaultValue() { - return EclipseLinkJoinFetch.DEFAULT_VALUE; - } - - public void setValue(EclipseLinkJoinFetchType newJoinFetchValue) { - if (this.joinFetchValue == newJoinFetchValue) { - return; - } - - EclipseLinkJoinFetchType oldJoinFetchValue = this.joinFetchValue; - this.joinFetchValue = newJoinFetchValue; - - if (newJoinFetchValue != null) { - if (getResourceJoinFetch() == null) { - addResourceJoinFetch(); - } - getResourceJoinFetch().setValue(EclipseLinkJoinFetchType.toJavaResourceModel(newJoinFetchValue)); - } - else { - if (getResourceJoinFetch() != null) { - removeResourceJoinFetch(); - } - } - firePropertyChanged(EclipseLinkJoinFetch.VALUE_PROPERTY, oldJoinFetchValue, newJoinFetchValue); - } - - /** - * internal setter used only for updating from the resource model. - * There were problems with InvalidThreadAccess exceptions in the UI - * when you set a value from the UI and the annotation doesn't exist yet. - * Adding the annotation causes an update to occur and then the exception. - */ - protected void setValue_(EclipseLinkJoinFetchType newJoinFetchValue) { - EclipseLinkJoinFetchType oldJoinFetchValue = this.joinFetchValue; - this.joinFetchValue = newJoinFetchValue; - firePropertyChanged(EclipseLinkJoinFetch.VALUE_PROPERTY, oldJoinFetchValue, newJoinFetchValue); - } - - public void initialize(JavaResourcePersistentAttribute jrpa) { - this.resourcePersistentAttribute = jrpa; - EclipseLinkJoinFetchAnnotation resourceJoinFetch = this.getResourceJoinFetch(); - this.joinFetchValue = this.joinFetch(resourceJoinFetch); - } - - public void update(JavaResourcePersistentAttribute jrpa) { - this.resourcePersistentAttribute = jrpa; - EclipseLinkJoinFetchAnnotation resourceJoinFetch = this.getResourceJoinFetch(); - setValue_(joinFetch(resourceJoinFetch)); - } - - private EclipseLinkJoinFetchType joinFetch(EclipseLinkJoinFetchAnnotation resourceJoinFetch) { - if (resourceJoinFetch == null) { - return null; - } - if (resourceJoinFetch.getValue() == null) { - // @JoinFetch is equivalent to @JoinFetch(JoinFetch.INNER) - return getDefaultValue(); - } - return EclipseLinkJoinFetchType.fromJavaResourceModel(resourceJoinFetch.getValue()); - } - - public TextRange getValidationTextRange(CompilationUnit astRoot) { - EclipseLinkJoinFetchAnnotation resourceJoinFetch = this.getResourceJoinFetch(); - return resourceJoinFetch == null ? null : resourceJoinFetch.getTextRange(astRoot); - } -} diff --git a/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/java/JavaEclipseLinkManyToManyMapping.java b/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/java/JavaEclipseLinkManyToManyMapping.java deleted file mode 100644 index 7c01655ec7..0000000000 --- a/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/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.eclipselink.core.internal.context.java; - -import java.util.List; -import java.util.Vector; - -import org.eclipse.jdt.core.dom.CompilationUnit; -import org.eclipse.jpt.core.context.java.JavaPersistentAttribute; -import org.eclipse.jpt.core.internal.context.java.AbstractJavaManyToManyMapping; -import org.eclipse.jpt.eclipselink.core.context.EclipseLinkJoinFetch; -import org.eclipse.jpt.eclipselink.core.context.EclipseLinkRelationshipMapping; -import org.eclipse.jpt.eclipselink.core.resource.java.EclipseLink; -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); - } - - @Override - protected void addSupportingAnnotationNamesTo(Vector<String> names) { - super.addSupportingAnnotationNamesTo(names); - names.add(EclipseLink.JOIN_FETCH); - } - - public EclipseLinkJoinFetch getJoinFetch() { - return this.joinFetch; - } - - @Override - protected void initialize() { - super.initialize(); - this.joinFetch.initialize(this.getResourcePersistentAttribute()); - } - - @Override - protected void update() { - super.update(); - this.joinFetch.update(this.getResourcePersistentAttribute()); - } - - @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.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/java/JavaEclipseLinkManyToOneMapping.java b/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/java/JavaEclipseLinkManyToOneMapping.java deleted file mode 100644 index 6fa415c9a6..0000000000 --- a/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/java/JavaEclipseLinkManyToOneMapping.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.eclipselink.core.internal.context.java; - -import java.util.List; -import java.util.Vector; - -import org.eclipse.jdt.core.dom.CompilationUnit; -import org.eclipse.jpt.core.context.java.JavaPersistentAttribute; -import org.eclipse.jpt.core.internal.context.java.AbstractJavaManyToOneMapping; -import org.eclipse.jpt.eclipselink.core.context.EclipseLinkJoinFetch; -import org.eclipse.jpt.eclipselink.core.context.EclipseLinkRelationshipMapping; -import org.eclipse.jpt.eclipselink.core.resource.java.EclipseLink; -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); - } - - @Override - protected void addSupportingAnnotationNamesTo(Vector<String> names) { - super.addSupportingAnnotationNamesTo(names); - names.add(EclipseLink.JOIN_FETCH); - } - - public EclipseLinkJoinFetch getJoinFetch() { - return this.joinFetch; - } - - @Override - protected void initialize() { - super.initialize(); - this.joinFetch.initialize(this.getResourcePersistentAttribute()); - } - - @Override - protected void update() { - super.update(); - this.joinFetch.update(this.getResourcePersistentAttribute()); - } - - @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.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/java/JavaEclipseLinkMappedSuperclassImpl.java b/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/java/JavaEclipseLinkMappedSuperclassImpl.java deleted file mode 100644 index 46915fad54..0000000000 --- a/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/java/JavaEclipseLinkMappedSuperclassImpl.java +++ /dev/null @@ -1,112 +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.eclipselink.core.internal.context.java; - -import java.util.List; -import org.eclipse.jdt.core.dom.CompilationUnit; -import org.eclipse.jpt.core.context.java.JavaPersistentType; -import org.eclipse.jpt.core.internal.context.java.AbstractJavaMappedSuperclass; -import org.eclipse.jpt.core.jpa2.context.Cacheable2_0; -import org.eclipse.jpt.core.jpa2.context.CacheableHolder2_0; -import org.eclipse.jpt.core.resource.java.JavaResourcePersistentType; -import org.eclipse.jpt.eclipselink.core.context.EclipseLinkChangeTracking; -import org.eclipse.jpt.eclipselink.core.context.EclipseLinkCustomizer; -import org.eclipse.jpt.eclipselink.core.context.EclipseLinkReadOnly; -import org.eclipse.jpt.eclipselink.core.context.java.JavaEclipseLinkConverterHolder; -import org.eclipse.jpt.eclipselink.core.context.java.JavaEclipseLinkMappedSuperclass; -import org.eclipse.jpt.eclipselink.core.context.java.JavaEclipseLinkCaching; -import org.eclipse.wst.validation.internal.provisional.core.IMessage; -import org.eclipse.wst.validation.internal.provisional.core.IReporter; - -public class JavaEclipseLinkMappedSuperclassImpl - extends AbstractJavaMappedSuperclass - implements JavaEclipseLinkMappedSuperclass, - CacheableHolder2_0 -{ - protected JavaEclipseLinkCaching eclipseLinkCaching; - - protected final JavaEclipseLinkConverterHolder converterHolder; - - protected final JavaEclipseLinkReadOnly readOnly; - - protected final JavaEclipseLinkCustomizer customizer; - - protected final JavaEclipseLinkChangeTracking changeTracking; - - public JavaEclipseLinkMappedSuperclassImpl(JavaPersistentType parent) { - super(parent); - this.eclipseLinkCaching = new JavaEclipseLinkCachingImpl(this); - this.converterHolder = new JavaEclipseLinkConverterHolderImpl(this); - this.readOnly = new JavaEclipseLinkReadOnly(this); - this.customizer = new JavaEclipseLinkCustomizer(this); - this.changeTracking = new JavaEclipseLinkChangeTracking(this); - } - - public JavaEclipseLinkCaching getCaching() { - return this.eclipseLinkCaching; - } - - public JavaEclipseLinkConverterHolder getConverterHolder() { - return this.converterHolder; - } - - public EclipseLinkReadOnly getReadOnly() { - return this.readOnly; - } - - public EclipseLinkCustomizer getCustomizer() { - return this.customizer; - } - - public EclipseLinkChangeTracking getChangeTracking() { - return this.changeTracking; - } - - public Cacheable2_0 getCacheable() { - return ((CacheableHolder2_0) getCaching()).getCacheable(); - } - - public boolean calculateDefaultCacheable() { - return ((CacheableHolder2_0) getCaching()).calculateDefaultCacheable(); - } - - @Override - public void initialize(JavaResourcePersistentType jrpt) { - super.initialize(jrpt); - this.eclipseLinkCaching.initialize(jrpt); - this.converterHolder.initialize(jrpt); - this.readOnly.initialize(jrpt); - this.customizer.initialize(jrpt); - this.changeTracking.initialize(jrpt); - } - - @Override - public void update(JavaResourcePersistentType jrpt) { - super.update(jrpt); - this.eclipseLinkCaching.update(jrpt); - this.converterHolder.update(jrpt); - this.readOnly.update(jrpt); - this.customizer.update(jrpt); - this.changeTracking.update(jrpt); - } - - - //********** Validation ******************************************** - - @Override - public void validate(List<IMessage> messages, IReporter reporter, CompilationUnit astRoot) { - super.validate(messages, reporter, astRoot); - this.eclipseLinkCaching.validate(messages, reporter, astRoot); - this.converterHolder.validate(messages, reporter, astRoot); - this.readOnly.validate(messages, reporter, astRoot); - this.customizer.validate(messages, reporter, astRoot); - this.changeTracking.validate(messages, reporter, astRoot); - } -} diff --git a/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/java/JavaEclipseLinkMutable.java b/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/java/JavaEclipseLinkMutable.java deleted file mode 100644 index 07983c6654..0000000000 --- a/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/java/JavaEclipseLinkMutable.java +++ /dev/null @@ -1,145 +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.eclipselink.core.internal.context.java; - -import org.eclipse.jdt.core.dom.CompilationUnit; -import org.eclipse.jpt.core.context.java.JavaAttributeMapping; -import org.eclipse.jpt.core.internal.context.java.AbstractJavaJpaContextNode; -import org.eclipse.jpt.core.resource.java.JavaResourcePersistentAttribute; -import org.eclipse.jpt.core.utility.TextRange; -import org.eclipse.jpt.eclipselink.core.context.EclipseLinkMutable; -import org.eclipse.jpt.eclipselink.core.internal.context.persistence.EclipseLinkPersistenceUnit; -import org.eclipse.jpt.eclipselink.core.resource.java.EclipseLinkMutableAnnotation; - -public class JavaEclipseLinkMutable extends AbstractJavaJpaContextNode implements EclipseLinkMutable -{ - protected boolean defaultMutable; - protected Boolean specifiedMutable; - - protected JavaResourcePersistentAttribute resourcePersistentAttribute; - - public JavaEclipseLinkMutable(JavaAttributeMapping parent) { - super(parent); - } - - protected JavaAttributeMapping getAttributeMapping() { - return (JavaAttributeMapping) this.getParent(); - } - - @Override - public EclipseLinkPersistenceUnit getPersistenceUnit() { - return (EclipseLinkPersistenceUnit) super.getPersistenceUnit(); - } - - protected String getMutableAnnotationName() { - return EclipseLinkMutableAnnotation.ANNOTATION_NAME; - } - - protected EclipseLinkMutableAnnotation getResourceMutable() { - return (EclipseLinkMutableAnnotation) this.resourcePersistentAttribute.getAnnotation(getMutableAnnotationName()); - } - - protected void addResourceMutable() { - this.resourcePersistentAttribute.addAnnotation(getMutableAnnotationName()); - } - - protected void removeResourceMutable() { - this.resourcePersistentAttribute.removeAnnotation(getMutableAnnotationName()); - } - - protected boolean calculateDefaultMutable() { - JavaEclipseLinkPersistentAttribute javaAttribute = (JavaEclipseLinkPersistentAttribute) this.getAttributeMapping().getPersistentAttribute(); - if (javaAttribute.typeIsDateOrCalendar()) { - Boolean persistenceUnitDefaultMutable = this.getPersistenceUnit().getOptions().getTemporalMutable(); - return persistenceUnitDefaultMutable == null ? false : persistenceUnitDefaultMutable.booleanValue(); - } - return javaAttribute.typeIsSerializable(); - } - - public boolean isMutable() { - return this.specifiedMutable != null ? this.specifiedMutable.booleanValue() : this.defaultMutable; - } - - public boolean isDefaultMutable() { - return this.defaultMutable; - } - - protected void setDefaultMutable(boolean newDefaultMutable) { - boolean oldDefaultMutable = this.defaultMutable; - this.defaultMutable = newDefaultMutable; - firePropertyChanged(DEFAULT_MUTABLE_PROPERTY, oldDefaultMutable, newDefaultMutable); - } - - public Boolean getSpecifiedMutable() { - return this.specifiedMutable; - } - - public void setSpecifiedMutable(Boolean newSpecifiedMutable) { - if (this.specifiedMutable == newSpecifiedMutable) { - return; - } - Boolean oldSpecifiedMutable = this.specifiedMutable; - this.specifiedMutable = newSpecifiedMutable; - - if (newSpecifiedMutable != null) { - if (getResourceMutable() == null) { - addResourceMutable(); - } - if (newSpecifiedMutable.booleanValue()) { - if (getResourceMutable().getValue() == Boolean.FALSE) { - getResourceMutable().setValue(null); - } - } - else { - getResourceMutable().setValue(Boolean.FALSE); - } - } - else { - removeResourceMutable(); - } - firePropertyChanged(EclipseLinkMutable.SPECIFIED_MUTABLE_PROPERTY, oldSpecifiedMutable, newSpecifiedMutable); - } - - protected void setSpecifiedMutable_(Boolean newSpecifiedMutable) { - Boolean oldSpecifiedMutable = this.specifiedMutable; - this.specifiedMutable = newSpecifiedMutable; - firePropertyChanged(SPECIFIED_MUTABLE_PROPERTY, oldSpecifiedMutable, newSpecifiedMutable); - } - - public void initialize(JavaResourcePersistentAttribute jrpa) { - this.resourcePersistentAttribute = jrpa; - EclipseLinkMutableAnnotation resourceMutable = this.getResourceMutable(); - this.specifiedMutable = this.specifiedMutable(resourceMutable); - this.defaultMutable = this.calculateDefaultMutable(); - } - - public void update(JavaResourcePersistentAttribute jrpa) { - this.resourcePersistentAttribute = jrpa; - EclipseLinkMutableAnnotation resourceMutable = this.getResourceMutable(); - this.setSpecifiedMutable_(this.specifiedMutable(resourceMutable)); - this.setDefaultMutable(this.calculateDefaultMutable()); - } - - private Boolean specifiedMutable(EclipseLinkMutableAnnotation resourceMutable) { - if (resourceMutable == null) { - return null; - } - if (resourceMutable.getValue() == null) { //@Mutable is equivalent to @Mutable(true) - return Boolean.TRUE; - } - return resourceMutable.getValue(); - } - - public TextRange getValidationTextRange(CompilationUnit astRoot) { - EclipseLinkMutableAnnotation resourceMutable = this.getResourceMutable(); - return resourceMutable == null ? null : resourceMutable.getTextRange(astRoot); - } - -} diff --git a/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/java/JavaEclipseLinkObjectTypeConverter.java b/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/java/JavaEclipseLinkObjectTypeConverter.java deleted file mode 100644 index ba6e0c8fe1..0000000000 --- a/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/java/JavaEclipseLinkObjectTypeConverter.java +++ /dev/null @@ -1,263 +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.eclipselink.core.internal.context.java; - -import java.util.ArrayList; -import java.util.Iterator; -import java.util.List; -import java.util.ListIterator; -import org.eclipse.jdt.core.dom.CompilationUnit; -import org.eclipse.jpt.core.context.java.JavaJpaContextNode; -import org.eclipse.jpt.core.resource.java.JavaResourcePersistentMember; -import org.eclipse.jpt.eclipselink.core.context.EclipseLinkConversionValue; -import org.eclipse.jpt.eclipselink.core.context.EclipseLinkConverter; -import org.eclipse.jpt.eclipselink.core.context.EclipseLinkObjectTypeConverter; -import org.eclipse.jpt.eclipselink.core.resource.java.EclipseLinkConversionValueAnnotation; -import org.eclipse.jpt.eclipselink.core.resource.java.EclipseLinkObjectTypeConverterAnnotation; -import org.eclipse.jpt.utility.internal.CollectionTools; -import org.eclipse.jpt.utility.internal.iterators.CloneListIterator; -import org.eclipse.jpt.utility.internal.iterators.TransformationListIterator; -import org.eclipse.wst.validation.internal.provisional.core.IMessage; -import org.eclipse.wst.validation.internal.provisional.core.IReporter; - -public class JavaEclipseLinkObjectTypeConverter extends JavaEclipseLinkConverter - implements EclipseLinkObjectTypeConverter -{ - private String dataType; - - private String objectType; - - private String defaultObjectValue; - - private final List<JavaEclipseLinkConversionValue> conversionValues; - - - public JavaEclipseLinkObjectTypeConverter(JavaJpaContextNode parent) { - super(parent); - this.conversionValues = new ArrayList<JavaEclipseLinkConversionValue>(); - } - - - public String getType() { - return EclipseLinkConverter.OBJECT_TYPE_CONVERTER; - } - - @Override - public String getAnnotationName() { - return EclipseLinkObjectTypeConverterAnnotation.ANNOTATION_NAME; - } - - @Override - protected EclipseLinkObjectTypeConverterAnnotation getAnnotation() { - return (EclipseLinkObjectTypeConverterAnnotation) super.getAnnotation(); - } - - - // **************** data type ********************************************** - - public String getDataType() { - return this.dataType; - } - - public void setDataType(String newDataType) { - String oldDataType = this.dataType; - this.dataType = newDataType; - getAnnotation().setDataType(newDataType); - firePropertyChanged(DATA_TYPE_PROPERTY, oldDataType, newDataType); - } - - protected void setDataType_(String newDataType) { - String oldDataType = this.dataType; - this.dataType = newDataType; - firePropertyChanged(DATA_TYPE_PROPERTY, oldDataType, newDataType); - } - - - // **************** object type ******************************************** - - public String getObjectType() { - return this.objectType; - } - - public void setObjectType(String newObjectType) { - String oldObjectType = this.objectType; - this.objectType = newObjectType; - getAnnotation().setObjectType(newObjectType); - firePropertyChanged(OBJECT_TYPE_PROPERTY, oldObjectType, newObjectType); - } - - protected void setObjectType_(String newObjectType) { - String oldObjectType = this.objectType; - this.objectType = newObjectType; - firePropertyChanged(OBJECT_TYPE_PROPERTY, oldObjectType, newObjectType); - } - - - // **************** conversion values ************************************** - - public ListIterator<JavaEclipseLinkConversionValue> conversionValues() { - return new CloneListIterator<JavaEclipseLinkConversionValue>(this.conversionValues); - } - - public int conversionValuesSize() { - return this.conversionValues.size(); - } - - public JavaEclipseLinkConversionValue addConversionValue(int index) { - JavaEclipseLinkConversionValue conversionValue = new JavaEclipseLinkConversionValue(this); - this.conversionValues.add(index, conversionValue); - EclipseLinkConversionValueAnnotation resourceConversionValue = getAnnotation().addConversionValue(index); - conversionValue.initialize(resourceConversionValue); - fireItemAdded(CONVERSION_VALUES_LIST, index, conversionValue); - return conversionValue; - } - - public JavaEclipseLinkConversionValue addConversionValue() { - return this.addConversionValue(this.conversionValues.size()); - } - - protected void addConversionValue(int index, JavaEclipseLinkConversionValue conversionValue) { - addItemToList(index, conversionValue, this.conversionValues, CONVERSION_VALUES_LIST); - } - - protected void addConversionValue(JavaEclipseLinkConversionValue conversionValue) { - this.addConversionValue(this.conversionValues.size(), conversionValue); - } - - public void removeConversionValue(EclipseLinkConversionValue conversionValue) { - this.removeConversionValue(this.conversionValues.indexOf(conversionValue)); - } - - public void removeConversionValue(int index) { - JavaEclipseLinkConversionValue removedConversionValue = this.conversionValues.remove(index); - getAnnotation().removeConversionValue(index); - fireItemRemoved(CONVERSION_VALUES_LIST, index, removedConversionValue); - } - - protected void removeConversionValue_(JavaEclipseLinkConversionValue conversionValue) { - removeItemFromList(conversionValue, this.conversionValues, CONVERSION_VALUES_LIST); - } - - public void moveConversionValue(int targetIndex, int sourceIndex) { - CollectionTools.move(this.conversionValues, targetIndex, sourceIndex); - getAnnotation().moveConversionValue(targetIndex, sourceIndex); - fireItemMoved(CONVERSION_VALUES_LIST, targetIndex, sourceIndex); - } - - public ListIterator<String> dataValues() { - return new TransformationListIterator<JavaEclipseLinkConversionValue, String>(conversionValues()) { - @Override - protected String transform(JavaEclipseLinkConversionValue next) { - return next.getDataValue(); - } - }; - } - - - // **************** default object value *********************************** - - public String getDefaultObjectValue() { - return this.defaultObjectValue; - } - - public void setDefaultObjectValue(String newDefaultObjectValue) { - String oldDefaultObjectValue = this.defaultObjectValue; - this.defaultObjectValue = newDefaultObjectValue; - getAnnotation().setDefaultObjectValue(newDefaultObjectValue); - firePropertyChanged(DEFAULT_OBJECT_VALUE_PROPERTY, oldDefaultObjectValue, newDefaultObjectValue); - } - - protected void setDefaultObjectValue_(String newDefaultObjectValue) { - String oldDefaultObjectValue = this.defaultObjectValue; - this.defaultObjectValue = newDefaultObjectValue; - firePropertyChanged(DEFAULT_OBJECT_VALUE_PROPERTY, oldDefaultObjectValue, newDefaultObjectValue); - } - - - // **************** resource interaction *********************************** - - @Override - protected void initialize(JavaResourcePersistentMember jrpm) { - super.initialize(jrpm); - EclipseLinkObjectTypeConverterAnnotation resourceConverter = getAnnotation(); - this.dataType = this.dataType(resourceConverter); - this.objectType = this.objectType(resourceConverter); - this.defaultObjectValue = this.defaultObjectValue(resourceConverter); - this.initializeConversionValues(resourceConverter); - } - - protected void initializeConversionValues(EclipseLinkObjectTypeConverterAnnotation resourceConverter) { - if (resourceConverter == null) { - return; - } - ListIterator<EclipseLinkConversionValueAnnotation> resourceConversionValues = resourceConverter.conversionValues(); - - while(resourceConversionValues.hasNext()) { - this.conversionValues.add(buildConversionValue(resourceConversionValues.next())); - } - } - - protected JavaEclipseLinkConversionValue buildConversionValue(EclipseLinkConversionValueAnnotation resourceConversionValue) { - JavaEclipseLinkConversionValue conversionValue = new JavaEclipseLinkConversionValue(this); - conversionValue.initialize(resourceConversionValue); - return conversionValue; - } - - @Override - public void update(JavaResourcePersistentMember jrpm) { - super.update(jrpm); - EclipseLinkObjectTypeConverterAnnotation resourceConverter = getAnnotation(); - this.setDataType_(this.dataType(resourceConverter)); - this.setObjectType_(this.objectType(resourceConverter)); - this.setDefaultObjectValue_(this.defaultObjectValue(resourceConverter)); - this.updateConversionValues(resourceConverter); - } - - protected void updateConversionValues(EclipseLinkObjectTypeConverterAnnotation resourceConverter) { - ListIterator<JavaEclipseLinkConversionValue> contextConversionValues = conversionValues(); - ListIterator<EclipseLinkConversionValueAnnotation> resourceConversionValues = resourceConverter.conversionValues(); - while (contextConversionValues.hasNext()) { - JavaEclipseLinkConversionValue conversionValues = contextConversionValues.next(); - if (resourceConversionValues.hasNext()) { - conversionValues.update(resourceConversionValues.next()); - } - else { - removeConversionValue_(conversionValues); - } - } - - while (resourceConversionValues.hasNext()) { - addConversionValue(buildConversionValue(resourceConversionValues.next())); - } - } - - protected String dataType(EclipseLinkObjectTypeConverterAnnotation resourceConverter) { - return resourceConverter == null ? null : resourceConverter.getDataType(); - } - - protected String objectType(EclipseLinkObjectTypeConverterAnnotation resourceConverter) { - return resourceConverter == null ? null : resourceConverter.getObjectType(); - } - - protected String defaultObjectValue(EclipseLinkObjectTypeConverterAnnotation resourceConverter) { - return resourceConverter == null ? null : resourceConverter.getDefaultObjectValue(); - } - - - // **************** validation ********************************************* - - @Override - public void validate(List<IMessage> messages, IReporter reporter, CompilationUnit astRoot) { - super.validate(messages, reporter, astRoot); - for (Iterator<JavaEclipseLinkConversionValue> stream = conversionValues(); stream.hasNext();) { - stream.next().validate(messages, reporter, astRoot); - } - } -} diff --git a/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/java/JavaEclipseLinkOneToManyMapping.java b/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/java/JavaEclipseLinkOneToManyMapping.java deleted file mode 100644 index cedddf6552..0000000000 --- a/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/java/JavaEclipseLinkOneToManyMapping.java +++ /dev/null @@ -1,116 +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.eclipselink.core.internal.context.java; - -import java.util.List; -import java.util.Vector; - -import org.eclipse.jdt.core.dom.CompilationUnit; -import org.eclipse.jpt.core.context.java.JavaPersistentAttribute; -import org.eclipse.jpt.core.context.java.JavaRelationshipReference; -import org.eclipse.jpt.core.internal.context.java.AbstractJavaOneToManyMapping; -import org.eclipse.jpt.core.resource.java.OneToManyAnnotation; -import org.eclipse.jpt.eclipselink.core.context.EclipseLinkJoinFetch; -import org.eclipse.jpt.eclipselink.core.context.EclipseLinkPrivateOwned; -import org.eclipse.jpt.eclipselink.core.resource.java.EclipseLink; -import org.eclipse.jpt.eclipselink.core.resource.java.EclipseLinkPrivateOwnedAnnotation; -import org.eclipse.jpt.eclipselink.core.v2_0.context.EclipseLinkOneToManyMapping2_0; -import org.eclipse.wst.validation.internal.provisional.core.IMessage; -import org.eclipse.wst.validation.internal.provisional.core.IReporter; - -public class JavaEclipseLinkOneToManyMapping - extends AbstractJavaOneToManyMapping<OneToManyAnnotation> - 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); - } - - @Override - protected JavaRelationshipReference buildRelationshipReference() { - return new JavaEclipseLinkOneToManyRelationshipReference(this); - } - - @Override - protected void addSupportingAnnotationNamesTo(Vector<String> names) { - super.addSupportingAnnotationNamesTo(names); - names.add(EclipseLink.JOIN_FETCH); - names.add(EclipseLink.PRIVATE_OWNED); - } - - @Override - public JavaEclipseLinkOneToManyRelationshipReference getRelationshipReference() { - return (JavaEclipseLinkOneToManyRelationshipReference) super.getRelationshipReference(); - } - - - // **************** private owned ****************************************** - - public EclipseLinkPrivateOwned getPrivateOwned() { - return this.privateOwned; - } - - protected String getPrivateOwnedAnnotationName() { - return EclipseLinkPrivateOwnedAnnotation.ANNOTATION_NAME; - } - - protected EclipseLinkPrivateOwnedAnnotation getResourcePrivateOwned() { - return (EclipseLinkPrivateOwnedAnnotation) this.getResourcePersistentAttribute().getAnnotation(getPrivateOwnedAnnotationName()); - } - - protected void addResourcePrivateOwned() { - this.getResourcePersistentAttribute().addAnnotation(getPrivateOwnedAnnotationName()); - } - - protected void removeResourcePrivateOwned() { - this.getResourcePersistentAttribute().removeAnnotation(getPrivateOwnedAnnotationName()); - } - - - // **************** join fetch ********************************************* - - public EclipseLinkJoinFetch getJoinFetch() { - return this.joinFetch; - } - - - // **************** resource -> context ************************************ - - @Override - protected void initialize() { - super.initialize(); - this.joinFetch.initialize(this.getResourcePersistentAttribute()); - this.privateOwned.initialize(this.getResourcePersistentAttribute()); - } - - @Override - protected void update() { - super.update(); - this.joinFetch.update(this.getResourcePersistentAttribute()); - this.privateOwned.update(this.getResourcePersistentAttribute()); - } - - - // **************** 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.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/java/JavaEclipseLinkOneToManyMappingDefinition.java b/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/java/JavaEclipseLinkOneToManyMappingDefinition.java deleted file mode 100644 index 329cd77a58..0000000000 --- a/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/java/JavaEclipseLinkOneToManyMappingDefinition.java +++ /dev/null @@ -1,61 +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.eclipselink.core.internal.context.java; - -import org.eclipse.jpt.core.JpaFactory; -import org.eclipse.jpt.core.context.java.JavaAttributeMapping; -import org.eclipse.jpt.core.context.java.JavaAttributeMappingDefinition; -import org.eclipse.jpt.core.context.java.JavaPersistentAttribute; -import org.eclipse.jpt.core.internal.context.java.AbstractJavaAttributeMappingDefinition; -import org.eclipse.jpt.core.internal.context.java.JavaOneToManyMappingDefinition; - -public class JavaEclipseLinkOneToManyMappingDefinition - extends AbstractJavaAttributeMappingDefinition -{ - // singleton - private static final JavaEclipseLinkOneToManyMappingDefinition INSTANCE = - new JavaEclipseLinkOneToManyMappingDefinition(); - - - /** - * Return the singleton. - */ - public static JavaAttributeMappingDefinition instance() { - return INSTANCE; - } - - - /** - * Enforce singleton usage - */ - private JavaEclipseLinkOneToManyMappingDefinition() { - super(); - } - - - public String getKey() { - return JavaOneToManyMappingDefinition.instance().getKey(); - } - - public String getAnnotationName() { - return JavaOneToManyMappingDefinition.instance().getAnnotationName(); - } - - public JavaAttributeMapping buildMapping(JavaPersistentAttribute parent, JpaFactory factory) { - return JavaOneToManyMappingDefinition.instance().buildMapping(parent, factory); - } - - @Override - public boolean testDefault(JavaPersistentAttribute persistentAttribute) { - String targetEntity = persistentAttribute.getMultiReferenceEntityTypeName(); - return (targetEntity != null) - && (persistentAttribute.getPersistenceUnit().getEntity(targetEntity) != null); - } -} diff --git a/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/java/JavaEclipseLinkOneToManyRelationshipReference.java b/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/java/JavaEclipseLinkOneToManyRelationshipReference.java deleted file mode 100644 index 5cc467d12b..0000000000 --- a/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/java/JavaEclipseLinkOneToManyRelationshipReference.java +++ /dev/null @@ -1,155 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2009 Oracle. - * All rights reserved. This program and the accompanying materials are - * made available under the terms of the Eclipse Public License v1.0 which - * accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Oracle - initial API and implementation - *******************************************************************************/ -package org.eclipse.jpt.eclipselink.core.internal.context.java; - -import java.util.Iterator; -import java.util.List; -import org.eclipse.jdt.core.dom.CompilationUnit; -import org.eclipse.jpt.core.MappingKeys; -import org.eclipse.jpt.core.context.AttributeMapping; -import org.eclipse.jpt.core.context.JoiningStrategy; -import org.eclipse.jpt.core.context.java.JavaJoinColumnEnabledRelationshipReference; -import org.eclipse.jpt.core.context.java.JavaJoinColumnJoiningStrategy; -import org.eclipse.jpt.core.internal.context.java.AbstractJavaOneToManyRelationshipReference; -import org.eclipse.jpt.core.internal.context.java.GenericJavaJoinColumnJoiningStrategy; -import org.eclipse.jpt.eclipselink.core.context.EclipseLinkOneToManyRelationshipReference; -import org.eclipse.jpt.utility.Filter; -import org.eclipse.wst.validation.internal.provisional.core.IMessage; -import org.eclipse.wst.validation.internal.provisional.core.IReporter; - -public class JavaEclipseLinkOneToManyRelationshipReference - extends AbstractJavaOneToManyRelationshipReference - implements EclipseLinkOneToManyRelationshipReference, - JavaJoinColumnEnabledRelationshipReference -{ - protected final JavaJoinColumnJoiningStrategy joinColumnJoiningStrategy; - - - public JavaEclipseLinkOneToManyRelationshipReference( - JavaEclipseLinkOneToManyMapping parent) { - super(parent); - this.joinColumnJoiningStrategy = buildJoinColumnJoiningStrategy(); - } - - - protected JavaJoinColumnJoiningStrategy buildJoinColumnJoiningStrategy() { - return new GenericJavaJoinColumnJoiningStrategy(this); - } - - @Override - public JavaEclipseLinkOneToManyMapping getRelationshipMapping() { - return (JavaEclipseLinkOneToManyMapping) getParent(); - } - - - @Override - protected JoiningStrategy calculatePredominantJoiningStrategy() { - if (this.mappedByJoiningStrategy.getMappedByAttribute() != null) { - return this.mappedByJoiningStrategy; - } - else if (this.joinColumnJoiningStrategy.hasSpecifiedJoinColumns()) { - return this.joinColumnJoiningStrategy; - } - else { - return this.joinTableJoiningStrategy; - } - } - - @Override - public Iterator<String> javaCompletionProposals(int pos, Filter<String> filter, CompilationUnit astRoot) { - Iterator<String> result = super.javaCompletionProposals(pos, filter, astRoot); - if (result == null) { - result = this.joinColumnJoiningStrategy.javaCompletionProposals(pos, filter, astRoot); - } - return result; - } - - - // **************** mapped by ********************************************** - - @Override - public void setMappedByJoiningStrategy() { - super.setMappedByJoiningStrategy(); - this.joinColumnJoiningStrategy.removeStrategy(); - } - - @Override - public boolean mayBeMappedBy(AttributeMapping mappedByMapping) { - return super.mayBeMappedBy(mappedByMapping) || - mappedByMapping.getKey() == MappingKeys.ONE_TO_ONE_ATTRIBUTE_MAPPING_KEY; - } - - - // **************** join table ********************************************* - - @Override - public void setJoinTableJoiningStrategy() { - super.setJoinTableJoiningStrategy(); - this.joinColumnJoiningStrategy.removeStrategy(); - } - - @Override - public boolean mayHaveDefaultJoinTable() { - return super.mayHaveDefaultJoinTable() - && ! this.joinColumnJoiningStrategy.hasSpecifiedJoinColumns(); - } - - - // **************** join columns ******************************************* - - public JavaJoinColumnJoiningStrategy getJoinColumnJoiningStrategy() { - return this.joinColumnJoiningStrategy; - } - - public boolean usesJoinColumnJoiningStrategy() { - return getPredominantJoiningStrategy() == this.joinColumnJoiningStrategy; - } - - public void setJoinColumnJoiningStrategy() { - this.joinColumnJoiningStrategy.addStrategy(); - this.mappedByJoiningStrategy.removeStrategy(); - this.joinTableJoiningStrategy.removeStrategy(); - } - - public void unsetJoinColumnJoiningStrategy() { - this.joinColumnJoiningStrategy.removeStrategy(); - } - - public boolean mayHaveDefaultJoinColumn() { - return this.mappedByJoiningStrategy.getMappedByAttribute() == null - && this.joinTableJoiningStrategy.getJoinTable() == null; - } - - - - // **************** resource => context ************************************ - - @Override - protected void initializeJoiningStrategies() { - this.joinColumnJoiningStrategy.initialize(); - super.initializeJoiningStrategies(); - } - - @Override - protected void updateJoiningStrategies() { - this.joinColumnJoiningStrategy.update(); - super.updateJoiningStrategies(); - } - - - // **************** Validation ********************************************* - - @Override - public void validate(List<IMessage> messages, IReporter reporter, CompilationUnit astRoot) { - super.validate(messages, reporter, astRoot); - this.joinColumnJoiningStrategy.validate(messages, reporter, astRoot); - } -} diff --git a/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/java/JavaEclipseLinkOneToOneMapping.java b/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/java/JavaEclipseLinkOneToOneMapping.java deleted file mode 100644 index 1e1c0db5c3..0000000000 --- a/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/java/JavaEclipseLinkOneToOneMapping.java +++ /dev/null @@ -1,75 +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.eclipselink.core.internal.context.java; - -import java.util.List; -import java.util.Vector; - -import org.eclipse.jdt.core.dom.CompilationUnit; -import org.eclipse.jpt.core.context.java.JavaPersistentAttribute; -import org.eclipse.jpt.core.internal.context.java.AbstractJavaOneToOneMapping; -import org.eclipse.jpt.eclipselink.core.context.EclipseLinkJoinFetch; -import org.eclipse.jpt.eclipselink.core.context.EclipseLinkPrivateOwned; -import org.eclipse.jpt.eclipselink.core.resource.java.EclipseLink; -import org.eclipse.jpt.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); - } - - @Override - protected void addSupportingAnnotationNamesTo(Vector<String> names) { - super.addSupportingAnnotationNamesTo(names); - names.add(EclipseLink.JOIN_FETCH); - names.add(EclipseLink.PRIVATE_OWNED); - } - - public EclipseLinkJoinFetch getJoinFetch() { - return this.joinFetch; - } - - public EclipseLinkPrivateOwned getPrivateOwned() { - return this.privateOwned; - } - - @Override - protected void initialize() { - super.initialize(); - this.joinFetch.initialize(this.getResourcePersistentAttribute()); - this.privateOwned.initialize(this.getResourcePersistentAttribute()); - } - - @Override - protected void update() { - super.update(); - this.joinFetch.update(this.getResourcePersistentAttribute()); - this.privateOwned.update(this.getResourcePersistentAttribute()); - } - - @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.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/java/JavaEclipseLinkOneToOneMappingDefinition.java b/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/java/JavaEclipseLinkOneToOneMappingDefinition.java deleted file mode 100644 index 47370a3b47..0000000000 --- a/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/java/JavaEclipseLinkOneToOneMappingDefinition.java +++ /dev/null @@ -1,61 +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.eclipselink.core.internal.context.java; - -import org.eclipse.jpt.core.JpaFactory; -import org.eclipse.jpt.core.context.java.JavaAttributeMapping; -import org.eclipse.jpt.core.context.java.JavaAttributeMappingDefinition; -import org.eclipse.jpt.core.context.java.JavaPersistentAttribute; -import org.eclipse.jpt.core.internal.context.java.AbstractJavaAttributeMappingDefinition; -import org.eclipse.jpt.core.internal.context.java.JavaOneToOneMappingDefinition; - -public class JavaEclipseLinkOneToOneMappingDefinition - extends AbstractJavaAttributeMappingDefinition -{ - // singleton - private static final JavaEclipseLinkOneToOneMappingDefinition INSTANCE = - new JavaEclipseLinkOneToOneMappingDefinition(); - - - /** - * Return the singleton. - */ - public static JavaAttributeMappingDefinition instance() { - return INSTANCE; - } - - - /** - * Enforce singleton usage - */ - private JavaEclipseLinkOneToOneMappingDefinition() { - super(); - } - - - public String getKey() { - return JavaOneToOneMappingDefinition.instance().getKey(); - } - - public String getAnnotationName() { - return JavaOneToOneMappingDefinition.instance().getAnnotationName(); - } - - public JavaAttributeMapping buildMapping(JavaPersistentAttribute parent, JpaFactory factory) { - return JavaOneToOneMappingDefinition.instance().buildMapping(parent, factory); - } - - @Override - public boolean testDefault(JavaPersistentAttribute persistentAttribute) { - String targetEntity = persistentAttribute.getSingleReferenceEntityTypeName(); - return (targetEntity != null) - && (persistentAttribute.getPersistenceUnit().getEntity(targetEntity) != null); - } -} diff --git a/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/java/JavaEclipseLinkPersistentAttribute.java b/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/java/JavaEclipseLinkPersistentAttribute.java deleted file mode 100644 index 69c9c118c7..0000000000 --- a/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/java/JavaEclipseLinkPersistentAttribute.java +++ /dev/null @@ -1,94 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2009 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.eclipselink.core.internal.context.java; - -import org.eclipse.jpt.core.context.AccessType; -import org.eclipse.jpt.core.context.MultiRelationshipMapping; -import org.eclipse.jpt.core.context.PersistentType; -import org.eclipse.jpt.core.internal.context.java.AbstractJavaPersistentAttribute; -import org.eclipse.jpt.core.jpa2.context.MetamodelField; -import org.eclipse.jpt.core.jpa2.context.java.JavaPersistentAttribute2_0; -import org.eclipse.jpt.core.resource.java.JavaResourcePersistentAttribute; -import org.eclipse.jpt.utility.internal.ClassTools; - -/** - * EclipseLink Java persistent attribute - */ -public class JavaEclipseLinkPersistentAttribute - extends AbstractJavaPersistentAttribute - implements JavaPersistentAttribute2_0 -{ - public JavaEclipseLinkPersistentAttribute(PersistentType parent, JavaResourcePersistentAttribute jrpa) { - super(parent, jrpa); - } - - - // ********** AccessHolder implementation ********** - - public AccessType getSpecifiedAccess() { - return null; - } - - public void setSpecifiedAccess(AccessType specifiedAccess) { - throw new UnsupportedOperationException(); - } - - /** - * Return whether the specified type is a subclass of java.util.Date or java.util.Calendar. - */ - 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(this.resourcePersistentAttribute.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$ - } - - // ********** metamodel ********** - - public String getMetamodelContainerFieldTypeName() { - return this.getJpaContainer(this.resourcePersistentAttribute.getTypeName()).getMetamodelContainerFieldTypeName(); - } - - public String getMetamodelContainerFieldMapKeyTypeName() { - return this.getJpaContainer(this.resourcePersistentAttribute.getTypeName()).getMetamodelContainerFieldMapKeyTypeName((MultiRelationshipMapping) this.getMapping()); - } - - public String getMetamodelTypeName() { - String typeName = this.resourcePersistentAttribute.getTypeName(); - if (typeName == null) { - return MetamodelField.DEFAULT_TYPE_NAME; - } - if (ClassTools.classNamedIsPrimitive(typeName)) { - return ClassTools.wrapperClassName(typeName); // ??? - } - return typeName; - } -} diff --git a/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/java/JavaEclipseLinkPrivateOwned.java b/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/java/JavaEclipseLinkPrivateOwned.java deleted file mode 100644 index b78910b26b..0000000000 --- a/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/java/JavaEclipseLinkPrivateOwned.java +++ /dev/null @@ -1,96 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2008, 2009 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.eclipselink.core.internal.context.java; - -import org.eclipse.jdt.core.dom.CompilationUnit; -import org.eclipse.jpt.core.context.java.JavaAttributeMapping; -import org.eclipse.jpt.core.internal.context.java.AbstractJavaJpaContextNode; -import org.eclipse.jpt.core.resource.java.JavaResourcePersistentAttribute; -import org.eclipse.jpt.core.utility.TextRange; -import org.eclipse.jpt.eclipselink.core.context.EclipseLinkPrivateOwned; -import org.eclipse.jpt.eclipselink.core.resource.java.EclipseLinkPrivateOwnedAnnotation; - -public class JavaEclipseLinkPrivateOwned - extends AbstractJavaJpaContextNode - implements EclipseLinkPrivateOwned -{ - protected boolean privateOwned; - - protected JavaResourcePersistentAttribute resourcePersistentAttribute; - - public JavaEclipseLinkPrivateOwned(JavaAttributeMapping parent) { - super(parent); - } - - protected String getPrivateOwnedAnnotationName() { - return EclipseLinkPrivateOwnedAnnotation.ANNOTATION_NAME; - } - - protected EclipseLinkPrivateOwnedAnnotation getResourcePrivateOwned() { - return (EclipseLinkPrivateOwnedAnnotation) this.resourcePersistentAttribute.getAnnotation(getPrivateOwnedAnnotationName()); - } - - protected void addResourcePrivateOwned() { - this.resourcePersistentAttribute.addAnnotation(getPrivateOwnedAnnotationName()); - } - - protected void removeResourcePrivateOwned() { - this.resourcePersistentAttribute.removeAnnotation(getPrivateOwnedAnnotationName()); - } - - public boolean isPrivateOwned() { - return this.privateOwned; - } - - public void setPrivateOwned(boolean newPrivateOwned) { - if (this.privateOwned == newPrivateOwned) { - return; - } - boolean oldPrivateOwned = this.privateOwned; - this.privateOwned = newPrivateOwned; - - if (newPrivateOwned) { - addResourcePrivateOwned(); - } - else { - //have to check if annotation exists in case the change is from false to null or vice versa - if (getResourcePrivateOwned() != null) { - removeResourcePrivateOwned(); - } - } - firePropertyChanged(PRIVATE_OWNED_PROPERTY, oldPrivateOwned, newPrivateOwned); - } - - protected void setPrivateOwned_(boolean newPrivateOwned) { - boolean oldPrivateOwned = this.privateOwned; - this.privateOwned = newPrivateOwned; - firePropertyChanged(PRIVATE_OWNED_PROPERTY, oldPrivateOwned, newPrivateOwned); - } - - public void initialize(JavaResourcePersistentAttribute jrpa) { - this.resourcePersistentAttribute = jrpa; - this.privateOwned = privateOwned(); - } - - public void update(JavaResourcePersistentAttribute jrpa) { - this.resourcePersistentAttribute = jrpa; - this.setPrivateOwned_(privateOwned()); - } - - private boolean privateOwned() { - return getResourcePrivateOwned() != null; - } - - public TextRange getValidationTextRange(CompilationUnit astRoot) { - EclipseLinkPrivateOwnedAnnotation resourcePrivateOwned = this.getResourcePrivateOwned(); - return resourcePrivateOwned == null ? null : resourcePrivateOwned.getTextRange(astRoot); - } - -} diff --git a/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/java/JavaEclipseLinkReadOnly.java b/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/java/JavaEclipseLinkReadOnly.java deleted file mode 100644 index 6c68a9c0a0..0000000000 --- a/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/java/JavaEclipseLinkReadOnly.java +++ /dev/null @@ -1,103 +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.eclipselink.core.internal.context.java; - -import org.eclipse.jdt.core.dom.CompilationUnit; -import org.eclipse.jpt.core.context.java.JavaTypeMapping; -import org.eclipse.jpt.core.internal.context.java.AbstractJavaJpaContextNode; -import org.eclipse.jpt.core.resource.java.JavaResourcePersistentType; -import org.eclipse.jpt.core.utility.TextRange; -import org.eclipse.jpt.eclipselink.core.context.EclipseLinkReadOnly; -import org.eclipse.jpt.eclipselink.core.resource.java.EclipseLinkReadOnlyAnnotation; - -public class JavaEclipseLinkReadOnly extends AbstractJavaJpaContextNode implements EclipseLinkReadOnly -{ - protected Boolean specifiedReadOnly; - - protected JavaResourcePersistentType resourcePersistentType; - - - public JavaEclipseLinkReadOnly(JavaTypeMapping parent) { - super(parent); - } - - - protected String getReadOnlyAnnotationName() { - return EclipseLinkReadOnlyAnnotation.ANNOTATION_NAME; - } - - protected EclipseLinkReadOnlyAnnotation getResourceReadOnly() { - return (EclipseLinkReadOnlyAnnotation) this.resourcePersistentType.getAnnotation(getReadOnlyAnnotationName()); - } - - protected void addResourceReadOnly() { - this.resourcePersistentType.addAnnotation(getReadOnlyAnnotationName()); - } - - protected void removeResourceReadOnly() { - this.resourcePersistentType.removeAnnotation(getReadOnlyAnnotationName()); - } - - public boolean isReadOnly() { - return (this.getSpecifiedReadOnly() != null) ? this.getSpecifiedReadOnly().booleanValue() : this.isDefaultReadOnly(); - } - - public boolean isDefaultReadOnly() { - return EclipseLinkReadOnly.DEFAULT_READ_ONLY; - } - - public Boolean getSpecifiedReadOnly() { - return this.specifiedReadOnly; - } - - public void setSpecifiedReadOnly(Boolean newReadOnly) { - if (this.specifiedReadOnly == newReadOnly) { - return; - } - Boolean oldReadOnly = this.specifiedReadOnly; - this.specifiedReadOnly = newReadOnly; - - if (newReadOnly != null && newReadOnly.booleanValue()) { - addResourceReadOnly(); - } - else { - //have to check if annotation exists in case the change is from false to null or vice versa - if (getResourceReadOnly() != null) { - removeResourceReadOnly(); - } - } - firePropertyChanged(SPECIFIED_READ_ONLY_PROPERTY, oldReadOnly, newReadOnly); - } - - protected void setSpecifiedReadOnly_(Boolean newReadOnly) { - Boolean oldReadOnly = this.specifiedReadOnly; - this.specifiedReadOnly = newReadOnly; - firePropertyChanged(SPECIFIED_READ_ONLY_PROPERTY, oldReadOnly, newReadOnly); - } - - public void initialize(JavaResourcePersistentType jrpt) { - this.resourcePersistentType = jrpt; - this.specifiedReadOnly = readOnly(); - } - - public void update(JavaResourcePersistentType jrpt) { - this.resourcePersistentType = jrpt; - this.setSpecifiedReadOnly_(readOnly()); - } - - private Boolean readOnly() { - return getResourceReadOnly() == null ? null : Boolean.TRUE; - } - - public TextRange getValidationTextRange(CompilationUnit astRoot) { - EclipseLinkReadOnlyAnnotation resourceReadOnly = this.getResourceReadOnly(); - return resourceReadOnly == null ? null : resourceReadOnly.getTextRange(astRoot); - } -} diff --git a/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/java/JavaEclipseLinkStructConverter.java b/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/java/JavaEclipseLinkStructConverter.java deleted file mode 100644 index 97a78f2ac1..0000000000 --- a/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/java/JavaEclipseLinkStructConverter.java +++ /dev/null @@ -1,81 +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.eclipselink.core.internal.context.java; - -import org.eclipse.jpt.core.context.java.JavaJpaContextNode; -import org.eclipse.jpt.core.resource.java.JavaResourcePersistentMember; -import org.eclipse.jpt.eclipselink.core.context.EclipseLinkConverter; -import org.eclipse.jpt.eclipselink.core.context.EclipseLinkStructConverter; -import org.eclipse.jpt.eclipselink.core.resource.java.EclipseLinkStructConverterAnnotation; - -public class JavaEclipseLinkStructConverter extends JavaEclipseLinkConverter - implements EclipseLinkStructConverter -{ - private String converterClass; - - - public JavaEclipseLinkStructConverter(JavaJpaContextNode parent) { - super(parent); - } - - - public String getType() { - return EclipseLinkConverter.STRUCT_CONVERTER; - } - - @Override - public String getAnnotationName() { - return EclipseLinkStructConverterAnnotation.ANNOTATION_NAME; - } - - @Override - protected EclipseLinkStructConverterAnnotation getAnnotation() { - return (EclipseLinkStructConverterAnnotation) super.getAnnotation(); - } - - - // **************** converter class **************************************** - - public String getConverterClass() { - return this.converterClass; - } - - public void setConverterClass(String newConverterClass) { - String oldConverterClass = this.converterClass; - this.converterClass = newConverterClass; - getAnnotation().setConverter(newConverterClass); - firePropertyChanged(CONVERTER_CLASS_PROPERTY, oldConverterClass, newConverterClass); - } - - protected void setConverterClass_(String newConverterClass) { - String oldConverterClass = this.converterClass; - this.converterClass = newConverterClass; - firePropertyChanged(CONVERTER_CLASS_PROPERTY, oldConverterClass, newConverterClass); - } - - - // **************** resource interaction *********************************** - - @Override - protected void initialize(JavaResourcePersistentMember jrpm) { - super.initialize(jrpm); - this.converterClass = this.converterClass(getAnnotation()); - } - - @Override - public void update(JavaResourcePersistentMember jrpm) { - super.update(jrpm); - this.setConverterClass_(this.converterClass(getAnnotation())); - } - - protected String converterClass(EclipseLinkStructConverterAnnotation resourceConverter) { - return resourceConverter == null ? null : resourceConverter.getConverter(); - } -} diff --git a/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/java/JavaEclipseLinkTransformationMapping.java b/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/java/JavaEclipseLinkTransformationMapping.java deleted file mode 100644 index b154fb38fa..0000000000 --- a/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/java/JavaEclipseLinkTransformationMapping.java +++ /dev/null @@ -1,34 +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.eclipselink.core.internal.context.java; - -import org.eclipse.jpt.core.context.java.JavaPersistentAttribute; -import org.eclipse.jpt.core.internal.context.java.AbstractJavaAttributeMapping; -import org.eclipse.jpt.eclipselink.core.EclipseLinkMappingKeys; -import org.eclipse.jpt.eclipselink.core.context.EclipseLinkTransformationMapping; -import org.eclipse.jpt.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; - } - - public String getAnnotationName() { - return EclipseLinkTransformationAnnotation.ANNOTATION_NAME; - } -} diff --git a/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/java/JavaEclipseLinkTransformationMappingDefinition.java b/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/java/JavaEclipseLinkTransformationMappingDefinition.java deleted file mode 100644 index 5f87f1ebd2..0000000000 --- a/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/java/JavaEclipseLinkTransformationMappingDefinition.java +++ /dev/null @@ -1,56 +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.eclipselink.core.internal.context.java; - -import org.eclipse.jpt.core.JpaFactory; -import org.eclipse.jpt.core.context.java.JavaAttributeMapping; -import org.eclipse.jpt.core.context.java.JavaAttributeMappingDefinition; -import org.eclipse.jpt.core.context.java.JavaPersistentAttribute; -import org.eclipse.jpt.core.internal.context.java.AbstractJavaAttributeMappingDefinition; -import org.eclipse.jpt.eclipselink.core.EclipseLinkMappingKeys; -import org.eclipse.jpt.eclipselink.core.internal.EclipseLinkJpaFactory; -import org.eclipse.jpt.eclipselink.core.resource.java.EclipseLinkTransformationAnnotation; - -public class JavaEclipseLinkTransformationMappingDefinition - extends AbstractJavaAttributeMappingDefinition -{ - // singleton - private static final JavaEclipseLinkTransformationMappingDefinition INSTANCE = - new JavaEclipseLinkTransformationMappingDefinition(); - - - /** - * Return the singleton. - */ - public static JavaAttributeMappingDefinition instance() { - return INSTANCE; - } - - - /** - * Enforce singleton usage - */ - private JavaEclipseLinkTransformationMappingDefinition() { - super(); - } - - - public String getKey() { - return EclipseLinkMappingKeys.TRANSFORMATION_ATTRIBUTE_MAPPING_KEY; - } - - public String getAnnotationName() { - return EclipseLinkTransformationAnnotation.ANNOTATION_NAME; - } - - public JavaAttributeMapping buildMapping(JavaPersistentAttribute parent, JpaFactory factory) { - return ((EclipseLinkJpaFactory) factory).buildJavaEclipseLinkTransformationMapping(parent); - } -} diff --git a/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/java/JavaEclipseLinkTypeConverter.java b/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/java/JavaEclipseLinkTypeConverter.java deleted file mode 100644 index fb4ebaae9f..0000000000 --- a/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/java/JavaEclipseLinkTypeConverter.java +++ /dev/null @@ -1,110 +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.eclipselink.core.internal.context.java; - -import org.eclipse.jpt.core.context.java.JavaJpaContextNode; -import org.eclipse.jpt.core.resource.java.JavaResourcePersistentMember; -import org.eclipse.jpt.eclipselink.core.context.EclipseLinkConverter; -import org.eclipse.jpt.eclipselink.core.context.EclipseLinkTypeConverter; -import org.eclipse.jpt.eclipselink.core.resource.java.EclipseLinkTypeConverterAnnotation; - -public class JavaEclipseLinkTypeConverter extends JavaEclipseLinkConverter - implements EclipseLinkTypeConverter -{ - private String dataType; - - private String objectType; - - - public JavaEclipseLinkTypeConverter(JavaJpaContextNode parent) { - super(parent); - } - - public String getType() { - return EclipseLinkConverter.TYPE_CONVERTER; - } - - @Override - public String getAnnotationName() { - return EclipseLinkTypeConverterAnnotation.ANNOTATION_NAME; - } - - @Override - protected EclipseLinkTypeConverterAnnotation getAnnotation() { - return (EclipseLinkTypeConverterAnnotation) super.getAnnotation(); - } - - - // **************** data type ********************************************** - - public String getDataType() { - return this.dataType; - } - - public void setDataType(String newDataType) { - String oldDataType = this.dataType; - this.dataType = newDataType; - getAnnotation().setDataType(newDataType); - firePropertyChanged(DATA_TYPE_PROPERTY, oldDataType, newDataType); - } - - protected void setDataType_(String newDataType) { - String oldDataType = this.dataType; - this.dataType = newDataType; - firePropertyChanged(DATA_TYPE_PROPERTY, oldDataType, newDataType); - } - - - // **************** object type ******************************************** - - public String getObjectType() { - return this.objectType; - } - - public void setObjectType(String newObjectType) { - String oldObjectType = this.objectType; - this.objectType = newObjectType; - getAnnotation().setObjectType(newObjectType); - firePropertyChanged(OBJECT_TYPE_PROPERTY, oldObjectType, newObjectType); - } - - protected void setObjectType_(String newObjectType) { - String oldObjectType = this.objectType; - this.objectType = newObjectType; - firePropertyChanged(OBJECT_TYPE_PROPERTY, oldObjectType, newObjectType); - } - - - // **************** resource interaction *********************************** - - @Override - protected void initialize(JavaResourcePersistentMember jrpm) { - super.initialize(jrpm); - EclipseLinkTypeConverterAnnotation resourceConverter = getAnnotation(); - this.dataType = this.dataType(resourceConverter); - this.objectType = this.objectType(resourceConverter); - } - - @Override - public void update(JavaResourcePersistentMember jrpm) { - super.update(jrpm); - EclipseLinkTypeConverterAnnotation resourceConverter = getAnnotation(); - this.setDataType_(this.dataType(resourceConverter)); - this.setObjectType_(this.objectType(resourceConverter)); - } - - protected String dataType(EclipseLinkTypeConverterAnnotation resourceConverter) { - return resourceConverter == null ? null : resourceConverter.getDataType(); - } - - protected String objectType(EclipseLinkTypeConverterAnnotation resourceConverter) { - return resourceConverter == null ? null : resourceConverter.getObjectType(); - } -} diff --git a/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/java/JavaEclipseLinkVariableOneToOneMapping.java b/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/java/JavaEclipseLinkVariableOneToOneMapping.java deleted file mode 100644 index c270c6a4bd..0000000000 --- a/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/java/JavaEclipseLinkVariableOneToOneMapping.java +++ /dev/null @@ -1,34 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2009 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.eclipselink.core.internal.context.java; - -import org.eclipse.jpt.core.context.java.JavaPersistentAttribute; -import org.eclipse.jpt.core.internal.context.java.AbstractJavaAttributeMapping; -import org.eclipse.jpt.eclipselink.core.EclipseLinkMappingKeys; -import org.eclipse.jpt.eclipselink.core.context.EclipseLinkVariableOneToOneMapping; -import org.eclipse.jpt.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; - } - - public String getAnnotationName() { - return EclipseLinkVariableOneToOneAnnotation.ANNOTATION_NAME; - } -} diff --git a/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/java/JavaEclipseLinkVariableOneToOneMappingDefinition.java b/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/java/JavaEclipseLinkVariableOneToOneMappingDefinition.java deleted file mode 100644 index 920e605f3a..0000000000 --- a/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/java/JavaEclipseLinkVariableOneToOneMappingDefinition.java +++ /dev/null @@ -1,62 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2009 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.eclipselink.core.internal.context.java; - -import org.eclipse.jpt.core.JpaFactory; -import org.eclipse.jpt.core.context.java.JavaAttributeMapping; -import org.eclipse.jpt.core.context.java.JavaAttributeMappingDefinition; -import org.eclipse.jpt.core.context.java.JavaPersistentAttribute; -import org.eclipse.jpt.core.internal.context.java.AbstractJavaAttributeMappingDefinition; -import org.eclipse.jpt.eclipselink.core.EclipseLinkMappingKeys; -import org.eclipse.jpt.eclipselink.core.internal.EclipseLinkJpaFactory; -import org.eclipse.jpt.eclipselink.core.resource.java.EclipseLinkVariableOneToOneAnnotation; - -public class JavaEclipseLinkVariableOneToOneMappingDefinition - extends AbstractJavaAttributeMappingDefinition -{ - // singleton - private static final JavaEclipseLinkVariableOneToOneMappingDefinition INSTANCE = - new JavaEclipseLinkVariableOneToOneMappingDefinition(); - - - /** - * Return the singleton. - */ - public static JavaAttributeMappingDefinition instance() { - return INSTANCE; - } - - - /** - * Enforce singleton usage - */ - private JavaEclipseLinkVariableOneToOneMappingDefinition() { - super(); - } - - - public String getKey() { - return EclipseLinkMappingKeys.VARIABLE_ONE_TO_ONE_ATTRIBUTE_MAPPING_KEY; - } - - public String getAnnotationName() { - return EclipseLinkVariableOneToOneAnnotation.ANNOTATION_NAME; - } - - public JavaAttributeMapping buildMapping(JavaPersistentAttribute parent, JpaFactory factory) { - return ((EclipseLinkJpaFactory) factory).buildJavaEclipseLinkVariableOneToOneMapping(parent); - } - - @Override - public boolean testDefault(JavaPersistentAttribute persistentAttribute) { - return ((JavaEclipseLinkPersistentAttribute) persistentAttribute).typeIsValidForVariableOneToOne(); - } - -} diff --git a/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/java/JavaEclipseLinkVersionMapping.java b/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/java/JavaEclipseLinkVersionMapping.java deleted file mode 100644 index b7e913c385..0000000000 --- a/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/java/JavaEclipseLinkVersionMapping.java +++ /dev/null @@ -1,120 +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.eclipselink.core.internal.context.java; - -import java.util.Iterator; -import java.util.List; -import java.util.Vector; - -import org.eclipse.jdt.core.dom.CompilationUnit; -import org.eclipse.jpt.core.context.java.JavaConverter; -import org.eclipse.jpt.core.context.java.JavaPersistentAttribute; -import org.eclipse.jpt.core.internal.context.java.AbstractJavaVersionMapping; -import org.eclipse.jpt.eclipselink.core.context.EclipseLinkConvert; -import org.eclipse.jpt.eclipselink.core.context.EclipseLinkMutable; -import org.eclipse.jpt.eclipselink.core.context.EclipseLinkVersionMapping; -import org.eclipse.jpt.eclipselink.core.resource.java.EclipseLink; -import org.eclipse.jpt.eclipselink.core.resource.java.EclipseLinkConvertAnnotation; -import org.eclipse.jpt.utility.Filter; -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); - } - - //************** JavaAttributeMapping implementation *************** - - @Override - protected void addSupportingAnnotationNamesTo(Vector<String> names) { - super.addSupportingAnnotationNamesTo(names); - names.add(EclipseLink.MUTABLE); - names.add(EclipseLink.CONVERT); - } - - - //************** EclipseLinkVersionMapping overrides *************** - - @Override - protected JavaConverter buildSpecifiedConverter(String converterType) { - JavaConverter javaConverter = super.buildSpecifiedConverter(converterType); - if (javaConverter != null) { - return javaConverter; - } - if (converterType == EclipseLinkConvert.ECLIPSE_LINK_CONVERTER) { - return new JavaEclipseLinkConvert(this, this.getResourcePersistentAttribute()); - } - return null; - } - - @Override - protected String getResourceConverterType() { - //check @Convert first, this is the order that EclipseLink searches - if (this.getResourcePersistentAttribute().getAnnotation(EclipseLinkConvertAnnotation.ANNOTATION_NAME) != null) { - return EclipseLinkConvert.ECLIPSE_LINK_CONVERTER; - } - return super.getResourceConverterType(); - } - - - //************ EclipselinkVersionMapping implementation **************** - - public EclipseLinkMutable getMutable() { - return this.mutable; - } - - - //************ initialization/update **************** - - @Override - protected void initialize() { - super.initialize(); - this.mutable.initialize(this.getResourcePersistentAttribute()); - } - - @Override - protected void update() { - super.update(); - this.mutable.update(this.getResourcePersistentAttribute()); - } - - // ********** code assist ********** - - @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 (getConverter() != null) { - result = getConverter().javaCompletionProposals(pos, filter, astRoot); - if (result != null) { - return result; - } - } - return null; - } - - //************ validation **************** - - @Override - public void validate(List<IMessage> messages, IReporter reporter, CompilationUnit astRoot) { - super.validate(messages, reporter, astRoot); - this.mutable.validate(messages, reporter, astRoot); - } - -} diff --git a/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/orm/AbstractEclipseLinkOrmXmlDefinition.java b/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/orm/AbstractEclipseLinkOrmXmlDefinition.java deleted file mode 100644 index 7aa95d2c54..0000000000 --- a/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/orm/AbstractEclipseLinkOrmXmlDefinition.java +++ /dev/null @@ -1,85 +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.eclipselink.core.internal.context.orm; - -import org.eclipse.emf.ecore.EFactory; -import org.eclipse.jpt.core.context.orm.NullOrmAttributeMappingDefinition; -import org.eclipse.jpt.core.context.orm.OrmAttributeMappingDefinition; -import org.eclipse.jpt.core.context.orm.OrmTypeMappingDefinition; -import org.eclipse.jpt.core.internal.context.orm.AbstractOrmXmlDefinition; -import org.eclipse.jpt.core.internal.context.orm.OrmBasicMappingDefinition; -import org.eclipse.jpt.core.internal.context.orm.OrmEmbeddableDefinition; -import org.eclipse.jpt.core.internal.context.orm.OrmEmbeddedIdMappingDefinition; -import org.eclipse.jpt.core.internal.context.orm.OrmEmbeddedMappingDefinition; -import org.eclipse.jpt.core.internal.context.orm.OrmEntityDefinition; -import org.eclipse.jpt.core.internal.context.orm.OrmIdMappingDefinition; -import org.eclipse.jpt.core.internal.context.orm.OrmManyToManyMappingDefinition; -import org.eclipse.jpt.core.internal.context.orm.OrmManyToOneMappingDefinition; -import org.eclipse.jpt.core.internal.context.orm.OrmMappedSuperclassDefinition; -import org.eclipse.jpt.core.internal.context.orm.OrmOneToManyMappingDefinition; -import org.eclipse.jpt.core.internal.context.orm.OrmOneToOneMappingDefinition; -import org.eclipse.jpt.core.internal.context.orm.OrmTransientMappingDefinition; -import org.eclipse.jpt.core.internal.context.orm.OrmVersionMappingDefinition; -import org.eclipse.jpt.eclipselink.core.resource.orm.EclipseLinkOrmFactory; - -public abstract class AbstractEclipseLinkOrmXmlDefinition - extends AbstractOrmXmlDefinition -{ - - /** - * zero-argument constructor - */ - protected AbstractEclipseLinkOrmXmlDefinition() { - super(); - } - - - public EFactory getResourceNodeFactory() { - return EclipseLinkOrmFactory.eINSTANCE; - } - - - // ********* ORM type mappings ********* - - @Override - protected OrmTypeMappingDefinition[] buildOrmTypeMappingDefinitions() { - // order should not matter here, but we'll use the same order as for java - // @see {@link EclipseLinkJpaPlatformProvider} - return new OrmTypeMappingDefinition[] { - OrmEntityDefinition.instance(), - OrmEmbeddableDefinition.instance(), - OrmMappedSuperclassDefinition.instance()}; - } - - - // ********** ORM attribute mappings ********** - - @Override - protected OrmAttributeMappingDefinition[] buildOrmAttributeMappingDefinitions() { - // order should not matter here, but we'll use the same order as for java - // @see {@link EclipseLinkJpaPlatformProvider} - return new OrmAttributeMappingDefinition[] { - OrmTransientMappingDefinition.instance(), - OrmEclipseLinkBasicCollectionMappingDefinition.instance(), - OrmEclipseLinkBasicMapMappingDefinition.instance(), - OrmIdMappingDefinition.instance(), - OrmVersionMappingDefinition.instance(), - OrmBasicMappingDefinition.instance(), - OrmEmbeddedMappingDefinition.instance(), - OrmEmbeddedIdMappingDefinition.instance(), - OrmEclipseLinkTransformationMappingDefinition.instance(), - OrmManyToManyMappingDefinition.instance(), - OrmManyToOneMappingDefinition.instance(), - OrmOneToManyMappingDefinition.instance(), - OrmOneToOneMappingDefinition.instance(), - OrmEclipseLinkVariableOneToOneMappingDefinition.instance(), - NullOrmAttributeMappingDefinition.instance()}; - } -} diff --git a/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/orm/EclipseLinkEntityMappingsImpl.java b/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/orm/EclipseLinkEntityMappingsImpl.java deleted file mode 100644 index e4134f2d81..0000000000 --- a/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/orm/EclipseLinkEntityMappingsImpl.java +++ /dev/null @@ -1,60 +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.eclipselink.core.internal.context.orm; - -import java.util.List; -import org.eclipse.jpt.core.context.orm.OrmXml; -import org.eclipse.jpt.core.internal.context.orm.AbstractEntityMappings; -import org.eclipse.jpt.eclipselink.core.context.orm.EclipseLinkConverterHolder; -import org.eclipse.jpt.eclipselink.core.context.orm.EclipseLinkEntityMappings; -import org.eclipse.jpt.eclipselink.core.internal.JptEclipseLinkCorePlugin; -import org.eclipse.jpt.eclipselink.core.resource.orm.XmlEntityMappings; -import org.eclipse.wst.validation.internal.provisional.core.IMessage; -import org.eclipse.wst.validation.internal.provisional.core.IReporter; - -public class EclipseLinkEntityMappingsImpl - extends AbstractEntityMappings - implements EclipseLinkEntityMappings -{ - - protected final OrmEclipseLinkConverterHolder converterHolder; - - public EclipseLinkEntityMappingsImpl(OrmXml parent, XmlEntityMappings resource) { - super(parent, resource); - this.converterHolder = new OrmEclipseLinkConverterHolder(this, (XmlEntityMappings) this.xmlEntityMappings); - } - - // **************** EclipseLinkEntityMappings impl ********************************** - - public EclipseLinkConverterHolder getConverterHolder() { - return this.converterHolder; - } - - - @Override - public void update() { - super.update(); - this.converterHolder.update(); - } - - // **************** validation ********************************************* - - @Override - public void validate(List<IMessage> messages, IReporter reporter) { - super.validate(messages, reporter); - this.converterHolder.validate(messages, reporter); - } - - @Override - protected String latestDocumentVersion() { - return getJpaPlatform().getMostRecentSupportedResourceType( - JptEclipseLinkCorePlugin.ECLIPSELINK_ORM_XML_CONTENT_TYPE).getVersion(); - } -} diff --git a/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/orm/EclipseLinkOrmXmlContextNodeFactory.java b/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/orm/EclipseLinkOrmXmlContextNodeFactory.java deleted file mode 100644 index 6fb099a2bb..0000000000 --- a/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/orm/EclipseLinkOrmXmlContextNodeFactory.java +++ /dev/null @@ -1,220 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2009 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.eclipselink.core.internal.context.orm; - -import org.eclipse.jpt.core.context.java.JavaAttributeMapping; -import org.eclipse.jpt.core.context.java.JavaBasicMapping; -import org.eclipse.jpt.core.context.java.JavaEmbeddedIdMapping; -import org.eclipse.jpt.core.context.java.JavaEmbeddedMapping; -import org.eclipse.jpt.core.context.java.JavaIdMapping; -import org.eclipse.jpt.core.context.java.JavaManyToManyMapping; -import org.eclipse.jpt.core.context.java.JavaManyToOneMapping; -import org.eclipse.jpt.core.context.java.JavaOneToManyMapping; -import org.eclipse.jpt.core.context.java.JavaOneToOneMapping; -import org.eclipse.jpt.core.context.java.JavaTransientMapping; -import org.eclipse.jpt.core.context.java.JavaVersionMapping; -import org.eclipse.jpt.core.context.orm.EntityMappings; -import org.eclipse.jpt.core.context.orm.OrmBasicMapping; -import org.eclipse.jpt.core.context.orm.OrmEmbeddable; -import org.eclipse.jpt.core.context.orm.OrmEntity; -import org.eclipse.jpt.core.context.orm.OrmIdMapping; -import org.eclipse.jpt.core.context.orm.OrmManyToManyMapping; -import org.eclipse.jpt.core.context.orm.OrmManyToOneMapping; -import org.eclipse.jpt.core.context.orm.OrmMappedSuperclass; -import org.eclipse.jpt.core.context.orm.OrmOneToManyMapping; -import org.eclipse.jpt.core.context.orm.OrmOneToOneMapping; -import org.eclipse.jpt.core.context.orm.OrmPersistentAttribute; -import org.eclipse.jpt.core.context.orm.OrmPersistentType; -import org.eclipse.jpt.core.context.orm.OrmTypeMapping; -import org.eclipse.jpt.core.context.orm.OrmVersionMapping; -import org.eclipse.jpt.core.context.orm.OrmXml; -import org.eclipse.jpt.core.internal.context.orm.AbstractOrmXmlContextNodeFactory; -import org.eclipse.jpt.core.resource.orm.XmlNullAttributeMapping; -import org.eclipse.jpt.eclipselink.core.internal.context.java.JavaEclipseLinkBasicCollectionMapping; -import org.eclipse.jpt.eclipselink.core.internal.context.java.JavaEclipseLinkBasicMapMapping; -import org.eclipse.jpt.eclipselink.core.internal.context.java.JavaEclipseLinkOneToManyMapping; -import org.eclipse.jpt.eclipselink.core.internal.context.java.JavaEclipseLinkOneToOneMapping; -import org.eclipse.jpt.eclipselink.core.internal.context.java.JavaEclipseLinkTransformationMapping; -import org.eclipse.jpt.eclipselink.core.internal.context.java.JavaEclipseLinkVariableOneToOneMapping; -import org.eclipse.jpt.eclipselink.core.resource.orm.XmlBasic; -import org.eclipse.jpt.eclipselink.core.resource.orm.XmlBasicCollection; -import org.eclipse.jpt.eclipselink.core.resource.orm.XmlBasicMap; -import org.eclipse.jpt.eclipselink.core.resource.orm.XmlEmbeddable; -import org.eclipse.jpt.eclipselink.core.resource.orm.XmlEmbedded; -import org.eclipse.jpt.eclipselink.core.resource.orm.XmlEmbeddedId; -import org.eclipse.jpt.eclipselink.core.resource.orm.XmlEntity; -import org.eclipse.jpt.eclipselink.core.resource.orm.XmlEntityMappings; -import org.eclipse.jpt.eclipselink.core.resource.orm.XmlId; -import org.eclipse.jpt.eclipselink.core.resource.orm.XmlManyToMany; -import org.eclipse.jpt.eclipselink.core.resource.orm.XmlManyToOne; -import org.eclipse.jpt.eclipselink.core.resource.orm.XmlMappedSuperclass; -import org.eclipse.jpt.eclipselink.core.resource.orm.XmlOneToMany; -import org.eclipse.jpt.eclipselink.core.resource.orm.XmlOneToOne; -import org.eclipse.jpt.eclipselink.core.resource.orm.XmlTransformation; -import org.eclipse.jpt.eclipselink.core.resource.orm.XmlTransient; -import org.eclipse.jpt.eclipselink.core.resource.orm.XmlVariableOneToOne; -import org.eclipse.jpt.eclipselink.core.resource.orm.XmlVersion; - -public class EclipseLinkOrmXmlContextNodeFactory extends AbstractOrmXmlContextNodeFactory -{ - - // ********** EclipseLink-specific ORM Context Model ********** - - @Override - public EntityMappings buildEntityMappings(OrmXml parent, org.eclipse.jpt.core.resource.orm.XmlEntityMappings xmlEntityMappings) { - return new EclipseLinkEntityMappingsImpl(parent, (XmlEntityMappings) xmlEntityMappings); - } - - @Override - public OrmPersistentAttribute buildOrmPersistentAttribute(OrmPersistentType parent, OrmPersistentAttribute.Owner owner, org.eclipse.jpt.core.resource.orm.XmlAttributeMapping resourceMapping) { - return new OrmEclipseLinkPersistentAttribute(parent, owner, resourceMapping); - } - - @Override - public OrmEmbeddable buildOrmEmbeddable(OrmPersistentType type, org.eclipse.jpt.core.resource.orm.XmlEmbeddable resourceMapping) { - return new OrmEclipseLinkEmbeddableImpl(type, (XmlEmbeddable) resourceMapping); - } - - @Override - public OrmEntity buildOrmEntity(OrmPersistentType type, org.eclipse.jpt.core.resource.orm.XmlEntity resourceMapping) { - return new OrmEclipseLinkEntityImpl(type, (XmlEntity) resourceMapping); - } - - @Override - public OrmMappedSuperclass buildOrmMappedSuperclass(OrmPersistentType type, org.eclipse.jpt.core.resource.orm.XmlMappedSuperclass resourceMapping) { - return new OrmEclipseLinkMappedSuperclassImpl(type, (XmlMappedSuperclass) resourceMapping); - } - - @Override - public OrmBasicMapping buildOrmBasicMapping(OrmPersistentAttribute parent, org.eclipse.jpt.core.resource.orm.XmlBasic resourceMapping) { - return new OrmEclipseLinkBasicMapping(parent, (XmlBasic) resourceMapping); - } - - @Override - public OrmIdMapping buildOrmIdMapping(OrmPersistentAttribute parent, org.eclipse.jpt.core.resource.orm.XmlId resourceMapping) { - return new OrmEclipseLinkIdMapping(parent, (XmlId) resourceMapping); - } - - @Override - public OrmManyToManyMapping buildOrmManyToManyMapping(OrmPersistentAttribute parent, org.eclipse.jpt.core.resource.orm.XmlManyToMany resourceMapping) { - return new OrmEclipseLinkManyToManyMapping(parent, (XmlManyToMany) resourceMapping); - } - - @Override - public OrmManyToOneMapping buildOrmManyToOneMapping(OrmPersistentAttribute parent, org.eclipse.jpt.core.resource.orm.XmlManyToOne resourceMapping) { - return new OrmEclipseLinkManyToOneMapping(parent, (XmlManyToOne) resourceMapping); - } - - @Override - public OrmOneToManyMapping buildOrmOneToManyMapping(OrmPersistentAttribute parent, org.eclipse.jpt.core.resource.orm.XmlOneToMany resourceMapping) { - return new OrmEclipseLinkOneToManyMapping(parent, (XmlOneToMany) resourceMapping); - } - - @Override - public OrmOneToOneMapping buildOrmOneToOneMapping(OrmPersistentAttribute parent, org.eclipse.jpt.core.resource.orm.XmlOneToOne resourceMapping) { - return new OrmEclipseLinkOneToOneMapping(parent, (XmlOneToOne) resourceMapping); - } - - @Override - public OrmVersionMapping buildOrmVersionMapping(OrmPersistentAttribute parent, org.eclipse.jpt.core.resource.orm.XmlVersion resourceMapping) { - return new OrmEclipseLinkVersionMapping(parent, (XmlVersion) resourceMapping); - } - - public OrmEclipseLinkBasicCollectionMapping buildOrmEclipseLinkBasicCollectionMapping(OrmPersistentAttribute parent, XmlBasicCollection resourceMapping) { - return new OrmEclipseLinkBasicCollectionMapping(parent, resourceMapping); - } - - public OrmEclipseLinkBasicMapMapping buildOrmEclipseLinkBasicMapMapping(OrmPersistentAttribute parent, XmlBasicMap resourceMapping) { - return new OrmEclipseLinkBasicMapMapping(parent, resourceMapping); - } - - public OrmEclipseLinkTransformationMapping buildOrmEclipseLinkTransformationMapping(OrmPersistentAttribute parent, XmlTransformation resourceMapping) { - return new OrmEclipseLinkTransformationMapping(parent, resourceMapping); - } - - public OrmEclipseLinkVariableOneToOneMapping buildOrmEclipseLinkVariableOneToOneMapping(OrmPersistentAttribute parent, XmlVariableOneToOne resourceMapping) { - return new OrmEclipseLinkVariableOneToOneMapping(parent, resourceMapping); - } - - - // ********** EclipseLink-specific ORM Virtual Resource Model ********** - - - @Override - public XmlBasic buildVirtualXmlBasic(OrmTypeMapping ormTypeMapping, JavaBasicMapping javaBasicMapping) { - return new VirtualEclipseLinkXmlBasic(ormTypeMapping, javaBasicMapping); - } - - @Override - public XmlId buildVirtualXmlId(OrmTypeMapping ormTypeMapping, JavaIdMapping javaIdMapping) { - return new VirtualEclipseLinkXmlId(ormTypeMapping, javaIdMapping); - } - - @Override - public XmlEmbeddedId buildVirtualXmlEmbeddedId(OrmTypeMapping ormTypeMapping, JavaEmbeddedIdMapping javaEmbeddedIdMapping) { - return new VirtualEclipseLinkXmlEmbeddedId(ormTypeMapping, javaEmbeddedIdMapping); - } - - @Override - public XmlEmbedded buildVirtualXmlEmbedded(OrmTypeMapping ormTypeMapping, JavaEmbeddedMapping javaEmbeddedMapping) { - return new VirtualEclipseLinkXmlEmbedded(ormTypeMapping, javaEmbeddedMapping); - } - - @Override - public XmlManyToMany buildVirtualXmlManyToMany(OrmTypeMapping ormTypeMapping, JavaManyToManyMapping javaManyToManyMapping) { - return new VirtualEclipseLinkXmlManyToMany(ormTypeMapping, javaManyToManyMapping); - } - - @Override - public XmlManyToOne buildVirtualXmlManyToOne(OrmTypeMapping ormTypeMapping, JavaManyToOneMapping javaManyToOneMapping) { - return new VirtualEclipseLinkXmlManyToOne(ormTypeMapping, javaManyToOneMapping); - } - - @Override - public XmlOneToMany buildVirtualXmlOneToMany(OrmTypeMapping ormTypeMapping, JavaOneToManyMapping javaOneToManyMapping) { - return new VirtualEclipseLinkXmlOneToMany(ormTypeMapping, (JavaEclipseLinkOneToManyMapping) javaOneToManyMapping); - } - - @Override - public XmlOneToOne buildVirtualXmlOneToOne(OrmTypeMapping ormTypeMapping, JavaOneToOneMapping javaOneToOneMapping) { - return new VirtualEclipseLinkXmlOneToOne(ormTypeMapping, (JavaEclipseLinkOneToOneMapping) javaOneToOneMapping); - } - - @Override - public XmlVersion buildVirtualXmlVersion(OrmTypeMapping ormTypeMapping, JavaVersionMapping javaVersionMapping) { - return new VirtualEclipseLinkXmlVersion(ormTypeMapping, javaVersionMapping); - } - - @Override - public XmlTransient buildVirtualXmlTransient(OrmTypeMapping ormTypeMapping, JavaTransientMapping javaTransientMapping) { - return new VirtualEclipseLinkXmlTransient(ormTypeMapping, javaTransientMapping); - } - - public XmlBasicCollection buildVirtualEclipseLinkXmlBasicCollection(OrmTypeMapping ormTypeMapping, JavaEclipseLinkBasicCollectionMapping javaBasicCollectionMapping) { - return new VirtualEclipseLinkXmlBasicCollection(ormTypeMapping, javaBasicCollectionMapping); - } - - public XmlBasicMap buildVirtualEclipseLinkXmlBasicMap(OrmTypeMapping ormTypeMapping, JavaEclipseLinkBasicMapMapping javaBasicMapMapping) { - return new VirtualEclipseLinkXmlBasicMap(ormTypeMapping, javaBasicMapMapping); - } - - public XmlTransformation buildVirtualEclipseLinkXmlTransformation(OrmTypeMapping ormTypeMapping, JavaEclipseLinkTransformationMapping javaTransformationMapping) { - return new VirtualEclipseLinkXmlTransformation(ormTypeMapping, javaTransformationMapping); - } - - public XmlVariableOneToOne buildVirtualEclipseLinkXmlVariableOneToOne(OrmTypeMapping ormTypeMapping, JavaEclipseLinkVariableOneToOneMapping javaVariableOneToOneMapping) { - return new VirtualEclipseLinkXmlVariableOneToOne(ormTypeMapping, javaVariableOneToOneMapping); - } - - @Override - public XmlNullAttributeMapping buildVirtualXmlNullAttributeMapping(OrmTypeMapping ormTypeMapping, JavaAttributeMapping javaAttributeMapping) { - return new VirtualEclipseLinkXmlNullAttributeMapping(ormTypeMapping, javaAttributeMapping); - } -} diff --git a/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/orm/EclipseLinkOrmXmlDefinition.java b/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/orm/EclipseLinkOrmXmlDefinition.java deleted file mode 100644 index bd05becebe..0000000000 --- a/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/orm/EclipseLinkOrmXmlDefinition.java +++ /dev/null @@ -1,47 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2008, 2009 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.eclipselink.core.internal.context.orm; - -import org.eclipse.jpt.core.JpaResourceType; -import org.eclipse.jpt.core.context.orm.OrmXmlContextNodeFactory; -import org.eclipse.jpt.core.context.orm.OrmXmlDefinition; -import org.eclipse.jpt.eclipselink.core.internal.JptEclipseLinkCorePlugin; - -public class EclipseLinkOrmXmlDefinition - extends AbstractEclipseLinkOrmXmlDefinition -{ - // singleton - private static final OrmXmlDefinition INSTANCE = - new EclipseLinkOrmXmlDefinition(); - - - /** - * Return the singleton. - */ - public static OrmXmlDefinition instance() { - return INSTANCE; - } - - /** - * Ensure single instance. - */ - private EclipseLinkOrmXmlDefinition() { - super(); - } - - @Override - protected OrmXmlContextNodeFactory buildContextNodeFactory() { - return new EclipseLinkOrmXmlContextNodeFactory(); - } - - public JpaResourceType getResourceType() { - return JptEclipseLinkCorePlugin.ECLIPSELINK_ORM_XML_1_0_RESOURCE_TYPE; - } -} diff --git a/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/orm/OrmEclipseLinkBasicCollectionMapping.java b/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/orm/OrmEclipseLinkBasicCollectionMapping.java deleted file mode 100644 index ac39919e28..0000000000 --- a/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/orm/OrmEclipseLinkBasicCollectionMapping.java +++ /dev/null @@ -1,47 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2008, 2009 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.eclipselink.core.internal.context.orm; - -import org.eclipse.jpt.core.context.orm.OrmAttributeMapping; -import org.eclipse.jpt.core.context.orm.OrmPersistentAttribute; -import org.eclipse.jpt.core.internal.context.orm.AbstractOrmAttributeMapping; -import org.eclipse.jpt.eclipselink.core.EclipseLinkMappingKeys; -import org.eclipse.jpt.eclipselink.core.context.EclipseLinkBasicCollectionMapping; -import org.eclipse.jpt.eclipselink.core.resource.orm.Attributes; -import org.eclipse.jpt.eclipselink.core.resource.orm.XmlBasicCollection; - -public class OrmEclipseLinkBasicCollectionMapping - extends AbstractOrmAttributeMapping<XmlBasicCollection> - implements EclipseLinkBasicCollectionMapping -{ - public OrmEclipseLinkBasicCollectionMapping(OrmPersistentAttribute parent, XmlBasicCollection resourceMapping) { - super(parent, resourceMapping); - } - - public void initializeOn(OrmAttributeMapping newMapping) { - newMapping.initializeFromOrmAttributeMapping(this); - } - - public String getKey() { - return EclipseLinkMappingKeys.BASIC_COLLECTION_ATTRIBUTE_MAPPING_KEY; - } - - public void addToResourceModel(org.eclipse.jpt.core.resource.orm.Attributes resourceAttributes) { - ((Attributes) resourceAttributes).getBasicCollections().add(this.resourceAttributeMapping); - } - - public void removeFromResourceModel(org.eclipse.jpt.core.resource.orm.Attributes resourceAttributes) { - ((Attributes) resourceAttributes).getBasicCollections().remove(this.resourceAttributeMapping); - } - - public int getXmlSequence() { - return 23; - } -} diff --git a/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/orm/OrmEclipseLinkBasicCollectionMappingDefinition.java b/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/orm/OrmEclipseLinkBasicCollectionMappingDefinition.java deleted file mode 100644 index cdbff1b4a9..0000000000 --- a/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/orm/OrmEclipseLinkBasicCollectionMappingDefinition.java +++ /dev/null @@ -1,76 +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.eclipselink.core.internal.context.orm; - -import org.eclipse.emf.ecore.EFactory; -import org.eclipse.jpt.core.context.java.JavaAttributeMapping; -import org.eclipse.jpt.core.context.orm.OrmAttributeMapping; -import org.eclipse.jpt.core.context.orm.OrmAttributeMappingDefinition; -import org.eclipse.jpt.core.context.orm.OrmPersistentAttribute; -import org.eclipse.jpt.core.context.orm.OrmTypeMapping; -import org.eclipse.jpt.core.context.orm.OrmXmlContextNodeFactory; -import org.eclipse.jpt.core.resource.orm.XmlAttributeMapping; -import org.eclipse.jpt.core.resource.xml.EmfTools; -import org.eclipse.jpt.eclipselink.core.EclipseLinkMappingKeys; -import org.eclipse.jpt.eclipselink.core.internal.context.java.JavaEclipseLinkBasicCollectionMapping; -import org.eclipse.jpt.eclipselink.core.resource.orm.EclipseLinkOrmPackage; -import org.eclipse.jpt.eclipselink.core.resource.orm.XmlBasicCollection; - -public class OrmEclipseLinkBasicCollectionMappingDefinition - implements OrmAttributeMappingDefinition -{ - // singleton - private static final OrmEclipseLinkBasicCollectionMappingDefinition INSTANCE = - new OrmEclipseLinkBasicCollectionMappingDefinition(); - - - /** - * Return the singleton. - */ - public static OrmAttributeMappingDefinition instance() { - return INSTANCE; - } - - - /** - * Enforce singleton usage - */ - private OrmEclipseLinkBasicCollectionMappingDefinition() { - super(); - } - - - public String getKey() { - return EclipseLinkMappingKeys.BASIC_COLLECTION_ATTRIBUTE_MAPPING_KEY; - } - - public XmlAttributeMapping buildResourceMapping(EFactory factory) { - return EmfTools.create( - factory, - EclipseLinkOrmPackage.eINSTANCE.getXmlBasicCollection(), - XmlBasicCollection.class); - } - - public OrmAttributeMapping buildContextMapping( - OrmPersistentAttribute parent, - XmlAttributeMapping resourceMapping, - OrmXmlContextNodeFactory factory) { - return ((EclipseLinkOrmXmlContextNodeFactory) factory). - buildOrmEclipseLinkBasicCollectionMapping(parent, (XmlBasicCollection) resourceMapping); - } - - public XmlAttributeMapping buildVirtualResourceMapping( - OrmTypeMapping ormTypeMapping, - JavaAttributeMapping javaAttributeMapping, - OrmXmlContextNodeFactory factory) { - return ((EclipseLinkOrmXmlContextNodeFactory) factory). - buildVirtualEclipseLinkXmlBasicCollection(ormTypeMapping, (JavaEclipseLinkBasicCollectionMapping) javaAttributeMapping); - } -} diff --git a/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/orm/OrmEclipseLinkBasicMapMapping.java b/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/orm/OrmEclipseLinkBasicMapMapping.java deleted file mode 100644 index 63de675e52..0000000000 --- a/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/orm/OrmEclipseLinkBasicMapMapping.java +++ /dev/null @@ -1,48 +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.eclipselink.core.internal.context.orm; - -import org.eclipse.jpt.core.context.orm.OrmAttributeMapping; -import org.eclipse.jpt.core.context.orm.OrmPersistentAttribute; -import org.eclipse.jpt.core.internal.context.orm.AbstractOrmAttributeMapping; -import org.eclipse.jpt.eclipselink.core.EclipseLinkMappingKeys; -import org.eclipse.jpt.eclipselink.core.context.EclipseLinkBasicMapMapping; -import org.eclipse.jpt.eclipselink.core.resource.orm.Attributes; -import org.eclipse.jpt.eclipselink.core.resource.orm.XmlBasicMap; - -public class OrmEclipseLinkBasicMapMapping - extends AbstractOrmAttributeMapping<XmlBasicMap> - implements EclipseLinkBasicMapMapping -{ - public OrmEclipseLinkBasicMapMapping(OrmPersistentAttribute parent, XmlBasicMap resourceMapping) { - super(parent, resourceMapping); - } - - public void initializeOn(OrmAttributeMapping newMapping) { - newMapping.initializeFromOrmAttributeMapping(this); - } - - public String getKey() { - return EclipseLinkMappingKeys.BASIC_MAP_ATTRIBUTE_MAPPING_KEY; - } - - public void addToResourceModel(org.eclipse.jpt.core.resource.orm.Attributes resourceAttributes) { - ((Attributes) resourceAttributes).getBasicMaps().add(this.resourceAttributeMapping); - } - - public void removeFromResourceModel(org.eclipse.jpt.core.resource.orm.Attributes resourceAttributes) { - ((Attributes) resourceAttributes).getBasicMaps().remove(this.resourceAttributeMapping); - } - - - public int getXmlSequence() { - return 27; - } -} diff --git a/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/orm/OrmEclipseLinkBasicMapMappingDefinition.java b/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/orm/OrmEclipseLinkBasicMapMappingDefinition.java deleted file mode 100644 index 9a89a095d8..0000000000 --- a/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/orm/OrmEclipseLinkBasicMapMappingDefinition.java +++ /dev/null @@ -1,76 +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.eclipselink.core.internal.context.orm; - -import org.eclipse.emf.ecore.EFactory; -import org.eclipse.jpt.core.context.java.JavaAttributeMapping; -import org.eclipse.jpt.core.context.orm.OrmAttributeMapping; -import org.eclipse.jpt.core.context.orm.OrmAttributeMappingDefinition; -import org.eclipse.jpt.core.context.orm.OrmPersistentAttribute; -import org.eclipse.jpt.core.context.orm.OrmTypeMapping; -import org.eclipse.jpt.core.context.orm.OrmXmlContextNodeFactory; -import org.eclipse.jpt.core.resource.orm.XmlAttributeMapping; -import org.eclipse.jpt.core.resource.xml.EmfTools; -import org.eclipse.jpt.eclipselink.core.EclipseLinkMappingKeys; -import org.eclipse.jpt.eclipselink.core.internal.context.java.JavaEclipseLinkBasicMapMapping; -import org.eclipse.jpt.eclipselink.core.resource.orm.EclipseLinkOrmPackage; -import org.eclipse.jpt.eclipselink.core.resource.orm.XmlBasicMap; - -public class OrmEclipseLinkBasicMapMappingDefinition - implements OrmAttributeMappingDefinition -{ - // singleton - private static final OrmEclipseLinkBasicMapMappingDefinition INSTANCE = - new OrmEclipseLinkBasicMapMappingDefinition(); - - - /** - * Return the singleton - */ - public static OrmAttributeMappingDefinition instance() { - return INSTANCE; - } - - - /** - * Ensforce singleton usage - */ - private OrmEclipseLinkBasicMapMappingDefinition() { - super(); - } - - - public String getKey() { - return EclipseLinkMappingKeys.BASIC_MAP_ATTRIBUTE_MAPPING_KEY; - } - - public XmlAttributeMapping buildResourceMapping(EFactory factory) { - return EmfTools.create( - factory, - EclipseLinkOrmPackage.eINSTANCE.getXmlBasicMap(), - XmlBasicMap.class); - } - - public OrmAttributeMapping buildContextMapping( - OrmPersistentAttribute parent, - XmlAttributeMapping resourceMapping, - OrmXmlContextNodeFactory factory) { - return ((EclipseLinkOrmXmlContextNodeFactory) factory). - buildOrmEclipseLinkBasicMapMapping(parent, (XmlBasicMap) resourceMapping); - } - - public XmlAttributeMapping buildVirtualResourceMapping( - OrmTypeMapping ormTypeMapping, - JavaAttributeMapping javaAttributeMapping, - OrmXmlContextNodeFactory factory) { - return ((EclipseLinkOrmXmlContextNodeFactory) factory). - buildVirtualEclipseLinkXmlBasicMap(ormTypeMapping, (JavaEclipseLinkBasicMapMapping) javaAttributeMapping); - } -} diff --git a/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/orm/OrmEclipseLinkBasicMapping.java b/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/orm/OrmEclipseLinkBasicMapping.java deleted file mode 100644 index a45b8544d2..0000000000 --- a/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/orm/OrmEclipseLinkBasicMapping.java +++ /dev/null @@ -1,78 +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.eclipselink.core.internal.context.orm; - -import java.util.List; -import org.eclipse.jpt.core.context.orm.OrmConverter; -import org.eclipse.jpt.core.context.orm.OrmPersistentAttribute; -import org.eclipse.jpt.core.internal.context.orm.AbstractOrmBasicMapping; -import org.eclipse.jpt.eclipselink.core.context.EclipseLinkConvert; -import org.eclipse.jpt.eclipselink.core.context.EclipseLinkBasicMapping; -import org.eclipse.jpt.eclipselink.core.context.EclipseLinkMutable; -import org.eclipse.jpt.eclipselink.core.resource.orm.XmlBasic; -import org.eclipse.wst.validation.internal.provisional.core.IMessage; -import org.eclipse.wst.validation.internal.provisional.core.IReporter; - -public class OrmEclipseLinkBasicMapping extends AbstractOrmBasicMapping<XmlBasic> - implements EclipseLinkBasicMapping -{ - protected OrmEclipseLinkMutable mutable; - - - public OrmEclipseLinkBasicMapping(OrmPersistentAttribute parent, XmlBasic resourceMapping) { - super(parent, resourceMapping); - this.mutable = new OrmEclipseLinkMutable(this, this.resourceAttributeMapping); - } - - - public EclipseLinkMutable getMutable() { - return this.mutable; - } - - @Override - protected OrmConverter buildSpecifiedConverter(String converterType) { - OrmConverter ormConverter = super.buildSpecifiedConverter(converterType); - if (ormConverter != null) { - return ormConverter; - } - if (converterType == EclipseLinkConvert.ECLIPSE_LINK_CONVERTER) { - return new OrmEclipseLinkConvert(this, this.resourceAttributeMapping); - } - return null; - } - - @Override - protected String getResourceConverterType() { - //check @Convert first, this is the order that EclipseLink searches - if (this.resourceAttributeMapping.getConvert() != null) { - return EclipseLinkConvert.ECLIPSE_LINK_CONVERTER; - } - return super.getResourceConverterType(); - } - - - // **************** resource-context interaction *************************** - - @Override - public void update() { - super.update(); - this.mutable.update(); - } - - - // **************** validation ************************************** - - @Override - public void validate(List<IMessage> messages, IReporter reporter) { - super.validate(messages, reporter); - // TODO - mutable validation - } -} diff --git a/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/orm/OrmEclipseLinkCachingImpl.java b/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/orm/OrmEclipseLinkCachingImpl.java deleted file mode 100644 index ad50a83c0e..0000000000 --- a/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/orm/OrmEclipseLinkCachingImpl.java +++ /dev/null @@ -1,710 +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.eclipselink.core.internal.context.orm; - -import org.eclipse.jpt.core.context.PersistentType; -import org.eclipse.jpt.core.context.java.JavaPersistentType; -import org.eclipse.jpt.core.context.orm.OrmTypeMapping; -import org.eclipse.jpt.core.internal.context.orm.AbstractOrmXmlContextNode; -import org.eclipse.jpt.core.jpa2.context.CacheableHolder2_0; -import org.eclipse.jpt.core.jpa2.context.orm.OrmCacheable2_0; -import org.eclipse.jpt.core.jpa2.context.orm.OrmCacheableHolder2_0; -import org.eclipse.jpt.core.jpa2.context.orm.OrmXml2_0ContextNodeFactory; -import org.eclipse.jpt.core.jpa2.context.persistence.PersistenceUnit2_0; -import org.eclipse.jpt.core.resource.orm.v2_0.XmlCacheable_2_0; -import org.eclipse.jpt.core.utility.TextRange; -import org.eclipse.jpt.eclipselink.core.context.EclipseLinkCacheCoordinationType; -import org.eclipse.jpt.eclipselink.core.context.EclipseLinkCacheType; -import org.eclipse.jpt.eclipselink.core.context.EclipseLinkExistenceType; -import org.eclipse.jpt.eclipselink.core.context.EclipseLinkExpiryTimeOfDay; -import org.eclipse.jpt.eclipselink.core.context.java.JavaEclipseLinkCaching; -import org.eclipse.jpt.eclipselink.core.context.orm.OrmEclipseLinkCaching; -import org.eclipse.jpt.eclipselink.core.resource.orm.EclipseLinkOrmFactory; -import org.eclipse.jpt.eclipselink.core.resource.orm.XmlCache; -import org.eclipse.jpt.eclipselink.core.resource.orm.XmlCacheHolder; -import org.eclipse.jpt.eclipselink.core.resource.orm.XmlTimeOfDay; - -public class OrmEclipseLinkCachingImpl - extends AbstractOrmXmlContextNode - implements - OrmEclipseLinkCaching, - OrmCacheableHolder2_0 -{ - protected final XmlCacheHolder resource; - - protected int defaultSize; - protected Integer specifiedSize; - - protected boolean defaultShared; - protected Boolean specifiedShared; - - protected EclipseLinkCacheType defaultType; - protected EclipseLinkCacheType specifiedType; - - protected boolean defaultAlwaysRefresh; - protected Boolean specifiedAlwaysRefresh; - - protected boolean defaultRefreshOnlyIfNewer; - protected Boolean specifiedRefreshOnlyIfNewer; - - protected boolean defaultDisableHits; - protected Boolean specifiedDisableHits; - - protected EclipseLinkCacheCoordinationType defaultCoordinationType; - protected EclipseLinkCacheCoordinationType specifiedCoordinationType; - - protected EclipseLinkExistenceType specifiedExistenceType; - protected EclipseLinkExistenceType defaultExistenceType; - - protected Integer expiry; - protected OrmEclipseLinkExpiryTimeOfDay expiryTimeOfDay; - - protected final OrmCacheable2_0 cacheable; - - public OrmEclipseLinkCachingImpl(OrmTypeMapping parent, XmlCacheHolder resource, XmlCacheable_2_0 cacheableResource, JavaEclipseLinkCaching javaCaching) { - super(parent); - this.resource = resource; - XmlCache resourceCache = getResourceCache(); - this.defaultSize = this.defaultSize(javaCaching); - this.specifiedSize = getResourceSize(resourceCache); - this.defaultShared = this.defaultShared(javaCaching); - this.specifiedShared = this.getResourceShared(resourceCache); - this.defaultAlwaysRefresh = this.defaultAlwaysRefresh(javaCaching); - this.specifiedAlwaysRefresh = this.getResourceAlwaysRefresh(resourceCache); - this.defaultRefreshOnlyIfNewer = this.defaultRefreshOnlyIfNewer(javaCaching); - this.specifiedRefreshOnlyIfNewer = this.getResourceRefreshOnlyIfNewer(resourceCache); - this.defaultDisableHits = this.defaultDisableHits(javaCaching); - this.specifiedDisableHits = this.getResourceDisableHits(resourceCache); - this.defaultType = this.defaultType(javaCaching); - this.specifiedType = this.getResourceType(resourceCache); - this.defaultCoordinationType = this.defaultCoordinationType(javaCaching); - this.specifiedCoordinationType = this.getResourceCoordinationType(resourceCache); - this.defaultExistenceType = this.defaultExistenceType(javaCaching); - this.specifiedExistenceType = this.getResourceExistenceChecking(); - this.initializeExpiry(resourceCache); - this.cacheable = ((OrmXml2_0ContextNodeFactory) getXmlContextNodeFactory()).buildOrmCacheable(this, cacheableResource); - } - - @Override - public OrmTypeMapping getParent() { - return (OrmTypeMapping) super.getParent(); - } - - public int getSize() { - return (this.specifiedSize == null) ? this.defaultSize : this.specifiedSize.intValue(); - } - - public int getDefaultSize() { - return this.defaultSize; - } - - protected void setDefaultSize(int newSize) { - int oldSize = this.defaultSize; - this.defaultSize = newSize; - firePropertyChanged(DEFAULT_SIZE_PROPERTY, oldSize, newSize); - } - - public Integer getSpecifiedSize() { - return this.specifiedSize; - } - - public void setSpecifiedSize(Integer newSpecifiedSize) { - Integer oldSpecifiedSize = this.specifiedSize; - this.specifiedSize = newSpecifiedSize; - if (oldSpecifiedSize != newSpecifiedSize) { - if (this.getResourceCache() != null) { - this.getResourceCache().setSize(newSpecifiedSize); - if (this.getResourceCache().isUnset()) { - removeResourceCache(); - } - } - else if (newSpecifiedSize != null) { - addResourceCache(); - getResourceCache().setSize(newSpecifiedSize); - } - } - firePropertyChanged(SPECIFIED_SIZE_PROPERTY, oldSpecifiedSize, newSpecifiedSize); - } - - protected void setSpecifiedSize_(Integer newSpecifiedSize) { - Integer oldSpecifiedSize = this.specifiedSize; - this.specifiedSize = newSpecifiedSize; - firePropertyChanged(SPECIFIED_SIZE_PROPERTY, oldSpecifiedSize, newSpecifiedSize); - } - - - public boolean isShared() { - return (this.specifiedShared == null) ? this.defaultShared : this.specifiedShared.booleanValue(); - } - - public boolean isDefaultShared() { - return this.defaultShared; - } - - protected void setDefaultShared(boolean newDefaultShared) { - boolean oldDefaultShared = this.defaultShared; - this.defaultShared = newDefaultShared; - firePropertyChanged(DEFAULT_SHARED_PROPERTY, oldDefaultShared, newDefaultShared); - } - - public Boolean getSpecifiedShared() { - return this.specifiedShared; - } - - public void setSpecifiedShared(Boolean newSpecifiedShared) { - Boolean oldSpecifiedShared = this.specifiedShared; - this.specifiedShared = newSpecifiedShared; - if (oldSpecifiedShared != newSpecifiedShared) { - if (this.getResourceCache() != null) { - this.getResourceCache().setShared(newSpecifiedShared); - if (this.getResourceCache().isUnset()) { - removeResourceCache(); - } - } - else if (newSpecifiedShared != null) { - addResourceCache(); - getResourceCache().setShared(newSpecifiedShared); - } - } - firePropertyChanged(SPECIFIED_SHARED_PROPERTY, oldSpecifiedShared, newSpecifiedShared); - if (newSpecifiedShared == Boolean.FALSE) { - setSpecifiedType(null); - setSpecifiedSize(null); - setSpecifiedAlwaysRefresh(null); - setSpecifiedRefreshOnlyIfNewer(null); - setSpecifiedDisableHits(null); - setSpecifiedCoordinationType(null); - setExpiry(null); - if (this.expiryTimeOfDay != null) { - removeExpiryTimeOfDay(); - } - } - } - - protected void setSpecifiedShared_(Boolean newSpecifiedShared) { - Boolean oldSpecifiedShared = this.specifiedShared; - this.specifiedShared = newSpecifiedShared; - firePropertyChanged(SPECIFIED_SHARED_PROPERTY, oldSpecifiedShared, newSpecifiedShared); - } - - - public boolean isAlwaysRefresh() { - return (this.specifiedAlwaysRefresh == null) ? this.defaultAlwaysRefresh : this.specifiedAlwaysRefresh.booleanValue(); - } - - public boolean isDefaultAlwaysRefresh() { - return this.defaultAlwaysRefresh; - } - - protected void setDefaultAlwaysRefresh(boolean newDefaultAlwaysRefresh) { - boolean oldDefaultAlwaysRefresh = this.defaultAlwaysRefresh; - this.defaultAlwaysRefresh = newDefaultAlwaysRefresh; - firePropertyChanged(DEFAULT_ALWAYS_REFRESH_PROPERTY, oldDefaultAlwaysRefresh, newDefaultAlwaysRefresh); - } - - public Boolean getSpecifiedAlwaysRefresh() { - return this.specifiedAlwaysRefresh; - } - - public void setSpecifiedAlwaysRefresh(Boolean newSpecifiedAlwaysRefresh) { - Boolean oldSpecifiedAlwaysRefresh = this.specifiedAlwaysRefresh; - this.specifiedAlwaysRefresh = newSpecifiedAlwaysRefresh; - if (oldSpecifiedAlwaysRefresh != newSpecifiedAlwaysRefresh) { - if (this.getResourceCache() != null) { - this.getResourceCache().setAlwaysRefresh(newSpecifiedAlwaysRefresh); - if (this.getResourceCache().isUnset()) { - removeResourceCache(); - } - } - else if (newSpecifiedAlwaysRefresh != null) { - addResourceCache(); - getResourceCache().setAlwaysRefresh(newSpecifiedAlwaysRefresh); - } - } - firePropertyChanged(SPECIFIED_ALWAYS_REFRESH_PROPERTY, oldSpecifiedAlwaysRefresh, newSpecifiedAlwaysRefresh); - } - - protected void setSpecifiedAlwaysRefresh_(Boolean newSpecifiedAlwaysRefresh) { - Boolean oldSpecifiedAlwaysRefresh = this.specifiedAlwaysRefresh; - this.specifiedAlwaysRefresh = newSpecifiedAlwaysRefresh; - firePropertyChanged(SPECIFIED_ALWAYS_REFRESH_PROPERTY, oldSpecifiedAlwaysRefresh, newSpecifiedAlwaysRefresh); - } - - - public boolean isRefreshOnlyIfNewer() { - return (this.specifiedRefreshOnlyIfNewer == null) ? this.defaultRefreshOnlyIfNewer : this.specifiedRefreshOnlyIfNewer.booleanValue(); - } - - public boolean isDefaultRefreshOnlyIfNewer() { - return this.defaultRefreshOnlyIfNewer; - } - - protected void setDefaultRefreshOnlyIfNewer(boolean newDefaultRefreshOnlyIfNewer) { - boolean oldDefaultRefreshOnlyIfNewer = this.defaultRefreshOnlyIfNewer; - this.defaultRefreshOnlyIfNewer = newDefaultRefreshOnlyIfNewer; - firePropertyChanged(DEFAULT_REFRESH_ONLY_IF_NEWER_PROPERTY, oldDefaultRefreshOnlyIfNewer, newDefaultRefreshOnlyIfNewer); - } - - public Boolean getSpecifiedRefreshOnlyIfNewer() { - return this.specifiedRefreshOnlyIfNewer; - } - - public void setSpecifiedRefreshOnlyIfNewer(Boolean newSpecifiedRefreshOnlyIfNewer) { - Boolean oldSpecifiedRefreshOnlyIfNewer = this.specifiedRefreshOnlyIfNewer; - this.specifiedRefreshOnlyIfNewer = newSpecifiedRefreshOnlyIfNewer; - if (oldSpecifiedRefreshOnlyIfNewer != newSpecifiedRefreshOnlyIfNewer) { - if (this.getResourceCache() != null) { - this.getResourceCache().setRefreshOnlyIfNewer(newSpecifiedRefreshOnlyIfNewer); - if (this.getResourceCache().isUnset()) { - removeResourceCache(); - } - } - else if (newSpecifiedRefreshOnlyIfNewer != null) { - addResourceCache(); - getResourceCache().setRefreshOnlyIfNewer(newSpecifiedRefreshOnlyIfNewer); - } - } - firePropertyChanged(SPECIFIED_REFRESH_ONLY_IF_NEWER_PROPERTY, oldSpecifiedRefreshOnlyIfNewer, newSpecifiedRefreshOnlyIfNewer); - } - - protected void setSpecifiedRefreshOnlyIfNewer_(Boolean newSpecifiedRefreshOnlyIfNewer) { - Boolean oldSpecifiedRefreshOnlyIfNewer = this.specifiedRefreshOnlyIfNewer; - this.specifiedRefreshOnlyIfNewer = newSpecifiedRefreshOnlyIfNewer; - firePropertyChanged(SPECIFIED_REFRESH_ONLY_IF_NEWER_PROPERTY, oldSpecifiedRefreshOnlyIfNewer, newSpecifiedRefreshOnlyIfNewer); - } - - - public boolean isDisableHits() { - return (this.specifiedDisableHits == null) ? this.defaultDisableHits : this.specifiedDisableHits.booleanValue(); - } - - public boolean isDefaultDisableHits() { - return this.defaultDisableHits; - } - - protected void setDefaultDisableHits(boolean newDefaultDisableHits) { - boolean oldDefaultDisableHits = this.defaultDisableHits; - this.defaultDisableHits = newDefaultDisableHits; - firePropertyChanged(DEFAULT_DISABLE_HITS_PROPERTY, oldDefaultDisableHits, newDefaultDisableHits); - } - - public Boolean getSpecifiedDisableHits() { - return this.specifiedDisableHits; - } - - public void setSpecifiedDisableHits(Boolean newSpecifiedDisableHits) { - Boolean oldSpecifiedDisableHits = this.specifiedDisableHits; - this.specifiedDisableHits = newSpecifiedDisableHits; - if (oldSpecifiedDisableHits != newSpecifiedDisableHits) { - if (this.getResourceCache() != null) { - this.getResourceCache().setDisableHits(newSpecifiedDisableHits); - if (this.getResourceCache().isUnset()) { - removeResourceCache(); - } - } - else if (newSpecifiedDisableHits != null) { - addResourceCache(); - getResourceCache().setDisableHits(newSpecifiedDisableHits); - } - } - firePropertyChanged(SPECIFIED_DISABLE_HITS_PROPERTY, oldSpecifiedDisableHits, newSpecifiedDisableHits); - } - - protected void setSpecifiedDisableHits_(Boolean newSpecifiedDisableHits) { - Boolean oldSpecifiedDisableHits = this.specifiedDisableHits; - this.specifiedDisableHits = newSpecifiedDisableHits; - firePropertyChanged(SPECIFIED_DISABLE_HITS_PROPERTY, oldSpecifiedDisableHits, newSpecifiedDisableHits); - } - - public EclipseLinkCacheType getType() { - return (this.specifiedType == null) ? this.defaultType : this.specifiedType; - } - - public EclipseLinkCacheType getDefaultType() { - return this.defaultType; - } - - protected void setDefaultType(EclipseLinkCacheType newDefaultType) { - EclipseLinkCacheType oldDefaultType= this.defaultType; - this.defaultType = newDefaultType; - firePropertyChanged(DEFAULT_TYPE_PROPERTY, oldDefaultType, newDefaultType); - } - - public EclipseLinkCacheType getSpecifiedType() { - return this.specifiedType; - } - - public void setSpecifiedType(EclipseLinkCacheType newSpecifiedType) { - EclipseLinkCacheType oldSpecifiedType = this.specifiedType; - this.specifiedType = newSpecifiedType; - if (oldSpecifiedType != newSpecifiedType) { - if (this.getResourceCache() != null) { - this.getResourceCache().setType(EclipseLinkCacheType.toOrmResourceModel(newSpecifiedType)); - if (this.getResourceCache().isUnset()) { - removeResourceCache(); - } - } - else if (newSpecifiedType != null) { - addResourceCache(); - getResourceCache().setType(EclipseLinkCacheType.toOrmResourceModel(newSpecifiedType)); - } - } - firePropertyChanged(SPECIFIED_TYPE_PROPERTY, oldSpecifiedType, newSpecifiedType); - } - - protected void setSpecifiedType_(EclipseLinkCacheType newSpecifiedType) { - EclipseLinkCacheType oldSpecifiedType= this.specifiedType; - this.specifiedType = newSpecifiedType; - firePropertyChanged(SPECIFIED_TYPE_PROPERTY, oldSpecifiedType, newSpecifiedType); - } - - - public EclipseLinkCacheCoordinationType getCoordinationType() { - return (this.specifiedCoordinationType == null) ? this.defaultCoordinationType : this.specifiedCoordinationType; - } - - public EclipseLinkCacheCoordinationType getDefaultCoordinationType() { - return this.defaultCoordinationType; - } - - protected void setDefaultCoordinationType(EclipseLinkCacheCoordinationType newDefaultcCoordinationType) { - EclipseLinkCacheCoordinationType oldDefaultcCoordinationType= this.defaultCoordinationType; - this.defaultCoordinationType = newDefaultcCoordinationType; - firePropertyChanged(DEFAULT_COORDINATION_TYPE_PROPERTY, oldDefaultcCoordinationType, newDefaultcCoordinationType); - } - - public EclipseLinkCacheCoordinationType getSpecifiedCoordinationType() { - return this.specifiedCoordinationType; - } - - public void setSpecifiedCoordinationType(EclipseLinkCacheCoordinationType newSpecifiedCoordinationType) { - EclipseLinkCacheCoordinationType oldSpecifiedCoordinationType = this.specifiedCoordinationType; - this.specifiedCoordinationType = newSpecifiedCoordinationType; - if (oldSpecifiedCoordinationType != newSpecifiedCoordinationType) { - if (this.getResourceCache() != null) { - this.getResourceCache().setCoordinationType(EclipseLinkCacheCoordinationType.toOrmResourceModel(newSpecifiedCoordinationType)); - if (this.getResourceCache().isUnset()) { - removeResourceCache(); - } - } - else if (newSpecifiedCoordinationType != null) { - addResourceCache(); - getResourceCache().setCoordinationType(EclipseLinkCacheCoordinationType.toOrmResourceModel(newSpecifiedCoordinationType)); - } - } - firePropertyChanged(SPECIFIED_COORDINATION_TYPE_PROPERTY, oldSpecifiedCoordinationType, newSpecifiedCoordinationType); - } - - protected void setSpecifiedCoordinationType_(EclipseLinkCacheCoordinationType newSpecifiedCoordinationType) { - EclipseLinkCacheCoordinationType oldSpecifiedCoordinationType = this.specifiedCoordinationType; - this.specifiedCoordinationType = newSpecifiedCoordinationType; - firePropertyChanged(SPECIFIED_COORDINATION_TYPE_PROPERTY, oldSpecifiedCoordinationType, newSpecifiedCoordinationType); - } - - public EclipseLinkExistenceType getExistenceType() { - return (this.specifiedExistenceType == null) ? this.defaultExistenceType : this.specifiedExistenceType; - } - - public EclipseLinkExistenceType getDefaultExistenceType() { - return this.defaultExistenceType; - } - - protected void setDefaultExistenceType(EclipseLinkExistenceType newDefaultExistenceType) { - EclipseLinkExistenceType oldDefaultExistenceType = this.defaultExistenceType; - this.defaultExistenceType = newDefaultExistenceType; - firePropertyChanged(DEFAULT_EXISTENCE_TYPE_PROPERTY, oldDefaultExistenceType, newDefaultExistenceType); - } - - public EclipseLinkExistenceType getSpecifiedExistenceType() { - return this.specifiedExistenceType; - } - - public void setSpecifiedExistenceType(EclipseLinkExistenceType newSpecifiedExistenceType) { - EclipseLinkExistenceType oldSpecifiedExistenceType = this.specifiedExistenceType; - this.specifiedExistenceType = newSpecifiedExistenceType; - this.resource.setExistenceChecking(EclipseLinkExistenceType.toOrmResourceModel(newSpecifiedExistenceType)); - firePropertyChanged(SPECIFIED_EXISTENCE_TYPE_PROPERTY, oldSpecifiedExistenceType, newSpecifiedExistenceType); - } - - protected void setSpecifiedExistenceType_(EclipseLinkExistenceType newSpecifiedExistenceType) { - EclipseLinkExistenceType oldSpecifiedExistenceType = this.specifiedExistenceType; - this.specifiedExistenceType = newSpecifiedExistenceType; - firePropertyChanged(SPECIFIED_EXISTENCE_TYPE_PROPERTY, oldSpecifiedExistenceType, newSpecifiedExistenceType); - } - - public Integer getExpiry() { - return this.expiry; - } - - public void setExpiry(Integer newExpiry) { - Integer oldExpiry = this.expiry; - this.expiry = newExpiry; - if (oldExpiry != newExpiry) { - if (this.getResourceCache() != null) { - this.getResourceCache().setExpiry(newExpiry); - if (this.getResourceCache().isUnset()) { - removeResourceCache(); - } - } - else if (newExpiry != null) { - addResourceCache(); - this.getResourceCache().setExpiry(newExpiry); - } - } - firePropertyChanged(EXPIRY_PROPERTY, oldExpiry, newExpiry); - if (newExpiry != null && this.expiryTimeOfDay != null) { - removeExpiryTimeOfDay(); - } - } - - protected void setExpiry_(Integer newExpiry) { - Integer oldExpiry = this.expiry; - this.expiry = newExpiry; - firePropertyChanged(EXPIRY_PROPERTY, oldExpiry, newExpiry); - } - - public EclipseLinkExpiryTimeOfDay getExpiryTimeOfDay() { - return this.expiryTimeOfDay; - } - - public EclipseLinkExpiryTimeOfDay addExpiryTimeOfDay() { - if (this.expiryTimeOfDay != null) { - throw new IllegalStateException("expiryTimeOfDay already exists, use getExpiryTimeOfDay()"); //$NON-NLS-1$ - } - if (getResourceCache() == null) { - addResourceCache(); - } - OrmEclipseLinkExpiryTimeOfDay newExpiryTimeOfDay = new OrmEclipseLinkExpiryTimeOfDay(this); - this.expiryTimeOfDay = newExpiryTimeOfDay; - XmlTimeOfDay resourceTimeOfDay = EclipseLinkOrmFactory.eINSTANCE.createXmlTimeOfDay(); - newExpiryTimeOfDay.initialize(resourceTimeOfDay); - getResourceCache().setExpiryTimeOfDay(resourceTimeOfDay); - firePropertyChanged(EXPIRY_TIME_OF_DAY_PROPERTY, null, newExpiryTimeOfDay); - setExpiry(null); - return newExpiryTimeOfDay; - } - - public void removeExpiryTimeOfDay() { - if (this.expiryTimeOfDay == null) { - throw new IllegalStateException("timeOfDayExpiry does not exist"); //$NON-NLS-1$ - } - EclipseLinkExpiryTimeOfDay oldExpiryTimeOfDay = this.expiryTimeOfDay; - this.expiryTimeOfDay = null; - getResourceCache().setExpiryTimeOfDay(null); - if (this.getResourceCache().isUnset()) { - removeResourceCache(); - } - firePropertyChanged(EXPIRY_TIME_OF_DAY_PROPERTY, oldExpiryTimeOfDay, null); - } - - protected void setExpiryTimeOfDay(OrmEclipseLinkExpiryTimeOfDay newExpiryTimeOfDay) { - OrmEclipseLinkExpiryTimeOfDay oldExpiryTimeOfDay = this.expiryTimeOfDay; - this.expiryTimeOfDay = newExpiryTimeOfDay; - firePropertyChanged(EXPIRY_TIME_OF_DAY_PROPERTY, oldExpiryTimeOfDay, newExpiryTimeOfDay); - } - - protected XmlCache getResourceCache() { - return this.resource.getCache(); - } - - protected void addResourceCache() { - this.resource.setCache(EclipseLinkOrmFactory.eINSTANCE.createXmlCache()); - } - - protected void removeResourceCache() { - this.resource.setCache(null); - } - - public OrmCacheable2_0 getCacheable() { - return this.cacheable; - } - - public boolean calculateDefaultCacheable() { - if (!getParent().isMetadataComplete()) { - JavaPersistentType javaPersistentType = getParent().getPersistentType().getJavaPersistentType(); - if (javaPersistentType != null && javaPersistentType.getMapping() instanceof CacheableHolder2_0) { - return ((CacheableHolder2_0) javaPersistentType.getMapping()).getCacheable().isCacheable(); - } - } - CacheableHolder2_0 cacheableHolder = getCacheableSuperPersistentType(getParent().getPersistentType()); - if (cacheableHolder != null) { - return cacheableHolder.getCacheable().isCacheable(); - } - return ((PersistenceUnit2_0) getPersistenceUnit()).calculateDefaultCacheable(); - } - - protected CacheableHolder2_0 getCacheableSuperPersistentType(PersistentType persistentType) { - PersistentType superPersistentType = persistentType.getSuperPersistentType(); - if (superPersistentType != null) { - if (superPersistentType.getMapping() instanceof CacheableHolder2_0) { - return (CacheableHolder2_0) superPersistentType.getMapping(); - } - return getCacheableSuperPersistentType(superPersistentType); - } - return null; - } - - // **************** initialize/update ************************************** - - protected void initializeExpiry(XmlCache resourceCache) { - if (resourceCache == null) { - return; - } - if (resourceCache.getExpiryTimeOfDay() == null) { - this.expiry = resourceCache.getExpiry(); - } - else { - if (resourceCache.getExpiry() == null) { //handle with validation if both expiry and expiryTimeOfDay are set - this.expiryTimeOfDay = new OrmEclipseLinkExpiryTimeOfDay(this); - this.expiryTimeOfDay.initialize(resourceCache.getExpiryTimeOfDay()); - } - } - } - - public void update(JavaEclipseLinkCaching javaCaching) { - XmlCache resourceCache = getResourceCache(); - setDefaultSize(this.defaultSize(javaCaching)); - setSpecifiedSize_(this.getResourceSize(resourceCache)); - setDefaultShared(this.defaultShared(javaCaching)); - setSpecifiedShared_(this.getResourceShared(resourceCache)); - setDefaultAlwaysRefresh(this.defaultAlwaysRefresh(javaCaching)); - setSpecifiedAlwaysRefresh_(this.getResourceAlwaysRefresh(resourceCache)); - setDefaultRefreshOnlyIfNewer(this.defaultRefreshOnlyIfNewer(javaCaching)); - setSpecifiedRefreshOnlyIfNewer_(this.getResourceRefreshOnlyIfNewer(resourceCache)); - setDefaultDisableHits(this.defaultDisableHits(javaCaching)); - setSpecifiedDisableHits_(this.getResourceDisableHits(resourceCache)); - setDefaultType(this.defaultType(javaCaching)); - setSpecifiedType_(this.getResourceType(resourceCache)); - setDefaultCoordinationType(this.defaultCoordinationType(javaCaching)); - setSpecifiedCoordinationType_(this.getResourceCoordinationType(resourceCache)); - setDefaultExistenceType(this.defaultExistenceType(javaCaching)); - setSpecifiedExistenceType_(this.getResourceExistenceChecking()); - this.updateExpiry(resourceCache); - this.cacheable.update(); - } - - protected void updateExpiry(XmlCache resourceCache) { - if (resourceCache == null) { - setExpiryTimeOfDay(null); - setExpiry_(null); - return; - } - if (resourceCache.getExpiryTimeOfDay() == null) { - setExpiryTimeOfDay(null); - setExpiry_(resourceCache.getExpiry()); - } - else { - if (this.expiryTimeOfDay != null) { - this.expiryTimeOfDay.update(resourceCache.getExpiryTimeOfDay()); - } - else if (resourceCache.getExpiry() == null){ - setExpiryTimeOfDay(new OrmEclipseLinkExpiryTimeOfDay(this)); - this.expiryTimeOfDay.initialize(resourceCache.getExpiryTimeOfDay()); - } - else { //handle with validation if both expiry and expiryTimeOfDay are set - setExpiryTimeOfDay(null); - } - } - } - - protected int defaultSize(JavaEclipseLinkCaching javaCaching) { - return (javaCaching == null) ? DEFAULT_SIZE : javaCaching.getSize(); - } - - protected Integer getResourceSize(XmlCache resource) { - return (resource == null) ? null : resource.getSize(); - } - - protected boolean defaultShared(JavaEclipseLinkCaching javaCaching) { - if (javaCaching == null) { - return DEFAULT_SHARED; - } - return getResourceCache() == null ? javaCaching.isShared() : DEFAULT_SHARED; - } - - protected Boolean getResourceShared(XmlCache resource) { - return (resource == null) ? null : resource.getShared(); - } - - protected boolean defaultAlwaysRefresh(JavaEclipseLinkCaching javaCaching) { - if (javaCaching == null) { - return DEFAULT_ALWAYS_REFRESH; - } - return getResourceCache() == null ? javaCaching.isAlwaysRefresh() : DEFAULT_ALWAYS_REFRESH; - } - - protected Boolean getResourceAlwaysRefresh(XmlCache resource) { - return (resource == null) ? null : resource.getAlwaysRefresh(); - } - - protected boolean defaultRefreshOnlyIfNewer(JavaEclipseLinkCaching javaCaching) { - if (javaCaching == null) { - return DEFAULT_REFRESH_ONLY_IF_NEWER; - } - return getResourceCache() == null ? javaCaching.isRefreshOnlyIfNewer() : DEFAULT_REFRESH_ONLY_IF_NEWER; - } - - protected Boolean getResourceRefreshOnlyIfNewer(XmlCache resource) { - return (resource == null) ? null : resource.getRefreshOnlyIfNewer(); - } - - protected boolean defaultDisableHits(JavaEclipseLinkCaching javaCaching) { - if (javaCaching == null) { - return DEFAULT_DISABLE_HITS; - } - return getResourceCache() == null ? javaCaching.isDisableHits() : DEFAULT_DISABLE_HITS; - } - - protected Boolean getResourceDisableHits(XmlCache resource) { - return (resource == null) ? null : resource.getDisableHits(); - } - - protected EclipseLinkCacheType defaultType(JavaEclipseLinkCaching javaCaching) { - if (javaCaching == null) { - return DEFAULT_TYPE; - } - return getResourceCache() == null ? javaCaching.getType() : DEFAULT_TYPE; - } - - protected EclipseLinkCacheType getResourceType(XmlCache resource) { - return (resource == null) ? null : EclipseLinkCacheType.fromOrmResourceModel(resource.getType()); - } - - protected EclipseLinkCacheCoordinationType defaultCoordinationType(JavaEclipseLinkCaching javaCaching) { - if (javaCaching == null) { - return DEFAULT_COORDINATION_TYPE; - } - return getResourceCache() == null ? javaCaching.getCoordinationType() : DEFAULT_COORDINATION_TYPE; - } - - protected EclipseLinkCacheCoordinationType getResourceCoordinationType(XmlCache resource) { - return (resource == null) ? null : EclipseLinkCacheCoordinationType.fromOrmResourceModel(resource.getCoordinationType()); - } - - protected EclipseLinkExistenceType defaultExistenceType(JavaEclipseLinkCaching javaCaching) { - return (javaCaching == null) ? DEFAULT_EXISTENCE_TYPE : javaCaching.getExistenceType(); - } - - protected EclipseLinkExistenceType getResourceExistenceChecking() { - return (this.resource == null) ? null : EclipseLinkExistenceType.fromOrmResourceModel(this.resource.getExistenceChecking()); - } - - protected Integer getResourceExpiry(XmlCache resource) { - return (resource == null) ? null : resource.getExpiry(); - } - - // **************** validation ************************************** - - public TextRange getValidationTextRange() { - XmlCache resource = getResourceCache(); - return resource == null ? null : resource.getValidationTextRange(); - } - -} diff --git a/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/orm/OrmEclipseLinkChangeTracking.java b/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/orm/OrmEclipseLinkChangeTracking.java deleted file mode 100644 index 5d2b5b45ca..0000000000 --- a/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/orm/OrmEclipseLinkChangeTracking.java +++ /dev/null @@ -1,104 +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.eclipselink.core.internal.context.orm; - -import org.eclipse.jpt.core.context.orm.OrmTypeMapping; -import org.eclipse.jpt.core.internal.context.orm.AbstractOrmXmlContextNode; -import org.eclipse.jpt.core.utility.TextRange; -import org.eclipse.jpt.eclipselink.core.context.EclipseLinkChangeTracking; -import org.eclipse.jpt.eclipselink.core.context.EclipseLinkChangeTrackingType; -import org.eclipse.jpt.eclipselink.core.resource.orm.EclipseLinkOrmFactory; -import org.eclipse.jpt.eclipselink.core.resource.orm.XmlChangeTracking; -import org.eclipse.jpt.eclipselink.core.resource.orm.XmlChangeTrackingHolder; - -public class OrmEclipseLinkChangeTracking extends AbstractOrmXmlContextNode - implements EclipseLinkChangeTracking -{ - protected final XmlChangeTrackingHolder resource; - - protected EclipseLinkChangeTrackingType defaultType; - - protected EclipseLinkChangeTrackingType specifiedType; - - - public OrmEclipseLinkChangeTracking(OrmTypeMapping parent, XmlChangeTrackingHolder resource, EclipseLinkChangeTracking javaChangeTracking) { - super(parent); - this.resource = resource; - this.defaultType = calculateDefaultType(javaChangeTracking); - this.specifiedType = getResourceChangeTracking(); - } - - - public EclipseLinkChangeTrackingType getType() { - return (getSpecifiedType() != null) ? getSpecifiedType() : getDefaultType(); - } - - public EclipseLinkChangeTrackingType getDefaultType() { - return this.defaultType; - } - - protected void setDefaultType_(EclipseLinkChangeTrackingType newDefaultType) { - EclipseLinkChangeTrackingType oldDefaultType = this.defaultType; - this.defaultType = newDefaultType; - firePropertyChanged(DEFAULT_TYPE_PROPERTY, oldDefaultType, newDefaultType); - } - - public EclipseLinkChangeTrackingType getSpecifiedType() { - return this.specifiedType; - } - - public void setSpecifiedType(EclipseLinkChangeTrackingType newSpecifiedType) { - EclipseLinkChangeTrackingType oldSpecifiedType = this.specifiedType; - this.specifiedType = newSpecifiedType; - - if (newSpecifiedType == null) { - this.resource.setChangeTracking(null); - } - else { - if (this.resource.getChangeTracking() == null) { - this.resource.setChangeTracking(EclipseLinkOrmFactory.eINSTANCE.createXmlChangeTracking()); - } - this.resource.getChangeTracking().setType(EclipseLinkChangeTrackingType.toOrmResourceModel(newSpecifiedType)); - } - - firePropertyChanged(SPECIFIED_TYPE_PROPERTY, oldSpecifiedType, newSpecifiedType); - } - - protected void setSpecifiedType_(EclipseLinkChangeTrackingType newSpecifiedType) { - EclipseLinkChangeTrackingType oldSpecifiedType = this.specifiedType; - this.specifiedType = newSpecifiedType; - firePropertyChanged(SPECIFIED_TYPE_PROPERTY, oldSpecifiedType, newSpecifiedType); - } - - - // **************** updating ************************************** - - protected void update(EclipseLinkChangeTracking javaChangeTracking) { - setDefaultType_(calculateDefaultType(javaChangeTracking)); - setSpecifiedType_(getResourceChangeTracking()); - } - - protected EclipseLinkChangeTrackingType calculateDefaultType(EclipseLinkChangeTracking javaChangeTracking) { - return (javaChangeTracking != null) ? javaChangeTracking.getType() : EclipseLinkChangeTracking.DEFAULT_TYPE; - } - - protected EclipseLinkChangeTrackingType getResourceChangeTracking() { - XmlChangeTracking xmlChangeTracking = this.resource.getChangeTracking(); - return (xmlChangeTracking != null) ? EclipseLinkChangeTrackingType.fromOrmResourceModel(xmlChangeTracking.getType()) : null; - } - - - // **************** validation ************************************** - - public TextRange getValidationTextRange() { - return this.resource.getValidationTextRange(); - } -} diff --git a/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/orm/OrmEclipseLinkConversionValue.java b/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/orm/OrmEclipseLinkConversionValue.java deleted file mode 100644 index c71a71daa7..0000000000 --- a/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/orm/OrmEclipseLinkConversionValue.java +++ /dev/null @@ -1,127 +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.eclipselink.core.internal.context.orm; - -import java.util.List; -import org.eclipse.jpt.core.internal.context.orm.AbstractOrmXmlContextNode; -import org.eclipse.jpt.core.utility.TextRange; -import org.eclipse.jpt.eclipselink.core.context.EclipseLinkConversionValue; -import org.eclipse.jpt.eclipselink.core.internal.DefaultEclipseLinkJpaValidationMessages; -import org.eclipse.jpt.eclipselink.core.internal.EclipseLinkJpaValidationMessages; -import org.eclipse.jpt.eclipselink.core.resource.orm.XmlConversionValue; -import org.eclipse.jpt.utility.internal.CollectionTools; -import org.eclipse.wst.validation.internal.provisional.core.IMessage; -import org.eclipse.wst.validation.internal.provisional.core.IReporter; - -public class OrmEclipseLinkConversionValue extends AbstractOrmXmlContextNode implements EclipseLinkConversionValue -{ - private XmlConversionValue resourceConversionValue; - - private String dataValue; - - private String objectValue; - - public OrmEclipseLinkConversionValue(OrmEclipseLinkObjectTypeConverter parent) { - super(parent); - } - - @Override - public OrmEclipseLinkObjectTypeConverter getParent() { - return (OrmEclipseLinkObjectTypeConverter) super.getParent(); - } - - public TextRange getValidationTextRange() { - return this.resourceConversionValue.getValidationTextRange(); - } - - public String getDataValue() { - return this.dataValue; - } - - public void setDataValue(String newDataValue) { - String oldDataValue = this.dataValue; - this.dataValue = newDataValue; - this.resourceConversionValue.setDataValue(newDataValue); - firePropertyChanged(DATA_VALUE_PROPERTY, oldDataValue, newDataValue); - } - - protected void setDataValue_(String newDataValue) { - String oldDataValue = this.dataValue; - this.dataValue = newDataValue; - firePropertyChanged(DATA_VALUE_PROPERTY, oldDataValue, newDataValue); - } - - public String getObjectValue() { - return this.objectValue; - } - - public void setObjectValue(String newObjectValue) { - String oldObjectValue = this.objectValue; - this.objectValue = newObjectValue; - this.resourceConversionValue.setObjectValue(newObjectValue); - firePropertyChanged(OBJECT_VALUE_PROPERTY, oldObjectValue, newObjectValue); - } - - protected void setObjectValue_(String newObjectValue) { - String oldObjectValue = this.objectValue; - this.objectValue = newObjectValue; - firePropertyChanged(OBJECT_VALUE_PROPERTY, oldObjectValue, newObjectValue); - } - - public void initialize(XmlConversionValue resourceConversionValue) { - this.resourceConversionValue = resourceConversionValue; - this.dataValue = this.getResourceDataValue(); - this.objectValue = this.getResourceObjectValue(); - } - - public void update(XmlConversionValue resourceConversionValue) { - this.resourceConversionValue = resourceConversionValue; - this.setDataValue_(this.getResourceDataValue()); - this.setObjectValue_(this.getResourceObjectValue()); - } - - protected String getResourceDataValue() { - return this.resourceConversionValue.getDataValue(); - } - - protected String getResourceObjectValue() { - return this.resourceConversionValue.getObjectValue(); - } - - public TextRange getDataValueTextRange() { - return this.resourceConversionValue.getDataValueTextRange(); - } - - public TextRange getObjectValueTextRange() { - return this.resourceConversionValue.getObjectValueTextRange(); - } - - @Override - public void validate(List<IMessage> messages, IReporter reporter) { - super.validate(messages, reporter); - validateDataValuesUnique(messages); - } - - protected void validateDataValuesUnique(List<IMessage> messages) { - List<String> dataValues = CollectionTools.list(getParent().dataValues()); - dataValues.remove(this.dataValue); - if (dataValues.contains(this.dataValue)) { - messages.add( - DefaultEclipseLinkJpaValidationMessages.buildMessage( - IMessage.HIGH_SEVERITY, - EclipseLinkJpaValidationMessages.MULTIPLE_OBJECT_VALUES_FOR_DATA_VALUE, - new String[] {this.dataValue}, - this, - this.getDataValueTextRange() - ) - ); - } - } -} diff --git a/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/orm/OrmEclipseLinkConvert.java b/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/orm/OrmEclipseLinkConvert.java deleted file mode 100644 index 1a9a8c62b7..0000000000 --- a/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/orm/OrmEclipseLinkConvert.java +++ /dev/null @@ -1,274 +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.eclipselink.core.internal.context.orm; - -import java.util.List; -import org.eclipse.jpt.core.context.orm.OrmAttributeMapping; -import org.eclipse.jpt.core.context.orm.OrmConverter; -import org.eclipse.jpt.core.internal.context.orm.AbstractOrmXmlContextNode; -import org.eclipse.jpt.core.resource.xml.JpaEObject; -import org.eclipse.jpt.core.utility.TextRange; -import org.eclipse.jpt.eclipselink.core.context.EclipseLinkConvert; -import org.eclipse.jpt.eclipselink.core.context.EclipseLinkConverter; -import org.eclipse.jpt.eclipselink.core.resource.orm.EclipseLinkOrmFactory; -import org.eclipse.jpt.eclipselink.core.resource.orm.XmlConverter; -import org.eclipse.jpt.eclipselink.core.resource.orm.XmlConvertibleMapping; -import org.eclipse.jpt.eclipselink.core.resource.orm.XmlObjectTypeConverter; -import org.eclipse.jpt.eclipselink.core.resource.orm.XmlStructConverter; -import org.eclipse.jpt.eclipselink.core.resource.orm.XmlTypeConverter; -import org.eclipse.wst.validation.internal.provisional.core.IMessage; -import org.eclipse.wst.validation.internal.provisional.core.IReporter; - -public class OrmEclipseLinkConvert extends AbstractOrmXmlContextNode implements EclipseLinkConvert, OrmConverter -{ - protected String specifiedConverterName; - - protected XmlConvertibleMapping resourceMapping; - - protected OrmEclipseLinkConverter<?> converter; - - public OrmEclipseLinkConvert(OrmAttributeMapping parent, XmlConvertibleMapping resourceMapping) { - super(parent); - this.initialize(resourceMapping); - } - - @Override - public OrmAttributeMapping getParent() { - return (OrmAttributeMapping) super.getParent(); - } - - public String getType() { - return EclipseLinkConvert.ECLIPSE_LINK_CONVERTER; - } - - public void addToResourceModel() { - this.resourceMapping.setConvert(""); //$NON-NLS-1$ - } - - public void removeFromResourceModel() { - this.resourceMapping.setConvert(null); - } - - public TextRange getValidationTextRange() { - return this.resourceMapping.getConvertTextRange(); - } - - public String getConverterName() { - return getSpecifiedConverterName() == null ? getDefaultConverterName() : getSpecifiedConverterName(); - } - - public String getDefaultConverterName() { - return DEFAULT_CONVERTER_NAME; - } - - public String getSpecifiedConverterName() { - return this.specifiedConverterName; - } - - public void setSpecifiedConverterName(String newSpecifiedConverterName) { - String oldSpecifiedConverterName = this.specifiedConverterName; - this.specifiedConverterName = newSpecifiedConverterName; - this.resourceMapping.setConvert(newSpecifiedConverterName); - firePropertyChanged(SPECIFIED_CONVERTER_NAME_PROPERTY, oldSpecifiedConverterName, newSpecifiedConverterName); - } - - protected void setSpecifiedConverterName_(String newSpecifiedConverterName) { - String oldSpecifiedConverterName = this.specifiedConverterName; - this.specifiedConverterName = newSpecifiedConverterName; - firePropertyChanged(SPECIFIED_CONVERTER_NAME_PROPERTY, oldSpecifiedConverterName, newSpecifiedConverterName); - } - - public OrmEclipseLinkConverter<?> getConverter() { - return this.converter; - } - - protected String getConverterType() { - if (this.converter == null) { - return EclipseLinkConverter.NO_CONVERTER; - } - return this.converter.getType(); - } - - public void setConverter(String converterType) { - if (getConverterType() == converterType) { - return; - } - OrmEclipseLinkConverter<?> oldConverter = this.converter; - if (oldConverter != null) { - this.converter = null; //set to null now to avoid update triggering events - removeConverter(oldConverter.getType()); - } - JpaEObject resourceConverter = buildResourceConverter(converterType); - OrmEclipseLinkConverter<?> newConverter = buildConverter(converterType, resourceConverter); - this.converter = newConverter; - if (newConverter != null) { - addConverter(converterType, resourceConverter); - } - firePropertyChanged(CONVERTER_PROPERTY, oldConverter, newConverter); - } - - //TODO yes, i know, many if/else type checks in the methods below. - //will look at factoring this out when I have time after M3! Also EclipseLinkJavaConvert - protected void removeConverter(String converterType) { - if (converterType == EclipseLinkConverter.CUSTOM_CONVERTER) { - this.resourceMapping.setConverter(null); - } - else if (converterType == EclipseLinkConverter.TYPE_CONVERTER) { - this.resourceMapping.setTypeConverter(null); - } - else if (converterType == EclipseLinkConverter.OBJECT_TYPE_CONVERTER) { - this.resourceMapping.setObjectTypeConverter(null); - } - else if (converterType == EclipseLinkConverter.STRUCT_CONVERTER) { - this.resourceMapping.setStructConverter(null); - } - } - - protected JpaEObject buildResourceConverter(String converterType) { - if (converterType == EclipseLinkConverter.CUSTOM_CONVERTER) { - return EclipseLinkOrmFactory.eINSTANCE.createXmlConverter(); - } - else if (converterType == EclipseLinkConverter.TYPE_CONVERTER) { - return EclipseLinkOrmFactory.eINSTANCE.createXmlTypeConverter(); - } - else if (converterType == EclipseLinkConverter.OBJECT_TYPE_CONVERTER) { - return EclipseLinkOrmFactory.eINSTANCE.createXmlObjectTypeConverter(); - } - else if (converterType == EclipseLinkConverter.STRUCT_CONVERTER) { - return EclipseLinkOrmFactory.eINSTANCE.createXmlStructConverter(); - } - return null; - } - - protected void addConverter(String converterType, JpaEObject resourceConverter) { - if (converterType == EclipseLinkConverter.CUSTOM_CONVERTER) { - this.resourceMapping.setConverter((XmlConverter) resourceConverter); - } - else if (converterType == EclipseLinkConverter.TYPE_CONVERTER) { - this.resourceMapping.setTypeConverter((XmlTypeConverter) resourceConverter); - } - else if (converterType == EclipseLinkConverter.OBJECT_TYPE_CONVERTER) { - this.resourceMapping.setObjectTypeConverter((XmlObjectTypeConverter) resourceConverter); - } - else if (converterType == EclipseLinkConverter.STRUCT_CONVERTER) { - this.resourceMapping.setStructConverter((XmlStructConverter) resourceConverter); - } - } - - protected OrmEclipseLinkConverter<?> buildConverter(String converterType, JpaEObject resourceConverter) { - if (converterType == EclipseLinkConverter.NO_CONVERTER) { - return null; - } - if (converterType == EclipseLinkConverter.CUSTOM_CONVERTER) { - return buildCustomConverter((XmlConverter) resourceConverter); - } - else if (converterType == EclipseLinkConverter.TYPE_CONVERTER) { - return buildTypeConverter((XmlTypeConverter) resourceConverter); - } - else if (converterType == EclipseLinkConverter.OBJECT_TYPE_CONVERTER) { - return buildObjectTypeConverter((XmlObjectTypeConverter) resourceConverter); - } - else if (converterType == EclipseLinkConverter.STRUCT_CONVERTER) { - return buildStructConverter((XmlStructConverter) resourceConverter); - } - return null; - } - - protected void setConverter(OrmEclipseLinkConverter<?> newConverter) { - OrmEclipseLinkConverter<?> oldConverter = this.converter; - this.converter = newConverter; - firePropertyChanged(CONVERTER_PROPERTY, oldConverter, newConverter); - } - - protected void initialize(XmlConvertibleMapping resourceMapping) { - this.resourceMapping = resourceMapping; - this.specifiedConverterName = this.getResourceConvert(); - this.converter = this.buildConverter(); - } - - public void update() { - this.setSpecifiedConverterName_(this.getResourceConvert()); - if (getResourceConverterType() == getConverterType()) { - this.converter.update(); - } - else { - setConverter(buildConverter()); - } - } - - protected String getResourceConvert() { - return this.resourceMapping == null ? null : this.resourceMapping.getConvert(); - } - - protected String getResourceConverterType() { - if (this.resourceMapping.getConverter() != null) { - return EclipseLinkConverter.CUSTOM_CONVERTER; - } - else if (this.resourceMapping.getTypeConverter() != null) { - return EclipseLinkConverter.TYPE_CONVERTER; - } - else if (this.resourceMapping.getObjectTypeConverter() != null) { - return EclipseLinkConverter.OBJECT_TYPE_CONVERTER; - } - else if (this.resourceMapping.getStructConverter() != null) { - return EclipseLinkConverter.STRUCT_CONVERTER; - } - - return null; - } - protected OrmEclipseLinkConverter<?> buildConverter() { - if (this.resourceMapping.getConverter() != null) { - return buildCustomConverter(this.resourceMapping.getConverter()); - } - else if (this.resourceMapping.getTypeConverter() != null) { - return buildTypeConverter(this.resourceMapping.getTypeConverter()); - } - else if (this.resourceMapping.getObjectTypeConverter() != null) { - return buildObjectTypeConverter(this.resourceMapping.getObjectTypeConverter()); - } - else if (this.resourceMapping.getStructConverter() != null) { - return buildStructConverter(this.resourceMapping.getStructConverter()); - } - - return null; - } - - protected OrmEclipseLinkCustomConverter buildCustomConverter(XmlConverter resourceConverter) { - OrmEclipseLinkCustomConverter contextConverter = new OrmEclipseLinkCustomConverter(this); - contextConverter.initialize(resourceConverter); - return contextConverter; - } - - protected OrmEclipseLinkTypeConverter buildTypeConverter(XmlTypeConverter resourceConverter) { - OrmEclipseLinkTypeConverter contextConverter = new OrmEclipseLinkTypeConverter(this); - contextConverter.initialize(resourceConverter); - return contextConverter; - } - - protected OrmEclipseLinkObjectTypeConverter buildObjectTypeConverter(XmlObjectTypeConverter resourceConverter) { - OrmEclipseLinkObjectTypeConverter contextConverter = new OrmEclipseLinkObjectTypeConverter(this); - contextConverter.initialize(resourceConverter); - return contextConverter; - } - - protected OrmEclipseLinkStructConverter buildStructConverter(XmlStructConverter resourceConverter) { - OrmEclipseLinkStructConverter contextConverter = new OrmEclipseLinkStructConverter(this); - contextConverter.initialize(resourceConverter); - return contextConverter; - } - - @Override - public void validate(List<IMessage> messages, IReporter reporter) { - super.validate(messages, reporter); - if (getConverter() != null) { - getConverter().validate(messages, reporter); - } - } -} diff --git a/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/orm/OrmEclipseLinkConverter.java b/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/orm/OrmEclipseLinkConverter.java deleted file mode 100644 index b02945f566..0000000000 --- a/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/orm/OrmEclipseLinkConverter.java +++ /dev/null @@ -1,106 +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.eclipselink.core.internal.context.orm; - -import org.eclipse.jpt.core.context.XmlContextNode; -import org.eclipse.jpt.core.internal.context.orm.AbstractOrmXmlContextNode; -import org.eclipse.jpt.core.utility.TextRange; -import org.eclipse.jpt.eclipselink.core.context.EclipseLinkConverter; -import org.eclipse.jpt.eclipselink.core.internal.context.java.JavaEclipseLinkConverter; -import org.eclipse.jpt.eclipselink.core.internal.context.persistence.EclipseLinkPersistenceUnit; -import org.eclipse.jpt.eclipselink.core.resource.orm.XmlNamedConverter; -import org.eclipse.jpt.utility.internal.StringTools; - -public abstract class OrmEclipseLinkConverter<T extends XmlNamedConverter> - extends AbstractOrmXmlContextNode implements EclipseLinkConverter -{ - protected T resourceConverter; - - protected String name; - - - protected OrmEclipseLinkConverter(XmlContextNode parent) { - super(parent); - } - - @Override - public EclipseLinkPersistenceUnit getPersistenceUnit() { - return (EclipseLinkPersistenceUnit) super.getPersistenceUnit(); - } - - - protected T getXmlResource() { - return this.resourceConverter; - } - - public char getEnclosingTypeSeparator() { - return '$'; - } - - // **************** name *************************************************** - - public String getName() { - return this.name; - } - - public void setName(String newName) { - String oldName = this.name; - this.name = newName; - this.resourceConverter.setName(newName); - firePropertyChanged(NAME_PROPERTY, oldName, newName); - } - - protected void setName_(String newName) { - String oldName = this.name; - this.name = newName; - firePropertyChanged(NAME_PROPERTY, oldName, newName); - } - - - // **************** resource interaction *********************************** - - protected void initialize(T resource) { - this.resourceConverter = resource; - this.name = getResourceName(); - } - - public void update() { - this.setName_(getResourceName()); - getPersistenceUnit().addConverter(this); - } - - protected String getResourceName() { - return this.resourceConverter.getName(); - } - - - // **************** validation ********************************************* - - public boolean overrides(EclipseLinkConverter converter) { - if (getName() == null) { - return false; - } - // this isn't ideal, but it will have to do until we have further adopter input - return this.getName().equals(converter.getName()) && converter instanceof JavaEclipseLinkConverter; - } - - public boolean duplicates(EclipseLinkConverter converter) { - return (this != converter) - && ! StringTools.stringIsEmpty(this.name) - && this.name.equals(converter.getName()) - && ! this.overrides(converter) - && ! converter.overrides(this); - } - - public TextRange getValidationTextRange() { - return this.resourceConverter.getValidationTextRange(); - } -}
\ No newline at end of file diff --git a/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/orm/OrmEclipseLinkConverterHolder.java b/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/orm/OrmEclipseLinkConverterHolder.java deleted file mode 100644 index d071f3011f..0000000000 --- a/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/orm/OrmEclipseLinkConverterHolder.java +++ /dev/null @@ -1,452 +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.eclipselink.core.internal.context.orm; - -import java.util.ArrayList; -import java.util.Collection; -import java.util.List; -import java.util.ListIterator; -import org.eclipse.jpt.core.context.XmlContextNode; -import org.eclipse.jpt.core.internal.context.orm.AbstractOrmXmlContextNode; -import org.eclipse.jpt.core.utility.TextRange; -import org.eclipse.jpt.eclipselink.core.context.EclipseLinkCustomConverter; -import org.eclipse.jpt.eclipselink.core.context.EclipseLinkObjectTypeConverter; -import org.eclipse.jpt.eclipselink.core.context.EclipseLinkStructConverter; -import org.eclipse.jpt.eclipselink.core.context.EclipseLinkTypeConverter; -import org.eclipse.jpt.eclipselink.core.context.orm.EclipseLinkConverterHolder; -import org.eclipse.jpt.eclipselink.core.resource.orm.EclipseLinkOrmFactory; -import org.eclipse.jpt.eclipselink.core.resource.orm.XmlConverter; -import org.eclipse.jpt.eclipselink.core.resource.orm.XmlConvertersHolder; -import org.eclipse.jpt.eclipselink.core.resource.orm.XmlObjectTypeConverter; -import org.eclipse.jpt.eclipselink.core.resource.orm.XmlStructConverter; -import org.eclipse.jpt.eclipselink.core.resource.orm.XmlTypeConverter; -import org.eclipse.jpt.utility.internal.CollectionTools; -import org.eclipse.wst.validation.internal.provisional.core.IMessage; -import org.eclipse.wst.validation.internal.provisional.core.IReporter; - -public class OrmEclipseLinkConverterHolder extends AbstractOrmXmlContextNode implements EclipseLinkConverterHolder -{ - private final XmlConvertersHolder resourceConvertersHolder; - - protected final List<OrmEclipseLinkCustomConverter> customConverters; - protected final List<OrmEclipseLinkObjectTypeConverter> objectTypeConverters; - protected final List<OrmEclipseLinkStructConverter> structConverters; - protected final List<OrmEclipseLinkTypeConverter> typeConverters; - - public OrmEclipseLinkConverterHolder(XmlContextNode parent, XmlConvertersHolder resourceConvertersHolder) { - super(parent); - this.resourceConvertersHolder = resourceConvertersHolder; - this.customConverters = new ArrayList<OrmEclipseLinkCustomConverter>(); - this.objectTypeConverters = new ArrayList<OrmEclipseLinkObjectTypeConverter>(); - this.structConverters = new ArrayList<OrmEclipseLinkStructConverter>(); - this.typeConverters = new ArrayList<OrmEclipseLinkTypeConverter>(); - this.initializeCustomConverters(); - this.initializeObjectTypeConverters(); - this.initializeStructConverters(); - this.initializeTypeConverters(); - } - - public ListIterator<OrmEclipseLinkCustomConverter> customConverters() { - return this.customConverters.listIterator(); - } - - public int customConvertersSize() { - return this.customConverters.size(); - } - - public EclipseLinkCustomConverter addCustomConverter(int index) { - XmlConverter resourceConverter = EclipseLinkOrmFactory.eINSTANCE.createXmlConverter(); - OrmEclipseLinkCustomConverter contextConverter = this.buildCustomConverter(resourceConverter); - this.customConverters.add(index, contextConverter); - this.resourceConvertersHolder.getConverters().add(index, resourceConverter); - this.fireItemAdded(CUSTOM_CONVERTERS_LIST, index, contextConverter); - return contextConverter; - } - - protected void addCustomConverter(int index, OrmEclipseLinkCustomConverter converter) { - addItemToList(index, converter, this.customConverters, CUSTOM_CONVERTERS_LIST); - } - - protected void addCustomConverter(OrmEclipseLinkCustomConverter converter) { - this.addCustomConverter(this.customConverters.size(), converter); - } - - public void removeCustomConverter(int index) { - OrmEclipseLinkCustomConverter removedConverter = this.customConverters.remove(index); - this.resourceConvertersHolder.getConverters().remove(index); - fireItemRemoved(CUSTOM_CONVERTERS_LIST, index, removedConverter); - } - - public void removeCustomConverter(EclipseLinkCustomConverter converter) { - this.removeCustomConverter(this.customConverters.indexOf(converter)); - } - - protected void removeConverter_(EclipseLinkCustomConverter converter) { - removeItemFromList(converter, this.customConverters, CUSTOM_CONVERTERS_LIST); - } - - public void moveCustomConverter(int targetIndex, int sourceIndex) { - CollectionTools.move(this.customConverters, targetIndex, sourceIndex); - this.resourceConvertersHolder.getConverters().move(targetIndex, sourceIndex); - fireItemMoved(CUSTOM_CONVERTERS_LIST, targetIndex, sourceIndex); - } - - protected void moveCustomConverter_(int index, OrmEclipseLinkCustomConverter converter) { - moveItemInList(index, this.customConverters.indexOf(converter), this.customConverters, CUSTOM_CONVERTERS_LIST); - } - - public ListIterator<OrmEclipseLinkObjectTypeConverter> objectTypeConverters() { - return this.objectTypeConverters.listIterator(); - } - - public int objectTypeConvertersSize() { - return this.objectTypeConverters.size(); - } - - public EclipseLinkObjectTypeConverter addObjectTypeConverter(int index) { - XmlObjectTypeConverter resourceObjectTypeConverter = EclipseLinkOrmFactory.eINSTANCE.createXmlObjectTypeConverter(); - OrmEclipseLinkObjectTypeConverter contextObjectTypeConverter = this.buildObjectTypeConverter(resourceObjectTypeConverter); - this.objectTypeConverters.add(index, contextObjectTypeConverter); - this.resourceConvertersHolder.getObjectTypeConverters().add(index, resourceObjectTypeConverter); - this.fireItemAdded(OBJECT_TYPE_CONVERTERS_LIST, index, contextObjectTypeConverter); - return contextObjectTypeConverter; - } - - protected void addObjectTypeConverter(int index, OrmEclipseLinkObjectTypeConverter converter) { - addItemToList(index, converter, this.objectTypeConverters, OBJECT_TYPE_CONVERTERS_LIST); - } - - protected void addObjectTypeConverter(OrmEclipseLinkObjectTypeConverter converter) { - this.addObjectTypeConverter(this.objectTypeConverters.size(), converter); - } - - public void removeObjectTypeConverter(int index) { - OrmEclipseLinkObjectTypeConverter removedObjectTypeConverter = this.objectTypeConverters.remove(index); - this.resourceConvertersHolder.getObjectTypeConverters().remove(index); - fireItemRemoved(OBJECT_TYPE_CONVERTERS_LIST, index, removedObjectTypeConverter); - } - - public void removeObjectTypeConverter(EclipseLinkObjectTypeConverter converter) { - this.removeObjectTypeConverter(this.objectTypeConverters.indexOf(converter)); - } - - protected void removeObjectTypeConverter_(EclipseLinkObjectTypeConverter converter) { - removeItemFromList(converter, this.objectTypeConverters, OBJECT_TYPE_CONVERTERS_LIST); - } - - public void moveObjectTypeConverter(int targetIndex, int sourceIndex) { - CollectionTools.move(this.objectTypeConverters, targetIndex, sourceIndex); - this.resourceConvertersHolder.getObjectTypeConverters().move(targetIndex, sourceIndex); - fireItemMoved(OBJECT_TYPE_CONVERTERS_LIST, targetIndex, sourceIndex); - } - - protected void moveObjectTypeConverter_(int index, OrmEclipseLinkObjectTypeConverter converter) { - moveItemInList(index, this.objectTypeConverters.indexOf(converter), this.objectTypeConverters, OBJECT_TYPE_CONVERTERS_LIST); - } - - public ListIterator<OrmEclipseLinkStructConverter> structConverters() { - return this.structConverters.listIterator(); - } - - public int structConvertersSize() { - return this.structConverters.size(); - } - - public EclipseLinkStructConverter addStructConverter(int index) { - XmlStructConverter resourceStructConverter = EclipseLinkOrmFactory.eINSTANCE.createXmlStructConverter(); - OrmEclipseLinkStructConverter contextStructConverter = this.buildStructConverter(resourceStructConverter); - this.structConverters.add(index, contextStructConverter); - this.resourceConvertersHolder.getStructConverters().add(index, resourceStructConverter); - this.fireItemAdded(STRUCT_CONVERTERS_LIST, index, contextStructConverter); - return contextStructConverter; - } - - protected void addStructConverter(int index, OrmEclipseLinkStructConverter converter) { - addItemToList(index, converter, this.structConverters, STRUCT_CONVERTERS_LIST); - } - - protected void addStructConverter(OrmEclipseLinkStructConverter converter) { - this.addStructConverter(this.structConverters.size(), converter); - } - - public void removeStructConverter(int index) { - OrmEclipseLinkStructConverter removedStructConverter = this.structConverters.remove(index); - this.resourceConvertersHolder.getStructConverters().remove(index); - fireItemRemoved(STRUCT_CONVERTERS_LIST, index, removedStructConverter); - } - - public void removeStructConverter(EclipseLinkStructConverter converter) { - this.removeStructConverter(this.structConverters.indexOf(converter)); - } - - protected void removeStructConverter_(EclipseLinkStructConverter converter) { - removeItemFromList(converter, this.structConverters, STRUCT_CONVERTERS_LIST); - } - - public void moveStructConverter(int targetIndex, int sourceIndex) { - CollectionTools.move(this.structConverters, targetIndex, sourceIndex); - this.resourceConvertersHolder.getStructConverters().move(targetIndex, sourceIndex); - fireItemMoved(STRUCT_CONVERTERS_LIST, targetIndex, sourceIndex); - } - - protected void moveStructConverter_(int index, OrmEclipseLinkStructConverter converter) { - moveItemInList(index, this.structConverters.indexOf(converter), this.structConverters, STRUCT_CONVERTERS_LIST); - } - - - public ListIterator<OrmEclipseLinkTypeConverter> typeConverters() { - return this.typeConverters.listIterator(); - } - - public int typeConvertersSize() { - return this.typeConverters.size(); - } - - public EclipseLinkTypeConverter addTypeConverter(int index) { - XmlTypeConverter resourceTypeConverter = EclipseLinkOrmFactory.eINSTANCE.createXmlTypeConverter(); - OrmEclipseLinkTypeConverter contextTypeConverter = this.buildTypeConverter(resourceTypeConverter); - this.typeConverters.add(index, contextTypeConverter); - this.resourceConvertersHolder.getTypeConverters().add(index, resourceTypeConverter); - this.fireItemAdded(TYPE_CONVERTERS_LIST, index, contextTypeConverter); - return contextTypeConverter; - } - - protected void addTypeConverter(int index, OrmEclipseLinkTypeConverter converter) { - addItemToList(index, converter, this.typeConverters, TYPE_CONVERTERS_LIST); - } - - protected void addTypeConverter(OrmEclipseLinkTypeConverter converter) { - this.addTypeConverter(this.typeConverters.size(), converter); - } - - public void removeTypeConverter(int index) { - OrmEclipseLinkTypeConverter removedTypeConverter = this.typeConverters.remove(index); - this.resourceConvertersHolder.getTypeConverters().remove(index); - fireItemRemoved(TYPE_CONVERTERS_LIST, index, removedTypeConverter); - } - - public void removeTypeConverter(EclipseLinkTypeConverter converter) { - this.removeTypeConverter(this.typeConverters.indexOf(converter)); - } - - protected void removeTypeConverter_(EclipseLinkTypeConverter converter) { - removeItemFromList(converter, this.typeConverters, TYPE_CONVERTERS_LIST); - } - - public void moveTypeConverter(int targetIndex, int sourceIndex) { - CollectionTools.move(this.typeConverters, targetIndex, sourceIndex); - this.resourceConvertersHolder.getTypeConverters().move(targetIndex, sourceIndex); - fireItemMoved(TYPE_CONVERTERS_LIST, targetIndex, sourceIndex); - } - - protected void moveTypeConverter_(int index, OrmEclipseLinkTypeConverter converter) { - moveItemInList(index, this.typeConverters.indexOf(converter), this.typeConverters, TYPE_CONVERTERS_LIST); - } - - protected void initializeCustomConverters() { - for (XmlConverter resourceConverter : this.resourceConvertersHolder.getConverters()) { - this.customConverters.add(this.buildCustomConverter(resourceConverter)); - } - } - - protected void initializeObjectTypeConverters() { - for (XmlObjectTypeConverter resourceConverter : this.resourceConvertersHolder.getObjectTypeConverters()) { - this.objectTypeConverters.add(this.buildObjectTypeConverter(resourceConverter)); - } - } - - protected void initializeStructConverters() { - for (XmlStructConverter resourceConverter : this.resourceConvertersHolder.getStructConverters()) { - this.structConverters.add(this.buildStructConverter(resourceConverter)); - } - } - - protected void initializeTypeConverters() { - for (XmlTypeConverter resourceConverter : this.resourceConvertersHolder.getTypeConverters()) { - this.typeConverters.add(this.buildTypeConverter(resourceConverter)); - } - } - - protected OrmEclipseLinkCustomConverter buildCustomConverter(XmlConverter resourceConverter) { - OrmEclipseLinkCustomConverter contextConverter = new OrmEclipseLinkCustomConverter(this); - contextConverter.initialize(resourceConverter); - return contextConverter; - } - - protected OrmEclipseLinkTypeConverter buildTypeConverter(XmlTypeConverter resourceConverter) { - OrmEclipseLinkTypeConverter contextConverter = new OrmEclipseLinkTypeConverter(this); - contextConverter.initialize(resourceConverter); - return contextConverter; - } - - protected OrmEclipseLinkObjectTypeConverter buildObjectTypeConverter(XmlObjectTypeConverter resourceConverter) { - OrmEclipseLinkObjectTypeConverter contextConverter = new OrmEclipseLinkObjectTypeConverter(this); - contextConverter.initialize(resourceConverter); - return contextConverter; - } - - protected OrmEclipseLinkStructConverter buildStructConverter(XmlStructConverter resourceConverter) { - OrmEclipseLinkStructConverter contextConverter = new OrmEclipseLinkStructConverter(this); - contextConverter.initialize(resourceConverter); - return contextConverter; - } - - public void update() { - this.updateCustomConverters(); - this.updateObjectTypeConverters(); - this.updateStructConverters(); - this.updateTypeConverters(); - } - - protected void updateCustomConverters() { - Collection<OrmEclipseLinkCustomConverter> contextConvertersToRemove = CollectionTools.collection(customConverters()); - Collection<OrmEclipseLinkCustomConverter> contextConvertersToUpdate = new ArrayList<OrmEclipseLinkCustomConverter>(); - int resourceIndex = 0; - - // make a copy of the XML conversion values (to prevent ConcurrentModificationException) - List<XmlConverter> xmlConverters = this.resourceConvertersHolder.getConverters(); - for (XmlConverter resourceConverter : xmlConverters.toArray(new XmlConverter[xmlConverters.size()])) { - boolean contextConverterFound = false; - for (OrmEclipseLinkCustomConverter contextConverter : contextConvertersToRemove) { - if (contextConverter.getXmlResource() == resourceConverter) { - moveCustomConverter_(resourceIndex, contextConverter); - contextConvertersToRemove.remove(contextConverter); - contextConvertersToUpdate.add(contextConverter); - contextConverterFound = true; - break; - } - } - if (!contextConverterFound) { - addCustomConverter(this.buildCustomConverter(resourceConverter)); - } - resourceIndex++; - } - for (OrmEclipseLinkCustomConverter contextConverter : contextConvertersToRemove) { - removeConverter_(contextConverter); - } - //first handle adding/removing of the converters, then update the others last, - //this causes less churn in the update process - for (OrmEclipseLinkCustomConverter contextConverter : contextConvertersToUpdate) { - contextConverter.update(); - } - } - - protected void updateObjectTypeConverters() { - Collection<OrmEclipseLinkObjectTypeConverter> contextConvertersToRemove = CollectionTools.collection(objectTypeConverters()); - Collection<OrmEclipseLinkObjectTypeConverter> contextConvertersToUpdate = new ArrayList<OrmEclipseLinkObjectTypeConverter>(); - int resourceIndex = 0; - - // make a copy of the XML converters (to prevent ConcurrentModificationException) - List<XmlObjectTypeConverter> xmlConverters = this.resourceConvertersHolder.getObjectTypeConverters(); - for (XmlObjectTypeConverter xmlConverter : xmlConverters.toArray(new XmlObjectTypeConverter[xmlConverters.size()])) { - boolean contextConverterFound = false; - for (OrmEclipseLinkObjectTypeConverter contextObjectTypeConverter : contextConvertersToRemove) { - if (contextObjectTypeConverter.getXmlResource() == xmlConverter) { - moveObjectTypeConverter_(resourceIndex, contextObjectTypeConverter); - contextConvertersToRemove.remove(contextObjectTypeConverter); - contextConvertersToUpdate.add(contextObjectTypeConverter); - contextConverterFound = true; - break; - } - } - if (!contextConverterFound) { - addObjectTypeConverter(this.buildObjectTypeConverter(xmlConverter)); - } - resourceIndex++; - } - for (OrmEclipseLinkObjectTypeConverter contextObjectTypeConverter : contextConvertersToRemove) { - removeObjectTypeConverter_(contextObjectTypeConverter); - } - //first handle adding/removing of the converters, then update the others last, - //this causes less churn in the update process - for (OrmEclipseLinkObjectTypeConverter contextObjectTypeConverter : contextConvertersToUpdate) { - contextObjectTypeConverter.update(); - } - } - - protected void updateTypeConverters() { - Collection<OrmEclipseLinkTypeConverter> contextConvertersToRemove = CollectionTools.collection(typeConverters()); - Collection<OrmEclipseLinkTypeConverter> contextConvertersToUpdate = new ArrayList<OrmEclipseLinkTypeConverter>(); - int resourceIndex = 0; - - List<XmlTypeConverter> xmlConverters = this.resourceConvertersHolder.getTypeConverters(); - for (XmlTypeConverter xmlConverter : xmlConverters.toArray(new XmlTypeConverter[xmlConverters.size()])) { - boolean contextTypeConverterFound = false; - for (OrmEclipseLinkTypeConverter contextTypeConverter : contextConvertersToRemove) { - if (contextTypeConverter.getXmlResource() == xmlConverter) { - moveTypeConverter_(resourceIndex, contextTypeConverter); - contextConvertersToRemove.remove(contextTypeConverter); - contextConvertersToUpdate.add(contextTypeConverter); - contextTypeConverterFound = true; - break; - } - } - if (!contextTypeConverterFound) { - addTypeConverter(this.buildTypeConverter(xmlConverter)); - } - resourceIndex++; - } - for (OrmEclipseLinkTypeConverter contextTypeConverter : contextConvertersToRemove) { - removeTypeConverter_(contextTypeConverter); - } - //first handle adding/removing of the converters, then update the others last, - //this causes less churn in the update process - for (OrmEclipseLinkTypeConverter contextTypeConverter : contextConvertersToUpdate) { - contextTypeConverter.update(); - } - } - - protected void updateStructConverters() { - Collection<OrmEclipseLinkStructConverter> contextConvertersToRemove = CollectionTools.collection(structConverters()); - Collection<OrmEclipseLinkStructConverter> contextConvertersToUpdate = new ArrayList<OrmEclipseLinkStructConverter>(); - int resourceIndex = 0; - - // make a copy of the XML converters (to prevent ConcurrentModificationException) - List<XmlStructConverter> xmlConverters = this.resourceConvertersHolder.getStructConverters(); - for (XmlStructConverter resourceStructConverter : xmlConverters.toArray(new XmlStructConverter[xmlConverters.size()])) { - boolean contextStructConverterFound = false; - for (OrmEclipseLinkStructConverter contextStructConverter : contextConvertersToRemove) { - if (contextStructConverter.getXmlResource() == resourceStructConverter) { - moveStructConverter_(resourceIndex, contextStructConverter); - contextConvertersToRemove.remove(contextStructConverter); - contextConvertersToUpdate.add(contextStructConverter); - contextStructConverterFound = true; - break; - } - } - if (!contextStructConverterFound) { - addStructConverter(this.buildStructConverter(resourceStructConverter)); - } - resourceIndex++; - } - for (OrmEclipseLinkStructConverter contextStructConverter : contextConvertersToRemove) { - removeStructConverter_(contextStructConverter); - } - //first handle adding/removing of the converters, then update the others last, - //this causes less churn in the update process - for (OrmEclipseLinkStructConverter contextStructConverter : contextConvertersToUpdate) { - contextStructConverter.update(); - } - } - - //************ validation *************** - - @Override - public void validate(List<IMessage> messages, IReporter reporter) { - super.validate(messages, reporter); - } - - - public TextRange getValidationTextRange() { - return this.resourceConvertersHolder.getValidationTextRange(); - } - - -} diff --git a/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/orm/OrmEclipseLinkCustomConverter.java b/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/orm/OrmEclipseLinkCustomConverter.java deleted file mode 100644 index ed5772f18a..0000000000 --- a/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/orm/OrmEclipseLinkCustomConverter.java +++ /dev/null @@ -1,100 +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.eclipselink.core.internal.context.orm; - -import java.util.List; -import org.eclipse.jpt.core.context.XmlContextNode; -import org.eclipse.jpt.eclipselink.core.context.EclipseLinkCustomConverter; -import org.eclipse.jpt.eclipselink.core.context.EclipseLinkConverter; -import org.eclipse.jpt.eclipselink.core.resource.orm.XmlConverter; -import org.eclipse.wst.validation.internal.provisional.core.IMessage; -import org.eclipse.wst.validation.internal.provisional.core.IReporter; - -public class OrmEclipseLinkCustomConverter extends OrmEclipseLinkConverter<XmlConverter> - implements EclipseLinkCustomConverter -{ - private String converterClass; - - - public OrmEclipseLinkCustomConverter(XmlContextNode parent) { - super(parent); - } - - - public String getType() { - return EclipseLinkConverter.CUSTOM_CONVERTER; - } - - - // **************** converter class **************************************** - - public String getConverterClass() { - return this.converterClass; - } - - public void setConverterClass(String newConverterClass) { - String oldConverterClass = this.converterClass; - this.converterClass = newConverterClass; - this.resourceConverter.setClassName(newConverterClass); - firePropertyChanged(CONVERTER_CLASS_PROPERTY, oldConverterClass, newConverterClass); - } - - protected void setConverterClass_(String newConverterClass) { - String oldConverterClass = this.converterClass; - this.converterClass = newConverterClass; - firePropertyChanged(CONVERTER_CLASS_PROPERTY, oldConverterClass, newConverterClass); - } - - - // **************** resource interaction *********************************** - - @Override - protected void initialize(XmlConverter xmlResource) { - super.initialize(xmlResource); - this.converterClass = getResourceClassName(); - } - - @Override - public void update() { - super.update(); - setConverterClass_(getResourceClassName()); - } - - protected String getResourceClassName() { - return this.resourceConverter.getClassName(); - } - - - // **************** validation ********************************************* - - @Override - public void validate(List<IMessage> messages, IReporter reporter) { - super.validate(messages, reporter); - validateConverterClass(messages); - } -//TODO validate converter class - protected void validateConverterClass(List<IMessage> messages) { -// if (!getResourceConverter().implementsConverter()) { -// messages.add( -// DefaultEclipseLinkJpaValidationMessages.buildMessage( -// IMessage.HIGH_SEVERITY, -// EclipseLinkJpaValidationMessages.CONVERTER_CLASS_IMPLEMENTS_CONVERTER, -// new String[] {this.converterClass}, -// this, -// getConverterClassTextRange() -// ) -// ); -// } - } - -// public TextRange getConverterClassTextRange() { -// return getResourceConverter().getClassNameTextRange(); -// } -}
\ No newline at end of file diff --git a/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/orm/OrmEclipseLinkCustomizer.java b/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/orm/OrmEclipseLinkCustomizer.java deleted file mode 100644 index e0948aec67..0000000000 --- a/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/orm/OrmEclipseLinkCustomizer.java +++ /dev/null @@ -1,119 +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.eclipselink.core.internal.context.orm; - -import org.eclipse.jpt.core.context.orm.OrmTypeMapping; -import org.eclipse.jpt.core.internal.context.orm.AbstractOrmXmlContextNode; -import org.eclipse.jpt.core.utility.TextRange; -import org.eclipse.jpt.eclipselink.core.context.EclipseLinkCustomizer; -import org.eclipse.jpt.eclipselink.core.resource.orm.EclipseLinkOrmFactory; -import org.eclipse.jpt.eclipselink.core.resource.orm.XmlCustomizer; -import org.eclipse.jpt.eclipselink.core.resource.orm.XmlCustomizerHolder; - -public class OrmEclipseLinkCustomizer extends AbstractOrmXmlContextNode - implements EclipseLinkCustomizer -{ - protected final XmlCustomizerHolder resource; - - protected String specifiedCustomizerClass; - - protected String defaultCustomizerClass; - - public OrmEclipseLinkCustomizer(OrmTypeMapping parent, XmlCustomizerHolder resource, EclipseLinkCustomizer javaCustomizer) { - super(parent); - this.resource = resource; - this.defaultCustomizerClass = getJavaCustomizerClass(javaCustomizer); - this.specifiedCustomizerClass = getResourceCustomizerClass(); - } - - public char getCustomizerClassEnclosingTypeSeparator() { - return '$'; - } - - public String getCustomizerClass() { - return this.specifiedCustomizerClass == null ? this.defaultCustomizerClass : this.specifiedCustomizerClass; - } - - public String getDefaultCustomizerClass() { - return this.defaultCustomizerClass; - } - - protected void setDefaultCustomizerClass(String newDefaultCustomizerClass) { - String oldDefaultCustomizerClass = this.defaultCustomizerClass; - this.defaultCustomizerClass = newDefaultCustomizerClass; - firePropertyChanged(DEFAULT_CUSTOMIZER_CLASS_PROPERTY, oldDefaultCustomizerClass, newDefaultCustomizerClass); - } - - public String getSpecifiedCustomizerClass() { - return this.specifiedCustomizerClass; - } - - public void setSpecifiedCustomizerClass(String newCustomizerClass) { - String oldCustomizerClass = this.specifiedCustomizerClass; - this.specifiedCustomizerClass = newCustomizerClass; - if (oldCustomizerClass != newCustomizerClass) { - if (this.getResourceCustomizer() != null) { - this.getResourceCustomizer().setCustomizerClassName(newCustomizerClass); - if (this.getResourceCustomizer().isUnset()) { - removeResourceCustomizer(); - } - } - else if (newCustomizerClass != null) { - addResourceCustomizer(); - getResourceCustomizer().setCustomizerClassName(newCustomizerClass); - } - } - firePropertyChanged(SPECIFIED_CUSTOMIZER_CLASS_PROPERTY, oldCustomizerClass, newCustomizerClass); - } - - protected void setSpecifiedCustomizerClass_(String newCustomizerClass) { - String oldCustomizerClass = this.specifiedCustomizerClass; - this.specifiedCustomizerClass = newCustomizerClass; - firePropertyChanged(SPECIFIED_CUSTOMIZER_CLASS_PROPERTY, oldCustomizerClass, newCustomizerClass); - } - - protected XmlCustomizer getResourceCustomizer() { - return this.resource.getCustomizer(); - } - - protected void addResourceCustomizer() { - this.resource.setCustomizer(EclipseLinkOrmFactory.eINSTANCE.createXmlCustomizer()); - } - - protected void removeResourceCustomizer() { - this.resource.setCustomizer(null); - } - - - // **************** updating ************************************** - - protected void update(EclipseLinkCustomizer javaCustomizer) { - setDefaultCustomizerClass(getJavaCustomizerClass(javaCustomizer)); - setSpecifiedCustomizerClass_(getResourceCustomizerClass()); - } - - protected String getJavaCustomizerClass(EclipseLinkCustomizer javaCustomizer) { - return (javaCustomizer == null) ? null : javaCustomizer.getCustomizerClass(); - } - - protected String getResourceCustomizerClass() { - XmlCustomizer resource = getResourceCustomizer(); - return (resource == null) ? null : resource.getCustomizerClassName(); - } - - - // **************** validation ************************************** - - public TextRange getValidationTextRange() { - XmlCustomizer resource = getResourceCustomizer(); - return resource == null ? null : resource.getCustomizerClassNameTextRange(); - } - -} diff --git a/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/orm/OrmEclipseLinkEmbeddableImpl.java b/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/orm/OrmEclipseLinkEmbeddableImpl.java deleted file mode 100644 index 19b2362b1c..0000000000 --- a/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/orm/OrmEclipseLinkEmbeddableImpl.java +++ /dev/null @@ -1,92 +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.eclipselink.core.internal.context.orm; - -import java.util.List; -import org.eclipse.jpt.core.context.orm.OrmPersistentType; -import org.eclipse.jpt.core.internal.context.orm.AbstractOrmEmbeddable; -import org.eclipse.jpt.eclipselink.core.context.EclipseLinkChangeTracking; -import org.eclipse.jpt.eclipselink.core.context.EclipseLinkCustomizer; -import org.eclipse.jpt.eclipselink.core.context.java.JavaEclipseLinkEmbeddable; -import org.eclipse.jpt.eclipselink.core.context.orm.EclipseLinkConverterHolder; -import org.eclipse.jpt.eclipselink.core.context.orm.OrmEclipseLinkEmbeddable; -import org.eclipse.jpt.eclipselink.core.resource.orm.XmlChangeTrackingHolder; -import org.eclipse.jpt.eclipselink.core.resource.orm.XmlConvertersHolder; -import org.eclipse.jpt.eclipselink.core.resource.orm.XmlCustomizerHolder; -import org.eclipse.jpt.eclipselink.core.resource.orm.XmlEmbeddable; -import org.eclipse.wst.validation.internal.provisional.core.IMessage; -import org.eclipse.wst.validation.internal.provisional.core.IReporter; - -public class OrmEclipseLinkEmbeddableImpl extends AbstractOrmEmbeddable - implements OrmEclipseLinkEmbeddable -{ - protected final OrmEclipseLinkCustomizer customizer; - - protected final OrmEclipseLinkChangeTracking changeTracking; - - protected final OrmEclipseLinkConverterHolder converterHolder; - - public OrmEclipseLinkEmbeddableImpl(OrmPersistentType parent, XmlEmbeddable resourceMapping) { - super(parent, resourceMapping); - this.customizer = new OrmEclipseLinkCustomizer(this, (XmlCustomizerHolder) this.resourceTypeMapping, getJavaCustomizer()); - this.changeTracking = new OrmEclipseLinkChangeTracking(this, (XmlChangeTrackingHolder) this.resourceTypeMapping, getJavaChangeTracking()); - this.converterHolder = new OrmEclipseLinkConverterHolder(this, (XmlConvertersHolder) this.resourceTypeMapping); - } - - public EclipseLinkCustomizer getCustomizer() { - return this.customizer; - } - - public EclipseLinkChangeTracking getChangeTracking() { - return this.changeTracking; - } - - public EclipseLinkConverterHolder getConverterHolder() { - return this.converterHolder; - } - - - - // **************** resource-context interaction *************************** - - @Override - public void update() { - super.update(); - this.customizer.update(getJavaCustomizer()); - this.changeTracking.update(getJavaChangeTracking()); - this.converterHolder.update(); - } - - @Override - protected JavaEclipseLinkEmbeddable getJavaEmbeddableForDefaults() { - return (JavaEclipseLinkEmbeddable) super.getJavaEmbeddableForDefaults(); - } - - - protected EclipseLinkCustomizer getJavaCustomizer() { - JavaEclipseLinkEmbeddable javaEmbeddable = getJavaEmbeddableForDefaults(); - return (javaEmbeddable == null) ? null : javaEmbeddable.getCustomizer(); - } - - protected EclipseLinkChangeTracking getJavaChangeTracking() { - JavaEclipseLinkEmbeddable javaEmbeddable = getJavaEmbeddableForDefaults(); - return (javaEmbeddable == null) ? null : javaEmbeddable.getChangeTracking(); - } - - - // **************** validation ************************************** - - @Override - public void validate(List<IMessage> messages, IReporter reporter) { - super.validate(messages, reporter); - this.customizer.validate(messages, reporter); - this.changeTracking.validate(messages, reporter); - } -} diff --git a/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/orm/OrmEclipseLinkEntityImpl.java b/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/orm/OrmEclipseLinkEntityImpl.java deleted file mode 100644 index 4b94a8cea5..0000000000 --- a/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/orm/OrmEclipseLinkEntityImpl.java +++ /dev/null @@ -1,135 +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.eclipselink.core.internal.context.orm; - -import java.util.List; -import org.eclipse.jpt.core.context.orm.OrmPersistentType; -import org.eclipse.jpt.core.internal.context.orm.AbstractOrmEntity; -import org.eclipse.jpt.core.jpa2.context.CacheableHolder2_0; -import org.eclipse.jpt.core.jpa2.context.orm.OrmCacheable2_0; -import org.eclipse.jpt.core.jpa2.context.orm.OrmCacheableHolder2_0; -import org.eclipse.jpt.core.resource.orm.v2_0.XmlCacheable_2_0; -import org.eclipse.jpt.eclipselink.core.context.EclipseLinkChangeTracking; -import org.eclipse.jpt.eclipselink.core.context.EclipseLinkCustomizer; -import org.eclipse.jpt.eclipselink.core.context.EclipseLinkReadOnly; -import org.eclipse.jpt.eclipselink.core.context.java.JavaEclipseLinkEntity; -import org.eclipse.jpt.eclipselink.core.context.java.JavaEclipseLinkCaching; -import org.eclipse.jpt.eclipselink.core.context.orm.EclipseLinkConverterHolder; -import org.eclipse.jpt.eclipselink.core.context.orm.OrmEclipseLinkCaching; -import org.eclipse.jpt.eclipselink.core.context.orm.OrmEclipseLinkEntity; -import org.eclipse.jpt.eclipselink.core.resource.orm.XmlCacheHolder; -import org.eclipse.jpt.eclipselink.core.resource.orm.XmlChangeTrackingHolder; -import org.eclipse.jpt.eclipselink.core.resource.orm.XmlConvertersHolder; -import org.eclipse.jpt.eclipselink.core.resource.orm.XmlCustomizerHolder; -import org.eclipse.jpt.eclipselink.core.resource.orm.XmlEntity; -import org.eclipse.jpt.eclipselink.core.resource.orm.XmlReadOnly; -import org.eclipse.wst.validation.internal.provisional.core.IMessage; -import org.eclipse.wst.validation.internal.provisional.core.IReporter; - -public class OrmEclipseLinkEntityImpl extends AbstractOrmEntity - implements OrmEclipseLinkEntity -{ - protected final OrmEclipseLinkReadOnly readOnly; - - protected final OrmEclipseLinkCustomizer customizer; - - protected final OrmEclipseLinkChangeTracking changeTracking; - - protected final OrmEclipseLinkCaching caching; - - protected final OrmEclipseLinkConverterHolder converterHolder; - - - public OrmEclipseLinkEntityImpl(OrmPersistentType parent, XmlEntity resourceMapping) { - super(parent, resourceMapping); - this.readOnly = new OrmEclipseLinkReadOnly(this, (XmlReadOnly) this.resourceTypeMapping, getJavaReadOnly()); - this.customizer = new OrmEclipseLinkCustomizer(this, (XmlCustomizerHolder) this.resourceTypeMapping, getJavaCustomizer()); - this.changeTracking = new OrmEclipseLinkChangeTracking(this, (XmlChangeTrackingHolder) this.resourceTypeMapping, getJavaChangeTracking()); - this.caching = new OrmEclipseLinkCachingImpl(this, (XmlCacheHolder) this.resourceTypeMapping, (XmlCacheable_2_0) this.resourceTypeMapping, getJavaCaching()); - this.converterHolder = new OrmEclipseLinkConverterHolder(this, (XmlConvertersHolder) this.resourceTypeMapping); - } - - public OrmEclipseLinkCaching getCaching() { - return this.caching; - } - - public EclipseLinkCustomizer getCustomizer() { - return this.customizer; - } - - public EclipseLinkChangeTracking getChangeTracking() { - return this.changeTracking; - } - - public OrmEclipseLinkReadOnly getReadOnly() { - return this.readOnly; - } - - public EclipseLinkConverterHolder getConverterHolder() { - return this.converterHolder; - } - - public OrmCacheable2_0 getCacheable() { - return ((OrmCacheableHolder2_0) getCaching()).getCacheable(); - } - - public boolean calculateDefaultCacheable() { - return ((CacheableHolder2_0) getCaching()).calculateDefaultCacheable(); - } - - // **************** resource-context interaction *************************** - - @Override - public void update() { - super.update(); - this.readOnly.update(getJavaReadOnly()); - this.customizer.update(getJavaCustomizer()); - this.changeTracking.update(getJavaChangeTracking()); - this.caching.update(getJavaCaching()); - this.converterHolder.update(); - } - - @Override - protected JavaEclipseLinkEntity getJavaEntityForDefaults() { - return (JavaEclipseLinkEntity) super.getJavaEntityForDefaults(); - } - - protected EclipseLinkReadOnly getJavaReadOnly() { - JavaEclipseLinkEntity javaEntity = getJavaEntityForDefaults(); - return (javaEntity == null) ? null : javaEntity.getReadOnly(); - } - - protected EclipseLinkCustomizer getJavaCustomizer() { - JavaEclipseLinkEntity javaEntity = getJavaEntityForDefaults(); - return (javaEntity == null) ? null : javaEntity.getCustomizer(); - } - - protected EclipseLinkChangeTracking getJavaChangeTracking() { - JavaEclipseLinkEntity javaEntity = getJavaEntityForDefaults(); - return (javaEntity == null) ? null : javaEntity.getChangeTracking(); - } - - protected JavaEclipseLinkCaching getJavaCaching() { - JavaEclipseLinkEntity javaEntity = getJavaEntityForDefaults(); - return (javaEntity == null) ? null : javaEntity.getCaching(); - } - - - // **************** validation ************************************** - - @Override - public void validate(List<IMessage> messages, IReporter reporter) { - super.validate(messages, reporter); - this.readOnly.validate(messages, reporter); - this.customizer.validate(messages, reporter); - this.changeTracking.validate(messages, reporter); - this.caching.validate(messages, reporter); - } -} diff --git a/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/orm/OrmEclipseLinkExpiryTimeOfDay.java b/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/orm/OrmEclipseLinkExpiryTimeOfDay.java deleted file mode 100644 index 00cf3d386c..0000000000 --- a/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/orm/OrmEclipseLinkExpiryTimeOfDay.java +++ /dev/null @@ -1,137 +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.eclipselink.core.internal.context.orm; - -import org.eclipse.jpt.core.internal.context.orm.AbstractOrmXmlContextNode; -import org.eclipse.jpt.core.utility.TextRange; -import org.eclipse.jpt.eclipselink.core.context.EclipseLinkExpiryTimeOfDay; -import org.eclipse.jpt.eclipselink.core.context.orm.OrmEclipseLinkCaching; -import org.eclipse.jpt.eclipselink.core.resource.orm.XmlTimeOfDay; - -public class OrmEclipseLinkExpiryTimeOfDay extends AbstractOrmXmlContextNode - implements EclipseLinkExpiryTimeOfDay -{ - - protected Integer hour; - protected Integer minute; - protected Integer second; - protected Integer millisecond; - - protected XmlTimeOfDay resourceTimeOfDay; - - public OrmEclipseLinkExpiryTimeOfDay(OrmEclipseLinkCaching parent) { - super(parent); - } - - - public Integer getHour() { - return this.hour; - } - - public void setHour(Integer newHour) { - Integer oldHour = this.hour; - this.hour = newHour; - this.resourceTimeOfDay.setHour(newHour); - firePropertyChanged(HOUR_PROPERTY, oldHour, newHour); - } - - protected void setHour_(Integer newHour) { - Integer oldHour = this.hour; - this.hour = newHour; - firePropertyChanged(HOUR_PROPERTY, oldHour, newHour); - } - - public Integer getMinute() { - return this.minute; - } - - public void setMinute(Integer newMinute) { - Integer oldMinute = this.minute; - this.minute = newMinute; - this.resourceTimeOfDay.setMinute(newMinute); - firePropertyChanged(MINUTE_PROPERTY, oldMinute, newMinute); - } - - protected void setMinute_(Integer newMinute) { - Integer oldMinute = this.minute; - this.minute = newMinute; - firePropertyChanged(MINUTE_PROPERTY, oldMinute, newMinute); - } - - public Integer getSecond() { - return this.second; - } - - public void setSecond(Integer newSecond) { - Integer oldSecond = this.second; - this.second = newSecond; - this.resourceTimeOfDay.setSecond(newSecond); - firePropertyChanged(SECOND_PROPERTY, oldSecond, newSecond); - } - - protected void setSecond_(Integer newSecond) { - Integer oldSecond = this.second; - this.second = newSecond; - firePropertyChanged(SECOND_PROPERTY, oldSecond, newSecond); - } - - public Integer getMillisecond() { - return this.millisecond; - } - - public void setMillisecond(Integer newMillisecond) { - Integer oldMillisecond = this.millisecond; - this.millisecond = newMillisecond; - this.resourceTimeOfDay.setMillisecond(newMillisecond); - firePropertyChanged(MILLISECOND_PROPERTY, oldMillisecond, newMillisecond); - } - - protected void setMillisecond_(Integer newMillisecond) { - Integer oldMillisecond = this.millisecond; - this.millisecond = newMillisecond; - firePropertyChanged(MILLISECOND_PROPERTY, oldMillisecond, newMillisecond); - } - - public TextRange getValidationTextRange() { - return this.resourceTimeOfDay.getValidationTextRange(); - } - - public void initialize(XmlTimeOfDay resource) { - this.resourceTimeOfDay = resource; - this.hour = getResourceHour(); - this.minute = getResourceMinute(); - this.second = getResourceSecond(); - this.millisecond = getResourceMillisecond(); - } - - public void update(XmlTimeOfDay resource) { - this.resourceTimeOfDay = resource; - this.setHour_(getResourceHour()); - this.setMinute_(getResourceMinute()); - this.setSecond_(getResourceSecond()); - this.setMillisecond_(getResourceMillisecond()); - } - - protected Integer getResourceHour() { - return this.resourceTimeOfDay.getHour(); - } - - protected Integer getResourceMinute() { - return this.resourceTimeOfDay.getMinute(); - } - - protected Integer getResourceSecond() { - return this.resourceTimeOfDay.getSecond(); - } - - protected Integer getResourceMillisecond() { - return this.resourceTimeOfDay.getMillisecond(); - } -} diff --git a/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/orm/OrmEclipseLinkIdMapping.java b/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/orm/OrmEclipseLinkIdMapping.java deleted file mode 100644 index 24e7b027f9..0000000000 --- a/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/orm/OrmEclipseLinkIdMapping.java +++ /dev/null @@ -1,77 +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.eclipselink.core.internal.context.orm; - -import java.util.List; -import org.eclipse.jpt.core.context.orm.OrmConverter; -import org.eclipse.jpt.core.context.orm.OrmPersistentAttribute; -import org.eclipse.jpt.core.internal.context.orm.AbstractOrmIdMapping; -import org.eclipse.jpt.eclipselink.core.context.EclipseLinkConvert; -import org.eclipse.jpt.eclipselink.core.context.EclipseLinkIdMapping; -import org.eclipse.jpt.eclipselink.core.context.EclipseLinkMutable; -import org.eclipse.jpt.eclipselink.core.resource.orm.XmlId; -import org.eclipse.wst.validation.internal.provisional.core.IMessage; -import org.eclipse.wst.validation.internal.provisional.core.IReporter; - -public class OrmEclipseLinkIdMapping extends AbstractOrmIdMapping<XmlId> - implements EclipseLinkIdMapping -{ - protected OrmEclipseLinkMutable mutable; - - - public OrmEclipseLinkIdMapping(OrmPersistentAttribute parent, XmlId resourceMapping) { - super(parent, resourceMapping); - this.mutable = new OrmEclipseLinkMutable(this, this.resourceAttributeMapping); - } - - - public EclipseLinkMutable getMutable() { - return this.mutable; - } - - @Override - protected OrmConverter buildSpecifiedConverter(String converterType) { - OrmConverter ormConverter = super.buildSpecifiedConverter(converterType); - if (ormConverter != null) { - return ormConverter; - } - if (converterType == EclipseLinkConvert.ECLIPSE_LINK_CONVERTER) { - return new OrmEclipseLinkConvert(this, this.resourceAttributeMapping); - } - return null; - } - - @Override - protected String getResourceConverterType() { - //check @Convert first, this is the order that EclipseLink searches - if (this.resourceAttributeMapping.getConvert() != null) { - return EclipseLinkConvert.ECLIPSE_LINK_CONVERTER; - } - return super.getResourceConverterType(); - } - - // **************** resource-context interaction *************************** - - @Override - public void update() { - super.update(); - this.mutable.update(); - } - - - // **************** validation ************************************** - - @Override - public void validate(List<IMessage> messages, IReporter reporter) { - super.validate(messages, reporter); - // TODO - mutable validation - } -} diff --git a/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/orm/OrmEclipseLinkJoinFetch.java b/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/orm/OrmEclipseLinkJoinFetch.java deleted file mode 100644 index b7734db7eb..0000000000 --- a/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/orm/OrmEclipseLinkJoinFetch.java +++ /dev/null @@ -1,68 +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.eclipselink.core.internal.context.orm; - -import org.eclipse.jpt.core.context.orm.OrmAttributeMapping; -import org.eclipse.jpt.core.internal.context.orm.AbstractOrmXmlContextNode; -import org.eclipse.jpt.core.utility.TextRange; -import org.eclipse.jpt.eclipselink.core.context.EclipseLinkJoinFetch; -import org.eclipse.jpt.eclipselink.core.context.EclipseLinkJoinFetchType; -import org.eclipse.jpt.eclipselink.core.resource.orm.XmlJoinFetch; - -public class OrmEclipseLinkJoinFetch extends AbstractOrmXmlContextNode - implements EclipseLinkJoinFetch -{ - protected XmlJoinFetch resource; - - protected EclipseLinkJoinFetchType joinFetchValue; - - - public OrmEclipseLinkJoinFetch(OrmAttributeMapping parent, XmlJoinFetch resource) { - super(parent); - this.resource = resource; - this.joinFetchValue = getResourceJoinFetch(); - } - - - public EclipseLinkJoinFetchType getValue() { - return this.joinFetchValue; - } - - public void setValue(EclipseLinkJoinFetchType newJoinFetchValue) { - EclipseLinkJoinFetchType oldJoinFetchValue = this.joinFetchValue; - this.joinFetchValue = newJoinFetchValue; - this.resource.setJoinFetch(EclipseLinkJoinFetchType.toOrmResourceModel(newJoinFetchValue)); - firePropertyChanged(VALUE_PROPERTY, oldJoinFetchValue, newJoinFetchValue); - } - - protected void setValue_(EclipseLinkJoinFetchType newJoinFetchValue) { - EclipseLinkJoinFetchType oldJoinFetchValue = this.joinFetchValue; - this.joinFetchValue = newJoinFetchValue; - firePropertyChanged(VALUE_PROPERTY, oldJoinFetchValue, newJoinFetchValue); - } - - - // **************** initialize/update ************************************** - - protected void update() { - setValue_(getResourceJoinFetch()); - } - - protected EclipseLinkJoinFetchType getResourceJoinFetch() { - return EclipseLinkJoinFetchType.fromOrmResourceModel(this.resource.getJoinFetch()); - } - - // **************** validation ************************************** - - public TextRange getValidationTextRange() { - return this.resource.getJoinFetchTextRange(); - } -} diff --git a/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/orm/OrmEclipseLinkManyToManyMapping.java b/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/orm/OrmEclipseLinkManyToManyMapping.java deleted file mode 100644 index e55cd31347..0000000000 --- a/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/orm/OrmEclipseLinkManyToManyMapping.java +++ /dev/null @@ -1,55 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2008, 2009 Oracle. - * All rights reserved. This program and the accompanying materials are - * made available under the terms of the Eclipse Public License v1.0 which - * accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Oracle - initial API and implementation - *******************************************************************************/ -package org.eclipse.jpt.eclipselink.core.internal.context.orm; - -import java.util.List; -import org.eclipse.jpt.core.context.orm.OrmPersistentAttribute; -import org.eclipse.jpt.core.internal.context.orm.AbstractOrmManyToManyMapping; -import org.eclipse.jpt.eclipselink.core.context.EclipseLinkRelationshipMapping; -import org.eclipse.jpt.eclipselink.core.context.EclipseLinkJoinFetch; -import org.eclipse.jpt.eclipselink.core.resource.orm.XmlManyToMany; -import org.eclipse.wst.validation.internal.provisional.core.IMessage; -import org.eclipse.wst.validation.internal.provisional.core.IReporter; - -public class OrmEclipseLinkManyToManyMapping extends AbstractOrmManyToManyMapping<XmlManyToMany> - implements EclipseLinkRelationshipMapping -{ - protected OrmEclipseLinkJoinFetch joinFetch; - - - public OrmEclipseLinkManyToManyMapping(OrmPersistentAttribute parent, XmlManyToMany resourceMapping) { - super(parent, resourceMapping); - this.joinFetch = new OrmEclipseLinkJoinFetch(this, this.resourceAttributeMapping); - } - - - public EclipseLinkJoinFetch getJoinFetch() { - return this.joinFetch; - } - - - // **************** resource-context interaction *************************** - - @Override - public void update() { - super.update(); - this.joinFetch.update(); - } - - - // **************** validation ************************************** - - @Override - public void validate(List<IMessage> messages, IReporter reporter) { - super.validate(messages, reporter); - // TODO - private owned, join fetch validation - } -}
\ No newline at end of file diff --git a/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/orm/OrmEclipseLinkManyToOneMapping.java b/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/orm/OrmEclipseLinkManyToOneMapping.java deleted file mode 100644 index 2f78a2bec1..0000000000 --- a/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/orm/OrmEclipseLinkManyToOneMapping.java +++ /dev/null @@ -1,55 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2008, 2009 Oracle. - * All rights reserved. This program and the accompanying materials are - * made available under the terms of the Eclipse Public License v1.0 which - * accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Oracle - initial API and implementation - *******************************************************************************/ -package org.eclipse.jpt.eclipselink.core.internal.context.orm; - -import java.util.List; -import org.eclipse.jpt.core.context.orm.OrmPersistentAttribute; -import org.eclipse.jpt.core.internal.context.orm.AbstractOrmManyToOneMapping; -import org.eclipse.jpt.eclipselink.core.context.EclipseLinkRelationshipMapping; -import org.eclipse.jpt.eclipselink.core.context.EclipseLinkJoinFetch; -import org.eclipse.jpt.eclipselink.core.resource.orm.XmlManyToOne; -import org.eclipse.wst.validation.internal.provisional.core.IMessage; -import org.eclipse.wst.validation.internal.provisional.core.IReporter; - -public class OrmEclipseLinkManyToOneMapping extends AbstractOrmManyToOneMapping<XmlManyToOne> - implements EclipseLinkRelationshipMapping -{ - protected OrmEclipseLinkJoinFetch joinFetch; - - - public OrmEclipseLinkManyToOneMapping(OrmPersistentAttribute parent, XmlManyToOne resourceMapping) { - super(parent, resourceMapping); - this.joinFetch = new OrmEclipseLinkJoinFetch(this, this.resourceAttributeMapping); - } - - - public EclipseLinkJoinFetch getJoinFetch() { - return this.joinFetch; - } - - - // **************** resource-context interaction *************************** - - @Override - public void update() { - super.update(); - this.joinFetch.update(); - } - - - // **************** validation ************************************** - - @Override - public void validate(List<IMessage> messages, IReporter reporter) { - super.validate(messages, reporter); - // TODO - private owned, join fetch validation - } -}
\ No newline at end of file diff --git a/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/orm/OrmEclipseLinkMappedSuperclassImpl.java b/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/orm/OrmEclipseLinkMappedSuperclassImpl.java deleted file mode 100644 index e47f616649..0000000000 --- a/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/orm/OrmEclipseLinkMappedSuperclassImpl.java +++ /dev/null @@ -1,137 +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.eclipselink.core.internal.context.orm; - -import java.util.List; -import org.eclipse.jpt.core.context.orm.OrmPersistentType; -import org.eclipse.jpt.core.internal.context.orm.AbstractOrmMappedSuperclass; -import org.eclipse.jpt.core.jpa2.context.Cacheable2_0; -import org.eclipse.jpt.core.jpa2.context.CacheableHolder2_0; -import org.eclipse.jpt.core.resource.orm.v2_0.XmlCacheable_2_0; -import org.eclipse.jpt.eclipselink.core.context.EclipseLinkChangeTracking; -import org.eclipse.jpt.eclipselink.core.context.EclipseLinkCustomizer; -import org.eclipse.jpt.eclipselink.core.context.EclipseLinkReadOnly; -import org.eclipse.jpt.eclipselink.core.context.java.JavaEclipseLinkMappedSuperclass; -import org.eclipse.jpt.eclipselink.core.context.java.JavaEclipseLinkCaching; -import org.eclipse.jpt.eclipselink.core.context.orm.EclipseLinkConverterHolder; -import org.eclipse.jpt.eclipselink.core.context.orm.OrmEclipseLinkCaching; -import org.eclipse.jpt.eclipselink.core.context.orm.OrmEclipseLinkMappedSuperclass; -import org.eclipse.jpt.eclipselink.core.resource.orm.XmlCacheHolder; -import org.eclipse.jpt.eclipselink.core.resource.orm.XmlChangeTrackingHolder; -import org.eclipse.jpt.eclipselink.core.resource.orm.XmlConvertersHolder; -import org.eclipse.jpt.eclipselink.core.resource.orm.XmlCustomizerHolder; -import org.eclipse.jpt.eclipselink.core.resource.orm.XmlMappedSuperclass; -import org.eclipse.jpt.eclipselink.core.resource.orm.XmlReadOnly; -import org.eclipse.wst.validation.internal.provisional.core.IMessage; -import org.eclipse.wst.validation.internal.provisional.core.IReporter; - -public class OrmEclipseLinkMappedSuperclassImpl - extends AbstractOrmMappedSuperclass - implements - OrmEclipseLinkMappedSuperclass, - CacheableHolder2_0 -{ - protected final OrmEclipseLinkReadOnly readOnly; - - protected final OrmEclipseLinkCustomizer customizer; - - protected final OrmEclipseLinkChangeTracking changeTracking; - - protected final OrmEclipseLinkCaching caching; - - protected final OrmEclipseLinkConverterHolder converterHolder; - - - public OrmEclipseLinkMappedSuperclassImpl(OrmPersistentType parent, XmlMappedSuperclass resourceMapping) { - super(parent, resourceMapping); - this.readOnly = new OrmEclipseLinkReadOnly(this, (XmlReadOnly) this.resourceTypeMapping, getJavaReadOnly()); - this.customizer = new OrmEclipseLinkCustomizer(this, (XmlCustomizerHolder) this.resourceTypeMapping, getJavaCustomizer()); - this.changeTracking = new OrmEclipseLinkChangeTracking(this, (XmlChangeTrackingHolder) this.resourceTypeMapping, getJavaChangeTracking()); - this.caching = new OrmEclipseLinkCachingImpl(this, (XmlCacheHolder) this.resourceTypeMapping, (XmlCacheable_2_0) this.resourceTypeMapping, getJavaCaching()); - this.converterHolder = new OrmEclipseLinkConverterHolder(this, (XmlConvertersHolder) this.resourceTypeMapping); - } - - public OrmEclipseLinkCaching getCaching() { - return this.caching; - } - - public EclipseLinkCustomizer getCustomizer() { - return this.customizer; - } - - public EclipseLinkChangeTracking getChangeTracking() { - return this.changeTracking; - } - - public OrmEclipseLinkReadOnly getReadOnly() { - return this.readOnly; - } - - public EclipseLinkConverterHolder getConverterHolder() { - return this.converterHolder; - } - - public Cacheable2_0 getCacheable() { - return ((CacheableHolder2_0) getCaching()).getCacheable(); - } - - public boolean calculateDefaultCacheable() { - return ((CacheableHolder2_0) getCaching()).calculateDefaultCacheable(); - } - - // **************** resource-context interaction *************************** - - @Override - public void update() { - super.update(); - this.readOnly.update(getJavaReadOnly()); - this.customizer.update(getJavaCustomizer()); - this.changeTracking.update(getJavaChangeTracking()); - this.caching.update(getJavaCaching()); - this.converterHolder.update(); - } - - @Override - protected JavaEclipseLinkMappedSuperclass getJavaMappedSuperclassForDefaults() { - return (JavaEclipseLinkMappedSuperclass) super.getJavaMappedSuperclassForDefaults(); - } - - protected EclipseLinkReadOnly getJavaReadOnly() { - JavaEclipseLinkMappedSuperclass javaMappedSuperclass = getJavaMappedSuperclassForDefaults(); - return (javaMappedSuperclass == null) ? null : javaMappedSuperclass.getReadOnly(); - } - - protected EclipseLinkCustomizer getJavaCustomizer() { - JavaEclipseLinkMappedSuperclass javaMappedSuperclass = getJavaMappedSuperclassForDefaults(); - return (javaMappedSuperclass == null) ? null : javaMappedSuperclass.getCustomizer(); - } - - protected EclipseLinkChangeTracking getJavaChangeTracking() { - JavaEclipseLinkMappedSuperclass javaMappedSuperclass = getJavaMappedSuperclassForDefaults(); - return (javaMappedSuperclass == null) ? null : javaMappedSuperclass.getChangeTracking(); - } - - protected JavaEclipseLinkCaching getJavaCaching() { - JavaEclipseLinkMappedSuperclass javaMappedSuperclass = getJavaMappedSuperclassForDefaults(); - return (javaMappedSuperclass == null) ? null : javaMappedSuperclass.getCaching(); - } - - - // **************** validation ************************************** - - @Override - public void validate(List<IMessage> messages, IReporter reporter) { - super.validate(messages, reporter); - this.readOnly.validate(messages, reporter); - this.customizer.validate(messages, reporter); - this.changeTracking.validate(messages, reporter); - this.caching.validate(messages, reporter); - } -} diff --git a/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/orm/OrmEclipseLinkMutable.java b/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/orm/OrmEclipseLinkMutable.java deleted file mode 100644 index 3689979525..0000000000 --- a/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/orm/OrmEclipseLinkMutable.java +++ /dev/null @@ -1,107 +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.eclipselink.core.internal.context.orm; - -import org.eclipse.jpt.core.context.orm.OrmAttributeMapping; -import org.eclipse.jpt.core.internal.context.orm.AbstractOrmXmlContextNode; -import org.eclipse.jpt.core.utility.TextRange; -import org.eclipse.jpt.eclipselink.core.context.EclipseLinkMutable; -import org.eclipse.jpt.eclipselink.core.internal.context.java.JavaEclipseLinkPersistentAttribute; -import org.eclipse.jpt.eclipselink.core.internal.context.persistence.EclipseLinkPersistenceUnit; -import org.eclipse.jpt.eclipselink.core.resource.orm.XmlMutable; - -public class OrmEclipseLinkMutable extends AbstractOrmXmlContextNode - implements EclipseLinkMutable -{ - protected final XmlMutable resource; - - protected boolean defaultMutable; - - protected Boolean specifiedMutable; - - - public OrmEclipseLinkMutable(OrmAttributeMapping parent, XmlMutable resource) { - super(parent); - this.resource = resource; - this.defaultMutable = this.calculateDefaultMutable(); - this.specifiedMutable = this.getResourceMutable(); - } - - @Override - public EclipseLinkPersistenceUnit getPersistenceUnit() { - return (EclipseLinkPersistenceUnit) super.getPersistenceUnit(); - } - - protected OrmAttributeMapping getAttributeMapping() { - return (OrmAttributeMapping) getParent(); - } - - public boolean isMutable() { - return (this.specifiedMutable != null) ? this.specifiedMutable.booleanValue() : this.defaultMutable; - } - - public boolean isDefaultMutable() { - return this.defaultMutable; - } - - protected void setDefaultMutable(boolean newDefaultMutable) { - boolean oldDefaultMutable = this.defaultMutable; - this.defaultMutable = newDefaultMutable; - firePropertyChanged(DEFAULT_MUTABLE_PROPERTY, oldDefaultMutable, newDefaultMutable); - } - - public Boolean getSpecifiedMutable() { - return this.specifiedMutable; - } - - public void setSpecifiedMutable(Boolean newSpecifiedMutable) { - Boolean oldSpecifiedMutable = this.specifiedMutable; - this.specifiedMutable = newSpecifiedMutable; - this.resource.setMutable(newSpecifiedMutable); - firePropertyChanged(SPECIFIED_MUTABLE_PROPERTY, oldSpecifiedMutable, newSpecifiedMutable); - } - - protected void setSpecifiedMutable_(Boolean newSpecifiedMutable) { - Boolean oldSpecifiedMutable = this.specifiedMutable; - this.specifiedMutable = newSpecifiedMutable; - firePropertyChanged(SPECIFIED_MUTABLE_PROPERTY, oldSpecifiedMutable, newSpecifiedMutable); - } - - - // **************** initialize/update ************************************** - - protected void update() { - setDefaultMutable(this.calculateDefaultMutable()); - setSpecifiedMutable_(this.getResourceMutable()); - } - - protected Boolean getResourceMutable() { - return this.resource.getMutable(); - } - - protected boolean calculateDefaultMutable() { - JavaEclipseLinkPersistentAttribute javaAttribute = (JavaEclipseLinkPersistentAttribute) this.getAttributeMapping().getPersistentAttribute().getJavaPersistentAttribute(); - if (javaAttribute == null) { - return false; - } - if (javaAttribute.typeIsDateOrCalendar()) { - Boolean persistenceUnitDefaultMutable = getPersistenceUnit().getOptions().getTemporalMutable(); - return persistenceUnitDefaultMutable == null ? false : persistenceUnitDefaultMutable.booleanValue(); - } - return javaAttribute.typeIsSerializable(); - } - - - // **************** validation ************************************** - - public TextRange getValidationTextRange() { - return this.resource.getMutableTextRange(); - } -} diff --git a/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/orm/OrmEclipseLinkObjectTypeConverter.java b/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/orm/OrmEclipseLinkObjectTypeConverter.java deleted file mode 100644 index f0ecdf9341..0000000000 --- a/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/orm/OrmEclipseLinkObjectTypeConverter.java +++ /dev/null @@ -1,245 +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.eclipselink.core.internal.context.orm; - -import java.util.ArrayList; -import java.util.Iterator; -import java.util.List; -import java.util.ListIterator; -import org.eclipse.jpt.core.context.XmlContextNode; -import org.eclipse.jpt.eclipselink.core.context.EclipseLinkConversionValue; -import org.eclipse.jpt.eclipselink.core.context.EclipseLinkConverter; -import org.eclipse.jpt.eclipselink.core.context.EclipseLinkObjectTypeConverter; -import org.eclipse.jpt.eclipselink.core.resource.orm.EclipseLinkOrmFactory; -import org.eclipse.jpt.eclipselink.core.resource.orm.XmlConversionValue; -import org.eclipse.jpt.eclipselink.core.resource.orm.XmlObjectTypeConverter; -import org.eclipse.jpt.utility.internal.CollectionTools; -import org.eclipse.jpt.utility.internal.iterators.CloneIterator; -import org.eclipse.jpt.utility.internal.iterators.CloneListIterator; -import org.eclipse.jpt.utility.internal.iterators.TransformationListIterator; -import org.eclipse.wst.validation.internal.provisional.core.IMessage; -import org.eclipse.wst.validation.internal.provisional.core.IReporter; - -public class OrmEclipseLinkObjectTypeConverter extends OrmEclipseLinkConverter<XmlObjectTypeConverter> - implements EclipseLinkObjectTypeConverter -{ - private String dataType; - - private String objectType; - - private final List<OrmEclipseLinkConversionValue> conversionValues; - - private String defaultObjectValue; - - - public OrmEclipseLinkObjectTypeConverter(XmlContextNode parent) { - super(parent); - this.conversionValues = new ArrayList<OrmEclipseLinkConversionValue>(); - } - - public String getType() { - return EclipseLinkConverter.OBJECT_TYPE_CONVERTER; - } - - // **************** data type ********************************************** - - public String getDataType() { - return this.dataType; - } - - public void setDataType(String newDataType) { - String oldDataType = this.dataType; - this.dataType = newDataType; - getXmlResource().setDataType(newDataType); - firePropertyChanged(DATA_TYPE_PROPERTY, oldDataType, newDataType); - } - - protected void setDataType_(String newDataType) { - String oldDataType = this.dataType; - this.dataType = newDataType; - firePropertyChanged(DATA_TYPE_PROPERTY, oldDataType, newDataType); - } - - - // **************** object type ******************************************** - - public String getObjectType() { - return this.objectType; - } - - public void setObjectType(String newObjectType) { - String oldObjectType = this.objectType; - this.objectType = newObjectType; - getXmlResource().setObjectType(newObjectType); - firePropertyChanged(OBJECT_TYPE_PROPERTY, oldObjectType, newObjectType); - } - - protected void setObjectType_(String newObjectType) { - String oldObjectType = this.objectType; - this.objectType = newObjectType; - firePropertyChanged(OBJECT_TYPE_PROPERTY, oldObjectType, newObjectType); - } - - - // **************** conversion values ************************************** - - public ListIterator<OrmEclipseLinkConversionValue> conversionValues() { - return new CloneListIterator<OrmEclipseLinkConversionValue>(this.conversionValues); - } - - public int conversionValuesSize() { - return this.conversionValues.size(); - } - - public OrmEclipseLinkConversionValue addConversionValue(int index) { - XmlConversionValue resourceConversionValue = EclipseLinkOrmFactory.eINSTANCE.createXmlConversionValue(); - OrmEclipseLinkConversionValue contextConversionValue = buildConversionValue(resourceConversionValue); - this.conversionValues.add(index, contextConversionValue); - getXmlResource().getConversionValues().add(index, resourceConversionValue); - fireItemAdded(CONVERSION_VALUES_LIST, index, contextConversionValue); - return contextConversionValue; - } - - public OrmEclipseLinkConversionValue addConversionValue() { - return this.addConversionValue(this.conversionValues.size()); - } - - protected void addConversionValue(int index, OrmEclipseLinkConversionValue conversionValue) { - addItemToList(index, conversionValue, this.conversionValues, CONVERSION_VALUES_LIST); - } - - protected void addConversionValue(OrmEclipseLinkConversionValue conversionValue) { - this.addConversionValue(this.conversionValues.size(), conversionValue); - } - - public void removeConversionValue(int index) { - OrmEclipseLinkConversionValue removedJoinColumn = this.conversionValues.remove(index); - getXmlResource().getConversionValues().remove(index); - fireItemRemoved(CONVERSION_VALUES_LIST, index, removedJoinColumn); - } - - public void removeConversionValue(EclipseLinkConversionValue conversionValue) { - this.removeConversionValue(this.conversionValues.indexOf(conversionValue)); - } - - protected void removeConversionValue_(EclipseLinkConversionValue conversionValue) { - removeItemFromList(conversionValue, this.conversionValues, CONVERSION_VALUES_LIST); - } - - public void moveConversionValue(int targetIndex, int sourceIndex) { - CollectionTools.move(this.conversionValues, targetIndex, sourceIndex); - getXmlResource().getConversionValues().move(targetIndex, sourceIndex); - fireItemMoved(CONVERSION_VALUES_LIST, targetIndex, sourceIndex); - } - - public ListIterator<String> dataValues() { - return new TransformationListIterator<OrmEclipseLinkConversionValue, String>(conversionValues()) { - @Override - protected String transform(OrmEclipseLinkConversionValue next) { - return next.getDataValue(); - } - }; - } - - - // **************** default object value *********************************** - - public String getDefaultObjectValue() { - return this.defaultObjectValue; - } - - public void setDefaultObjectValue(String newDefaultObjectValue) { - String oldDefaultObjectValue = this.defaultObjectValue; - this.defaultObjectValue = newDefaultObjectValue; - getXmlResource().setDefaultObjectValue(newDefaultObjectValue); - firePropertyChanged(DEFAULT_OBJECT_VALUE_PROPERTY, oldDefaultObjectValue, newDefaultObjectValue); - } - - protected void setDefaultObjectValue_(String newDefaultObjectValue) { - String oldDefaultObjectValue = this.defaultObjectValue; - this.defaultObjectValue = newDefaultObjectValue; - firePropertyChanged(DEFAULT_OBJECT_VALUE_PROPERTY, oldDefaultObjectValue, newDefaultObjectValue); - } - - - // **************** resource interaction *********************************** - - @Override - protected void initialize(XmlObjectTypeConverter xmlResource) { - super.initialize(xmlResource); - this.dataType = this.getResourceDataType(); - this.objectType = this.getResourceObjectType(); - this.defaultObjectValue = this.getResourceDefaultObjectValue(); - this.initializeConversionValues(); - } - - protected void initializeConversionValues() { - for (XmlConversionValue resourceConversionValue : getXmlResource().getConversionValues()) { - this.conversionValues.add(buildConversionValue(resourceConversionValue)); - } - } - - @Override - public void update() { - super.update(); - setDataType_(getResourceDataType()); - setObjectType_(getResourceObjectType()); - setDefaultObjectValue_(getResourceDefaultObjectValue()); - updateConversionValues(); - } - - protected void updateConversionValues( ) { - // make a copy of the XML conversion values (to prevent ConcurrentModificationException) - Iterator<XmlConversionValue> xmlConversionValues = new CloneIterator<XmlConversionValue>(this.getXmlResource().getConversionValues()); - - for (Iterator<OrmEclipseLinkConversionValue> contextConversionValues = this.conversionValues(); contextConversionValues.hasNext(); ) { - OrmEclipseLinkConversionValue contextConversionValue = contextConversionValues.next(); - if (xmlConversionValues.hasNext()) { - contextConversionValue.update(xmlConversionValues.next()); - } - else { - removeConversionValue_(contextConversionValue); - } - } - - while (xmlConversionValues.hasNext()) { - addConversionValue(buildConversionValue(xmlConversionValues.next())); - } - } - - protected OrmEclipseLinkConversionValue buildConversionValue(XmlConversionValue resourceConversionValue) { - OrmEclipseLinkConversionValue conversionValue = new OrmEclipseLinkConversionValue(this); - conversionValue.initialize(resourceConversionValue); - return conversionValue; - } - - protected String getResourceDataType() { - return this.resourceConverter.getDataType(); - } - - protected String getResourceObjectType() { - return this.resourceConverter.getObjectType(); - } - - protected String getResourceDefaultObjectValue() { - return this.resourceConverter.getDefaultObjectValue(); - } - - - // **************** validation ********************************************* - - @Override - public void validate(List<IMessage> messages, IReporter reporter) { - super.validate(messages, reporter); - for (Iterator<OrmEclipseLinkConversionValue> stream = conversionValues(); stream.hasNext();) { - stream.next().validate(messages, reporter); - } - } -}
\ No newline at end of file diff --git a/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/orm/OrmEclipseLinkOneToManyMapping.java b/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/orm/OrmEclipseLinkOneToManyMapping.java deleted file mode 100644 index 53c7a09868..0000000000 --- a/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/orm/OrmEclipseLinkOneToManyMapping.java +++ /dev/null @@ -1,75 +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.eclipselink.core.internal.context.orm; - -import java.util.List; -import org.eclipse.jpt.core.context.orm.OrmPersistentAttribute; -import org.eclipse.jpt.core.context.orm.OrmRelationshipReference; -import org.eclipse.jpt.core.internal.context.orm.AbstractOrmOneToManyMapping; -import org.eclipse.jpt.eclipselink.core.context.EclipseLinkOneToManyMapping; -import org.eclipse.jpt.eclipselink.core.context.EclipseLinkJoinFetch; -import org.eclipse.jpt.eclipselink.core.context.EclipseLinkPrivateOwned; -import org.eclipse.jpt.eclipselink.core.resource.orm.XmlOneToMany; -import org.eclipse.wst.validation.internal.provisional.core.IMessage; -import org.eclipse.wst.validation.internal.provisional.core.IReporter; - -public class OrmEclipseLinkOneToManyMapping extends AbstractOrmOneToManyMapping<XmlOneToMany> - implements EclipseLinkOneToManyMapping -{ - protected OrmEclipseLinkPrivateOwned privateOwned; - - protected OrmEclipseLinkJoinFetch joinFetch; - - - public OrmEclipseLinkOneToManyMapping(OrmPersistentAttribute parent, XmlOneToMany resourceMapping) { - super(parent, resourceMapping); - this.privateOwned = new OrmEclipseLinkPrivateOwned(this, this.resourceAttributeMapping); - this.joinFetch = new OrmEclipseLinkJoinFetch(this, this.resourceAttributeMapping); - } - - - @Override - protected OrmRelationshipReference buildRelationshipReference() { - return new OrmEclipseLinkOneToManyRelationshipReference(this, this.resourceAttributeMapping); - } - - @Override - public OrmEclipseLinkOneToManyRelationshipReference getRelationshipReference() { - return (OrmEclipseLinkOneToManyRelationshipReference) super.getRelationshipReference(); - } - - public EclipseLinkPrivateOwned getPrivateOwned() { - return this.privateOwned; - } - - public EclipseLinkJoinFetch getJoinFetch() { - return this.joinFetch; - } - - - // **************** resource -> context ************************************ - - @Override - public void update() { - super.update(); - this.privateOwned.update(); - this.joinFetch.update(); - } - - - // **************** validation ********************************************* - - @Override - public void validate(List<IMessage> messages, IReporter reporter) { - super.validate(messages, reporter); - // TODO - private owned, join fetch validation - } -} diff --git a/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/orm/OrmEclipseLinkOneToManyRelationshipReference.java b/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/orm/OrmEclipseLinkOneToManyRelationshipReference.java deleted file mode 100644 index dbc2f8522d..0000000000 --- a/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/orm/OrmEclipseLinkOneToManyRelationshipReference.java +++ /dev/null @@ -1,163 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2009 Oracle. - * All rights reserved. This program and the accompanying materials are - * made available under the terms of the Eclipse Public License v1.0 which - * accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Oracle - initial API and implementation - *******************************************************************************/ -package org.eclipse.jpt.eclipselink.core.internal.context.orm; - -import java.util.List; -import org.eclipse.jpt.core.MappingKeys; -import org.eclipse.jpt.core.context.AttributeMapping; -import org.eclipse.jpt.core.context.JoinColumn; -import org.eclipse.jpt.core.context.JoiningStrategy; -import org.eclipse.jpt.core.context.orm.OrmJoinColumn; -import org.eclipse.jpt.core.context.orm.OrmJoinColumnEnabledRelationshipReference; -import org.eclipse.jpt.core.context.orm.OrmJoinColumnJoiningStrategy; -import org.eclipse.jpt.core.context.orm.OrmRelationshipReference; -import org.eclipse.jpt.core.internal.context.orm.AbstractOrmOneToManyRelationshipReference; -import org.eclipse.jpt.core.internal.context.orm.GenericOrmJoinColumnJoiningStrategy; -import org.eclipse.jpt.eclipselink.core.context.EclipseLinkOneToManyRelationshipReference; -import org.eclipse.jpt.eclipselink.core.resource.orm.XmlOneToMany; -import org.eclipse.jpt.utility.internal.CollectionTools; -import org.eclipse.wst.validation.internal.provisional.core.IMessage; -import org.eclipse.wst.validation.internal.provisional.core.IReporter; - -public class OrmEclipseLinkOneToManyRelationshipReference - extends AbstractOrmOneToManyRelationshipReference - implements EclipseLinkOneToManyRelationshipReference, - OrmJoinColumnEnabledRelationshipReference -{ - protected OrmJoinColumnJoiningStrategy joinColumnJoiningStrategy; - - - public OrmEclipseLinkOneToManyRelationshipReference( - OrmEclipseLinkOneToManyMapping parent, XmlOneToMany resource) { - super(parent, resource); - } - - - @Override - protected void initializeJoiningStrategies() { - this.joinColumnJoiningStrategy = buildJoinColumnJoiningStrategy(); - super.initializeJoiningStrategies(); - } - - protected OrmJoinColumnJoiningStrategy buildJoinColumnJoiningStrategy() { - return new GenericOrmJoinColumnJoiningStrategy(this, getResourceMapping()); - } - - @Override - public void initializeOn(OrmRelationshipReference newRelationshipReference) { - super.initializeOn(newRelationshipReference); - newRelationshipReference.initializeFromJoinColumnEnabledRelationshipReference(this); - } - - @Override - public void initializeFromJoinColumnEnabledRelationshipReference( - OrmJoinColumnEnabledRelationshipReference oldRelationshipReference) { - super.initializeFromJoinColumnEnabledRelationshipReference(oldRelationshipReference); - int index = 0; - for (JoinColumn joinColumn : - CollectionTools.iterable( - oldRelationshipReference.getJoinColumnJoiningStrategy().specifiedJoinColumns())) { - OrmJoinColumn newJoinColumn = getJoinColumnJoiningStrategy().addSpecifiedJoinColumn(index++); - newJoinColumn.initializeFrom(joinColumn); - } - } - - @Override - public XmlOneToMany getResourceMapping() { - return (XmlOneToMany) super.getResourceMapping(); - } - - @Override - protected JoiningStrategy calculatePredominantJoiningStrategy() { - if (this.mappedByJoiningStrategy.getMappedByAttribute() != null) { - return this.mappedByJoiningStrategy; - } - else if (this.joinColumnJoiningStrategy.hasSpecifiedJoinColumns()) { - return this.joinColumnJoiningStrategy; - } - else { - return this.joinTableJoiningStrategy; - } - } - - - // **************** mapped by ********************************************** - - @Override - public void setMappedByJoiningStrategy() { - super.setMappedByJoiningStrategy(); - this.joinColumnJoiningStrategy.removeStrategy(); - } - - @Override - public boolean mayBeMappedBy(AttributeMapping mappedByMapping) { - return super.mayBeMappedBy(mappedByMapping) || - mappedByMapping.getKey() == MappingKeys.ONE_TO_ONE_ATTRIBUTE_MAPPING_KEY; - } - - - // **************** join table ********************************************* - - @Override - public void setJoinTableJoiningStrategy() { - super.setJoinTableJoiningStrategy(); - this.joinColumnJoiningStrategy.removeStrategy(); - } - - @Override - public boolean mayHaveDefaultJoinTable() { - return super.mayHaveDefaultJoinTable() - && ! this.joinColumnJoiningStrategy.hasSpecifiedJoinColumns(); - } - - - // **************** join columns ******************************************* - - public OrmJoinColumnJoiningStrategy getJoinColumnJoiningStrategy() { - return this.joinColumnJoiningStrategy; - } - - public boolean usesJoinColumnJoiningStrategy() { - return getPredominantJoiningStrategy() == this.joinColumnJoiningStrategy; - } - - public void setJoinColumnJoiningStrategy() { - this.joinColumnJoiningStrategy.addStrategy(); - this.mappedByJoiningStrategy.removeStrategy(); - this.joinTableJoiningStrategy.removeStrategy(); - } - - public void unsetJoinColumnJoiningStrategy() { - this.joinColumnJoiningStrategy.removeStrategy(); - } - - public boolean mayHaveDefaultJoinColumn() { - return false; - } - - - // **************** resource => context ************************************ - - @Override - protected void updateJoiningStrategies() { - this.joinColumnJoiningStrategy.update(); - super.updateJoiningStrategies(); - } - - - // **************** Validation ********************************************* - - @Override - public void validate(List<IMessage> messages, IReporter reporter) { - super.validate(messages, reporter); - this.joinColumnJoiningStrategy.validate(messages, reporter); - } -} diff --git a/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/orm/OrmEclipseLinkOneToOneMapping.java b/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/orm/OrmEclipseLinkOneToOneMapping.java deleted file mode 100644 index 48556c6367..0000000000 --- a/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/orm/OrmEclipseLinkOneToOneMapping.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.eclipselink.core.internal.context.orm; - -import java.util.List; -import org.eclipse.jpt.core.context.orm.OrmPersistentAttribute; -import org.eclipse.jpt.core.internal.context.orm.AbstractOrmOneToOneMapping; -import org.eclipse.jpt.eclipselink.core.context.EclipseLinkOneToOneMapping; -import org.eclipse.jpt.eclipselink.core.context.EclipseLinkJoinFetch; -import org.eclipse.jpt.eclipselink.core.context.EclipseLinkPrivateOwned; -import org.eclipse.jpt.eclipselink.core.resource.orm.XmlOneToOne; -import org.eclipse.wst.validation.internal.provisional.core.IMessage; -import org.eclipse.wst.validation.internal.provisional.core.IReporter; - -public class OrmEclipseLinkOneToOneMapping extends AbstractOrmOneToOneMapping<XmlOneToOne> - implements EclipseLinkOneToOneMapping -{ - protected OrmEclipseLinkPrivateOwned privateOwned; - - protected OrmEclipseLinkJoinFetch joinFetch; - - - public OrmEclipseLinkOneToOneMapping(OrmPersistentAttribute parent, XmlOneToOne resourceMapping) { - super(parent, resourceMapping); - this.privateOwned = new OrmEclipseLinkPrivateOwned(this, this.resourceAttributeMapping); - this.joinFetch = new OrmEclipseLinkJoinFetch(this, this.resourceAttributeMapping); - } - - - public EclipseLinkPrivateOwned getPrivateOwned() { - return this.privateOwned; - } - - public EclipseLinkJoinFetch getJoinFetch() { - return this.joinFetch; - } - - - // **************** resource-context interaction *************************** - - @Override - public void update() { - super.update(); - this.privateOwned.update(); - this.joinFetch.update(); - } - - - // **************** validation ************************************** - - @Override - public void validate(List<IMessage> messages, IReporter reporter) { - super.validate(messages, reporter); - // TODO - private owned, join fetch validation - } -}
\ No newline at end of file diff --git a/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/orm/OrmEclipseLinkPersistentAttribute.java b/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/orm/OrmEclipseLinkPersistentAttribute.java deleted file mode 100644 index bf776d3ed2..0000000000 --- a/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/orm/OrmEclipseLinkPersistentAttribute.java +++ /dev/null @@ -1,38 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2009 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.eclipselink.core.internal.context.orm; - -import org.eclipse.jpt.core.context.AccessType; -import org.eclipse.jpt.core.context.orm.OrmPersistentType; -import org.eclipse.jpt.core.internal.context.orm.AbstractOrmPersistentAttribute; -import org.eclipse.jpt.core.resource.orm.XmlAttributeMapping; - - -public class OrmEclipseLinkPersistentAttribute extends AbstractOrmPersistentAttribute -{ - - public OrmEclipseLinkPersistentAttribute(OrmPersistentType parent, Owner owner, XmlAttributeMapping resourceMapping) { - super(parent, owner, resourceMapping); - } - - //****************** AccessHolder implementation ******************* - - /** - * EclipseLinkOrmPersistentAttribute does not support specified access (no access element in 1.0), so we return null - */ - public AccessType getSpecifiedAccess() { - return null; - } - - public void setSpecifiedAccess(AccessType newSpecifiedAccess) { - throw new UnsupportedOperationException("specifiedAccess is not supported for OrmEclipseLinkPersistentAttribute"); //$NON-NLS-1$ - } - -} diff --git a/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/orm/OrmEclipseLinkPrivateOwned.java b/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/orm/OrmEclipseLinkPrivateOwned.java deleted file mode 100644 index 882f7be169..0000000000 --- a/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/orm/OrmEclipseLinkPrivateOwned.java +++ /dev/null @@ -1,67 +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.eclipselink.core.internal.context.orm; - -import org.eclipse.jpt.core.context.orm.OrmAttributeMapping; -import org.eclipse.jpt.core.internal.context.orm.AbstractOrmXmlContextNode; -import org.eclipse.jpt.core.utility.TextRange; -import org.eclipse.jpt.eclipselink.core.context.EclipseLinkPrivateOwned; -import org.eclipse.jpt.eclipselink.core.resource.orm.XmlPrivateOwned; - -public class OrmEclipseLinkPrivateOwned extends AbstractOrmXmlContextNode - implements EclipseLinkPrivateOwned -{ - protected final XmlPrivateOwned resource; - - protected boolean privateOwned; - - - public OrmEclipseLinkPrivateOwned(OrmAttributeMapping parent, XmlPrivateOwned resource) { - super(parent); - this.resource = resource; - this.privateOwned = this.getResourcePrivateOwned(); - } - - - public boolean isPrivateOwned() { - return this.privateOwned; - } - - public void setPrivateOwned(boolean newPrivateOwned) { - boolean oldPrivateOwned = this.privateOwned; - this.privateOwned = newPrivateOwned; - this.resource.setPrivateOwned(newPrivateOwned); - firePropertyChanged(PRIVATE_OWNED_PROPERTY, oldPrivateOwned, newPrivateOwned); - } - - protected void setPrivateOwned_(boolean newPrivateOwned) { - boolean oldPrivateOwned = this.privateOwned; - this.privateOwned = newPrivateOwned; - firePropertyChanged(PRIVATE_OWNED_PROPERTY, oldPrivateOwned, newPrivateOwned); - } - - - // **************** initialize/update ************************************** - - protected void update() { - setPrivateOwned_(this.getResourcePrivateOwned()); - } - - protected boolean getResourcePrivateOwned() { - return this.resource.isPrivateOwned(); - } - - // **************** validation ************************************** - - public TextRange getValidationTextRange() { - return this.resource.getPrivateOwnedTextRange(); - } -} diff --git a/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/orm/OrmEclipseLinkReadOnly.java b/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/orm/OrmEclipseLinkReadOnly.java deleted file mode 100644 index 6469cb3c1b..0000000000 --- a/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/orm/OrmEclipseLinkReadOnly.java +++ /dev/null @@ -1,83 +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.eclipselink.core.internal.context.orm; - -import org.eclipse.jpt.core.context.orm.OrmTypeMapping; -import org.eclipse.jpt.core.internal.context.orm.AbstractOrmXmlContextNode; -import org.eclipse.jpt.core.utility.TextRange; -import org.eclipse.jpt.eclipselink.core.context.EclipseLinkReadOnly; -import org.eclipse.jpt.eclipselink.core.resource.orm.XmlReadOnly; - -public class OrmEclipseLinkReadOnly extends AbstractOrmXmlContextNode - implements EclipseLinkReadOnly -{ - protected final XmlReadOnly resource; - - protected boolean defaultReadOnly; - - protected Boolean specifiedReadOnly; - - - public OrmEclipseLinkReadOnly(OrmTypeMapping parent, XmlReadOnly resource, EclipseLinkReadOnly javaReadOnly) { - super(parent); - this.resource = resource; - this.defaultReadOnly = this.getJavaReadOnly(javaReadOnly); - this.specifiedReadOnly = this.getResourceReadOnly(); - } - - - public boolean isReadOnly() { - return (this.specifiedReadOnly == null) ? this.defaultReadOnly : this.specifiedReadOnly.booleanValue(); - } - - public boolean isDefaultReadOnly() { - return this.defaultReadOnly; - } - - public void setDefaultReadOnly(boolean newValue) { - boolean oldValue = this.defaultReadOnly; - this.defaultReadOnly = newValue; - firePropertyChanged(DEFAULT_READ_ONLY_PROPERTY, oldValue, newValue); - } - - public Boolean getSpecifiedReadOnly() { - return this.specifiedReadOnly; - } - - public void setSpecifiedReadOnly(Boolean newSpecifiedReadOnly) { - Boolean oldSpecifiedReadOnly = this.specifiedReadOnly; - this.specifiedReadOnly = newSpecifiedReadOnly; - this.resource.setReadOnly(newSpecifiedReadOnly); - firePropertyChanged(SPECIFIED_READ_ONLY_PROPERTY, oldSpecifiedReadOnly, newSpecifiedReadOnly); - } - - - // **************** initialize/update ************************************** - - protected void update(EclipseLinkReadOnly javaReadOnly) { - setDefaultReadOnly(this.getJavaReadOnly(javaReadOnly)); - setSpecifiedReadOnly(this.getResourceReadOnly()); - } - - protected boolean getJavaReadOnly(EclipseLinkReadOnly javaReadOnly) { - return (javaReadOnly == null) ? false : javaReadOnly.isReadOnly(); - } - - protected Boolean getResourceReadOnly() { - return this.resource.getReadOnly(); - } - - // **************** validation ************************************** - - public TextRange getValidationTextRange() { - return this.resource.getReadOnlyTextRange(); - } -} diff --git a/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/orm/OrmEclipseLinkStructConverter.java b/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/orm/OrmEclipseLinkStructConverter.java deleted file mode 100644 index 24f4b1f5ce..0000000000 --- a/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/orm/OrmEclipseLinkStructConverter.java +++ /dev/null @@ -1,100 +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.eclipselink.core.internal.context.orm; - -import java.util.List; -import org.eclipse.jpt.core.context.XmlContextNode; -import org.eclipse.jpt.eclipselink.core.context.EclipseLinkConverter; -import org.eclipse.jpt.eclipselink.core.context.EclipseLinkStructConverter; -import org.eclipse.jpt.eclipselink.core.resource.orm.XmlStructConverter; -import org.eclipse.wst.validation.internal.provisional.core.IMessage; -import org.eclipse.wst.validation.internal.provisional.core.IReporter; - -public class OrmEclipseLinkStructConverter extends OrmEclipseLinkConverter<XmlStructConverter> - implements EclipseLinkStructConverter -{ - private String converterClass; - - - public OrmEclipseLinkStructConverter(XmlContextNode parent) { - super(parent); - } - - public String getType() { - return EclipseLinkConverter.STRUCT_CONVERTER; - } - - - // **************** converter class **************************************** - - public String getConverterClass() { - return this.converterClass; - } - - public void setConverterClass(String newConverterClass) { - String oldConverterClass = this.converterClass; - this.converterClass = newConverterClass; - getXmlResource().setConverter(newConverterClass); - firePropertyChanged(CONVERTER_CLASS_PROPERTY, oldConverterClass, newConverterClass); - } - - protected void setConverterClass_(String newConverterClass) { - String oldConverterClass = this.converterClass; - this.converterClass = newConverterClass; - firePropertyChanged(CONVERTER_CLASS_PROPERTY, oldConverterClass, newConverterClass); - } - - - // **************** resource interaction *********************************** - - @Override - protected void initialize(XmlStructConverter xmlResource) { - super.initialize(xmlResource); - this.converterClass = getResourceConverterClass(); - } - - @Override - public void update() { - super.update(); - setConverterClass_(getResourceConverterClass()); - } - - protected String getResourceConverterClass() { - return this.resourceConverter.getConverter(); - } - - - // **************** validation ********************************************* - - @Override - public void validate(List<IMessage> messages, IReporter reporter) { - super.validate(messages, reporter); - validateConverterClass(messages); - } - -//TODO validate converter class - protected void validateConverterClass(List<IMessage> messages) { -// if (!getResourceConverter().implementsConverter()) { -// messages.add( -// DefaultEclipseLinkJpaValidationMessages.buildMessage( -// IMessage.HIGH_SEVERITY, -// EclipseLinkJpaValidationMessages.CONVERTER_CLASS_IMPLEMENTS_CONVERTER, -// new String[] {this.converterClass}, -// this, -// getConverterClassTextRange() -// ) -// ); -// } - } - -// public TextRange getConverterClassTextRange() { -// return getResourceConverter().getClassNameTextRange(); -// } -}
\ No newline at end of file diff --git a/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/orm/OrmEclipseLinkTransformationMapping.java b/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/orm/OrmEclipseLinkTransformationMapping.java deleted file mode 100644 index c20cde44d5..0000000000 --- a/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/orm/OrmEclipseLinkTransformationMapping.java +++ /dev/null @@ -1,48 +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.eclipselink.core.internal.context.orm; - -import org.eclipse.jpt.core.context.orm.OrmAttributeMapping; -import org.eclipse.jpt.core.context.orm.OrmPersistentAttribute; -import org.eclipse.jpt.core.internal.context.orm.AbstractOrmAttributeMapping; -import org.eclipse.jpt.eclipselink.core.EclipseLinkMappingKeys; -import org.eclipse.jpt.eclipselink.core.context.EclipseLinkTransformationMapping; -import org.eclipse.jpt.eclipselink.core.resource.orm.Attributes; -import org.eclipse.jpt.eclipselink.core.resource.orm.XmlTransformation; - -public class OrmEclipseLinkTransformationMapping - extends AbstractOrmAttributeMapping<XmlTransformation> - implements EclipseLinkTransformationMapping -{ - public OrmEclipseLinkTransformationMapping(OrmPersistentAttribute parent, XmlTransformation resourceMapping) { - super(parent, resourceMapping); - } - - public void initializeOn(OrmAttributeMapping newMapping) { - newMapping.initializeFromOrmAttributeMapping(this); - } - - public String getKey() { - return EclipseLinkMappingKeys.TRANSFORMATION_ATTRIBUTE_MAPPING_KEY; - } - - public void addToResourceModel(org.eclipse.jpt.core.resource.orm.Attributes resourceAttributes) { - ((Attributes) resourceAttributes).getTransformations().add(this.resourceAttributeMapping); - } - - public void removeFromResourceModel(org.eclipse.jpt.core.resource.orm.Attributes resourceAttributes) { - ((Attributes) resourceAttributes).getTransformations().remove(this.resourceAttributeMapping); - } - - - public int getXmlSequence() { - return 85; - } -} diff --git a/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/orm/OrmEclipseLinkTransformationMappingDefinition.java b/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/orm/OrmEclipseLinkTransformationMappingDefinition.java deleted file mode 100644 index 7fec83b655..0000000000 --- a/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/orm/OrmEclipseLinkTransformationMappingDefinition.java +++ /dev/null @@ -1,76 +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.eclipselink.core.internal.context.orm; - -import org.eclipse.emf.ecore.EFactory; -import org.eclipse.jpt.core.context.java.JavaAttributeMapping; -import org.eclipse.jpt.core.context.orm.OrmAttributeMapping; -import org.eclipse.jpt.core.context.orm.OrmAttributeMappingDefinition; -import org.eclipse.jpt.core.context.orm.OrmPersistentAttribute; -import org.eclipse.jpt.core.context.orm.OrmTypeMapping; -import org.eclipse.jpt.core.context.orm.OrmXmlContextNodeFactory; -import org.eclipse.jpt.core.resource.orm.XmlAttributeMapping; -import org.eclipse.jpt.core.resource.xml.EmfTools; -import org.eclipse.jpt.eclipselink.core.EclipseLinkMappingKeys; -import org.eclipse.jpt.eclipselink.core.internal.context.java.JavaEclipseLinkTransformationMapping; -import org.eclipse.jpt.eclipselink.core.resource.orm.EclipseLinkOrmPackage; -import org.eclipse.jpt.eclipselink.core.resource.orm.XmlTransformation; - -public class OrmEclipseLinkTransformationMappingDefinition - implements OrmAttributeMappingDefinition -{ - // singleton - private static final OrmEclipseLinkTransformationMappingDefinition INSTANCE = - new OrmEclipseLinkTransformationMappingDefinition(); - - - /** - * Return the singleton - */ - public static OrmAttributeMappingDefinition instance() { - return INSTANCE; - } - - - /** - * Enforce singleton usage - */ - private OrmEclipseLinkTransformationMappingDefinition() { - super(); - } - - - public String getKey() { - return EclipseLinkMappingKeys.TRANSFORMATION_ATTRIBUTE_MAPPING_KEY; - } - - public XmlAttributeMapping buildResourceMapping(EFactory factory) { - return EmfTools.create( - factory, - EclipseLinkOrmPackage.eINSTANCE.getXmlTransformation(), - XmlTransformation.class); - } - - public OrmAttributeMapping buildContextMapping( - OrmPersistentAttribute parent, - XmlAttributeMapping resourceMapping, - OrmXmlContextNodeFactory factory) { - return ((EclipseLinkOrmXmlContextNodeFactory) factory). - buildOrmEclipseLinkTransformationMapping(parent, (XmlTransformation) resourceMapping); - } - - public XmlAttributeMapping buildVirtualResourceMapping( - OrmTypeMapping ormTypeMapping, - JavaAttributeMapping javaAttributeMapping, - OrmXmlContextNodeFactory factory) { - return ((EclipseLinkOrmXmlContextNodeFactory) factory). - buildVirtualEclipseLinkXmlTransformation(ormTypeMapping, (JavaEclipseLinkTransformationMapping) javaAttributeMapping); - } -} diff --git a/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/orm/OrmEclipseLinkTypeConverter.java b/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/orm/OrmEclipseLinkTypeConverter.java deleted file mode 100644 index 5d94c4ecde..0000000000 --- a/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/orm/OrmEclipseLinkTypeConverter.java +++ /dev/null @@ -1,96 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2008, 2009 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.eclipselink.core.internal.context.orm; - -import org.eclipse.jpt.core.context.XmlContextNode; -import org.eclipse.jpt.eclipselink.core.context.EclipseLinkConverter; -import org.eclipse.jpt.eclipselink.core.context.EclipseLinkTypeConverter; -import org.eclipse.jpt.eclipselink.core.resource.orm.XmlTypeConverter; - -public class OrmEclipseLinkTypeConverter extends OrmEclipseLinkConverter<XmlTypeConverter> - implements EclipseLinkTypeConverter -{ - private String dataType; - - private String objectType; - - - public OrmEclipseLinkTypeConverter(XmlContextNode parent) { - super(parent); - } - - public String getType() { - return EclipseLinkConverter.TYPE_CONVERTER; - } - - // **************** data type ********************************************** - - public String getDataType() { - return this.dataType; - } - - public void setDataType(String newDataType) { - String oldDataType = this.dataType; - this.dataType = newDataType; - getXmlResource().setDataType(newDataType); - firePropertyChanged(DATA_TYPE_PROPERTY, oldDataType, newDataType); - } - - protected void setDataType_(String newDataType) { - String oldDataType = this.dataType; - this.dataType = newDataType; - firePropertyChanged(DATA_TYPE_PROPERTY, oldDataType, newDataType); - } - - - // **************** object type ******************************************** - - public String getObjectType() { - return this.objectType; - } - - public void setObjectType(String newObjectType) { - String oldObjectType = this.objectType; - this.objectType = newObjectType; - getXmlResource().setObjectType(newObjectType); - firePropertyChanged(OBJECT_TYPE_PROPERTY, oldObjectType, newObjectType); - } - - protected void setObjectType_(String newObjectType) { - String oldObjectType = this.objectType; - this.objectType = newObjectType; - firePropertyChanged(OBJECT_TYPE_PROPERTY, oldObjectType, newObjectType); - } - - - // **************** resource interaction *********************************** - - @Override - protected void initialize(XmlTypeConverter xmlResource) { - super.initialize(xmlResource); - this.dataType = getResourceDataType(); - this.objectType = getResourceObjectType(); - } - - @Override - public void update() { - super.update(); - setDataType_(getResourceDataType()); - setObjectType_(getResourceObjectType()); - } - - protected String getResourceDataType() { - return this.resourceConverter.getDataType(); - } - - protected String getResourceObjectType() { - return this.resourceConverter.getObjectType(); - } -}
\ No newline at end of file diff --git a/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/orm/OrmEclipseLinkVariableOneToOneMapping.java b/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/orm/OrmEclipseLinkVariableOneToOneMapping.java deleted file mode 100644 index 5550c36f47..0000000000 --- a/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/orm/OrmEclipseLinkVariableOneToOneMapping.java +++ /dev/null @@ -1,47 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2009 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.eclipselink.core.internal.context.orm; - -import org.eclipse.jpt.core.context.orm.OrmAttributeMapping; -import org.eclipse.jpt.core.context.orm.OrmPersistentAttribute; -import org.eclipse.jpt.core.internal.context.orm.AbstractOrmAttributeMapping; -import org.eclipse.jpt.eclipselink.core.EclipseLinkMappingKeys; -import org.eclipse.jpt.eclipselink.core.context.EclipseLinkVariableOneToOneMapping; -import org.eclipse.jpt.eclipselink.core.resource.orm.Attributes; -import org.eclipse.jpt.eclipselink.core.resource.orm.XmlVariableOneToOne; - -public class OrmEclipseLinkVariableOneToOneMapping - extends AbstractOrmAttributeMapping<XmlVariableOneToOne> - implements EclipseLinkVariableOneToOneMapping -{ - public OrmEclipseLinkVariableOneToOneMapping(OrmPersistentAttribute parent, XmlVariableOneToOne resourceMapping) { - super(parent, resourceMapping); - } - - public void initializeOn(OrmAttributeMapping newMapping) { - newMapping.initializeFromOrmAttributeMapping(this); - } - - public String getKey() { - return EclipseLinkMappingKeys.VARIABLE_ONE_TO_ONE_ATTRIBUTE_MAPPING_KEY; - } - - public void addToResourceModel(org.eclipse.jpt.core.resource.orm.Attributes resourceAttributes) { - ((Attributes) resourceAttributes).getVariableOneToOnes().add(this.resourceAttributeMapping); - } - - public void removeFromResourceModel(org.eclipse.jpt.core.resource.orm.Attributes resourceAttributes) { - ((Attributes) resourceAttributes).getVariableOneToOnes().remove(this.resourceAttributeMapping); - } - - public int getXmlSequence() { - return 65; - } -} diff --git a/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/orm/OrmEclipseLinkVariableOneToOneMappingDefinition.java b/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/orm/OrmEclipseLinkVariableOneToOneMappingDefinition.java deleted file mode 100644 index c1b0a9a1a3..0000000000 --- a/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/orm/OrmEclipseLinkVariableOneToOneMappingDefinition.java +++ /dev/null @@ -1,76 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2009 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.eclipselink.core.internal.context.orm; - -import org.eclipse.emf.ecore.EFactory; -import org.eclipse.jpt.core.context.java.JavaAttributeMapping; -import org.eclipse.jpt.core.context.orm.OrmAttributeMapping; -import org.eclipse.jpt.core.context.orm.OrmAttributeMappingDefinition; -import org.eclipse.jpt.core.context.orm.OrmPersistentAttribute; -import org.eclipse.jpt.core.context.orm.OrmTypeMapping; -import org.eclipse.jpt.core.context.orm.OrmXmlContextNodeFactory; -import org.eclipse.jpt.core.resource.orm.XmlAttributeMapping; -import org.eclipse.jpt.core.resource.xml.EmfTools; -import org.eclipse.jpt.eclipselink.core.EclipseLinkMappingKeys; -import org.eclipse.jpt.eclipselink.core.internal.context.java.JavaEclipseLinkVariableOneToOneMapping; -import org.eclipse.jpt.eclipselink.core.resource.orm.EclipseLinkOrmPackage; -import org.eclipse.jpt.eclipselink.core.resource.orm.XmlVariableOneToOne; - -public class OrmEclipseLinkVariableOneToOneMappingDefinition - implements OrmAttributeMappingDefinition -{ - // singleton - private static final OrmEclipseLinkVariableOneToOneMappingDefinition INSTANCE = - new OrmEclipseLinkVariableOneToOneMappingDefinition(); - - - /** - * Return the singleton - */ - public static OrmAttributeMappingDefinition instance() { - return INSTANCE; - } - - - /** - * Enforce singleton usage - */ - private OrmEclipseLinkVariableOneToOneMappingDefinition() { - super(); - } - - - public String getKey() { - return EclipseLinkMappingKeys.VARIABLE_ONE_TO_ONE_ATTRIBUTE_MAPPING_KEY; - } - - public XmlAttributeMapping buildResourceMapping(EFactory factory) { - return EmfTools.create( - factory, - EclipseLinkOrmPackage.eINSTANCE.getXmlVariableOneToOne(), - XmlVariableOneToOne.class); - } - - public OrmAttributeMapping buildContextMapping( - OrmPersistentAttribute parent, - XmlAttributeMapping resourceMapping, - OrmXmlContextNodeFactory factory) { - return ((EclipseLinkOrmXmlContextNodeFactory) factory). - buildOrmEclipseLinkVariableOneToOneMapping(parent, (XmlVariableOneToOne) resourceMapping); - } - - public XmlAttributeMapping buildVirtualResourceMapping( - OrmTypeMapping ormTypeMapping, - JavaAttributeMapping javaAttributeMapping, - OrmXmlContextNodeFactory factory) { - return ((EclipseLinkOrmXmlContextNodeFactory) factory). - buildVirtualEclipseLinkXmlVariableOneToOne(ormTypeMapping, (JavaEclipseLinkVariableOneToOneMapping) javaAttributeMapping); - } -} diff --git a/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/orm/OrmEclipseLinkVersionMapping.java b/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/orm/OrmEclipseLinkVersionMapping.java deleted file mode 100644 index 30a9db0b12..0000000000 --- a/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/orm/OrmEclipseLinkVersionMapping.java +++ /dev/null @@ -1,78 +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.eclipselink.core.internal.context.orm; - -import java.util.List; -import org.eclipse.jpt.core.context.orm.OrmConverter; -import org.eclipse.jpt.core.context.orm.OrmPersistentAttribute; -import org.eclipse.jpt.core.internal.context.orm.AbstractOrmVersionMapping; -import org.eclipse.jpt.eclipselink.core.context.EclipseLinkConvert; -import org.eclipse.jpt.eclipselink.core.context.EclipseLinkVersionMapping; -import org.eclipse.jpt.eclipselink.core.context.EclipseLinkMutable; -import org.eclipse.jpt.eclipselink.core.resource.orm.XmlVersion; -import org.eclipse.wst.validation.internal.provisional.core.IMessage; -import org.eclipse.wst.validation.internal.provisional.core.IReporter; - -public class OrmEclipseLinkVersionMapping extends AbstractOrmVersionMapping<XmlVersion> - implements EclipseLinkVersionMapping -{ - protected OrmEclipseLinkMutable mutable; - - - public OrmEclipseLinkVersionMapping(OrmPersistentAttribute parent, XmlVersion resourceMapping) { - super(parent, resourceMapping); - this.mutable = new OrmEclipseLinkMutable(this, this.resourceAttributeMapping); - } - - - public EclipseLinkMutable getMutable() { - return this.mutable; - } - - @Override - protected OrmConverter buildSpecifiedConverter(String converterType) { - OrmConverter ormConverter = super.buildSpecifiedConverter(converterType); - if (ormConverter != null) { - return ormConverter; - } - if (converterType == EclipseLinkConvert.ECLIPSE_LINK_CONVERTER) { - return new OrmEclipseLinkConvert(this, this.resourceAttributeMapping); - } - return null; - } - - @Override - protected String getResourceConverterType() { - //check @Convert first, this is the order that EclipseLink searches - if (this.resourceAttributeMapping.getConvert() != null) { - return EclipseLinkConvert.ECLIPSE_LINK_CONVERTER; - } - return super.getResourceConverterType(); - } - - // **************** resource-context interaction *************************** - - - @Override - public void update() { - super.update(); - this.mutable.update(); - } - - - // **************** validation ************************************** - - @Override - public void validate(List<IMessage> messages, IReporter reporter) { - super.validate(messages, reporter); - // TODO - mutable validation - } -} diff --git a/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/orm/VirtualEclipseLinkXmlBasic.java b/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/orm/VirtualEclipseLinkXmlBasic.java deleted file mode 100644 index 54d8a8b836..0000000000 --- a/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/orm/VirtualEclipseLinkXmlBasic.java +++ /dev/null @@ -1,284 +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.eclipselink.core.internal.context.orm; - -import org.eclipse.emf.common.util.EList; -import org.eclipse.jpt.core.context.java.JavaBasicMapping; -import org.eclipse.jpt.core.context.orm.OrmTypeMapping; -import org.eclipse.jpt.core.internal.context.orm.VirtualXmlBasic; -import org.eclipse.jpt.core.resource.orm.EnumType; -import org.eclipse.jpt.core.resource.orm.FetchType; -import org.eclipse.jpt.core.resource.orm.TemporalType; -import org.eclipse.jpt.core.resource.orm.XmlColumn; -import org.eclipse.jpt.core.utility.TextRange; -import org.eclipse.jpt.eclipselink.core.context.EclipseLinkConvert; -import org.eclipse.jpt.eclipselink.core.context.EclipseLinkCustomConverter; -import org.eclipse.jpt.eclipselink.core.context.EclipseLinkBasicMapping; -import org.eclipse.jpt.eclipselink.core.context.EclipseLinkConverter; -import org.eclipse.jpt.eclipselink.core.context.EclipseLinkObjectTypeConverter; -import org.eclipse.jpt.eclipselink.core.context.EclipseLinkStructConverter; -import org.eclipse.jpt.eclipselink.core.context.EclipseLinkTypeConverter; -import org.eclipse.jpt.eclipselink.core.resource.orm.XmlAccessMethods; -import org.eclipse.jpt.eclipselink.core.resource.orm.XmlBasic; -import org.eclipse.jpt.eclipselink.core.resource.orm.XmlConverter; -import org.eclipse.jpt.eclipselink.core.resource.orm.XmlObjectTypeConverter; -import org.eclipse.jpt.eclipselink.core.resource.orm.XmlProperty; -import org.eclipse.jpt.eclipselink.core.resource.orm.XmlStructConverter; -import org.eclipse.jpt.eclipselink.core.resource.orm.XmlTypeConverter; - -/** - * VirtualBasic is an implementation of Basic used when there is - * no tag in the orm.xml and an underlying javaBasicMapping exists. - */ -public class VirtualEclipseLinkXmlBasic extends XmlBasic -{ - protected OrmTypeMapping ormTypeMapping; - - protected final JavaBasicMapping javaAttributeMapping; - - protected final VirtualXmlBasic virtualXmlBasic; - - public VirtualEclipseLinkXmlBasic(OrmTypeMapping ormTypeMapping, JavaBasicMapping javaBasicMapping) { - super(); - this.ormTypeMapping = ormTypeMapping; - this.javaAttributeMapping = javaBasicMapping; - this.virtualXmlBasic = new VirtualXmlBasic(ormTypeMapping, javaBasicMapping); - } - - public boolean isOrmMetadataComplete() { - return this.ormTypeMapping.isMetadataComplete(); - } - - @Override - public String getMappingKey() { - return this.virtualXmlBasic.getMappingKey(); - } - - @Override - public String getName() { - return this.virtualXmlBasic.getName(); - } - - @Override - public void setName(String newName) { - this.virtualXmlBasic.setName(newName); - } - - @Override - public TextRange getNameTextRange() { - return this.virtualXmlBasic.getNameTextRange(); - } - - @Override - public XmlColumn getColumn() { - return this.virtualXmlBasic.getColumn(); - } - - @Override - public void setColumn(XmlColumn value) { - this.virtualXmlBasic.setColumn(value); - } - - @Override - public FetchType getFetch() { - return this.virtualXmlBasic.getFetch(); - } - - @Override - public void setFetch(FetchType newFetch) { - this.virtualXmlBasic.setFetch(newFetch); - } - - @Override - public Boolean getOptional() { - return this.virtualXmlBasic.getOptional(); - } - - @Override - public void setOptional(Boolean newOptional) { - this.virtualXmlBasic.setOptional(newOptional); - } - - @Override - public boolean isLob() { - return this.virtualXmlBasic.isLob(); - } - - @Override - public void setLob(boolean newLob) { - this.virtualXmlBasic.setLob(newLob); - } - - @Override - public TextRange getLobTextRange() { - return this.virtualXmlBasic.getLobTextRange(); - } - - @Override - public TemporalType getTemporal() { - return this.virtualXmlBasic.getTemporal(); - } - - @Override - public void setTemporal(TemporalType setTemporal){ - this.virtualXmlBasic.setTemporal(setTemporal); - } - - @Override - public TextRange getTemporalTextRange() { - return this.virtualXmlBasic.getTemporalTextRange(); - } - - @Override - public EnumType getEnumerated() { - return this.virtualXmlBasic.getEnumerated(); - } - - @Override - public void setEnumerated(EnumType setEnumerated) { - this.virtualXmlBasic.setEnumerated(setEnumerated); - } - - @Override - public TextRange getEnumeratedTextRange() { - return null; - } - - @Override - public Boolean getMutable() { - if (isOrmMetadataComplete()) { - return Boolean.valueOf(((EclipseLinkBasicMapping) this.javaAttributeMapping).getMutable().isDefaultMutable()); - } - return Boolean.valueOf(((EclipseLinkBasicMapping) this.javaAttributeMapping).getMutable().isMutable()); - } - - @Override - public void setMutable(Boolean value) { - throw new UnsupportedOperationException("cannot set values on a virtual mapping"); //$NON-NLS-1$ - } - - @Override - public TextRange getMutableTextRange() { - return null; - } - - @Override - public String getConvert() { - if (isOrmMetadataComplete()) { - return null; - } - if (this.javaAttributeMapping.getConverter().getType() == EclipseLinkConvert.ECLIPSE_LINK_CONVERTER) { - return ((EclipseLinkConvert) this.javaAttributeMapping.getConverter()).getConverterName(); - } - return null; - } - - @Override - public void setConvert(String value) { - throw new UnsupportedOperationException("cannot set values on a virtual mapping"); //$NON-NLS-1$ - } - - @Override - public TextRange getConvertTextRange() { - return null; - } - - @Override - public XmlConverter getConverter() { - if (isOrmMetadataComplete()) { - return null; - } - if (this.javaAttributeMapping.getConverter().getType() == EclipseLinkConvert.ECLIPSE_LINK_CONVERTER) { - EclipseLinkConverter converter = ((EclipseLinkConvert) this.javaAttributeMapping.getConverter()).getConverter(); - if (converter != null && converter.getType() == EclipseLinkConverter.CUSTOM_CONVERTER) { - return new VirtualEclipseLinkXmlConverter(this.ormTypeMapping, (EclipseLinkCustomConverter) ((EclipseLinkConvert) this.javaAttributeMapping.getConverter()).getConverter()); - } - } - return null; - } - - @Override - public void setConverter(XmlConverter value) { - throw new UnsupportedOperationException("cannot set values on a virtual mapping"); //$NON-NLS-1$ - } - - @Override - public XmlObjectTypeConverter getObjectTypeConverter() { - if (isOrmMetadataComplete()) { - return null; - } - if (this.javaAttributeMapping.getConverter().getType() == EclipseLinkConvert.ECLIPSE_LINK_CONVERTER) { - EclipseLinkConverter converter = ((EclipseLinkConvert) this.javaAttributeMapping.getConverter()).getConverter(); - if (converter != null && converter.getType() == EclipseLinkConverter.OBJECT_TYPE_CONVERTER) { - return new VirtualEclipseLinkXmlObjectTypeConverter(this.ormTypeMapping, (EclipseLinkObjectTypeConverter) ((EclipseLinkConvert) this.javaAttributeMapping.getConverter()).getConverter()); - } - } - return null; - } - - @Override - public void setObjectTypeConverter(XmlObjectTypeConverter value) { - throw new UnsupportedOperationException("cannot set values on a virtual mapping"); //$NON-NLS-1$ - } - - @Override - public XmlStructConverter getStructConverter() { - if (isOrmMetadataComplete()) { - return null; - } - if (this.javaAttributeMapping.getConverter().getType() == EclipseLinkConvert.ECLIPSE_LINK_CONVERTER) { - EclipseLinkConverter converter = ((EclipseLinkConvert) this.javaAttributeMapping.getConverter()).getConverter(); - if (converter != null && converter.getType() == EclipseLinkConverter.STRUCT_CONVERTER) { - return new VirtualEclipseLinkXmlStructConverter(this.ormTypeMapping, (EclipseLinkStructConverter) ((EclipseLinkConvert) this.javaAttributeMapping.getConverter()).getConverter()); - } - } - return null; - } - - @Override - public void setStructConverter(XmlStructConverter value) { - throw new UnsupportedOperationException("cannot set values on a virtual mapping"); //$NON-NLS-1$ - } - - @Override - public XmlTypeConverter getTypeConverter() { - if (isOrmMetadataComplete()) { - return null; - } - if (this.javaAttributeMapping.getConverter().getType() == EclipseLinkConvert.ECLIPSE_LINK_CONVERTER) { - EclipseLinkConverter converter = ((EclipseLinkConvert) this.javaAttributeMapping.getConverter()).getConverter(); - if (converter != null && converter.getType() == EclipseLinkConverter.TYPE_CONVERTER) { - return new VirtualEclipseLinkXmlTypeConverter(this.ormTypeMapping, (EclipseLinkTypeConverter) ((EclipseLinkConvert) this.javaAttributeMapping.getConverter()).getConverter()); - } - } - return null; - } - - @Override - public void setTypeConverter(XmlTypeConverter value) { - throw new UnsupportedOperationException("cannot set values on a virtual mapping"); //$NON-NLS-1$ - } - - @Override - public XmlAccessMethods getAccessMethods() { - return null; - } - - @Override - public void setAccessMethods(XmlAccessMethods value) { - throw new UnsupportedOperationException("cannot set values on a virtual mapping"); //$NON-NLS-1$ - } - - @Override - public EList<XmlProperty> getProperties() { - // TODO get from java annotations - return null; - } -} diff --git a/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/orm/VirtualEclipseLinkXmlBasicCollection.java b/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/orm/VirtualEclipseLinkXmlBasicCollection.java deleted file mode 100644 index ae8c31a6ab..0000000000 --- a/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/orm/VirtualEclipseLinkXmlBasicCollection.java +++ /dev/null @@ -1,81 +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.eclipselink.core.internal.context.orm; - -import org.eclipse.emf.common.util.EList; -import org.eclipse.jpt.core.context.orm.OrmTypeMapping; -import org.eclipse.jpt.core.internal.context.orm.VirtualXmlAttributeMapping; -import org.eclipse.jpt.core.utility.TextRange; -import org.eclipse.jpt.eclipselink.core.internal.context.java.JavaEclipseLinkBasicCollectionMapping; -import org.eclipse.jpt.eclipselink.core.resource.orm.XmlAccessMethods; -import org.eclipse.jpt.eclipselink.core.resource.orm.XmlBasicCollection; -import org.eclipse.jpt.eclipselink.core.resource.orm.XmlProperty; - -/** - * VirtualBasic is an implementation of Basic used when there is - * no tag in the orm.xml and an underlying javaBasicMapping exists. - */ -public class VirtualEclipseLinkXmlBasicCollection extends XmlBasicCollection -{ - protected OrmTypeMapping ormTypeMapping; - - protected final JavaEclipseLinkBasicCollectionMapping javaAttributeMapping; - - protected final VirtualXmlAttributeMapping virtualXmlAttributeMapping; - - public VirtualEclipseLinkXmlBasicCollection(OrmTypeMapping ormTypeMapping, JavaEclipseLinkBasicCollectionMapping javaBasicCollectionMapping) { - super(); - this.ormTypeMapping = ormTypeMapping; - this.javaAttributeMapping = javaBasicCollectionMapping; - this.virtualXmlAttributeMapping = new VirtualXmlAttributeMapping(ormTypeMapping, javaBasicCollectionMapping); - } - - public boolean isOrmMetadataComplete() { - return this.ormTypeMapping.isMetadataComplete(); - } - - @Override - public String getMappingKey() { - return this.virtualXmlAttributeMapping.getMappingKey(); - } - - @Override - public String getName() { - return this.virtualXmlAttributeMapping.getName(); - } - - @Override - public void setName(String newName) { - this.virtualXmlAttributeMapping.setName(newName); - } - - @Override - public TextRange getNameTextRange() { - return this.virtualXmlAttributeMapping.getNameTextRange(); - } - - @Override - public XmlAccessMethods getAccessMethods() { - return null; - } - - @Override - public void setAccessMethods(XmlAccessMethods value) { - throw new UnsupportedOperationException("cannot set values on a virtual mapping"); //$NON-NLS-1$ - } - - - @Override - public EList<XmlProperty> getProperties() { - // TODO get from java annotations - return null; - } - -} diff --git a/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/orm/VirtualEclipseLinkXmlBasicMap.java b/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/orm/VirtualEclipseLinkXmlBasicMap.java deleted file mode 100644 index 5acbb242d5..0000000000 --- a/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/orm/VirtualEclipseLinkXmlBasicMap.java +++ /dev/null @@ -1,81 +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.eclipselink.core.internal.context.orm; - -import org.eclipse.emf.common.util.EList; -import org.eclipse.jpt.core.context.orm.OrmTypeMapping; -import org.eclipse.jpt.core.internal.context.orm.VirtualXmlAttributeMapping; -import org.eclipse.jpt.core.utility.TextRange; -import org.eclipse.jpt.eclipselink.core.internal.context.java.JavaEclipseLinkBasicMapMapping; -import org.eclipse.jpt.eclipselink.core.resource.orm.XmlAccessMethods; -import org.eclipse.jpt.eclipselink.core.resource.orm.XmlBasicMap; -import org.eclipse.jpt.eclipselink.core.resource.orm.XmlProperty; - -/** - * VirtualBasic is an implementation of Basic used when there is - * no tag in the orm.xml and an underlying javaBasicMapping exists. - */ -public class VirtualEclipseLinkXmlBasicMap extends XmlBasicMap -{ - protected OrmTypeMapping ormTypeMapping; - - protected final JavaEclipseLinkBasicMapMapping javaAttributeMapping; - - protected final VirtualXmlAttributeMapping virtualXmlAttributeMapping; - - public VirtualEclipseLinkXmlBasicMap(OrmTypeMapping ormTypeMapping, JavaEclipseLinkBasicMapMapping javaBasicMapMapping) { - super(); - this.ormTypeMapping = ormTypeMapping; - this.javaAttributeMapping = javaBasicMapMapping; - this.virtualXmlAttributeMapping = new VirtualXmlAttributeMapping(ormTypeMapping, javaBasicMapMapping); - } - - public boolean isOrmMetadataComplete() { - return this.ormTypeMapping.isMetadataComplete(); - } - - @Override - public String getMappingKey() { - return this.virtualXmlAttributeMapping.getMappingKey(); - } - - @Override - public String getName() { - return this.virtualXmlAttributeMapping.getName(); - } - - @Override - public void setName(String newName) { - this.virtualXmlAttributeMapping.setName(newName); - } - - @Override - public TextRange getNameTextRange() { - return this.virtualXmlAttributeMapping.getNameTextRange(); - } - - @Override - public XmlAccessMethods getAccessMethods() { - return null; - } - - @Override - public void setAccessMethods(XmlAccessMethods value) { - throw new UnsupportedOperationException("cannot set values on a virtual mapping"); //$NON-NLS-1$ - } - - - @Override - public EList<XmlProperty> getProperties() { - // TODO get from java annotations - return null; - } - -} diff --git a/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/orm/VirtualEclipseLinkXmlConversionValue.java b/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/orm/VirtualEclipseLinkXmlConversionValue.java deleted file mode 100644 index e86b9abdee..0000000000 --- a/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/orm/VirtualEclipseLinkXmlConversionValue.java +++ /dev/null @@ -1,72 +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.eclipselink.core.internal.context.orm; - -import org.eclipse.jpt.core.context.orm.OrmTypeMapping; -import org.eclipse.jpt.core.utility.TextRange; -import org.eclipse.jpt.eclipselink.core.context.EclipseLinkConversionValue; -import org.eclipse.jpt.eclipselink.core.resource.orm.XmlConversionValue; - -/** - * VirtualBasic is an implementation of Basic used when there is - * no tag in the orm.xml and an underlying javaBasicMapping exists. - */ -public class VirtualEclipseLinkXmlConversionValue extends XmlConversionValue -{ - protected OrmTypeMapping ormTypeMapping; - - protected EclipseLinkConversionValue javaConversionValue; - - public VirtualEclipseLinkXmlConversionValue(OrmTypeMapping ormTypeMapping, EclipseLinkConversionValue javaConversionValue) { - super(); - this.ormTypeMapping = ormTypeMapping; - this.javaConversionValue = javaConversionValue; - } - - protected boolean isOrmMetadataComplete() { - return this.ormTypeMapping.isMetadataComplete(); - } - - @Override - public String getDataValue() { - if (isOrmMetadataComplete()) { - return null; - } - return this.javaConversionValue.getDataValue(); - } - - @Override - public void setDataValue(String value) { - throw new UnsupportedOperationException("cannot set values on a virtual mapping"); //$NON-NLS-1$ - } - - @Override - public String getObjectValue() { - if (isOrmMetadataComplete()) { - return null; - } - return this.javaConversionValue.getObjectValue(); - } - - @Override - public void setObjectValue(String value) { - throw new UnsupportedOperationException("cannot set values on a virtual mapping"); //$NON-NLS-1$ - } - - @Override - public TextRange getDataValueTextRange() { - return null; - } - - @Override - public TextRange getObjectValueTextRange() { - return null; - } -} diff --git a/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/orm/VirtualEclipseLinkXmlConverter.java b/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/orm/VirtualEclipseLinkXmlConverter.java deleted file mode 100644 index 8e938e308e..0000000000 --- a/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/orm/VirtualEclipseLinkXmlConverter.java +++ /dev/null @@ -1,61 +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.eclipselink.core.internal.context.orm; - -import org.eclipse.jpt.core.context.orm.OrmTypeMapping; -import org.eclipse.jpt.eclipselink.core.context.EclipseLinkCustomConverter; -import org.eclipse.jpt.eclipselink.core.resource.orm.XmlConverter; - -/** - * VirtualBasic is an implementation of Basic used when there is - * no tag in the orm.xml and an underlying javaBasicMapping exists. - */ -public class VirtualEclipseLinkXmlConverter extends XmlConverter -{ - protected OrmTypeMapping ormTypeMapping; - - protected EclipseLinkCustomConverter javaConverter; - - public VirtualEclipseLinkXmlConverter(OrmTypeMapping ormTypeMapping, EclipseLinkCustomConverter javaConverter) { - super(); - this.ormTypeMapping = ormTypeMapping; - this.javaConverter = javaConverter; - } - - protected boolean isOrmMetadataComplete() { - return this.ormTypeMapping.isMetadataComplete(); - } - - @Override - public String getClassName() { - if (isOrmMetadataComplete()) { - return null; - } - return this.javaConverter.getConverterClass(); - } - - @Override - public void setClassName(String value) { - throw new UnsupportedOperationException("cannot set values on a virtual mapping"); //$NON-NLS-1$ - } - - @Override - public String getName() { - if (isOrmMetadataComplete()) { - return null; - } - return this.javaConverter.getName(); - } - - @Override - public void setName(String value) { - throw new UnsupportedOperationException("cannot set values on a virtual mapping"); //$NON-NLS-1$ - } -} diff --git a/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/orm/VirtualEclipseLinkXmlEmbedded.java b/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/orm/VirtualEclipseLinkXmlEmbedded.java deleted file mode 100644 index 0828c62ca7..0000000000 --- a/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/orm/VirtualEclipseLinkXmlEmbedded.java +++ /dev/null @@ -1,81 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2009 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.eclipselink.core.internal.context.orm; - -import org.eclipse.emf.common.util.EList; -import org.eclipse.jpt.core.context.java.JavaEmbeddedMapping; -import org.eclipse.jpt.core.context.orm.OrmTypeMapping; -import org.eclipse.jpt.core.internal.context.orm.VirtualXmlEmbedded; -import org.eclipse.jpt.core.resource.orm.XmlAttributeOverride; -import org.eclipse.jpt.core.utility.TextRange; -import org.eclipse.jpt.eclipselink.core.resource.orm.XmlAccessMethods; -import org.eclipse.jpt.eclipselink.core.resource.orm.XmlEmbedded; -import org.eclipse.jpt.eclipselink.core.resource.orm.XmlProperty; - -/** - * VirtualBasic is an implementation of Basic used when there is - * no tag in the orm.xml and an underlying javaBasicMapping exists. - */ -public class VirtualEclipseLinkXmlEmbedded extends XmlEmbedded -{ - protected OrmTypeMapping ormTypeMapping; - - protected final JavaEmbeddedMapping javaAttributeMapping; - - protected final VirtualXmlEmbedded virtualXmlEmbedded; - - public VirtualEclipseLinkXmlEmbedded(OrmTypeMapping ormTypeMapping, JavaEmbeddedMapping javaEmbeddedMapping) { - super(); - this.ormTypeMapping = ormTypeMapping; - this.javaAttributeMapping = javaEmbeddedMapping; - this.virtualXmlEmbedded = new VirtualXmlEmbedded(ormTypeMapping, javaEmbeddedMapping); - } - - @Override - public String getMappingKey() { - return this.virtualXmlEmbedded.getMappingKey(); - } - - @Override - public String getName() { - return this.virtualXmlEmbedded.getName(); - } - - @Override - public void setName(String newName) { - this.virtualXmlEmbedded.setName(newName); - } - - @Override - public TextRange getNameTextRange() { - return this.virtualXmlEmbedded.getNameTextRange(); - } - - @Override - public EList<XmlAttributeOverride> getAttributeOverrides() { - return this.virtualXmlEmbedded.getAttributeOverrides(); - } - - @Override - public XmlAccessMethods getAccessMethods() { - return null; - } - - @Override - public void setAccessMethods(XmlAccessMethods value) { - throw new UnsupportedOperationException("cannot set values on a virtual mapping"); //$NON-NLS-1$ - } - - @Override - public EList<XmlProperty> getProperties() { - // TODO get from java annotations - return null; - } -} diff --git a/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/orm/VirtualEclipseLinkXmlEmbeddedId.java b/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/orm/VirtualEclipseLinkXmlEmbeddedId.java deleted file mode 100644 index 2668d37f82..0000000000 --- a/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/orm/VirtualEclipseLinkXmlEmbeddedId.java +++ /dev/null @@ -1,81 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2009 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.eclipselink.core.internal.context.orm; - -import org.eclipse.emf.common.util.EList; -import org.eclipse.jpt.core.context.java.JavaEmbeddedIdMapping; -import org.eclipse.jpt.core.context.orm.OrmTypeMapping; -import org.eclipse.jpt.core.internal.context.orm.VirtualXmlEmbeddedId; -import org.eclipse.jpt.core.resource.orm.XmlAttributeOverride; -import org.eclipse.jpt.core.utility.TextRange; -import org.eclipse.jpt.eclipselink.core.resource.orm.XmlAccessMethods; -import org.eclipse.jpt.eclipselink.core.resource.orm.XmlEmbeddedId; -import org.eclipse.jpt.eclipselink.core.resource.orm.XmlProperty; - -/** - * VirtualBasic is an implementation of Basic used when there is - * no tag in the orm.xml and an underlying javaBasicMapping exists. - */ -public class VirtualEclipseLinkXmlEmbeddedId extends XmlEmbeddedId -{ - protected OrmTypeMapping ormTypeMapping; - - protected final JavaEmbeddedIdMapping javaAttributeMapping; - - protected final VirtualXmlEmbeddedId virtualXmlEmbeddedId; - - public VirtualEclipseLinkXmlEmbeddedId(OrmTypeMapping ormTypeMapping, JavaEmbeddedIdMapping javaEmbeddedIdMapping) { - super(); - this.ormTypeMapping = ormTypeMapping; - this.javaAttributeMapping = javaEmbeddedIdMapping; - this.virtualXmlEmbeddedId = new VirtualXmlEmbeddedId(ormTypeMapping, javaEmbeddedIdMapping); - } - - @Override - public String getMappingKey() { - return this.virtualXmlEmbeddedId.getMappingKey(); - } - - @Override - public String getName() { - return this.virtualXmlEmbeddedId.getName(); - } - - @Override - public void setName(String newName) { - this.virtualXmlEmbeddedId.setName(newName); - } - - @Override - public TextRange getNameTextRange() { - return this.virtualXmlEmbeddedId.getNameTextRange(); - } - - @Override - public EList<XmlAttributeOverride> getAttributeOverrides() { - return this.virtualXmlEmbeddedId.getAttributeOverrides(); - } - - @Override - public XmlAccessMethods getAccessMethods() { - return null; - } - - @Override - public void setAccessMethods(XmlAccessMethods value) { - throw new UnsupportedOperationException("cannot set values on a virtual mapping"); //$NON-NLS-1$ - } - - @Override - public EList<XmlProperty> getProperties() { - // TODO get from java annotations - return null; - } -} diff --git a/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/orm/VirtualEclipseLinkXmlId.java b/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/orm/VirtualEclipseLinkXmlId.java deleted file mode 100644 index 418216627c..0000000000 --- a/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/orm/VirtualEclipseLinkXmlId.java +++ /dev/null @@ -1,282 +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.eclipselink.core.internal.context.orm; - -import org.eclipse.emf.common.util.EList; -import org.eclipse.jpt.core.context.java.JavaIdMapping; -import org.eclipse.jpt.core.context.orm.OrmTypeMapping; -import org.eclipse.jpt.core.internal.context.orm.VirtualXmlId; -import org.eclipse.jpt.core.resource.orm.EnumType; -import org.eclipse.jpt.core.resource.orm.TemporalType; -import org.eclipse.jpt.core.resource.orm.XmlColumn; -import org.eclipse.jpt.core.resource.orm.XmlGeneratedValue; -import org.eclipse.jpt.core.resource.orm.XmlSequenceGenerator; -import org.eclipse.jpt.core.resource.orm.XmlTableGenerator; -import org.eclipse.jpt.core.utility.TextRange; -import org.eclipse.jpt.eclipselink.core.context.EclipseLinkConvert; -import org.eclipse.jpt.eclipselink.core.context.EclipseLinkCustomConverter; -import org.eclipse.jpt.eclipselink.core.context.EclipseLinkConverter; -import org.eclipse.jpt.eclipselink.core.context.EclipseLinkIdMapping; -import org.eclipse.jpt.eclipselink.core.context.EclipseLinkObjectTypeConverter; -import org.eclipse.jpt.eclipselink.core.context.EclipseLinkStructConverter; -import org.eclipse.jpt.eclipselink.core.context.EclipseLinkTypeConverter; -import org.eclipse.jpt.eclipselink.core.resource.orm.XmlAccessMethods; -import org.eclipse.jpt.eclipselink.core.resource.orm.XmlConverter; -import org.eclipse.jpt.eclipselink.core.resource.orm.XmlId; -import org.eclipse.jpt.eclipselink.core.resource.orm.XmlObjectTypeConverter; -import org.eclipse.jpt.eclipselink.core.resource.orm.XmlProperty; -import org.eclipse.jpt.eclipselink.core.resource.orm.XmlStructConverter; -import org.eclipse.jpt.eclipselink.core.resource.orm.XmlTypeConverter; - -/** - * VirtualBasic is an implementation of Basic used when there is - * no tag in the orm.xml and an underlying javaBasicMapping exists. - */ -public class VirtualEclipseLinkXmlId extends XmlId -{ - protected OrmTypeMapping ormTypeMapping; - - protected final JavaIdMapping javaAttributeMapping; - - protected final VirtualXmlId virtualXmlId; - - public VirtualEclipseLinkXmlId(OrmTypeMapping ormTypeMapping, JavaIdMapping javaIdMapping) { - super(); - this.ormTypeMapping = ormTypeMapping; - this.javaAttributeMapping = javaIdMapping; - this.virtualXmlId = new VirtualXmlId(ormTypeMapping, javaIdMapping); - } - - @Override - public String getMappingKey() { - return this.virtualXmlId.getMappingKey(); - } - - @Override - public String getName() { - return this.virtualXmlId.getName(); - } - - @Override - public void setName(String newName) { - this.virtualXmlId.setName(newName); - } - - @Override - public TextRange getNameTextRange() { - return this.virtualXmlId.getNameTextRange(); - } - - @Override - public XmlColumn getColumn() { - return this.virtualXmlId.getColumn(); - } - - @Override - public void setColumn(XmlColumn value) { - this.virtualXmlId.setColumn(value); - } - - @Override - public TemporalType getTemporal() { - return this.virtualXmlId.getTemporal(); - } - - @Override - public void setTemporal(TemporalType newTemporal){ - this.virtualXmlId.setTemporal(newTemporal); - } - - @Override - public TextRange getTemporalTextRange() { - return this.virtualXmlId.getTemporalTextRange(); - } - - @Override - public XmlGeneratedValue getGeneratedValue() { - return this.virtualXmlId.getGeneratedValue(); - } - - @Override - public void setGeneratedValue(XmlGeneratedValue value) { - this.virtualXmlId.setGeneratedValue(value); - } - - @Override - public XmlSequenceGenerator getSequenceGenerator() { - return this.virtualXmlId.getSequenceGenerator(); - } - - @Override - public void setSequenceGenerator(XmlSequenceGenerator value) { - this.virtualXmlId.setSequenceGenerator(value); - } - - @Override - public XmlTableGenerator getTableGenerator() { - return this.virtualXmlId.getTableGenerator(); - } - - @Override - public void setTableGenerator(XmlTableGenerator value) { - this.virtualXmlId.setTableGenerator(value); - } - - @Override - public EnumType getEnumerated() { - return this.virtualXmlId.getEnumerated(); - } - - @Override - public void setEnumerated(EnumType value) { - this.virtualXmlId.setEnumerated(value); - } - - @Override - public TextRange getEnumeratedTextRange() { - return this.virtualXmlId.getEnumeratedTextRange(); - } - - @Override - public boolean isLob() { - return this.virtualXmlId.isLob(); - } - - @Override - public void setLob(boolean value) { - this.virtualXmlId.setLob(value); - } - - @Override - public TextRange getLobTextRange() { - return this.virtualXmlId.getLobTextRange(); - } - - - @Override - public Boolean getMutable() { - //don't need isOrmMetadataComplete() check because there is no default Id mapping - return Boolean.valueOf(((EclipseLinkIdMapping) this.javaAttributeMapping).getMutable().isMutable()); - } - - @Override - public void setMutable(Boolean value) { - throw new UnsupportedOperationException("cannot set values on a virtual mapping"); //$NON-NLS-1$ - } - - @Override - public String getConvert() { - //don't need isOrmMetadataComplete() check because there is no default Id mapping - if (this.javaAttributeMapping.getConverter().getType() == EclipseLinkConvert.ECLIPSE_LINK_CONVERTER) { - return ((EclipseLinkConvert) this.javaAttributeMapping.getConverter()).getConverterName(); - } - return null; - } - - @Override - public void setConvert(String value) { - throw new UnsupportedOperationException("cannot set values on a virtual mapping"); //$NON-NLS-1$ - } - - @Override - public XmlConverter getConverter() { - //don't need isOrmMetadataComplete() check because there is no default Id mapping - if (this.javaAttributeMapping.getConverter().getType() == EclipseLinkConvert.ECLIPSE_LINK_CONVERTER) { - EclipseLinkConverter converter = ((EclipseLinkConvert) this.javaAttributeMapping.getConverter()).getConverter(); - if (converter != null && converter.getType() == EclipseLinkConverter.CUSTOM_CONVERTER) { - return new VirtualEclipseLinkXmlConverter(this.ormTypeMapping, (EclipseLinkCustomConverter) ((EclipseLinkConvert) this.javaAttributeMapping.getConverter()).getConverter()); - } - } - return null; - } - - @Override - public void setConverter(XmlConverter value) { - throw new UnsupportedOperationException("cannot set values on a virtual mapping"); //$NON-NLS-1$ - } - - @Override - public XmlObjectTypeConverter getObjectTypeConverter() { - //don't need isOrmMetadataComplete() check because there is no default Id mapping - if (this.javaAttributeMapping.getConverter().getType() == EclipseLinkConvert.ECLIPSE_LINK_CONVERTER) { - EclipseLinkConverter converter = ((EclipseLinkConvert) this.javaAttributeMapping.getConverter()).getConverter(); - if (converter != null && converter.getType() == EclipseLinkConverter.OBJECT_TYPE_CONVERTER) { - return new VirtualEclipseLinkXmlObjectTypeConverter(this.ormTypeMapping, (EclipseLinkObjectTypeConverter) ((EclipseLinkConvert) this.javaAttributeMapping.getConverter()).getConverter()); - } - } - return null; - } - - @Override - public void setObjectTypeConverter(XmlObjectTypeConverter value) { - throw new UnsupportedOperationException("cannot set values on a virtual mapping"); //$NON-NLS-1$ - } - - @Override - public XmlStructConverter getStructConverter() { - //don't need isOrmMetadataComplete() check because there is no default Id mapping - if (this.javaAttributeMapping.getConverter().getType() == EclipseLinkConvert.ECLIPSE_LINK_CONVERTER) { - EclipseLinkConverter converter = ((EclipseLinkConvert) this.javaAttributeMapping.getConverter()).getConverter(); - if (converter != null && converter.getType() == EclipseLinkConverter.STRUCT_CONVERTER) { - return new VirtualEclipseLinkXmlStructConverter(this.ormTypeMapping, (EclipseLinkStructConverter) ((EclipseLinkConvert) this.javaAttributeMapping.getConverter()).getConverter()); - } - } - return null; - } - - @Override - public void setStructConverter(XmlStructConverter value) { - throw new UnsupportedOperationException("cannot set values on a virtual mapping"); //$NON-NLS-1$ - } - - @Override - public XmlTypeConverter getTypeConverter() { - //don't need isOrmMetadataComplete() check because there is no default Id mapping - if (this.javaAttributeMapping.getConverter().getType() == EclipseLinkConvert.ECLIPSE_LINK_CONVERTER) { - EclipseLinkConverter converter = ((EclipseLinkConvert) this.javaAttributeMapping.getConverter()).getConverter(); - if (converter != null && converter.getType() == EclipseLinkConverter.TYPE_CONVERTER) { - return new VirtualEclipseLinkXmlTypeConverter(this.ormTypeMapping, (EclipseLinkTypeConverter) ((EclipseLinkConvert) this.javaAttributeMapping.getConverter()).getConverter()); - } - } - return null; - } - - @Override - public void setTypeConverter(XmlTypeConverter value) { - throw new UnsupportedOperationException("cannot set values on a virtual mapping"); //$NON-NLS-1$ - } - - @Override - public XmlAccessMethods getAccessMethods() { - return null; - } - - @Override - public void setAccessMethods(XmlAccessMethods value) { - throw new UnsupportedOperationException("cannot set values on a virtual mapping"); //$NON-NLS-1$ - } - - @Override - public EList<XmlProperty> getProperties() { - // TODO get from java annotations - return null; - } - - @Override - public TextRange getMutableTextRange() { - return null; - } - - @Override - public TextRange getConvertTextRange() { - return null; - } - -} diff --git a/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/orm/VirtualEclipseLinkXmlManyToMany.java b/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/orm/VirtualEclipseLinkXmlManyToMany.java deleted file mode 100644 index cc6151f20c..0000000000 --- a/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/orm/VirtualEclipseLinkXmlManyToMany.java +++ /dev/null @@ -1,196 +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.eclipselink.core.internal.context.orm; - -import org.eclipse.emf.common.util.EList; -import org.eclipse.jpt.core.context.java.JavaManyToManyMapping; -import org.eclipse.jpt.core.context.orm.OrmTypeMapping; -import org.eclipse.jpt.core.internal.context.orm.VirtualXmlManyToMany; -import org.eclipse.jpt.core.resource.orm.CascadeType; -import org.eclipse.jpt.core.resource.orm.FetchType; -import org.eclipse.jpt.core.resource.orm.MapKey; -import org.eclipse.jpt.core.resource.orm.XmlJoinColumn; -import org.eclipse.jpt.core.resource.orm.XmlJoinTable; -import org.eclipse.jpt.core.resource.orm.XmlOrderColumn; -import org.eclipse.jpt.core.utility.TextRange; -import org.eclipse.jpt.eclipselink.core.context.EclipseLinkJoinFetchType; -import org.eclipse.jpt.eclipselink.core.internal.context.java.JavaEclipseLinkManyToManyMapping; -import org.eclipse.jpt.eclipselink.core.resource.orm.XmlAccessMethods; -import org.eclipse.jpt.eclipselink.core.resource.orm.XmlJoinFetchType; -import org.eclipse.jpt.eclipselink.core.resource.orm.XmlManyToMany; -import org.eclipse.jpt.eclipselink.core.resource.orm.XmlProperty; - -/** - * VirtualBasic is an implementation of Basic used when there is - * no tag in the orm.xml and an underlying javaBasicMapping exists. - */ -public class VirtualEclipseLinkXmlManyToMany extends XmlManyToMany -{ - protected OrmTypeMapping ormTypeMapping; - - protected final JavaManyToManyMapping javaAttributeMapping; - - protected final VirtualXmlManyToMany virtualXmlManyToMany; - - public VirtualEclipseLinkXmlManyToMany(OrmTypeMapping ormTypeMapping, JavaManyToManyMapping javaManyToManyMapping) { - super(); - this.ormTypeMapping = ormTypeMapping; - this.javaAttributeMapping = javaManyToManyMapping; - this.virtualXmlManyToMany = new VirtualXmlManyToMany(ormTypeMapping, javaManyToManyMapping); - } - - protected boolean isOrmMetadataComplete() { - return this.ormTypeMapping.isMetadataComplete(); - } - - @Override - public String getMappingKey() { - return this.virtualXmlManyToMany.getMappingKey(); - } - - @Override - public String getName() { - return this.virtualXmlManyToMany.getName(); - } - - @Override - public void setName(String newName) { - this.virtualXmlManyToMany.setName(newName); - } - - @Override - public TextRange getNameTextRange() { - return this.virtualXmlManyToMany.getNameTextRange(); - } - - @Override - public FetchType getFetch() { - return this.virtualXmlManyToMany.getFetch(); - } - - @Override - public void setFetch(FetchType newFetch) { - this.virtualXmlManyToMany.setFetch(newFetch); - } - - public EList<XmlJoinColumn> getJoinColumns() { - return this.virtualXmlManyToMany.getJoinColumns(); - } - - @Override - public CascadeType getCascade() { - return this.virtualXmlManyToMany.getCascade(); - } - - @Override - public void setCascade(CascadeType value) { - this.virtualXmlManyToMany.setCascade(value); - } - - @Override - public XmlJoinTable getJoinTable() { - return this.virtualXmlManyToMany.getJoinTable(); - } - - @Override - public void setJoinTable(XmlJoinTable value) { - this.virtualXmlManyToMany.setJoinTable(value); - } - - @Override - public String getTargetEntity() { - return this.virtualXmlManyToMany.getTargetEntity(); - } - - @Override - public void setTargetEntity(String value) { - this.virtualXmlManyToMany.setTargetEntity(value); - } - - @Override - public String getMappedBy() { - return this.virtualXmlManyToMany.getMappedBy(); - } - - @Override - public void setMappedBy(String value) { - this.virtualXmlManyToMany.setMappedBy(value); - } - - - @Override - public MapKey getMapKey() { - return this.virtualXmlManyToMany.getMapKey(); - } - - @Override - public void setMapKey(MapKey value) { - this.virtualXmlManyToMany.setMapKey(value); - } - - @Override - public String getOrderBy() { - return this.virtualXmlManyToMany.getOrderBy(); - } - - @Override - public void setOrderBy(String value) { - this.virtualXmlManyToMany.setOrderBy(value); - } - - @Override - public XmlOrderColumn getOrderColumn() { - return this.virtualXmlManyToMany.getOrderColumn(); - } - - @Override - public TextRange getMappedByTextRange() { - return this.virtualXmlManyToMany.getMappedByTextRange(); - } - - @Override - public TextRange getTargetEntityTextRange() { - return this.virtualXmlManyToMany.getTargetEntityTextRange(); - } - - @Override - public XmlJoinFetchType getJoinFetch() { - if (isOrmMetadataComplete()) { - return null; //don't return default value, it only applies for an empty @JoinFetch - } - return EclipseLinkJoinFetchType.toOrmResourceModel(((JavaEclipseLinkManyToManyMapping) this.javaAttributeMapping).getJoinFetch().getValue()); - } - - @Override - public void setJoinFetch(XmlJoinFetchType value) { - throw new UnsupportedOperationException("cannot set values on a virtual mapping"); //$NON-NLS-1$ - } - - @Override - public XmlAccessMethods getAccessMethods() { - return null; - } - - @Override - public void setAccessMethods(XmlAccessMethods value) { - throw new UnsupportedOperationException("cannot set values on a virtual mapping"); //$NON-NLS-1$ - } - - @Override - public EList<XmlProperty> getProperties() { - // TODO get from java annotations - return null; - } - - @Override - public TextRange getJoinFetchTextRange() { - return null; - } -} diff --git a/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/orm/VirtualEclipseLinkXmlManyToOne.java b/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/orm/VirtualEclipseLinkXmlManyToOne.java deleted file mode 100644 index 9647049fc9..0000000000 --- a/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/orm/VirtualEclipseLinkXmlManyToOne.java +++ /dev/null @@ -1,164 +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.eclipselink.core.internal.context.orm; - -import org.eclipse.emf.common.util.EList; -import org.eclipse.jpt.core.context.java.JavaManyToOneMapping; -import org.eclipse.jpt.core.context.orm.OrmTypeMapping; -import org.eclipse.jpt.core.internal.context.orm.VirtualXmlManyToOne; -import org.eclipse.jpt.core.resource.orm.CascadeType; -import org.eclipse.jpt.core.resource.orm.FetchType; -import org.eclipse.jpt.core.resource.orm.XmlJoinColumn; -import org.eclipse.jpt.core.resource.orm.XmlJoinTable; -import org.eclipse.jpt.core.utility.TextRange; -import org.eclipse.jpt.eclipselink.core.context.EclipseLinkJoinFetchType; -import org.eclipse.jpt.eclipselink.core.internal.context.java.JavaEclipseLinkManyToOneMapping; -import org.eclipse.jpt.eclipselink.core.resource.orm.XmlAccessMethods; -import org.eclipse.jpt.eclipselink.core.resource.orm.XmlJoinFetchType; -import org.eclipse.jpt.eclipselink.core.resource.orm.XmlManyToOne; -import org.eclipse.jpt.eclipselink.core.resource.orm.XmlProperty; - -/** - * VirtualBasic is an implementation of Basic used when there is - * no tag in the orm.xml and an underlying javaBasicMapping exists. - */ -public class VirtualEclipseLinkXmlManyToOne extends XmlManyToOne -{ - protected OrmTypeMapping ormTypeMapping; - - protected final JavaManyToOneMapping javaAttributeMapping; - - protected final VirtualXmlManyToOne virtualXmlManyToOne; - - public VirtualEclipseLinkXmlManyToOne(OrmTypeMapping ormTypeMapping, JavaManyToOneMapping javaManyToOneMapping) { - super(); - this.ormTypeMapping = ormTypeMapping; - this.javaAttributeMapping = javaManyToOneMapping; - this.virtualXmlManyToOne = new VirtualXmlManyToOne(ormTypeMapping, javaManyToOneMapping); - } - - protected boolean isOrmMetadataComplete() { - return this.ormTypeMapping.isMetadataComplete(); - } - - @Override - public String getMappingKey() { - return this.virtualXmlManyToOne.getMappingKey(); - } - - @Override - public String getName() { - return this.virtualXmlManyToOne.getName(); - } - - @Override - public void setName(String newName) { - this.virtualXmlManyToOne.setName(newName); - } - - @Override - public TextRange getNameTextRange() { - return this.virtualXmlManyToOne.getNameTextRange(); - } - - @Override - public FetchType getFetch() { - return this.virtualXmlManyToOne.getFetch(); - } - - @Override - public void setFetch(FetchType newFetch) { - this.virtualXmlManyToOne.setFetch(newFetch); - } - - @Override - public Boolean getOptional() { - return this.virtualXmlManyToOne.getOptional(); - } - - @Override - public void setOptional(Boolean newOptional) { - this.virtualXmlManyToOne.setOptional(newOptional); - } - - @Override - public EList<XmlJoinColumn> getJoinColumns() { - return this.virtualXmlManyToOne.getJoinColumns(); - } - - @Override - public CascadeType getCascade() { - return this.virtualXmlManyToOne.getCascade(); - } - - @Override - public void setCascade(CascadeType value) { - this.virtualXmlManyToOne.setCascade(value); - } - - @Override - public XmlJoinTable getJoinTable() { - return this.virtualXmlManyToOne.getJoinTable(); - } - - @Override - public void setJoinTable(XmlJoinTable value) { - this.virtualXmlManyToOne.setJoinTable(value); - } - - @Override - public String getTargetEntity() { - return this.virtualXmlManyToOne.getTargetEntity(); - } - - @Override - public void setTargetEntity(String value) { - this.virtualXmlManyToOne.setTargetEntity(value); - } - - @Override - public TextRange getTargetEntityTextRange() { - return this.virtualXmlManyToOne.getTargetEntityTextRange(); - } - - @Override - public XmlJoinFetchType getJoinFetch() { - if (isOrmMetadataComplete()) { - return null; //don't return default value, it only applies for an empty @JoinFetch - } - return EclipseLinkJoinFetchType.toOrmResourceModel(((JavaEclipseLinkManyToOneMapping) this.javaAttributeMapping).getJoinFetch().getValue()); - } - - @Override - public void setJoinFetch(XmlJoinFetchType value) { - throw new UnsupportedOperationException("cannot set values on a virtual mapping"); //$NON-NLS-1$ - } - - @Override - public XmlAccessMethods getAccessMethods() { - return null; - } - - @Override - public void setAccessMethods(XmlAccessMethods value) { - throw new UnsupportedOperationException("cannot set values on a virtual mapping"); //$NON-NLS-1$ - } - - @Override - public EList<XmlProperty> getProperties() { - // TODO get from java annotations - return null; - } - - @Override - public TextRange getJoinFetchTextRange() { - return null; - } -} diff --git a/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/orm/VirtualEclipseLinkXmlNullAttributeMapping.java b/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/orm/VirtualEclipseLinkXmlNullAttributeMapping.java deleted file mode 100644 index d50cc97b83..0000000000 --- a/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/orm/VirtualEclipseLinkXmlNullAttributeMapping.java +++ /dev/null @@ -1,77 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2009 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.eclipselink.core.internal.context.orm; - -import org.eclipse.emf.common.util.EList; -import org.eclipse.jpt.core.context.java.JavaAttributeMapping; -import org.eclipse.jpt.core.context.orm.OrmTypeMapping; -import org.eclipse.jpt.core.internal.context.orm.VirtualXmlNullAttributeMapping; -import org.eclipse.jpt.core.resource.orm.XmlNullAttributeMapping; -import org.eclipse.jpt.core.utility.TextRange; -import org.eclipse.jpt.eclipselink.core.resource.orm.XmlAccessMethods; -import org.eclipse.jpt.eclipselink.core.resource.orm.XmlAttributeMapping; -import org.eclipse.jpt.eclipselink.core.resource.orm.XmlProperty; - -/** - * VirtualVersion is an implementation of Version used when there is - * no tag in the orm.xml and an underlying javaVersionMapping exists. - */ -public class VirtualEclipseLinkXmlNullAttributeMapping extends XmlNullAttributeMapping implements XmlAttributeMapping -{ - - protected OrmTypeMapping ormTypeMapping; - - protected final JavaAttributeMapping javaAttributeMapping; - - protected final VirtualXmlNullAttributeMapping virtualXmlNullAttributeMapping; - - public VirtualEclipseLinkXmlNullAttributeMapping(OrmTypeMapping ormTypeMapping, JavaAttributeMapping javaAttributeMapping) { - super(); - this.ormTypeMapping = ormTypeMapping; - this.javaAttributeMapping = javaAttributeMapping; - this.virtualXmlNullAttributeMapping = new VirtualXmlNullAttributeMapping(ormTypeMapping, javaAttributeMapping); - } - - protected boolean isOrmMetadataComplete() { - return this.ormTypeMapping.isMetadataComplete(); - } - - public String getMappingKey() { - return this.virtualXmlNullAttributeMapping.getMappingKey(); - } - - @Override - public String getName() { - return this.virtualXmlNullAttributeMapping.getName(); - } - - @Override - public void setName(String newName) { - this.virtualXmlNullAttributeMapping.setName(newName); - } - - @Override - public TextRange getNameTextRange() { - return this.virtualXmlNullAttributeMapping.getNameTextRange(); - } - - public XmlAccessMethods getAccessMethods() { - return null; - } - - public void setAccessMethods(XmlAccessMethods value) { - throw new UnsupportedOperationException("cannot set values on a virtual mapping"); //$NON-NLS-1$ - } - - public EList<XmlProperty> getProperties() { - // TODO Auto-generated method stub - return null; - } -} diff --git a/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/orm/VirtualEclipseLinkXmlObjectTypeConverter.java b/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/orm/VirtualEclipseLinkXmlObjectTypeConverter.java deleted file mode 100644 index b1cac04110..0000000000 --- a/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/orm/VirtualEclipseLinkXmlObjectTypeConverter.java +++ /dev/null @@ -1,107 +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.eclipselink.core.internal.context.orm; - -import org.eclipse.emf.common.util.EList; -import org.eclipse.emf.ecore.util.EObjectContainmentEList; -import org.eclipse.jpt.core.context.orm.OrmTypeMapping; -import org.eclipse.jpt.eclipselink.core.context.EclipseLinkConversionValue; -import org.eclipse.jpt.eclipselink.core.context.EclipseLinkObjectTypeConverter; -import org.eclipse.jpt.eclipselink.core.resource.orm.EclipseLinkOrmPackage; -import org.eclipse.jpt.eclipselink.core.resource.orm.XmlConversionValue; -import org.eclipse.jpt.eclipselink.core.resource.orm.XmlObjectTypeConverter; -import org.eclipse.jpt.utility.internal.CollectionTools; - -/** - * VirtualBasic is an implementation of Basic used when there is - * no tag in the orm.xml and an underlying javaBasicMapping exists. - */ -public class VirtualEclipseLinkXmlObjectTypeConverter extends XmlObjectTypeConverter -{ - protected OrmTypeMapping ormTypeMapping; - - protected EclipseLinkObjectTypeConverter javaConverter; - - public VirtualEclipseLinkXmlObjectTypeConverter(OrmTypeMapping ormTypeMapping, EclipseLinkObjectTypeConverter javaConverter) { - super(); - this.ormTypeMapping = ormTypeMapping; - this.javaConverter = javaConverter; - } - - protected boolean isOrmMetadataComplete() { - return this.ormTypeMapping.isMetadataComplete(); - } - - @Override - public String getName() { - if (isOrmMetadataComplete()) { - return null; - } - return this.javaConverter.getName(); - } - - @Override - public void setName(String value) { - throw new UnsupportedOperationException("cannot set values on a virtual mapping"); //$NON-NLS-1$ - } - - @Override - public String getDataType() { - if (isOrmMetadataComplete()) { - return null; - } - return this.javaConverter.getDataType(); - } - - @Override - public void setDataType(String value) { - throw new UnsupportedOperationException("cannot set values on a virtual mapping"); //$NON-NLS-1$ - } - - @Override - public String getObjectType() { - if (isOrmMetadataComplete()) { - return null; - } - return this.javaConverter.getObjectType(); - } - - @Override - public void setObjectType(String value) { - throw new UnsupportedOperationException("cannot set values on a virtual mapping"); //$NON-NLS-1$ - } - - @Override - public String getDefaultObjectValue() { - if (isOrmMetadataComplete()) { - return null; - } - return this.javaConverter.getDefaultObjectValue(); - } - - @Override - public void setDefaultObjectValue(String value) { - throw new UnsupportedOperationException("cannot set values on a virtual mapping"); //$NON-NLS-1$ - } - - @Override - public EList<XmlConversionValue> getConversionValues() { - EList<XmlConversionValue> conversionValues = new EObjectContainmentEList<XmlConversionValue>(XmlConversionValue.class, this, EclipseLinkOrmPackage.XML_OBJECT_TYPE_CONVERTER__CONVERSION_VALUES); - if (isOrmMetadataComplete()) { - return conversionValues; - } - for (EclipseLinkConversionValue javaConversionValue : CollectionTools.iterable(this.javaConverter.conversionValues())) { - XmlConversionValue xmlConversionValue = new VirtualEclipseLinkXmlConversionValue(this.ormTypeMapping, javaConversionValue); - conversionValues.add(xmlConversionValue); - } - return conversionValues; - } - -} diff --git a/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/orm/VirtualEclipseLinkXmlOneToMany.java b/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/orm/VirtualEclipseLinkXmlOneToMany.java deleted file mode 100644 index 804ae659a8..0000000000 --- a/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/orm/VirtualEclipseLinkXmlOneToMany.java +++ /dev/null @@ -1,253 +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.eclipselink.core.internal.context.orm; - -import org.eclipse.emf.common.util.EList; -import org.eclipse.emf.ecore.util.EObjectContainmentEList; -import org.eclipse.jpt.core.context.java.JavaJoinColumn; -import org.eclipse.jpt.core.context.orm.OrmTypeMapping; -import org.eclipse.jpt.core.internal.context.orm.VirtualXmlJoinColumn; -import org.eclipse.jpt.core.internal.context.orm.VirtualXmlOneToMany; -import org.eclipse.jpt.core.jpa2.context.OneToManyMapping2_0; -import org.eclipse.jpt.core.jpa2.context.java.JavaOrphanRemovable2_0; -import org.eclipse.jpt.core.jpa2.context.java.JavaOrphanRemovalHolder2_0; -import org.eclipse.jpt.core.resource.orm.CascadeType; -import org.eclipse.jpt.core.resource.orm.FetchType; -import org.eclipse.jpt.core.resource.orm.MapKey; -import org.eclipse.jpt.core.resource.orm.OrmPackage; -import org.eclipse.jpt.core.resource.orm.XmlJoinColumn; -import org.eclipse.jpt.core.resource.orm.XmlJoinTable; -import org.eclipse.jpt.core.resource.orm.XmlOrderColumn; -import org.eclipse.jpt.core.utility.TextRange; -import org.eclipse.jpt.eclipselink.core.context.EclipseLinkJoinFetchType; -import org.eclipse.jpt.eclipselink.core.internal.context.java.JavaEclipseLinkOneToManyMapping; -import org.eclipse.jpt.eclipselink.core.resource.orm.XmlAccessMethods; -import org.eclipse.jpt.eclipselink.core.resource.orm.XmlJoinFetchType; -import org.eclipse.jpt.eclipselink.core.resource.orm.XmlOneToMany; -import org.eclipse.jpt.eclipselink.core.resource.orm.XmlProperty; -import org.eclipse.jpt.utility.internal.CollectionTools; - -/** - * VirtualBasic is an implementation of Basic used when there is - * no tag in the orm.xml and an underlying javaBasicMapping exists. - */ -public class VirtualEclipseLinkXmlOneToMany extends XmlOneToMany -{ - protected OrmTypeMapping ormTypeMapping; - - protected final JavaEclipseLinkOneToManyMapping javaAttributeMapping; - - protected final VirtualXmlOneToMany virtualXmlOneToMany; - - public VirtualEclipseLinkXmlOneToMany( - OrmTypeMapping ormTypeMapping, JavaEclipseLinkOneToManyMapping javaOneToManyMapping) { - super(); - this.ormTypeMapping = ormTypeMapping; - this.javaAttributeMapping = javaOneToManyMapping; - this.virtualXmlOneToMany = new VirtualXmlOneToMany(ormTypeMapping, javaOneToManyMapping); - } - - protected boolean isOrmMetadataComplete() { - return this.ormTypeMapping.isMetadataComplete(); - } - - @Override - public String getMappingKey() { - return this.virtualXmlOneToMany.getMappingKey(); - } - - @Override - public String getName() { - return this.virtualXmlOneToMany.getName(); - } - - @Override - public void setName(String newName) { - this.virtualXmlOneToMany.setName(newName); - } - - @Override - public TextRange getNameTextRange() { - return this.virtualXmlOneToMany.getNameTextRange(); - } - - @Override - public FetchType getFetch() { - return this.virtualXmlOneToMany.getFetch(); - } - - @Override - public void setFetch(FetchType newFetch) { - this.virtualXmlOneToMany.setFetch(newFetch); - } - - @Override - public CascadeType getCascade() { - return this.virtualXmlOneToMany.getCascade(); - } - - @Override - public void setCascade(CascadeType value) { - this.virtualXmlOneToMany.setCascade(value); - } - - @Override - public XmlJoinTable getJoinTable() { - return this.virtualXmlOneToMany.getJoinTable(); - } - - @Override - public void setJoinTable(XmlJoinTable value) { - this.virtualXmlOneToMany.setJoinTable(value); - } - - @Override - public String getTargetEntity() { - return this.virtualXmlOneToMany.getTargetEntity(); - } - - @Override - public void setTargetEntity(String value) { - this.virtualXmlOneToMany.setTargetEntity(value); - } - - @Override - public String getMappedBy() { - return this.virtualXmlOneToMany.getMappedBy(); - } - - @Override - public void setMappedBy(String value) { - this.virtualXmlOneToMany.setMappedBy(value); - } - - - @Override - public MapKey getMapKey() { - return this.virtualXmlOneToMany.getMapKey(); - } - - @Override - public void setMapKey(MapKey value) { - this.virtualXmlOneToMany.setMapKey(value); - } - - @Override - public String getOrderBy() { - return this.virtualXmlOneToMany.getOrderBy(); - } - - @Override - public void setOrderBy(String value) { - this.virtualXmlOneToMany.setOrderBy(value); - } - - @Override - public XmlOrderColumn getOrderColumn() { - return this.virtualXmlOneToMany.getOrderColumn(); - } - - @Override - public TextRange getMappedByTextRange() { - return this.virtualXmlOneToMany.getMappedByTextRange(); - } - - @Override - public TextRange getTargetEntityTextRange() { - return this.virtualXmlOneToMany.getTargetEntityTextRange(); - } - - @Override - public EList<XmlJoinColumn> getJoinColumns() { - //TODO need to check metadataComplete here - EList<XmlJoinColumn> joinColumns = - new EObjectContainmentEList<XmlJoinColumn>(XmlJoinColumn.class, this, OrmPackage.XML_ONE_TO_ONE__JOIN_COLUMNS); - //TODO here i'm using joinColumns() while VirtualXmlJoinTable uses specifiedJoinColumns()??? - for (JavaJoinColumn joinColumn : - CollectionTools.iterable( - this.javaAttributeMapping.getRelationshipReference(). - getJoinColumnJoiningStrategy().joinColumns())) { - XmlJoinColumn xmlJoinColumn = new VirtualXmlJoinColumn(joinColumn, this.isOrmMetadataComplete()); - joinColumns.add(xmlJoinColumn); - } - return joinColumns; - } - - @Override - public XmlJoinFetchType getJoinFetch() { - if (isOrmMetadataComplete()) { - return null; //don't return default value, it only applies for an empty @JoinFetch - } - return EclipseLinkJoinFetchType.toOrmResourceModel(this.javaAttributeMapping.getJoinFetch().getValue()); - } - - @Override - public void setJoinFetch(XmlJoinFetchType value) { - throw new UnsupportedOperationException("cannot set values on a virtual mapping"); //$NON-NLS-1$ - } - - @Override - public boolean isPrivateOwned() { - if (isOrmMetadataComplete()) { - return false; - } - return this.javaAttributeMapping.getPrivateOwned().isPrivateOwned(); - } - - @Override - public void setPrivateOwned(boolean value) { - throw new UnsupportedOperationException("cannot set values on a virtual mapping"); //$NON-NLS-1$ - } - - @Override - public XmlAccessMethods getAccessMethods() { - return null; - } - - @Override - public void setAccessMethods(XmlAccessMethods value) { - throw new UnsupportedOperationException("cannot set values on a virtual mapping"); //$NON-NLS-1$ - } - - @Override - public EList<XmlProperty> getProperties() { - // TODO get from java annotations - return null; - } - - @Override - public TextRange getJoinFetchTextRange() { - return null; - } - - @Override - public TextRange getPrivateOwnedTextRange() { - return null; - } - - private JavaOrphanRemovable2_0 getOrphanRemovalOf(OneToManyMapping2_0 oneToManyMapping) { - return ((JavaOrphanRemovalHolder2_0) oneToManyMapping).getOrphanRemoval(); - } - - @Override - public Boolean getOrphanRemoval() { - JavaOrphanRemovable2_0 mappingsOrphanRemoval = this.getOrphanRemovalOf(this.javaAttributeMapping); - if (this.isOrmMetadataComplete()) { - return Boolean.valueOf(mappingsOrphanRemoval.isDefaultOrphanRemoval()); - } - return Boolean.valueOf(mappingsOrphanRemoval.isOrphanRemoval()); - } - - @Override - public void setOrphanRemoval(Boolean newOrphanRemoval) { - throw new UnsupportedOperationException("cannot set values on a virtual mapping"); //$NON-NLS-1$ - } - -} diff --git a/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/orm/VirtualEclipseLinkXmlOneToOne.java b/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/orm/VirtualEclipseLinkXmlOneToOne.java deleted file mode 100644 index dbb904e5e2..0000000000 --- a/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/orm/VirtualEclipseLinkXmlOneToOne.java +++ /dev/null @@ -1,225 +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.eclipselink.core.internal.context.orm; - -import org.eclipse.emf.common.util.EList; -import org.eclipse.jpt.core.context.orm.OrmTypeMapping; -import org.eclipse.jpt.core.internal.context.orm.VirtualXmlOneToOne; -import org.eclipse.jpt.core.jpa2.context.OneToOneMapping2_0; -import org.eclipse.jpt.core.jpa2.context.java.JavaOrphanRemovable2_0; -import org.eclipse.jpt.core.jpa2.context.java.JavaOrphanRemovalHolder2_0; -import org.eclipse.jpt.core.resource.orm.CascadeType; -import org.eclipse.jpt.core.resource.orm.FetchType; -import org.eclipse.jpt.core.resource.orm.XmlJoinColumn; -import org.eclipse.jpt.core.resource.orm.XmlJoinTable; -import org.eclipse.jpt.core.resource.orm.XmlPrimaryKeyJoinColumn; -import org.eclipse.jpt.core.utility.TextRange; -import org.eclipse.jpt.eclipselink.core.context.EclipseLinkJoinFetchType; -import org.eclipse.jpt.eclipselink.core.internal.context.java.JavaEclipseLinkOneToOneMapping; -import org.eclipse.jpt.eclipselink.core.resource.orm.XmlAccessMethods; -import org.eclipse.jpt.eclipselink.core.resource.orm.XmlJoinFetchType; -import org.eclipse.jpt.eclipselink.core.resource.orm.XmlOneToOne; -import org.eclipse.jpt.eclipselink.core.resource.orm.XmlProperty; - -/** - * VirtualBasic is an implementation of Basic used when there is - * no tag in the orm.xml and an underlying javaBasicMapping exists. - */ -public class VirtualEclipseLinkXmlOneToOne extends XmlOneToOne -{ - protected OrmTypeMapping ormTypeMapping; - - protected final JavaEclipseLinkOneToOneMapping javaAttributeMapping; - - protected final VirtualXmlOneToOne virtualXmlOneToOne; - - public VirtualEclipseLinkXmlOneToOne(OrmTypeMapping ormTypeMapping, JavaEclipseLinkOneToOneMapping javaOneToOneMapping) { - super(); - this.ormTypeMapping = ormTypeMapping; - this.javaAttributeMapping = javaOneToOneMapping; - this.virtualXmlOneToOne = new VirtualXmlOneToOne(ormTypeMapping, javaOneToOneMapping); - } - - protected boolean isOrmMetadataComplete() { - return this.ormTypeMapping.isMetadataComplete(); - } - - @Override - public String getMappingKey() { - return this.virtualXmlOneToOne.getMappingKey(); - } - - @Override - public String getName() { - return this.virtualXmlOneToOne.getName(); - } - - @Override - public void setName(String newName) { - this.virtualXmlOneToOne.setName(newName); - } - - @Override - public TextRange getNameTextRange() { - return this.virtualXmlOneToOne.getNameTextRange(); - } - - @Override - public FetchType getFetch() { - return this.virtualXmlOneToOne.getFetch(); - } - - @Override - public void setFetch(FetchType newFetch) { - this.virtualXmlOneToOne.setFetch(newFetch); - } - - @Override - public Boolean getOptional() { - return this.virtualXmlOneToOne.getOptional(); - } - - @Override - public void setOptional(Boolean newOptional) { - this.virtualXmlOneToOne.setOptional(newOptional); - } - - @Override - public EList<XmlJoinColumn> getJoinColumns() { - return this.virtualXmlOneToOne.getJoinColumns(); - } - - @Override - public CascadeType getCascade() { - return this.virtualXmlOneToOne.getCascade(); - } - - @Override - public void setCascade(CascadeType value) { - this.virtualXmlOneToOne.setCascade(value); - } - - @Override - public XmlJoinTable getJoinTable() { - return this.virtualXmlOneToOne.getJoinTable(); - } - - @Override - public void setJoinTable(XmlJoinTable value) { - this.virtualXmlOneToOne.setJoinTable(value); - } - - @Override - public String getTargetEntity() { - return this.virtualXmlOneToOne.getTargetEntity(); - } - - @Override - public void setTargetEntity(String value) { - this.virtualXmlOneToOne.setTargetEntity(value); - } - - @Override - public String getMappedBy() { - return this.virtualXmlOneToOne.getMappedBy(); - } - - @Override - public void setMappedBy(String value) { - this.virtualXmlOneToOne.setMappedBy(value); - } - - @Override - public EList<XmlPrimaryKeyJoinColumn> getPrimaryKeyJoinColumns() { - return this.virtualXmlOneToOne.getPrimaryKeyJoinColumns(); - } - - @Override - public TextRange getMappedByTextRange() { - return this.virtualXmlOneToOne.getMappedByTextRange(); - } - - @Override - public TextRange getTargetEntityTextRange() { - return this.virtualXmlOneToOne.getTargetEntityTextRange(); - } - - @Override - public XmlJoinFetchType getJoinFetch() { - if (isOrmMetadataComplete()) { - return null; //don't return default value, it only applies for an empty @JoinFetch - } - return EclipseLinkJoinFetchType.toOrmResourceModel((this.javaAttributeMapping).getJoinFetch().getValue()); - } - - @Override - public void setJoinFetch(XmlJoinFetchType value) { - throw new UnsupportedOperationException("cannot set values on a virtual mapping"); //$NON-NLS-1$ - } - - @Override - public boolean isPrivateOwned() { - if (isOrmMetadataComplete()) { - return false; - } - return (this.javaAttributeMapping).getPrivateOwned().isPrivateOwned(); - } - - @Override - public void setPrivateOwned(boolean value) { - throw new UnsupportedOperationException("cannot set values on a virtual mapping"); //$NON-NLS-1$ - } - - @Override - public XmlAccessMethods getAccessMethods() { - return null; - } - - @Override - public void setAccessMethods(XmlAccessMethods value) { - throw new UnsupportedOperationException("cannot set values on a virtual mapping"); //$NON-NLS-1$ - } - - @Override - public EList<XmlProperty> getProperties() { - // TODO get from java annotations - return null; - } - - @Override - public TextRange getJoinFetchTextRange() { - return null; - } - - @Override - public TextRange getPrivateOwnedTextRange() { - return null; - } - - - private JavaOrphanRemovable2_0 getOrphanRemovalOf(OneToOneMapping2_0 oneToManyMapping) { - return ((JavaOrphanRemovalHolder2_0) oneToManyMapping).getOrphanRemoval(); - } - - @Override - public Boolean getOrphanRemoval() { - JavaOrphanRemovable2_0 mappingsOrphanRemoval = this.getOrphanRemovalOf(this.javaAttributeMapping); - if (this.isOrmMetadataComplete()) { - return Boolean.valueOf(mappingsOrphanRemoval.isDefaultOrphanRemoval()); - } - return Boolean.valueOf(mappingsOrphanRemoval.isOrphanRemoval()); - } - - @Override - public void setOrphanRemoval(Boolean newOrphanRemoval) { - throw new UnsupportedOperationException("cannot set values on a virtual mapping"); //$NON-NLS-1$ - } - -} diff --git a/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/orm/VirtualEclipseLinkXmlStructConverter.java b/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/orm/VirtualEclipseLinkXmlStructConverter.java deleted file mode 100644 index 40d8a5291d..0000000000 --- a/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/orm/VirtualEclipseLinkXmlStructConverter.java +++ /dev/null @@ -1,61 +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.eclipselink.core.internal.context.orm; - -import org.eclipse.jpt.core.context.orm.OrmTypeMapping; -import org.eclipse.jpt.eclipselink.core.context.EclipseLinkStructConverter; -import org.eclipse.jpt.eclipselink.core.resource.orm.XmlStructConverter; - -/** - * VirtualBasic is an implementation of Basic used when there is - * no tag in the orm.xml and an underlying javaBasicMapping exists. - */ -public class VirtualEclipseLinkXmlStructConverter extends XmlStructConverter -{ - protected OrmTypeMapping ormTypeMapping; - - protected EclipseLinkStructConverter javaConverter; - - public VirtualEclipseLinkXmlStructConverter(OrmTypeMapping ormTypeMapping, EclipseLinkStructConverter javaConverter) { - super(); - this.ormTypeMapping = ormTypeMapping; - this.javaConverter = javaConverter; - } - - protected boolean isOrmMetadataComplete() { - return this.ormTypeMapping.isMetadataComplete(); - } - - @Override - public String getConverter() { - if (isOrmMetadataComplete()) { - return null; - } - return this.javaConverter.getConverterClass(); - } - - @Override - public void setConverter(String value) { - throw new UnsupportedOperationException("cannot set values on a virtual mapping"); //$NON-NLS-1$ - } - - @Override - public String getName() { - if (isOrmMetadataComplete()) { - return null; - } - return this.javaConverter.getName(); - } - - @Override - public void setName(String value) { - throw new UnsupportedOperationException("cannot set values on a virtual mapping"); //$NON-NLS-1$ - } -} diff --git a/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/orm/VirtualEclipseLinkXmlTransformation.java b/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/orm/VirtualEclipseLinkXmlTransformation.java deleted file mode 100644 index 12cdd9c436..0000000000 --- a/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/orm/VirtualEclipseLinkXmlTransformation.java +++ /dev/null @@ -1,81 +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.eclipselink.core.internal.context.orm; - -import org.eclipse.emf.common.util.EList; -import org.eclipse.jpt.core.context.orm.OrmTypeMapping; -import org.eclipse.jpt.core.internal.context.orm.VirtualXmlAttributeMapping; -import org.eclipse.jpt.core.utility.TextRange; -import org.eclipse.jpt.eclipselink.core.internal.context.java.JavaEclipseLinkTransformationMapping; -import org.eclipse.jpt.eclipselink.core.resource.orm.XmlAccessMethods; -import org.eclipse.jpt.eclipselink.core.resource.orm.XmlProperty; -import org.eclipse.jpt.eclipselink.core.resource.orm.XmlTransformation; - -/** - * VirtualBasic is an implementation of Basic used when there is - * no tag in the orm.xml and an underlying javaBasicMapping exists. - */ -public class VirtualEclipseLinkXmlTransformation extends XmlTransformation -{ - protected OrmTypeMapping ormTypeMapping; - - protected final JavaEclipseLinkTransformationMapping javaAttributeMapping; - - protected final VirtualXmlAttributeMapping virtualXmlAttributeMapping; - - public VirtualEclipseLinkXmlTransformation(OrmTypeMapping ormTypeMapping, JavaEclipseLinkTransformationMapping javaTransformationMapping) { - super(); - this.ormTypeMapping = ormTypeMapping; - this.javaAttributeMapping = javaTransformationMapping; - this.virtualXmlAttributeMapping = new VirtualXmlAttributeMapping(ormTypeMapping, javaTransformationMapping); - } - - public boolean isOrmMetadataComplete() { - return this.ormTypeMapping.isMetadataComplete(); - } - - @Override - public String getMappingKey() { - return this.virtualXmlAttributeMapping.getMappingKey(); - } - - @Override - public String getName() { - return this.virtualXmlAttributeMapping.getName(); - } - - @Override - public void setName(String newName) { - this.virtualXmlAttributeMapping.setName(newName); - } - - @Override - public TextRange getNameTextRange() { - return this.virtualXmlAttributeMapping.getNameTextRange(); - } - - @Override - public XmlAccessMethods getAccessMethods() { - return null; - } - - @Override - public void setAccessMethods(XmlAccessMethods value) { - throw new UnsupportedOperationException("cannot set values on a virtual mapping"); //$NON-NLS-1$ - } - - - @Override - public EList<XmlProperty> getProperties() { - // TODO get from java annotations - return null; - } - -} diff --git a/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/orm/VirtualEclipseLinkXmlTransient.java b/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/orm/VirtualEclipseLinkXmlTransient.java deleted file mode 100644 index 01e83fbbd8..0000000000 --- a/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/orm/VirtualEclipseLinkXmlTransient.java +++ /dev/null @@ -1,73 +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.eclipselink.core.internal.context.orm; - -import org.eclipse.jpt.core.context.java.JavaTransientMapping; -import org.eclipse.jpt.core.context.orm.OrmTypeMapping; -import org.eclipse.jpt.core.internal.context.orm.VirtualXmlTransient; -import org.eclipse.jpt.core.utility.TextRange; -import org.eclipse.jpt.eclipselink.core.resource.orm.XmlAccessMethods; -import org.eclipse.jpt.eclipselink.core.resource.orm.XmlTransient; - -/** - * VirtualBasic is an implementation of Basic used when there is - * no tag in the orm.xml and an underlying javaBasicMapping exists. - */ -public class VirtualEclipseLinkXmlTransient extends XmlTransient -{ - - protected OrmTypeMapping ormTypeMapping; - - protected final JavaTransientMapping javaAttributeMapping; - - protected final VirtualXmlTransient virtualXmlTransient; - - public VirtualEclipseLinkXmlTransient(OrmTypeMapping ormTypeMapping, JavaTransientMapping javaTransientMapping) { - super(); - this.ormTypeMapping = ormTypeMapping; - this.javaAttributeMapping = javaTransientMapping; - this.virtualXmlTransient = new VirtualXmlTransient(ormTypeMapping, javaTransientMapping); - } - - protected boolean isOrmMetadataComplete() { - return this.ormTypeMapping.isMetadataComplete(); - } - - @Override - public String getMappingKey() { - return this.virtualXmlTransient.getMappingKey(); - } - - @Override - public String getName() { - return this.virtualXmlTransient.getName(); - } - - @Override - public void setName(String newName) { - this.virtualXmlTransient.setName(newName); - } - - @Override - public TextRange getNameTextRange() { - return this.virtualXmlTransient.getNameTextRange(); - } - - @Override - public XmlAccessMethods getAccessMethods() { - return null; - } - - @Override - public void setAccessMethods(XmlAccessMethods newAccessMethods) { - throw new UnsupportedOperationException("cannot set values on a virtual mapping"); //$NON-NLS-1$ - } - -} diff --git a/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/orm/VirtualEclipseLinkXmlTypeConverter.java b/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/orm/VirtualEclipseLinkXmlTypeConverter.java deleted file mode 100644 index a75b0ac5de..0000000000 --- a/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/orm/VirtualEclipseLinkXmlTypeConverter.java +++ /dev/null @@ -1,74 +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.eclipselink.core.internal.context.orm; - -import org.eclipse.jpt.core.context.orm.OrmTypeMapping; -import org.eclipse.jpt.eclipselink.core.context.EclipseLinkTypeConverter; -import org.eclipse.jpt.eclipselink.core.resource.orm.XmlTypeConverter; - -/** - * VirtualBasic is an implementation of Basic used when there is - * no tag in the orm.xml and an underlying javaBasicMapping exists. - */ -public class VirtualEclipseLinkXmlTypeConverter extends XmlTypeConverter -{ - protected OrmTypeMapping ormTypeMapping; - - protected EclipseLinkTypeConverter javaConverter; - - public VirtualEclipseLinkXmlTypeConverter(OrmTypeMapping ormTypeMapping, EclipseLinkTypeConverter javaConverter) { - super(); - this.ormTypeMapping = ormTypeMapping; - this.javaConverter = javaConverter; - } - - protected boolean isOrmMetadataComplete() { - return this.ormTypeMapping.isMetadataComplete(); - } - - @Override - public String getName() { - if (isOrmMetadataComplete()) { - return null; - } - return this.javaConverter.getName(); - } - - @Override - public void setName(String value) { - throw new UnsupportedOperationException("cannot set values on a virtual mapping"); //$NON-NLS-1$ - } - - @Override - public String getDataType() { - if (isOrmMetadataComplete()) { - return null; - } - return this.javaConverter.getDataType(); - } - - @Override - public void setDataType(String value) { - throw new UnsupportedOperationException("cannot set values on a virtual mapping"); //$NON-NLS-1$ - } - - @Override - public String getObjectType() { - if (isOrmMetadataComplete()) { - return null; - } - return this.javaConverter.getObjectType(); - } - - @Override - public void setObjectType(String value) { - throw new UnsupportedOperationException("cannot set values on a virtual mapping"); //$NON-NLS-1$ - } -} diff --git a/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/orm/VirtualEclipseLinkXmlVariableOneToOne.java b/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/orm/VirtualEclipseLinkXmlVariableOneToOne.java deleted file mode 100644 index 52bd0c28a0..0000000000 --- a/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/orm/VirtualEclipseLinkXmlVariableOneToOne.java +++ /dev/null @@ -1,81 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2009 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.eclipselink.core.internal.context.orm; - -import org.eclipse.emf.common.util.EList; -import org.eclipse.jpt.core.context.orm.OrmTypeMapping; -import org.eclipse.jpt.core.internal.context.orm.VirtualXmlAttributeMapping; -import org.eclipse.jpt.core.utility.TextRange; -import org.eclipse.jpt.eclipselink.core.internal.context.java.JavaEclipseLinkVariableOneToOneMapping; -import org.eclipse.jpt.eclipselink.core.resource.orm.XmlAccessMethods; -import org.eclipse.jpt.eclipselink.core.resource.orm.XmlProperty; -import org.eclipse.jpt.eclipselink.core.resource.orm.XmlVariableOneToOne; - -/** - * VirtualBasic is an implementation of Basic used when there is - * no tag in the orm.xml and an underlying javaBasicMapping exists. - */ -public class VirtualEclipseLinkXmlVariableOneToOne extends XmlVariableOneToOne -{ - protected OrmTypeMapping ormTypeMapping; - - protected final JavaEclipseLinkVariableOneToOneMapping javaAttributeMapping; - - protected final VirtualXmlAttributeMapping virtualXmlAttributeMapping; - - public VirtualEclipseLinkXmlVariableOneToOne(OrmTypeMapping ormTypeMapping, JavaEclipseLinkVariableOneToOneMapping javaVariableOneToOneMapping) { - super(); - this.ormTypeMapping = ormTypeMapping; - this.javaAttributeMapping = javaVariableOneToOneMapping; - this.virtualXmlAttributeMapping = new VirtualXmlAttributeMapping(ormTypeMapping, javaVariableOneToOneMapping); - } - - public boolean isOrmMetadataComplete() { - return this.ormTypeMapping.isMetadataComplete(); - } - - @Override - public String getMappingKey() { - return this.virtualXmlAttributeMapping.getMappingKey(); - } - - @Override - public String getName() { - return this.virtualXmlAttributeMapping.getName(); - } - - @Override - public void setName(String newName) { - this.virtualXmlAttributeMapping.setName(newName); - } - - @Override - public TextRange getNameTextRange() { - return this.virtualXmlAttributeMapping.getNameTextRange(); - } - - @Override - public XmlAccessMethods getAccessMethods() { - return null; - } - - @Override - public void setAccessMethods(XmlAccessMethods value) { - throw new UnsupportedOperationException("cannot set values on a virtual mapping"); //$NON-NLS-1$ - } - - - @Override - public EList<XmlProperty> getProperties() { - // TODO get from java annotations - return null; - } - -} diff --git a/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/orm/VirtualEclipseLinkXmlVersion.java b/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/orm/VirtualEclipseLinkXmlVersion.java deleted file mode 100644 index 2446d3b7ed..0000000000 --- a/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/orm/VirtualEclipseLinkXmlVersion.java +++ /dev/null @@ -1,254 +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.eclipselink.core.internal.context.orm; - -import org.eclipse.emf.common.util.EList; -import org.eclipse.jpt.core.context.java.JavaVersionMapping; -import org.eclipse.jpt.core.context.orm.OrmTypeMapping; -import org.eclipse.jpt.core.internal.context.orm.VirtualXmlVersion; -import org.eclipse.jpt.core.resource.orm.EnumType; -import org.eclipse.jpt.core.resource.orm.TemporalType; -import org.eclipse.jpt.core.resource.orm.XmlColumn; -import org.eclipse.jpt.core.utility.TextRange; -import org.eclipse.jpt.eclipselink.core.context.EclipseLinkConvert; -import org.eclipse.jpt.eclipselink.core.context.EclipseLinkCustomConverter; -import org.eclipse.jpt.eclipselink.core.context.EclipseLinkConverter; -import org.eclipse.jpt.eclipselink.core.context.EclipseLinkVersionMapping; -import org.eclipse.jpt.eclipselink.core.context.EclipseLinkObjectTypeConverter; -import org.eclipse.jpt.eclipselink.core.context.EclipseLinkStructConverter; -import org.eclipse.jpt.eclipselink.core.context.EclipseLinkTypeConverter; -import org.eclipse.jpt.eclipselink.core.resource.orm.XmlAccessMethods; -import org.eclipse.jpt.eclipselink.core.resource.orm.XmlConverter; -import org.eclipse.jpt.eclipselink.core.resource.orm.XmlObjectTypeConverter; -import org.eclipse.jpt.eclipselink.core.resource.orm.XmlProperty; -import org.eclipse.jpt.eclipselink.core.resource.orm.XmlStructConverter; -import org.eclipse.jpt.eclipselink.core.resource.orm.XmlTypeConverter; -import org.eclipse.jpt.eclipselink.core.resource.orm.XmlVersion; - -/** - * VirtualBasic is an implementation of Basic used when there is - * no tag in the orm.xml and an underlying javaBasicMapping exists. - */ -public class VirtualEclipseLinkXmlVersion extends XmlVersion -{ - - protected OrmTypeMapping ormTypeMapping; - - protected final JavaVersionMapping javaAttributeMapping; - - protected final VirtualXmlVersion virtualXmlVersion; - - public VirtualEclipseLinkXmlVersion(OrmTypeMapping ormTypeMapping, JavaVersionMapping javaVersionMapping) { - super(); - this.ormTypeMapping = ormTypeMapping; - this.javaAttributeMapping = javaVersionMapping; - this.virtualXmlVersion = new VirtualXmlVersion(ormTypeMapping, javaVersionMapping); - } - - protected boolean isOrmMetadataComplete() { - return this.ormTypeMapping.isMetadataComplete(); - } - - @Override - public String getMappingKey() { - return this.virtualXmlVersion.getMappingKey(); - } - - @Override - public String getName() { - return this.virtualXmlVersion.getName(); - } - - @Override - public void setName(String newName) { - this.virtualXmlVersion.setName(newName); - } - - @Override - public TextRange getNameTextRange() { - return this.virtualXmlVersion.getNameTextRange(); - } - - @Override - public XmlColumn getColumn() { - return this.virtualXmlVersion.getColumn(); - } - - @Override - public void setColumn(XmlColumn value) { - this.virtualXmlVersion.setColumn(value); - } - - @Override - public TemporalType getTemporal() { - return this.virtualXmlVersion.getTemporal(); - } - - @Override - public void setTemporal(TemporalType newTemporal){ - throw new UnsupportedOperationException("cannot set values on a virtual mapping"); //$NON-NLS-1$ - } - - @Override - public EnumType getEnumerated() { - return this.virtualXmlVersion.getEnumerated(); - } - - @Override - public void setEnumerated(EnumType value) { - throw new UnsupportedOperationException("cannot set values on a virtual mapping"); //$NON-NLS-1$ - } - - @Override - public boolean isLob() { - return this.virtualXmlVersion.isLob(); - } - - @Override - public void setLob(boolean value) { - throw new UnsupportedOperationException("cannot set values on a virtual mapping"); //$NON-NLS-1$ - } - - @Override - public TextRange getEnumeratedTextRange() { - return this.virtualXmlVersion.getEnumeratedTextRange(); - } - - @Override - public TextRange getLobTextRange() { - return this.virtualXmlVersion.getLobTextRange(); - } - - @Override - public TextRange getTemporalTextRange() { - return this.virtualXmlVersion.getTemporalTextRange(); - } - - @Override - public Boolean getMutable() { - //don't need isOrmMetadataComplete() check because there is no default Id mapping - return Boolean.valueOf(((EclipseLinkVersionMapping) this.javaAttributeMapping).getMutable().isMutable()); - } - - @Override - public void setMutable(Boolean value) { - throw new UnsupportedOperationException("cannot set values on a virtual mapping"); //$NON-NLS-1$ - } - - @Override - public String getConvert() { - //don't need isOrmMetadataComplete() check because there is no default Id mapping - if (this.javaAttributeMapping.getConverter().getType() == EclipseLinkConvert.ECLIPSE_LINK_CONVERTER) { - return ((EclipseLinkConvert) this.javaAttributeMapping.getConverter()).getConverterName(); - } - return null; - } - - @Override - public void setConvert(String value) { - throw new UnsupportedOperationException("cannot set values on a virtual mapping"); //$NON-NLS-1$ - } - - @Override - public TextRange getMutableTextRange() { - return null; - } - - @Override - public TextRange getConvertTextRange() { - return null; - } - - @Override - public XmlConverter getConverter() { - //don't need isOrmMetadataComplete() check because there is no default Id mapping - if (this.javaAttributeMapping.getConverter().getType() == EclipseLinkConvert.ECLIPSE_LINK_CONVERTER) { - EclipseLinkConverter converter = ((EclipseLinkConvert) this.javaAttributeMapping.getConverter()).getConverter(); - if (converter != null && converter.getType() == EclipseLinkConverter.CUSTOM_CONVERTER) { - return new VirtualEclipseLinkXmlConverter(this.ormTypeMapping, (EclipseLinkCustomConverter) ((EclipseLinkConvert) this.javaAttributeMapping.getConverter()).getConverter()); - } - } - return null; - } - - @Override - public void setConverter(XmlConverter value) { - throw new UnsupportedOperationException("cannot set values on a virtual mapping"); //$NON-NLS-1$ - } - - @Override - public XmlObjectTypeConverter getObjectTypeConverter() { - //don't need isOrmMetadataComplete() check because there is no default Id mapping - if (this.javaAttributeMapping.getConverter().getType() == EclipseLinkConvert.ECLIPSE_LINK_CONVERTER) { - EclipseLinkConverter converter = ((EclipseLinkConvert) this.javaAttributeMapping.getConverter()).getConverter(); - if (converter != null && converter.getType() == EclipseLinkConverter.OBJECT_TYPE_CONVERTER) { - return new VirtualEclipseLinkXmlObjectTypeConverter(this.ormTypeMapping, (EclipseLinkObjectTypeConverter) ((EclipseLinkConvert) this.javaAttributeMapping.getConverter()).getConverter()); - } - } - return null; - } - - @Override - public void setObjectTypeConverter(XmlObjectTypeConverter value) { - throw new UnsupportedOperationException("cannot set values on a virtual mapping"); //$NON-NLS-1$ - } - - @Override - public XmlStructConverter getStructConverter() { - //don't need isOrmMetadataComplete() check because there is no default Id mapping - if (this.javaAttributeMapping.getConverter().getType() == EclipseLinkConvert.ECLIPSE_LINK_CONVERTER) { - EclipseLinkConverter converter = ((EclipseLinkConvert) this.javaAttributeMapping.getConverter()).getConverter(); - if (converter != null && converter.getType() == EclipseLinkConverter.STRUCT_CONVERTER) { - return new VirtualEclipseLinkXmlStructConverter(this.ormTypeMapping, (EclipseLinkStructConverter) ((EclipseLinkConvert) this.javaAttributeMapping.getConverter()).getConverter()); - } - } - return null; - } - - @Override - public void setStructConverter(XmlStructConverter value) { - throw new UnsupportedOperationException("cannot set values on a virtual mapping"); //$NON-NLS-1$ - } - - @Override - public XmlTypeConverter getTypeConverter() { - //don't need isOrmMetadataComplete() check because there is no default Id mapping - if (this.javaAttributeMapping.getConverter().getType() == EclipseLinkConvert.ECLIPSE_LINK_CONVERTER) { - EclipseLinkConverter converter = ((EclipseLinkConvert) this.javaAttributeMapping.getConverter()).getConverter(); - if (converter != null && converter.getType() == EclipseLinkConverter.TYPE_CONVERTER) { - return new VirtualEclipseLinkXmlTypeConverter(this.ormTypeMapping, (EclipseLinkTypeConverter) ((EclipseLinkConvert) this.javaAttributeMapping.getConverter()).getConverter()); - } - } - return null; - } - - @Override - public void setTypeConverter(XmlTypeConverter value) { - throw new UnsupportedOperationException("cannot set values on a virtual mapping"); //$NON-NLS-1$ - } - - - @Override - public XmlAccessMethods getAccessMethods() { - return null; - } - - @Override - public void setAccessMethods(XmlAccessMethods value) { - throw new UnsupportedOperationException("cannot set values on a virtual mapping"); //$NON-NLS-1$ - } - - @Override - public EList<XmlProperty> getProperties() { - // TODO get from java annotations - return null; - } - -} diff --git a/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/persistence/EclipseLinkJarFileRef.java b/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/persistence/EclipseLinkJarFileRef.java deleted file mode 100644 index da7f13e5e3..0000000000 --- a/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/persistence/EclipseLinkJarFileRef.java +++ /dev/null @@ -1,31 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2009 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.eclipselink.core.internal.context.persistence; - -import org.eclipse.core.runtime.IPath; -import org.eclipse.jpt.core.context.persistence.PersistenceUnit; -import org.eclipse.jpt.core.internal.context.persistence.AbstractJarFileRef; -import org.eclipse.jpt.core.resource.persistence.XmlJarFileRef; -import org.eclipse.jpt.utility.internal.ArrayTools; - -public class EclipseLinkJarFileRef - extends AbstractJarFileRef -{ - public EclipseLinkJarFileRef(PersistenceUnit parent, XmlJarFileRef xmlJarFileRef) { - super(parent, xmlJarFileRef); - } - - @Override - protected IPath[] resolveDeploymentJarFilePathWeb(IPath root, IPath jarFilePath) { - IPath[] genericPath = super.resolveDeploymentJarFilePathWeb(root, jarFilePath); - return ArrayTools.removeLast(genericPath); - } - -} diff --git a/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/persistence/EclipseLinkPersistenceUnit.java b/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/persistence/EclipseLinkPersistenceUnit.java deleted file mode 100644 index 8efdedfa89..0000000000 --- a/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/persistence/EclipseLinkPersistenceUnit.java +++ /dev/null @@ -1,388 +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.eclipselink.core.internal.context.persistence; - -import java.util.ArrayList; -import java.util.HashSet; -import java.util.Iterator; -import java.util.List; -import java.util.ListIterator; -import java.util.Set; -import org.eclipse.jpt.core.context.persistence.MappingFileRef; -import org.eclipse.jpt.core.context.persistence.Persistence; -import org.eclipse.jpt.core.internal.context.persistence.AbstractPersistenceUnit; -import org.eclipse.jpt.core.internal.jpa1.context.persistence.ImpliedMappingFileRef; -import org.eclipse.jpt.core.jpa2.context.persistence.options.SharedCacheMode; -import org.eclipse.jpt.core.resource.persistence.XmlPersistenceUnit; -import org.eclipse.jpt.eclipselink.core.EclipseLinkJpaProject; -import org.eclipse.jpt.eclipselink.core.context.EclipseLinkConverter; -import org.eclipse.jpt.eclipselink.core.context.persistence.caching.Caching; -import org.eclipse.jpt.eclipselink.core.context.persistence.connection.Connection; -import org.eclipse.jpt.eclipselink.core.context.persistence.customization.Customization; -import org.eclipse.jpt.eclipselink.core.context.persistence.general.GeneralProperties; -import org.eclipse.jpt.eclipselink.core.context.persistence.logging.Logging; -import org.eclipse.jpt.eclipselink.core.context.persistence.options.Options; -import org.eclipse.jpt.eclipselink.core.context.persistence.schema.generation.SchemaGeneration; -import org.eclipse.jpt.eclipselink.core.internal.JptEclipseLinkCorePlugin; -import org.eclipse.jpt.eclipselink.core.internal.context.persistence.caching.EclipseLinkCaching; -import org.eclipse.jpt.eclipselink.core.internal.context.persistence.customization.EclipseLinkCustomization; -import org.eclipse.jpt.eclipselink.core.internal.context.persistence.general.EclipseLinkGeneralProperties; -import org.eclipse.jpt.eclipselink.core.internal.context.persistence.logging.EclipseLinkLogging; -import org.eclipse.jpt.eclipselink.core.internal.context.persistence.schema.generation.EclipseLinkSchemaGeneration; -import org.eclipse.jpt.utility.internal.CollectionTools; -import org.eclipse.jpt.utility.internal.iterators.CloneListIterator; -import org.eclipse.jpt.utility.internal.iterators.FilteringIterator; -import org.eclipse.jpt.utility.internal.iterators.ReadOnlyCompositeListIterator; -import org.eclipse.jpt.utility.internal.iterators.TransformationIterator; - -/** - * EclipseLink persistence unit - */ -public class EclipseLinkPersistenceUnit - extends AbstractPersistenceUnit -{ - protected MappingFileRef impliedEclipseLinkMappingFileRef; - - private/*final*/ GeneralProperties generalProperties; - private Customization customization; - private Caching caching; - private Logging logging; - private SchemaGeneration schemaGeneration; - - /* global converter definitions, defined elsewhere in model */ - protected final List<EclipseLinkConverter> converters = new ArrayList<EclipseLinkConverter>(); - - - public EclipseLinkPersistenceUnit(Persistence parent, XmlPersistenceUnit xmlPersistenceUnit) { - super(parent, xmlPersistenceUnit); - } - - @Override - protected void initializeProperties() { - super.initializeProperties(); - - this.generalProperties = this.buildEclipseLinkGeneralProperties(); - this.customization = this.buildEclipseLinkCustomization(); - this.caching = this.buildEclipseLinkCaching(); - this.logging = this.buildEclipseLinkLogging(); - this.schemaGeneration = this.buildEclipseLinkSchemaGeneration(); - } - - @Override - protected void addNonUpdateAspectNamesTo(Set<String> nonUpdateAspectNames) { - super.addNonUpdateAspectNamesTo(nonUpdateAspectNames); - nonUpdateAspectNames.add(CONVERTERS_LIST); - } - - @Override - public void propertyValueChanged(String propertyName, String newValue) { - super.propertyValueChanged(propertyName, newValue); - this.generalProperties.propertyValueChanged(propertyName, newValue); - this.customization.propertyValueChanged(propertyName, newValue); - this.caching.propertyValueChanged(propertyName, newValue); - this.logging.propertyValueChanged(propertyName, newValue); - this.schemaGeneration.propertyValueChanged(propertyName, newValue); - } - - @Override - public void propertyRemoved(String propertyName) { - super.propertyRemoved(propertyName); - this.generalProperties.propertyRemoved(propertyName); - this.customization.propertyRemoved(propertyName); - this.caching.propertyRemoved(propertyName); - this.logging.propertyRemoved(propertyName); - this.schemaGeneration.propertyRemoved(propertyName); - } - - @Override - protected SharedCacheMode buildDefaultSharedCacheMode() { - return SharedCacheMode.DISABLE_SELECTIVE; - } - - @Override - public boolean calculateDefaultCacheable() { - switch (getSharedCacheMode()) { - case NONE: - case ENABLE_SELECTIVE: - return false; - case ALL: - case DISABLE_SELECTIVE: - case UNSPECIFIED: - return true; - } - return true;//null - } - - // **************** mapping file refs ************************************** - - @Override - public ListIterator<MappingFileRef> mappingFileRefs() { - if (this.impliedEclipseLinkMappingFileRef == null) { - return super.mappingFileRefs(); - } - return new ReadOnlyCompositeListIterator<MappingFileRef>( - super.mappingFileRefs(), this.impliedEclipseLinkMappingFileRef); - } - - @Override - public int mappingFileRefsSize() { - if (this.impliedEclipseLinkMappingFileRef == null) { - return super.mappingFileRefsSize(); - } - return 1 + super.mappingFileRefsSize(); - } - - - // **************** implied eclipselink mapping file ref ******************* - - /** - * String constant associated with changes to the implied eclipselink mapping file ref - */ - public final static String IMPLIED_ECLIPSELINK_MAPPING_FILE_REF_PROPERTY = "impliedEclipseLinkMappingFileRef"; //$NON-NLS-1$ - - - public MappingFileRef getImpliedEclipseLinkMappingFileRef() { - return this.impliedEclipseLinkMappingFileRef; - } - - protected MappingFileRef setImpliedEclipseLinkMappingFileRef() { - if (this.impliedEclipseLinkMappingFileRef != null) { - throw new IllegalStateException("The implied eclipselink mapping file ref is already set."); //$NON-NLS-1$ - } - MappingFileRef mappingFileRef = buildEclipseLinkImpliedMappingFileRef(); - this.impliedEclipseLinkMappingFileRef = mappingFileRef; - firePropertyChanged(IMPLIED_ECLIPSELINK_MAPPING_FILE_REF_PROPERTY, null, mappingFileRef); - return mappingFileRef; - } - - protected void unsetImpliedEclipseLinkMappingFileRef() { - if (this.impliedEclipseLinkMappingFileRef == null) { - throw new IllegalStateException("The implied eclipselink mapping file ref is already unset."); //$NON-NLS-1$ - } - MappingFileRef mappingFileRef = this.impliedEclipseLinkMappingFileRef; - this.impliedEclipseLinkMappingFileRef.dispose(); - this.impliedEclipseLinkMappingFileRef = null; - firePropertyChanged(IMPLIED_ECLIPSELINK_MAPPING_FILE_REF_PROPERTY, mappingFileRef, null); - } - - - // **************** factory methods ********************************************* - - protected GeneralProperties buildEclipseLinkGeneralProperties() { - return new EclipseLinkGeneralProperties(this); - } - - protected Connection buildEclipseLinkConnection() { - return (Connection) getContextNodeFactory().buildConnection(this); - } - - protected Customization buildEclipseLinkCustomization() { - return new EclipseLinkCustomization(this); - } - - protected Caching buildEclipseLinkCaching() { - return new EclipseLinkCaching(this); - } - - protected Logging buildEclipseLinkLogging() { - return new EclipseLinkLogging(this); - } - - protected Options buildEclipseLinkOptions() { - return (Options) getContextNodeFactory().buildOptions(this); - } - - protected SchemaGeneration buildEclipseLinkSchemaGeneration() { - return new EclipseLinkSchemaGeneration(this); - } - - - // **************** properties ********************************************* - - public GeneralProperties getGeneralProperties() { - return this.generalProperties; - } - - @Override - public Connection getConnection() { - return (Connection) super.getConnection(); - } - - public Customization getCustomization() { - return this.customization; - } - - public Caching getCaching() { - return this.caching; - } - - public Logging getLogging() { - return this.logging; - } - - @Override - public Options getOptions() { - return (Options) super.getOptions(); - } - - public SchemaGeneration getSchemaGeneration() { - return this.schemaGeneration; - } - - - // **************** converters ********************************************* - - /** - * Identifier for changes to the list of global converter definitions. - * Note that there are no granular changes to this list. There is only - * notification that the entire list has changed. - */ - public static final String CONVERTERS_LIST = "converters"; //$NON-NLS-1$ - - /** - * Add the converter definition (defined elsewhere) to the list of converters - * defined within this persistence unit. - * Note that this should only be called during the process of updating the - * local converter definition. - * No change notification accompanies this action specifically. - */ - public void addConverter(EclipseLinkConverter converter) { - this.converters.add(converter); - } - - /** - * Return an iterator on all converters defined within this persistence unit, - * included duplicately named converters definitions. - */ - public ListIterator<EclipseLinkConverter> allConverters() { - return new CloneListIterator<EclipseLinkConverter>(this.converters); - } - - public int convertersSize() { - return this.converters.size(); - } - - /** - * Return an array of the names of the converters defined in the persistence - * unit, with duplicates removed. - */ - public String[] uniqueConverterNames() { - HashSet<String> names = CollectionTools.set(this.allNonNullConverterNames()); - return names.toArray(new String[names.size()]); - } - - protected Iterator<String> allNonNullConverterNames() { - return new FilteringIterator<String, String>(this.allConverterNames()) { - @Override - protected boolean accept(String converterName) { - return converterName != null; - } - }; - } - - protected Iterator<String> allConverterNames() { - return new TransformationIterator<EclipseLinkConverter, String>(this.allConverters()) { - @Override - protected String transform(EclipseLinkConverter converter) { - return converter.getName(); - } - }; - } - - - // **************** updating *********************************************** - - @Override - public void update(XmlPersistenceUnit persistenceUnit) { - this.converters.clear(); - super.update(persistenceUnit); - convertersUpdated(); - } - - @Override - public void postUpdate() { - super.postUpdate(); - if (this.impliedEclipseLinkMappingFileRef != null) { - this.impliedEclipseLinkMappingFileRef.postUpdate(); - } - } - - @Override - protected void initializeMappingFileRefs() { - super.initializeMappingFileRefs(); - - // use implied mapping file if - // a) properties does not exclude it - // b) it isn't otherwise specified - // c) the file actually exists - if (! impliedEclipseLinkMappingFileIsExcluded() - && ! impliedEclipseLinkMappingFileIsSpecified() - && impliedEclipseLinkMappingFileExists()) { - - this.impliedEclipseLinkMappingFileRef = buildEclipseLinkImpliedMappingFileRef(); - } - } - - private ImpliedMappingFileRef buildEclipseLinkImpliedMappingFileRef() { - return new ImpliedMappingFileRef(this, JptEclipseLinkCorePlugin.DEFAULT_ECLIPSELINK_ORM_XML_FILE_PATH); - } - - @Override - protected void updateMappingFileRefs() { - super.updateMappingFileRefs(); - - // use implied mapping file if - // a) properties does not exclude it - // b) it isn't otherwise specified - // c) the file actually exists - if (! impliedEclipseLinkMappingFileIsExcluded() - && ! impliedEclipseLinkMappingFileIsSpecified() - && impliedEclipseLinkMappingFileExists()) { - - if (this.impliedEclipseLinkMappingFileRef == null) { - setImpliedEclipseLinkMappingFileRef(); - } - getImpliedEclipseLinkMappingFileRef().update(null); - } - else if (this.impliedEclipseLinkMappingFileRef != null) { - unsetImpliedEclipseLinkMappingFileRef(); - } - } - - protected boolean impliedEclipseLinkMappingFileIsExcluded() { - return getGeneralProperties().getExcludeEclipselinkOrm() == Boolean.TRUE; - } - - protected boolean impliedEclipseLinkMappingFileIsSpecified() { - String impliedMappingFile = JptEclipseLinkCorePlugin.DEFAULT_ECLIPSELINK_ORM_XML_FILE_PATH; - for (Iterator<MappingFileRef> stream = specifiedMappingFileRefs(); stream.hasNext(); ) { - if (impliedMappingFile.equals(stream.next().getFileName())) { - return true; - } - } - return false; - } - - @Override - public EclipseLinkJpaProject getJpaProject() { - return (EclipseLinkJpaProject) super.getJpaProject(); - } - - protected boolean impliedEclipseLinkMappingFileExists() { - return getJpaProject().getDefaultEclipseLinkOrmXmlResource() != null; - } - - // This is called after the persistence unit has been updated to ensure - // we catch all added converters - protected void convertersUpdated() { - fireListChanged(CONVERTERS_LIST, this.converters); - } - -} diff --git a/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/persistence/EclipseLinkPersistenceUnitProperties.java b/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/persistence/EclipseLinkPersistenceUnitProperties.java deleted file mode 100644 index 20ebeeff03..0000000000 --- a/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/persistence/EclipseLinkPersistenceUnitProperties.java +++ /dev/null @@ -1,55 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2008, 2009 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - *******************************************************************************/ -package org.eclipse.jpt.eclipselink.core.internal.context.persistence; - -import java.util.Set; -import org.eclipse.jpt.core.context.persistence.PersistenceUnit; -import org.eclipse.jpt.core.internal.context.persistence.AbstractPersistenceUnitProperties; -import org.eclipse.jpt.utility.internal.CollectionTools; - -/** - * EclipseLinkPersistenceUnitProperties - * - * Listens to the propertyListAdapter - */ -public abstract class EclipseLinkPersistenceUnitProperties extends AbstractPersistenceUnitProperties -{ - // ********** constructors ********** - protected EclipseLinkPersistenceUnitProperties(PersistenceUnit parent) { - super(parent); - } - - // ******** Convenience methods ******** - - protected Set<PersistenceUnit.Property> getPropertiesSetWithPrefix(String keyPrefix) { - return CollectionTools.set(this.getPersistenceUnit().propertiesWithNamePrefix(keyPrefix)); - } - - /** - * Extracts the entityName of the specified property name. If the property name - * has no suffix, return an empty string. - */ - protected String extractEntityNameOf(PersistenceUnit.Property property) { - return extractEntityNameOf(property.getName()); - } - - /** - * Extracts the entityName of the specified string. If the string - * has no suffix, return an empty string. - */ - protected String extractEntityNameOf(String propertyName) { - int index = propertyName.lastIndexOf('.'); - if (index == -1) { - return ""; //$NON-NLS-1$ - } - return propertyName.substring(index + 1); - } - -} diff --git a/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/persistence/EclipseLinkPersistenceXmlContextNodeFactory.java b/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/persistence/EclipseLinkPersistenceXmlContextNodeFactory.java deleted file mode 100644 index 1f09758b7d..0000000000 --- a/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/persistence/EclipseLinkPersistenceXmlContextNodeFactory.java +++ /dev/null @@ -1,43 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2009 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.eclipselink.core.internal.context.persistence; - -import org.eclipse.jpt.core.context.persistence.JarFileRef; -import org.eclipse.jpt.core.context.persistence.Persistence; -import org.eclipse.jpt.core.context.persistence.PersistenceUnit; -import org.eclipse.jpt.core.context.persistence.PersistenceUnitProperties; -import org.eclipse.jpt.core.internal.context.persistence.AbstractPersistenceXmlContextNodeFactory; -import org.eclipse.jpt.core.resource.persistence.XmlJarFileRef; -import org.eclipse.jpt.core.resource.persistence.XmlPersistenceUnit; -import org.eclipse.jpt.eclipselink.core.internal.context.persistence.connection.EclipseLinkConnection; -import org.eclipse.jpt.eclipselink.core.internal.context.persistence.options.EclipseLinkOptions; - - -public class EclipseLinkPersistenceXmlContextNodeFactory extends AbstractPersistenceXmlContextNodeFactory -{ - - @Override - public PersistenceUnit buildPersistenceUnit(Persistence parent, XmlPersistenceUnit xmlPersistenceUnit) { - return new EclipseLinkPersistenceUnit(parent, xmlPersistenceUnit); - } - - @Override - public JarFileRef buildJarFileRef(PersistenceUnit parent, XmlJarFileRef xmlJarFileRef) { - return new EclipseLinkJarFileRef(parent, xmlJarFileRef); - } - - public PersistenceUnitProperties buildConnection(PersistenceUnit parent) { - return new EclipseLinkConnection(parent); - } - - public PersistenceUnitProperties buildOptions(PersistenceUnit parent) { - return new EclipseLinkOptions(parent); - } -} diff --git a/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/persistence/EclipseLinkPersistenceXmlDefinition.java b/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/persistence/EclipseLinkPersistenceXmlDefinition.java deleted file mode 100644 index f01bdc30d5..0000000000 --- a/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/persistence/EclipseLinkPersistenceXmlDefinition.java +++ /dev/null @@ -1,56 +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.eclipselink.core.internal.context.persistence; - -import org.eclipse.emf.ecore.EFactory; -import org.eclipse.jpt.core.JpaResourceType; -import org.eclipse.jpt.core.JptCorePlugin; -import org.eclipse.jpt.core.context.persistence.PersistenceXmlContextNodeFactory; -import org.eclipse.jpt.core.context.persistence.PersistenceXmlDefinition; -import org.eclipse.jpt.core.internal.context.persistence.AbstractPersistenceXmlDefinition; -import org.eclipse.jpt.core.resource.persistence.PersistenceFactory; - -public class EclipseLinkPersistenceXmlDefinition - extends AbstractPersistenceXmlDefinition -{ - // singleton - private static final PersistenceXmlDefinition INSTANCE = - new EclipseLinkPersistenceXmlDefinition(); - - - /** - * Return the singleton - */ - public static PersistenceXmlDefinition instance() { - return INSTANCE; - } - - - /** - * Enforce singleton usage - */ - private EclipseLinkPersistenceXmlDefinition() { - super(); - } - - - public EFactory getResourceNodeFactory() { - return PersistenceFactory.eINSTANCE; - } - - @Override - protected PersistenceXmlContextNodeFactory buildContextNodeFactory() { - return new EclipseLinkPersistenceXmlContextNodeFactory(); - } - - public JpaResourceType getResourceType() { - return JptCorePlugin.PERSISTENCE_XML_1_0_RESOURCE_TYPE; - } -} diff --git a/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/persistence/caching/EclipseLinkCaching.java b/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/persistence/caching/EclipseLinkCaching.java deleted file mode 100644 index 8a34c6de29..0000000000 --- a/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/persistence/caching/EclipseLinkCaching.java +++ /dev/null @@ -1,562 +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.eclipselink.core.internal.context.persistence.caching; - -import java.util.ArrayList; -import java.util.Iterator; -import java.util.List; -import java.util.ListIterator; -import java.util.Map; -import java.util.Set; - -import org.eclipse.jpt.core.context.persistence.PersistenceUnit; -import org.eclipse.jpt.eclipselink.core.context.persistence.caching.CacheType; -import org.eclipse.jpt.eclipselink.core.context.persistence.caching.Caching; -import org.eclipse.jpt.eclipselink.core.context.persistence.caching.FlushClearCache; -import org.eclipse.jpt.eclipselink.core.internal.context.persistence.EclipseLinkPersistenceUnitProperties; -import org.eclipse.jpt.utility.internal.iterators.CloneListIterator; -import org.eclipse.jpt.utility.internal.iterators.TransformationIterator; - -/** - * EclipseLinkCaching encapsulates EclipseLink Caching properties. - */ -public class EclipseLinkCaching extends EclipseLinkPersistenceUnitProperties - implements Caching -{ - // ********** EclipseLink properties ********** - private CacheType cacheTypeDefault; - private Integer cacheSizeDefault; - private Boolean sharedCacheDefault; - private FlushClearCache flushClearCache; - - private List<Entity> entities; - - // ********** constructors ********** - public EclipseLinkCaching(PersistenceUnit parent) { - super(parent); - } - - // ********** initialization ********** - /** - * Initializes properties with values from the persistence unit. - */ - @Override - protected void initializeProperties() { - this.entities = new ArrayList<Entity>(); - this.cacheTypeDefault = - this.getEnumValue(ECLIPSELINK_CACHE_TYPE_DEFAULT, CacheType.values()); - this.cacheSizeDefault = - this.getIntegerValue(ECLIPSELINK_CACHE_SIZE_DEFAULT); - this.sharedCacheDefault = - this.getBooleanValue(ECLIPSELINK_CACHE_SHARED_DEFAULT); - this.flushClearCache = - this.getEnumValue(ECLIPSELINK_FLUSH_CLEAR_CACHE, FlushClearCache.values()); - - Set<PersistenceUnit.Property> cacheTypeProperties = - this.getPropertiesSetWithPrefix(ECLIPSELINK_CACHE_TYPE); - Set<PersistenceUnit.Property> cacheSizeProperties = - this.getPropertiesSetWithPrefix(ECLIPSELINK_CACHE_SIZE); - Set<PersistenceUnit.Property> sharedCacheProperties = - this.getPropertiesSetWithPrefix(ECLIPSELINK_SHARED_CACHE); - - this.initializeEntitiesCacheType(cacheTypeProperties); - this.initializeEntitiesCacheSize(cacheSizeProperties); - this.initializeEntitiesSharedCache(sharedCacheProperties); - } - - private void initializeEntitiesCacheType(Set<PersistenceUnit.Property> cacheTypeProperties) { - for (PersistenceUnit.Property cacheTypeProperty : cacheTypeProperties) { - this.setEntityCacheTypeOf(cacheTypeProperty); - } - } - - private void initializeEntitiesCacheSize(Set<PersistenceUnit.Property> cacheSizeProperties) { - for (PersistenceUnit.Property cacheSizeProperty : cacheSizeProperties) { - this.setEntityCacheSizeOf(cacheSizeProperty); - } - } - - private void initializeEntitiesSharedCache(Set<PersistenceUnit.Property> sharedCacheProperties) { - for (PersistenceUnit.Property sharedCacheProperty : sharedCacheProperties) { - this.setEntitySharedCacheOf(sharedCacheProperty); - } - } - - // ********** behavior ********** - - public void propertyValueChanged(String propertyName, String newValue) { - if (propertyName.equals(ECLIPSELINK_CACHE_TYPE_DEFAULT)) { - this.cacheTypeDefaultChanged(newValue); - } - else if (propertyName.equals(ECLIPSELINK_CACHE_SIZE_DEFAULT)) { - this.cacheSizeDefaultChanged(newValue); - } - else if (propertyName.equals(ECLIPSELINK_CACHE_SHARED_DEFAULT)) { - this.sharedCacheDefaultChanged(newValue); - } - else if (propertyName.startsWith(ECLIPSELINK_CACHE_TYPE)) { - this.cacheTypeChanged(propertyName, newValue); - } - else if (propertyName.startsWith(ECLIPSELINK_CACHE_SIZE)) { - this.cacheSizeChanged(propertyName, newValue); - } - else if (propertyName.startsWith(ECLIPSELINK_SHARED_CACHE)) { - this.sharedCacheChanged(propertyName, newValue); - } - else if (propertyName.equals(ECLIPSELINK_FLUSH_CLEAR_CACHE)) { - this.flushClearCacheChanged(newValue); - } - } - - public void propertyRemoved(String propertyName) { - if (propertyName.equals(ECLIPSELINK_CACHE_TYPE_DEFAULT)) { - this.cacheTypeDefaultChanged(null); - } - else if (propertyName.equals(ECLIPSELINK_CACHE_SIZE_DEFAULT)) { - this.cacheSizeDefaultChanged(null); - } - else if (propertyName.equals(ECLIPSELINK_CACHE_SHARED_DEFAULT)) { - this.sharedCacheDefaultChanged(null); - } - else if (propertyName.startsWith(ECLIPSELINK_CACHE_TYPE)) { - this.cacheTypeChanged(propertyName, null); - } - else if (propertyName.startsWith(ECLIPSELINK_CACHE_SIZE)) { - this.cacheSizeChanged(propertyName, null); - } - else if (propertyName.startsWith(ECLIPSELINK_SHARED_CACHE)) { - this.sharedCacheChanged(propertyName, null); - } - else if (propertyName.equals(ECLIPSELINK_FLUSH_CLEAR_CACHE)) { - this.flushClearCacheChanged(null); - } - } - - /** - * Adds property names key/value pairs, where: - * key = EclipseLink property key; - * value = property id - */ - @Override - protected void addPropertyNames(Map<String, String> propertyNames) { - propertyNames.put( - ECLIPSELINK_CACHE_TYPE_DEFAULT, - CACHE_TYPE_DEFAULT_PROPERTY); - propertyNames.put( - ECLIPSELINK_CACHE_SIZE_DEFAULT, - CACHE_SIZE_DEFAULT_PROPERTY); - propertyNames.put( - ECLIPSELINK_CACHE_SHARED_DEFAULT, - SHARED_CACHE_DEFAULT_PROPERTY); - propertyNames.put( - ECLIPSELINK_FLUSH_CLEAR_CACHE, - FLUSH_CLEAR_CACHE_PROPERTY); - - // Don't need to initialize propertyNames for: - // cacheType, sharedCache, cacheSize - } - - /** - * Method used for identifying the given property. - */ - @Override - public boolean itemIsProperty(PersistenceUnit.Property item) { - boolean isProperty = super.itemIsProperty(item); - - if ( ! isProperty && item.getName() != null) { - if (item.getName().startsWith(ECLIPSELINK_CACHE_TYPE) || - item.getName().startsWith(ECLIPSELINK_CACHE_SIZE) || - item.getName().startsWith(ECLIPSELINK_SHARED_CACHE)) { - return true; - } - } - return isProperty; - } - - /** - * Returns the property name used for change notification of the given - * property. - */ - @Override - public String propertyIdOf(PersistenceUnit.Property property) { - try { - return super.propertyIdOf(property); - } - catch (IllegalArgumentException e) { - if (property.getName().startsWith(ECLIPSELINK_CACHE_TYPE)) { - return CACHE_TYPE_PROPERTY; - } - else if (property.getName().startsWith(ECLIPSELINK_CACHE_SIZE)) { - return CACHE_SIZE_PROPERTY; - } - else if (property.getName().startsWith(ECLIPSELINK_SHARED_CACHE)) { - return SHARED_CACHE_PROPERTY; - } - } - throw new IllegalArgumentException("Illegal property: " + property.toString()); - } - - public Entity addEntity(String entityName) { - if (this.entityExists(entityName)) { - throw new IllegalStateException("Entity " + entityName + " already exists."); - } - Entity newEntity = this.buildEntity(entityName); - this.entities.add(newEntity); - this.fireListChanged(ENTITIES_LIST, this.entities); - return newEntity; - } - - public void removeEntity(String entityName) { - if ( ! this.entityExists(entityName)) { - return; - } - Entity entity = this.getEntityNamed(entityName); - this.clearEntity(entity); - this.removeEntity(entity); - } - - // ********** CacheType ********** - public CacheType getCacheTypeOf(String entityName) { - Entity entity = this.getEntityNamed(entityName); - return (entity == null) ? null : entity.getCacheType(); - } - - public void setCacheTypeOf(String entityName, CacheType newCacheType) { - Entity old = this.setEntityCacheTypeOf(entityName, newCacheType); - this.putEnumValue(ECLIPSELINK_CACHE_TYPE, entityName, newCacheType, false); - this.firePropertyChanged(CACHE_TYPE_PROPERTY, old, this.getEntityNamed(entityName)); - } - - private void cacheTypeChanged(String propertyName, String stringValue) { - String entityName = this.extractEntityNameOf(propertyName); - Entity old = this.setEntityCacheTypeOf(entityName, stringValue); - this.firePropertyChanged(CACHE_TYPE_PROPERTY, old, this.getEntityNamed(entityName)); - } - - public CacheType getDefaultCacheType() { - return (this.cacheTypeDefault == null) ? DEFAULT_CACHE_TYPE : this.cacheTypeDefault; - } - - // ********** CacheSize ********** - public Integer getCacheSizeOf(String entityName) { - Entity entity = this.getEntityNamed(entityName); - return (entity == null) ? null : entity.getCacheSize(); - } - - public void setCacheSizeOf(String entityName, Integer newCacheSize) { - Entity old = this.setEntityCacheSizeOf(entityName, newCacheSize); - this.putIntegerValue(ECLIPSELINK_CACHE_SIZE + entityName, newCacheSize); - this.firePropertyChanged(CACHE_SIZE_PROPERTY, old, this.getEntityNamed(entityName)); - } - - private void cacheSizeChanged(String propertyName, String stringValue) { - String entityName = this.extractEntityNameOf(propertyName); - Entity old = this.setEntityCacheSizeOf(entityName, stringValue); - this.firePropertyChanged(CACHE_SIZE_PROPERTY, old, this.getEntityNamed(entityName)); - } - - public Integer getDefaultCacheSize() { - return (this.cacheSizeDefault == null) ? DEFAULT_CACHE_SIZE : this.cacheSizeDefault; - } - - // ********** SharedCache ********** - public Boolean getSharedCacheOf(String entityName) { - Entity entity = this.getEntityNamed(entityName); - return (entity == null) ? null : entity.cacheIsShared(); - } - - public void setSharedCacheOf(String entityName, Boolean newSharedCache) { - Entity old = this.setEntitySharedCacheOf(entityName, newSharedCache); - this.putBooleanValue(ECLIPSELINK_SHARED_CACHE, entityName, newSharedCache, false); - this.firePropertyChanged(SHARED_CACHE_PROPERTY, old, this.getEntityNamed(entityName)); - } - - private void sharedCacheChanged(String propertyName, String stringValue) { - String entityName = this.extractEntityNameOf(propertyName); - Entity old = this.setEntitySharedCacheOf(entityName, stringValue); - this.firePropertyChanged(SHARED_CACHE_PROPERTY, old, this.getEntityNamed(entityName)); - } - - public Boolean getDefaultSharedCache() { - return (this.sharedCacheDefault == null) ? DEFAULT_SHARED_CACHE : this.sharedCacheDefault; - } - - // ********** CacheTypeDefault ********** - public CacheType getCacheTypeDefault() { - return this.cacheTypeDefault; - } - - public void setCacheTypeDefault(CacheType newCacheTypeDefault) { - CacheType old = this.cacheTypeDefault; - this.cacheTypeDefault = newCacheTypeDefault; - this.putProperty(CACHE_TYPE_DEFAULT_PROPERTY, newCacheTypeDefault); - this.firePropertyChanged(CACHE_TYPE_DEFAULT_PROPERTY, old, newCacheTypeDefault); - } - - private void cacheTypeDefaultChanged(String stringValue) { - CacheType newValue = getEnumValueOf(stringValue, CacheType.values()); - CacheType old = this.cacheTypeDefault; - this.cacheTypeDefault = newValue; - this.firePropertyChanged(CACHE_TYPE_DEFAULT_PROPERTY, old, newValue); - } - - public CacheType getDefaultCacheTypeDefault() { - return DEFAULT_CACHE_TYPE_DEFAULT; - } - - // ********** CacheSizeDefault ********** - public Integer getCacheSizeDefault() { - return this.cacheSizeDefault; - } - - public void setCacheSizeDefault(Integer newCacheSizeDefault) { - Integer old = this.cacheSizeDefault; - this.cacheSizeDefault = newCacheSizeDefault; - this.putProperty(CACHE_SIZE_DEFAULT_PROPERTY, newCacheSizeDefault); - this.firePropertyChanged(CACHE_SIZE_DEFAULT_PROPERTY, old, newCacheSizeDefault); - } - - private void cacheSizeDefaultChanged(String stringValue) { - Integer newValue = getIntegerValueOf(stringValue); - Integer old = this.cacheSizeDefault; - this.cacheSizeDefault = newValue; - this.firePropertyChanged(CACHE_SIZE_DEFAULT_PROPERTY, old, newValue); - } - - public Integer getDefaultCacheSizeDefault() { - return DEFAULT_CACHE_SIZE_DEFAULT; - } - - // ********** SharedCacheDefault ********** - public Boolean getSharedCacheDefault() { - return this.sharedCacheDefault; - } - - public void setSharedCacheDefault(Boolean newSharedCacheDefault) { - Boolean old = this.sharedCacheDefault; - this.sharedCacheDefault = newSharedCacheDefault; - this.putProperty(SHARED_CACHE_DEFAULT_PROPERTY, newSharedCacheDefault); - this.firePropertyChanged(SHARED_CACHE_DEFAULT_PROPERTY, old, newSharedCacheDefault); - } - - private void sharedCacheDefaultChanged(String stringValue) { - Boolean newValue = getBooleanValueOf(stringValue); - - Boolean old = this.sharedCacheDefault; - this.sharedCacheDefault = newValue; - this.firePropertyChanged(SHARED_CACHE_DEFAULT_PROPERTY, old, newValue); - } - - public Boolean getDefaultSharedCacheDefault() { - return DEFAULT_SHARED_CACHE_DEFAULT; - } - - // ********** FlushClearCache ********** - - public FlushClearCache getFlushClearCache() { - return this.flushClearCache; - } - - public void setFlushClearCache(FlushClearCache newFlushClearCache) { - FlushClearCache old = this.flushClearCache; - this.flushClearCache = newFlushClearCache; - this.putProperty(FLUSH_CLEAR_CACHE_PROPERTY, newFlushClearCache); - this.firePropertyChanged(FLUSH_CLEAR_CACHE_PROPERTY, old, newFlushClearCache); - } - - private void flushClearCacheChanged(String stringValue) { - FlushClearCache newValue = getEnumValueOf(stringValue, FlushClearCache.values()); - FlushClearCache old = this.flushClearCache; - this.flushClearCache = newValue; - this.firePropertyChanged(FLUSH_CLEAR_CACHE_PROPERTY, old, newValue); - } - - public FlushClearCache getDefaultFlushClearCache() { - return DEFAULT_FLUSH_CLEAR_CACHE; - } - - // ****** Entity CacheType ******* - /** - * Returns the old Entity - */ - private Entity setEntityCacheTypeOf(String entityName, String stringValue) { - CacheType newValue = getEnumValueOf(stringValue, CacheType.values()); - return this.setEntityCacheTypeOf(entityName, newValue); - } - - /** - * Returns the old Entity - */ - private Entity setEntityCacheTypeOf(String entityName, CacheType cacheType) { - Entity entity = (this.entityExists(entityName)) ? - this.getEntityNamed(entityName) : - this.addEntity(entityName); - return this.setEntityCacheTypeOf(entity, cacheType); - } - - /** - * Returns the old Entity - */ - private Entity setEntityCacheTypeOf(Entity entity, CacheType cacheType) { - if(entity == null) { - throw new IllegalArgumentException(); - } - Entity old = entity.clone(); - entity.setCacheType(cacheType); - return old; - } - - private void setEntityCacheTypeOf(PersistenceUnit.Property cacheTypeProperty) { - String entityName = this.extractEntityNameOf(cacheTypeProperty); - this.setEntityCacheTypeOf(entityName, cacheTypeProperty.getValue()); - } - - // ****** Entity Cache size ******* - /** - * Returns the old Entity - */ - private Entity setEntityCacheSizeOf(String entityName, String stringValue) { - Integer newValue = getIntegerValueOf(stringValue); - return this.setEntityCacheSizeOf(entityName, newValue); - } - - /** - * Returns the old Entity - */ - private Entity setEntityCacheSizeOf(String entityName, Integer size) { - Entity entity = (this.entityExists(entityName)) ? - this.getEntityNamed(entityName) : - this.addEntity(entityName); - return this.setEntityCacheSizeOf(entity, size); - } - - /** - * Returns the old Entity - */ - private Entity setEntityCacheSizeOf(Entity entity, Integer size) { - if(entity == null) { - throw new IllegalArgumentException(); - } - Entity old = entity.clone(); - entity.setCacheSize(size); - return old; - } - - private void setEntityCacheSizeOf(PersistenceUnit.Property cacheSizeProperty) { - String entityName = this.extractEntityNameOf(cacheSizeProperty); - this.setEntityCacheSizeOf(entityName, cacheSizeProperty.getValue()); - } - - // ****** Entity SharedCache ******* - /** - * Returns the old Entity - */ - private Entity setEntitySharedCacheOf(String entityName, String stringValue) { - Boolean newValue = getBooleanValueOf(stringValue); - return this.setEntitySharedCacheOf(entityName, newValue); - } - - /** - * Returns the old Entity - */ - private Entity setEntitySharedCacheOf(String entityName, Boolean sharedCache) { - Entity entity = (this.entityExists(entityName)) ? - this.getEntityNamed(entityName) : - this.addEntity(entityName); - return this.setEntitySharedCacheOf(entity, sharedCache); - } - - /** - * Returns the old Entity - */ - private Entity setEntitySharedCacheOf(Entity entity, Boolean sharedCache) { - if(entity == null) { - throw new IllegalArgumentException(); - } - Entity old = entity.clone(); - entity.setSharedCache(sharedCache); - return old; - } - - private void setEntitySharedCacheOf(PersistenceUnit.Property sharedCacheProperty) { - String entityName = this.extractEntityNameOf(sharedCacheProperty); - this.setEntitySharedCacheOf(entityName, sharedCacheProperty.getValue()); - } - - // ****** convenience methods ******* - - /** - * Set all Entity properties to default. - */ - private void clearEntity(Entity entity) { - if(entity.isEmpty()) { - return; - } - String entityName = entity.getName(); - this.setCacheTypeOf(entityName, null); - this.setCacheSizeOf(entityName, null); - this.setSharedCacheOf(entityName, null); - } - - /** - * Returns the Entity with the given name. - */ - private Entity getEntityNamed(String name) { - for(Entity entity: this.entities) { - if(entity.getName().equals(name)) { - return entity; - } - } - return null; - } - - private Entity buildEntity(String name) { - return new Entity(this, name); - } - - private void removeEntity(Entity entity) { - if(entity == null) { - throw new IllegalArgumentException(); - } - this.entities.remove(entity); - this.fireListChanged(ENTITIES_LIST, this.entities); - } - - /** - * Return whether the Entity exist. - */ - public boolean entityExists(String name) { - for(Entity entity: this.entities) { - if(entity.getName().equals(name)) { - return true; - } - } - return false; - } - - // ****** entities list ******* - - public ListIterator<Entity> entities() { - return new CloneListIterator<Entity>(this.entities); - } - - public Iterator<String> entityNames() { - return new TransformationIterator<Entity, String>(this.entities()) { - @Override - protected String transform(Entity entity) { - return entity.getName(); - } - }; - } - - public int entitiesSize() { - return this.entities.size(); - } -} diff --git a/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/persistence/caching/Entity.java b/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/persistence/caching/Entity.java deleted file mode 100644 index df59739fc0..0000000000 --- a/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/persistence/caching/Entity.java +++ /dev/null @@ -1,143 +0,0 @@ -/******************************************************************************* -* Copyright (c) 2009 Oracle. All rights reserved. -* This program and the accompanying materials are made available under the -* terms of the Eclipse Public License v1.0, which accompanies this distribution -* and is available at http://www.eclipse.org/legal/epl-v10.html. -* -* Contributors: -* Oracle - initial API and implementation -*******************************************************************************/ -package org.eclipse.jpt.eclipselink.core.internal.context.persistence.caching; - -import java.io.Serializable; - -import org.eclipse.jpt.eclipselink.core.context.persistence.caching.CacheType; -import org.eclipse.jpt.eclipselink.core.context.persistence.caching.Caching; -import org.eclipse.jpt.utility.internal.StringTools; -import org.eclipse.jpt.utility.internal.model.AbstractModel; - -/** - * Entity - */ -public class Entity extends AbstractModel implements Cloneable, Serializable -{ - private String name; - private Caching parent; - - public static final String CACHE_TYPE_PROPERTY = Caching.CACHE_TYPE_PROPERTY; //$NON-NLS-1$ - public static final String CACHE_SIZE_PROPERTY = Caching.CACHE_SIZE_PROPERTY; //$NON-NLS-1$ - public static final String SHARED_CACHE_PROPERTY = Caching.SHARED_CACHE_PROPERTY; //$NON-NLS-1$ - - // ********** EclipseLink properties ********** - private CacheType cacheType; - private Integer cacheSize; - private Boolean cacheIsShared; - - private static final long serialVersionUID = 1L; - - // ********** constructors ********** - public Entity(Caching parent, String name) { - this(parent); - this.initialize(name); - } - - private Entity(Caching parent) { - this.parent = parent; - } - - private void initialize(String name) { - if(StringTools.stringIsEmpty(name)) { - throw new IllegalArgumentException(); - } - this.name = name; - } - - // ********** behaviors ********** - @Override - public boolean equals(Object o) { - if(o == null) { - return false; - } - Entity entity = (Entity) o; - return ( - (this.cacheType == null ? - entity.cacheType == null : this.cacheType.equals(entity.cacheType)) && - (this.cacheIsShared == null ? - entity.cacheIsShared == null : this.cacheIsShared.equals(entity.cacheIsShared)) && - (this.cacheSize == null ? - entity.cacheSize == null : this.cacheSize.equals(entity.cacheSize))); - } - - @Override - public Entity clone() { - try { - return (Entity)super.clone(); - } - catch (CloneNotSupportedException ex) { - throw new InternalError(); - } - } - - public boolean isEmpty() { - return (this.cacheType == null) && - (this.cacheSize == null) && - (this.cacheIsShared == null); - } - - public boolean entityNameIsValid() { - return ! StringTools.stringIsEmpty(this.name); - } - - public Caching getParent() { - return this.parent; - } - - // ********** name ********** - public String getName() { - return name; - } - - // ********** cacheType ********** - protected CacheType getCacheType() { - return this.cacheType; - } - - protected void setCacheType(CacheType cacheType) { - CacheType old = this.cacheType; - this.cacheType = cacheType; - this.firePropertyChanged(CACHE_TYPE_PROPERTY, old, cacheType); - } - - // ********** cacheSize ********** - protected Integer getCacheSize() { - return this.cacheSize; - } - - protected void setCacheSize(Integer cacheSize) { - Integer old = this.cacheSize; - this.cacheSize = cacheSize; - this.firePropertyChanged(CACHE_SIZE_PROPERTY, old, cacheSize); - } - - // ********** cacheIsShared ********** - protected Boolean cacheIsShared() { - return this.cacheIsShared; - } - - protected void setSharedCache(Boolean isShared) { - Boolean old = this.cacheIsShared; - this.cacheIsShared = isShared; - this.firePropertyChanged(SHARED_CACHE_PROPERTY, old, isShared); - } - - public void toString(StringBuilder sb) { - sb.append("name: "); - sb.append(this.name); - sb.append(", cacheType: "); - sb.append(this.cacheType); - sb.append(", cacheSize: "); - sb.append(this.cacheSize); - sb.append(", cacheIsShared: "); - sb.append(this.cacheIsShared); - } -} diff --git a/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/persistence/connection/EclipseLinkConnection.java b/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/persistence/connection/EclipseLinkConnection.java deleted file mode 100644 index c6be68c94e..0000000000 --- a/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/persistence/connection/EclipseLinkConnection.java +++ /dev/null @@ -1,600 +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.eclipselink.core.internal.context.persistence.connection; - -import java.util.Map; - -import org.eclipse.jpt.core.context.persistence.PersistenceUnit; -import org.eclipse.jpt.eclipselink.core.context.persistence.connection.BatchWriting; -import org.eclipse.jpt.eclipselink.core.context.persistence.connection.Connection; -import org.eclipse.jpt.eclipselink.core.internal.context.persistence.EclipseLinkPersistenceUnitProperties; - -/** - * EclipseLinkConnection - */ -public class EclipseLinkConnection extends EclipseLinkPersistenceUnitProperties - implements Connection -{ - - // ********** EclipseLink properties ********** - private BatchWriting batchWriting; - private Boolean nativeSql; - private Boolean cacheStatements; - private Integer cacheStatementsSize; - protected String driver; - protected String url; - protected String user; - protected String password; - private Boolean bindParameters; - private Boolean readConnectionsShared; - private Integer readConnectionsMin; - private Integer readConnectionsMax; - private Integer writeConnectionsMin; - private Integer writeConnectionsMax; - - - // ********** constructors ********** - public EclipseLinkConnection(PersistenceUnit parent) { - super(parent); - } - - // ********** initialization ********** - /** - * Initializes properties with values from the persistence unit. - */ - @Override - protected void initializeProperties() { - this.initializeDatabaseConnectionProperties(); - - this.batchWriting = - this.getEnumValue(ECLIPSELINK_BATCH_WRITING, BatchWriting.values()); - this.nativeSql = - this.getBooleanValue(ECLIPSELINK_NATIVE_SQL); - this.cacheStatements = - this.getBooleanValue(ECLIPSELINK_CACHE_STATEMENTS); - this.cacheStatementsSize = - this.getIntegerValue(ECLIPSELINK_CACHE_STATEMENTS_SIZE); - this.bindParameters = - this.getBooleanValue(ECLIPSELINK_BIND_PARAMETERS); - this.readConnectionsShared = - this.getBooleanValue(ECLIPSELINK_READ_CONNECTIONS_SHARED); - this.readConnectionsMin = - this.getIntegerValue(ECLIPSELINK_READ_CONNECTIONS_MIN); - this.readConnectionsMax = - this.getIntegerValue(ECLIPSELINK_READ_CONNECTIONS_MAX); - this.writeConnectionsMin = - this.getIntegerValue(ECLIPSELINK_WRITE_CONNECTIONS_MIN); - this.writeConnectionsMax = - this.getIntegerValue(ECLIPSELINK_WRITE_CONNECTIONS_MAX); - } - - protected void initializeDatabaseConnectionProperties() { - this.driver = - this.getStringValue(ECLIPSELINK_DRIVER); - this.url = - this.getStringValue(ECLIPSELINK_URL); - this.user = - this.getStringValue(ECLIPSELINK_USER); - this.password = - this.getStringValue(ECLIPSELINK_PASSWORD); - } - - // ********** behavior ********** - - public void propertyValueChanged(String propertyName, String newValue) { - if (propertyName.equals(ECLIPSELINK_NATIVE_SQL)) { - this.nativeSqlChanged(newValue); - } - else if (propertyName.equals(ECLIPSELINK_BATCH_WRITING)) { - this.batchWritingChanged(newValue); - } - else if (propertyName.equals(ECLIPSELINK_CACHE_STATEMENTS)) { - this.cacheStatementsChanged(newValue); - } - else if (propertyName.equals(ECLIPSELINK_DRIVER)) { - this.driverChanged(newValue); - } - else if (propertyName.equals(ECLIPSELINK_URL)) { - this.urlChanged(newValue); - } - else if (propertyName.equals(ECLIPSELINK_USER)) { - this.userChanged(newValue); - } - else if (propertyName.equals(ECLIPSELINK_PASSWORD)) { - this.passwordChanged(newValue); - } - else if (propertyName.equals(ECLIPSELINK_BIND_PARAMETERS)) { - this.bindParametersChanged(newValue); - } - else if (propertyName.equals(ECLIPSELINK_READ_CONNECTIONS_SHARED)) { - this.readConnectionsSharedChanged(newValue); - } - else if (propertyName.equals(ECLIPSELINK_CACHE_STATEMENTS_SIZE)) { - this.cacheStatementsSizeChanged(newValue); - } - else if (propertyName.equals(ECLIPSELINK_READ_CONNECTIONS_MIN)) { - readConnectionsMinChanged(newValue); - } - else if (propertyName.equals(ECLIPSELINK_READ_CONNECTIONS_MAX)) { - readConnectionsMaxChanged(newValue); - } - else if (propertyName.equals(ECLIPSELINK_WRITE_CONNECTIONS_MIN)) { - writeConnectionsMinChanged(newValue); - } - else if (propertyName.equals(ECLIPSELINK_WRITE_CONNECTIONS_MAX)) { - writeConnectionsMaxChanged(newValue); - } - } - - public void propertyRemoved(String propertyName) { - if (propertyName.equals(ECLIPSELINK_NATIVE_SQL)) { - this.nativeSqlChanged(null); - } - else if (propertyName.equals(ECLIPSELINK_BATCH_WRITING)) { - this.batchWritingChanged(null); - } - else if (propertyName.equals(ECLIPSELINK_CACHE_STATEMENTS)) { - this.cacheStatementsChanged(null); - } - else if (propertyName.equals(ECLIPSELINK_DRIVER)) { - this.driverChanged(null); - } - else if (propertyName.equals(ECLIPSELINK_URL)) { - this.urlChanged(null); - } - else if (propertyName.equals(ECLIPSELINK_USER)) { - this.userChanged(null); - } - else if (propertyName.equals(ECLIPSELINK_PASSWORD)) { - this.passwordChanged(null); - } - else if (propertyName.equals(ECLIPSELINK_BIND_PARAMETERS)) { - this.bindParametersChanged(null); - } - else if (propertyName.equals(ECLIPSELINK_READ_CONNECTIONS_SHARED)) { - this.readConnectionsSharedChanged(null); - } - else if (propertyName.equals(ECLIPSELINK_CACHE_STATEMENTS_SIZE)) { - this.cacheStatementsSizeChanged(null); - } - else if (propertyName.equals(ECLIPSELINK_READ_CONNECTIONS_MIN)) { - readConnectionsMinChanged(null); - } - else if (propertyName.equals(ECLIPSELINK_READ_CONNECTIONS_MAX)) { - readConnectionsMaxChanged(null); - } - else if (propertyName.equals(ECLIPSELINK_WRITE_CONNECTIONS_MIN)) { - writeConnectionsMinChanged(null); - } - else if (propertyName.equals(ECLIPSELINK_WRITE_CONNECTIONS_MAX)) { - writeConnectionsMaxChanged(null); - } - } - - /** - * Adds property names key/value pairs, where: - * key = EclipseLink property key - * value = property id - */ - @Override - protected void addPropertyNames(Map<String, String> propertyNames) { - this.addDatabaseConnectionPropertyNames(propertyNames); - - propertyNames.put( - ECLIPSELINK_NATIVE_SQL, - NATIVE_SQL_PROPERTY); - propertyNames.put( - ECLIPSELINK_BATCH_WRITING, - BATCH_WRITING_PROPERTY); - propertyNames.put( - ECLIPSELINK_CACHE_STATEMENTS, - CACHE_STATEMENTS_PROPERTY); - propertyNames.put( - ECLIPSELINK_CACHE_STATEMENTS_SIZE, - CACHE_STATEMENTS_SIZE_PROPERTY); - propertyNames.put( - ECLIPSELINK_BIND_PARAMETERS, - BIND_PARAMETERS_PROPERTY); - propertyNames.put( - ECLIPSELINK_READ_CONNECTIONS_SHARED, - READ_CONNECTIONS_SHARED_PROPERTY); - propertyNames.put( - ECLIPSELINK_READ_CONNECTIONS_MIN, - READ_CONNECTIONS_MIN_PROPERTY); - propertyNames.put( - ECLIPSELINK_READ_CONNECTIONS_MAX, - READ_CONNECTIONS_MAX_PROPERTY); - propertyNames.put( - ECLIPSELINK_WRITE_CONNECTIONS_MIN, - WRITE_CONNECTIONS_MIN_PROPERTY); - propertyNames.put( - ECLIPSELINK_WRITE_CONNECTIONS_MAX, - WRITE_CONNECTIONS_MAX_PROPERTY); - } - - protected void addDatabaseConnectionPropertyNames(Map<String, String> propertyNames) { - propertyNames.put( - ECLIPSELINK_DRIVER, - DRIVER_PROPERTY); - propertyNames.put( - ECLIPSELINK_URL, - URL_PROPERTY); - propertyNames.put( - ECLIPSELINK_USER, - USER_PROPERTY); - propertyNames.put( - ECLIPSELINK_PASSWORD, - PASSWORD_PROPERTY); - } - - /** - * Does all pre-treatment in this method before the property is set - */ - protected void preSetProperty() { - // do nothing by default - } - - // ********** NativeSql ********** - public Boolean getNativeSql() { - return this.nativeSql; - } - - public void setNativeSql(Boolean newNativeSql) { - this.preSetProperty(); - - Boolean old = this.nativeSql; - this.nativeSql = newNativeSql; - this.putProperty(NATIVE_SQL_PROPERTY, newNativeSql); - this.firePropertyChanged(NATIVE_SQL_PROPERTY, old, newNativeSql); - } - - private void nativeSqlChanged(String stringValue) { - Boolean newValue = getBooleanValueOf(stringValue); - - Boolean old = this.nativeSql; - this.nativeSql = newValue; - this.firePropertyChanged(NATIVE_SQL_PROPERTY, old, newValue); - } - - public Boolean getDefaultNativeSql() { - return DEFAULT_NATIVE_SQL; - } - - // ********** BatchWriting ********** - - public BatchWriting getBatchWriting() { - return this.batchWriting; - } - - public void setBatchWriting(BatchWriting newBatchWriting) { - this.preSetProperty(); - - BatchWriting old = this.batchWriting; - this.batchWriting = newBatchWriting; - this.putProperty(BATCH_WRITING_PROPERTY, newBatchWriting); - this.firePropertyChanged(BATCH_WRITING_PROPERTY, old, newBatchWriting); - } - - private void batchWritingChanged(String stringValue) { - BatchWriting newValue = getEnumValueOf(stringValue, BatchWriting.values()); - BatchWriting old = this.batchWriting; - this.batchWriting = newValue; - this.firePropertyChanged(BATCH_WRITING_PROPERTY, old, newValue); - } - - public BatchWriting getDefaultBatchWriting() { - return DEFAULT_BATCH_WRITING; - } - - // ********** CacheStatements ********** - public Boolean getCacheStatements() { - return this.cacheStatements; - } - - public void setCacheStatements(Boolean newCacheStatements) { - this.preSetProperty(); - - Boolean old = this.cacheStatements; - this.cacheStatements = newCacheStatements; - this.putProperty(CACHE_STATEMENTS_PROPERTY, newCacheStatements); - this.firePropertyChanged(CACHE_STATEMENTS_PROPERTY, old, newCacheStatements); - } - - private void cacheStatementsChanged(String stringValue) { - Boolean newValue = getBooleanValueOf(stringValue); - - Boolean old = this.cacheStatements; - this.cacheStatements = newValue; - this.firePropertyChanged(CACHE_STATEMENTS_PROPERTY, old, newValue); - } - - public Boolean getDefaultCacheStatements() { - return DEFAULT_CACHE_STATEMENTS; - } - - // ********** CacheStatementsSize ********** - public Integer getCacheStatementsSize() { - return this.cacheStatementsSize; - } - - public void setCacheStatementsSize(Integer newCacheStatementsSize) { - this.preSetProperty(); - - Integer old = this.cacheStatementsSize; - this.cacheStatementsSize = newCacheStatementsSize; - this.putProperty(CACHE_STATEMENTS_SIZE_PROPERTY, newCacheStatementsSize); - this.firePropertyChanged(CACHE_STATEMENTS_SIZE_PROPERTY, old, newCacheStatementsSize); - } - - private void cacheStatementsSizeChanged(String stringValue) { - Integer newValue = getIntegerValueOf(stringValue); - - Integer old = this.cacheStatementsSize; - this.cacheStatementsSize = newValue; - this.firePropertyChanged(CACHE_STATEMENTS_SIZE_PROPERTY, old, newValue); - } - - public Integer getDefaultCacheStatementsSize() { - return DEFAULT_CACHE_STATEMENTS_SIZE; - } - - // ********** Driver ********** - public String getDriver() { - return this.driver; - } - - public void setDriver(String newDriver) { - this.preSetProperty(); - - String old = this.driver; - this.driver = newDriver; - this.putProperty(DRIVER_PROPERTY, newDriver); - this.firePropertyChanged(DRIVER_PROPERTY, old, newDriver); - } - - protected void driverChanged(String newValue) { - String old = this.driver; - this.driver = newValue; - this.firePropertyChanged(DRIVER_PROPERTY, old, newValue); - } - - public String getDefaultDriver() { - return DEFAULT_DRIVER; - } - - // ********** URL ********** - public String getUrl() { - return this.url; - } - - public void setUrl(String newUrl) { - this.preSetProperty(); - - String old = this.url; - this.url = newUrl; - this.putProperty(URL_PROPERTY, newUrl); - this.firePropertyChanged(URL_PROPERTY, old, newUrl); - } - - protected void urlChanged(String newValue) { - String old = this.url; - this.url = newValue; - this.firePropertyChanged(URL_PROPERTY, old, newValue); - } - - public String getDefaultUrl() { - return DEFAULT_URL; - } - - // ********** User ********** - public String getUser() { - return this.user; - } - - public void setUser(String newUser) { - this.preSetProperty(); - - String old = this.user; - this.user = newUser; - this.putProperty(USER_PROPERTY, newUser); - this.firePropertyChanged(USER_PROPERTY, old, newUser); - } - - protected void userChanged(String newValue) { - String old = this.user; - this.user = newValue; - this.firePropertyChanged(USER_PROPERTY, old, newValue); - } - - public String getDefaultUser() { - return DEFAULT_USER; - } - - // ********** Password ********** - public String getPassword() { - return this.password; - } - - public void setPassword(String newPassword) { - this.preSetProperty(); - - String old = this.password; - this.password = newPassword; - this.putProperty(PASSWORD_PROPERTY, newPassword); - this.firePropertyChanged(PASSWORD_PROPERTY, old, newPassword); - } - - protected void passwordChanged(String newValue) { - String old = this.password; - this.password = newValue; - this.firePropertyChanged(PASSWORD_PROPERTY, old, newValue); - } - - public String getDefaultPassword() { - return DEFAULT_PASSWORD; - } - - // ********** BindParameters ********** - public Boolean getBindParameters() { - return this.bindParameters; - } - - public void setBindParameters(Boolean newBindParameters) { - this.preSetProperty(); - - Boolean old = this.bindParameters; - this.bindParameters = newBindParameters; - this.putProperty(BIND_PARAMETERS_PROPERTY, newBindParameters); - this.firePropertyChanged(BIND_PARAMETERS_PROPERTY, old, newBindParameters); - } - - private void bindParametersChanged(String stringValue) { - Boolean newValue = getBooleanValueOf(stringValue); - - Boolean old = this.bindParameters; - this.bindParameters = newValue; - this.firePropertyChanged(BIND_PARAMETERS_PROPERTY, old, newValue); - } - - public Boolean getDefaultBindParameters() { - return DEFAULT_BIND_PARAMETERS; - } - - // ********** ReadConnectionsShared ********** - public Boolean getReadConnectionsShared() { - return this.readConnectionsShared; - } - - public void setReadConnectionsShared(Boolean newReadConnectionsShared) { - this.preSetProperty(); - - Boolean old = this.readConnectionsShared; - this.readConnectionsShared = newReadConnectionsShared; - this.putProperty(READ_CONNECTIONS_SHARED_PROPERTY, newReadConnectionsShared); - this.firePropertyChanged(READ_CONNECTIONS_SHARED_PROPERTY, old, newReadConnectionsShared); - } - - private void readConnectionsSharedChanged(String stringValue) { - Boolean newValue = getBooleanValueOf(stringValue); - - Boolean old = this.readConnectionsShared; - this.readConnectionsShared = newValue; - this.firePropertyChanged(READ_CONNECTIONS_SHARED_PROPERTY, old, newValue); - } - - public Boolean getDefaultReadConnectionsShared() { - return DEFAULT_READ_CONNECTIONS_SHARED; - } - - // ********** ReadConnectionsMin ********** - public Integer getReadConnectionsMin() { - return this.readConnectionsMin; - } - - public void setReadConnectionsMin(Integer newReadConnectionsMin) { - this.preSetProperty(); - - Integer old = this.readConnectionsMin; - this.readConnectionsMin = newReadConnectionsMin; - this.putProperty(READ_CONNECTIONS_MIN_PROPERTY, newReadConnectionsMin); - this.firePropertyChanged(READ_CONNECTIONS_MIN_PROPERTY, old, newReadConnectionsMin); - } - - private void readConnectionsMinChanged(String stringValue) { - Integer newValue = getIntegerValueOf(stringValue); - - Integer old = this.readConnectionsMin; - this.readConnectionsMin = newValue; - this.firePropertyChanged(READ_CONNECTIONS_MIN_PROPERTY, old, newValue); - } - - public Integer getDefaultReadConnectionsMin() { - return DEFAULT_READ_CONNECTIONS_MIN; - } - - // ********** ReadConnectionsMax ********** - public Integer getReadConnectionsMax() { - return this.readConnectionsMax; - } - - public void setReadConnectionsMax(Integer newReadConnectionsMax) { - this.preSetProperty(); - - Integer old = this.readConnectionsMax; - this.readConnectionsMax = newReadConnectionsMax; - this.putProperty(READ_CONNECTIONS_MAX_PROPERTY, newReadConnectionsMax); - this.firePropertyChanged(READ_CONNECTIONS_MAX_PROPERTY, old, newReadConnectionsMax); - } - - private void readConnectionsMaxChanged(String stringValue) { - Integer newValue = getIntegerValueOf(stringValue); - - Integer old = this.readConnectionsMax; - this.readConnectionsMax = newValue; - this.firePropertyChanged(READ_CONNECTIONS_MAX_PROPERTY, old, newValue); - } - - public Integer getDefaultReadConnectionsMax() { - return DEFAULT_READ_CONNECTIONS_MAX; - } - - // ********** WriteConnectionsMin ********** - public Integer getWriteConnectionsMin() { - return this.writeConnectionsMin; - } - - public void setWriteConnectionsMin(Integer newWriteConnectionsMin) { - this.preSetProperty(); - - Integer old = this.writeConnectionsMin; - this.writeConnectionsMin = newWriteConnectionsMin; - this.putProperty(WRITE_CONNECTIONS_MIN_PROPERTY, newWriteConnectionsMin); - this.firePropertyChanged(WRITE_CONNECTIONS_MIN_PROPERTY, old, newWriteConnectionsMin); - } - - private void writeConnectionsMinChanged(String stringValue) { - Integer newValue = getIntegerValueOf(stringValue); - - Integer old = this.writeConnectionsMin; - this.writeConnectionsMin = newValue; - this.firePropertyChanged(WRITE_CONNECTIONS_MIN_PROPERTY, old, newValue); - } - - public Integer getDefaultWriteConnectionsMin() { - return DEFAULT_WRITE_CONNECTIONS_MIN; - } - - // ********** WriteConnectionsMax ********** - public Integer getWriteConnectionsMax() { - return this.writeConnectionsMax; - } - - public void setWriteConnectionsMax(Integer newWriteConnectionsMax) { - this.preSetProperty(); - - Integer old = this.writeConnectionsMax; - this.writeConnectionsMax = newWriteConnectionsMax; - this.putProperty(WRITE_CONNECTIONS_MAX_PROPERTY, newWriteConnectionsMax); - this.firePropertyChanged(WRITE_CONNECTIONS_MAX_PROPERTY, old, newWriteConnectionsMax); - } - - private void writeConnectionsMaxChanged(String stringValue) { - Integer newValue = getIntegerValueOf(stringValue); - - Integer old = this.writeConnectionsMax; - this.writeConnectionsMax = newValue; - this.firePropertyChanged(WRITE_CONNECTIONS_MAX_PROPERTY, old, newValue); - } - - public Integer getDefaultWriteConnectionsMax() { - return DEFAULT_WRITE_CONNECTIONS_MAX; - } - -} diff --git a/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/persistence/customization/EclipseLinkCustomization.java b/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/persistence/customization/EclipseLinkCustomization.java deleted file mode 100644 index b936c3f0c1..0000000000 --- a/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/persistence/customization/EclipseLinkCustomization.java +++ /dev/null @@ -1,752 +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.eclipselink.core.internal.context.persistence.customization; - -import java.util.ArrayList; -import java.util.Iterator; -import java.util.List; -import java.util.ListIterator; -import java.util.Map; -import java.util.Set; - -import org.eclipse.jpt.core.context.persistence.PersistenceUnit; -import org.eclipse.jpt.eclipselink.core.context.persistence.customization.Customization; -import org.eclipse.jpt.eclipselink.core.context.persistence.customization.Profiler; -import org.eclipse.jpt.eclipselink.core.context.persistence.customization.Weaving; -import org.eclipse.jpt.eclipselink.core.internal.context.persistence.EclipseLinkPersistenceUnitProperties; -import org.eclipse.jpt.utility.internal.iterators.CloneListIterator; -import org.eclipse.jpt.utility.internal.iterators.TransformationIterator; - -/** - * EclipseLinkCustomization - */ -public class EclipseLinkCustomization extends EclipseLinkPersistenceUnitProperties - implements Customization -{ - // ********** EclipseLink properties ********** - private Boolean throwExceptions; - private Weaving weaving; - private Boolean weavingLazy; - private Boolean weavingChangeTracking; - private Boolean weavingFetchGroups; - private Boolean weavingInternal; - private Boolean weavingEager; - private Boolean validationOnly; - private List<String> sessionCustomizers; - private String profiler; // storing EclipseLinkStringValue since value can be Profiler or custom class - private String exceptionHandler; - - private List<Entity> entities; - - // ********** constructors ********** - public EclipseLinkCustomization(PersistenceUnit parent) { - super(parent); - } - - // ********** initialization ********** - /** - * Initializes properties with values from the persistence unit. - */ - @Override - protected void initializeProperties() { - this.entities = new ArrayList<Entity>(); - - this.throwExceptions = - this.getBooleanValue(ECLIPSELINK_THROW_EXCEPTIONS); - this.weaving = - this.getEnumValue(ECLIPSELINK_WEAVING, Weaving.values()); - this.weavingLazy = - this.getBooleanValue(ECLIPSELINK_WEAVING_LAZY); - this.weavingChangeTracking = - this.getBooleanValue(ECLIPSELINK_WEAVING_CHANGE_TRACKING); - this.weavingFetchGroups = - this.getBooleanValue(ECLIPSELINK_WEAVING_FETCH_GROUPS); - this.weavingInternal = - this.getBooleanValue(ECLIPSELINK_WEAVING_INTERNAL); - this.weavingEager = - this.getBooleanValue(ECLIPSELINK_WEAVING_EAGER); - this.validationOnly = - this.getBooleanValue(ECLIPSELINK_VALIDATION_ONLY); - this.initializeSessionCustomizersFromPersistenceUnit(); - - Set<PersistenceUnit.Property> properties = - this.getPropertiesSetWithPrefix(ECLIPSELINK_DESCRIPTOR_CUSTOMIZER); - this.initializeEntitiesCustomizerClass(properties); - - this.profiler = this.getProfilerPropertyValue(); - this.exceptionHandler = - this.getStringValue(ECLIPSELINK_EXCEPTION_HANDLER); - } - - private void initializeSessionCustomizersFromPersistenceUnit() { - Set<PersistenceUnit.Property> properties = - this.getPropertiesSetWithPrefix(ECLIPSELINK_SESSION_CUSTOMIZER); - - this.sessionCustomizers = new ArrayList<String>(properties.size()); - this.initializeSessionCustomizersWith(properties); - } - - private void initializeSessionCustomizersWith(Set<PersistenceUnit.Property> properties) { - for (PersistenceUnit.Property property : properties) { - this.sessionCustomizers.add(property.getValue()); - } - } - - private void initializeEntitiesCustomizerClass(Set<PersistenceUnit.Property> descriptorCustomizerProperties) { - for (PersistenceUnit.Property descriptorCustomizerProperty : descriptorCustomizerProperties) { - this.setEntityDescriptorCustomizerOf(descriptorCustomizerProperty); - } - } - - /** - * Gets the Profiler property from the persistence unit. - */ - private String getProfilerPropertyValue() { - - String value = this.getStringValue(ECLIPSELINK_PROFILER); - if (value == null) { - return null; // no property found - } - Profiler standardProfiler = this.getEnumValue(ECLIPSELINK_PROFILER, Profiler.values()); - return (standardProfiler == null) ? value : getPropertyStringValueOf(standardProfiler); - } - - // ********** behavior ********** - - public void propertyValueChanged(String propertyName, String newValue) { - if (propertyName.equals(ECLIPSELINK_THROW_EXCEPTIONS)) { - this.throwExceptionsChanged(newValue); - } - else if (propertyName.equals(ECLIPSELINK_WEAVING)) { - this.weavingChanged(newValue); - } - else if (propertyName.equals(ECLIPSELINK_WEAVING_LAZY)) { - this.weavingLazyChanged(newValue); - } - else if (propertyName.equals(ECLIPSELINK_WEAVING_CHANGE_TRACKING)) { - this.weavingChangeTrackingChanged(newValue); - } - else if (propertyName.equals(ECLIPSELINK_WEAVING_FETCH_GROUPS)) { - this.weavingFetchGroupsChanged(newValue); - } - else if (propertyName.equals(ECLIPSELINK_WEAVING_INTERNAL)) { - this.weavingInternalChanged(newValue); - } - else if (propertyName.equals(ECLIPSELINK_WEAVING_EAGER)) { - this.weavingEagerChanged(newValue); - } - else if (propertyName.equals(ECLIPSELINK_VALIDATION_ONLY)) { - this.validationOnlyChanged(newValue); - } - else if (propertyName.equals(ECLIPSELINK_SESSION_CUSTOMIZER)) { - this.sessionCustomizersChanged(); - } - else if (propertyName.startsWith(ECLIPSELINK_DESCRIPTOR_CUSTOMIZER)) { - this.descriptorCustomizerChanged(propertyName, newValue); - } - else if (propertyName.equals(ECLIPSELINK_PROFILER)) { - this.profilerChanged(newValue); - } - else if (propertyName.equals(ECLIPSELINK_EXCEPTION_HANDLER)) { - this.exceptionHandlerChanged(newValue); - } - } - - public void propertyRemoved(String propertyName) { - if (propertyName.equals(ECLIPSELINK_THROW_EXCEPTIONS)) { - this.throwExceptionsChanged(null); - } - else if (propertyName.equals(ECLIPSELINK_WEAVING)) { - this.weavingChanged(null); - } - else if (propertyName.equals(ECLIPSELINK_WEAVING_LAZY)) { - this.weavingLazyChanged(null); - } - else if (propertyName.equals(ECLIPSELINK_WEAVING_CHANGE_TRACKING)) { - this.weavingChangeTrackingChanged(null); - } - else if (propertyName.equals(ECLIPSELINK_WEAVING_FETCH_GROUPS)) { - this.weavingFetchGroupsChanged(null); - } - else if (propertyName.equals(ECLIPSELINK_WEAVING_INTERNAL)) { - this.weavingInternalChanged(null); - } - else if (propertyName.equals(ECLIPSELINK_WEAVING_EAGER)) { - this.weavingEagerChanged(null); - } - else if (propertyName.equals(ECLIPSELINK_VALIDATION_ONLY)) { - this.validationOnlyChanged(null); - } - else if (propertyName.equals(ECLIPSELINK_SESSION_CUSTOMIZER)) { - this.sessionCustomizersChanged(); - } - else if (propertyName.startsWith(ECLIPSELINK_DESCRIPTOR_CUSTOMIZER)) { - this.descriptorCustomizerChanged(propertyName, null); - } - else if (propertyName.equals(ECLIPSELINK_PROFILER)) { - this.profilerChanged(null); - } - else if (propertyName.equals(ECLIPSELINK_EXCEPTION_HANDLER)) { - this.exceptionHandlerChanged(null); - } - - } - - /** - * Adds property names key/value pairs, where: - * key = EclipseLink property key - * value = property id - */ - @Override - protected void addPropertyNames(Map<String, String> propertyNames) { - propertyNames.put( - ECLIPSELINK_THROW_EXCEPTIONS, - THROW_EXCEPTIONS_PROPERTY); - propertyNames.put( - ECLIPSELINK_WEAVING, - WEAVING_PROPERTY); - propertyNames.put( - ECLIPSELINK_WEAVING_LAZY, - WEAVING_LAZY_PROPERTY); - propertyNames.put( - ECLIPSELINK_WEAVING_CHANGE_TRACKING, - WEAVING_CHANGE_TRACKING_PROPERTY); - propertyNames.put( - ECLIPSELINK_WEAVING_FETCH_GROUPS, - WEAVING_FETCH_GROUPS_PROPERTY); - propertyNames.put( - ECLIPSELINK_WEAVING_INTERNAL, - WEAVING_INTERNAL_PROPERTY); - propertyNames.put( - ECLIPSELINK_WEAVING_EAGER, - WEAVING_EAGER_PROPERTY); - propertyNames.put( - ECLIPSELINK_VALIDATION_ONLY, - VALIDATION_ONLY_PROPERTY); - propertyNames.put( - ECLIPSELINK_SESSION_CUSTOMIZER, - SESSION_CUSTOMIZER_PROPERTY); - propertyNames.put( - ECLIPSELINK_PROFILER, - PROFILER_PROPERTY); - propertyNames.put( - ECLIPSELINK_EXCEPTION_HANDLER, - EXCEPTION_HANDLER_PROPERTY); - - // Don't need to initialize propertyNames for: - // descriptorCustomizerProperty - } - - /** - * Method used for identifying the given property. - */ - @Override - public boolean itemIsProperty(PersistenceUnit.Property item) { - boolean isProperty = super.itemIsProperty(item); - - if ( ! isProperty && item.getName() != null) { - if (item.getName().startsWith(ECLIPSELINK_DESCRIPTOR_CUSTOMIZER)) { - return true; - } - } - return isProperty; - } - - /** - * Returns the property name used for change notification of the given - * property. - */ - @Override - public String propertyIdOf(PersistenceUnit.Property property) { - try { - return super.propertyIdOf(property); - } - catch (IllegalArgumentException e) { - if (property.getName().startsWith(ECLIPSELINK_DESCRIPTOR_CUSTOMIZER)) { - return DESCRIPTOR_CUSTOMIZER_PROPERTY; - } - } - throw new IllegalArgumentException("Illegal property: " + property); //$NON-NLS-1$ - } - - public Entity addEntity(String entityName) { - if (this.entityExists(entityName)) { - throw new IllegalStateException("Entity " + entityName + " already exists."); - } - Entity newEntity = this.buildEntity(entityName); - this.entities.add(newEntity); - this.fireListChanged(ENTITIES_LIST, this.entities); - return newEntity; - } - - public void removeEntity(String entityName) { - if ( ! this.entityExists(entityName)) { - return; - } - Entity entity = this.getEntityNamed(entityName); - this.clearEntity(entity); - this.removeEntity(entity); - } - - - // ********** ThrowExceptions ********** - public Boolean getThrowExceptions() { - return this.throwExceptions; - } - - public void setThrowExceptions(Boolean newThrowExceptions) { - Boolean old = this.throwExceptions; - this.throwExceptions = newThrowExceptions; - this.putProperty(THROW_EXCEPTIONS_PROPERTY, newThrowExceptions); - this.firePropertyChanged(THROW_EXCEPTIONS_PROPERTY, old, newThrowExceptions); - } - - private void throwExceptionsChanged(String stringValue) { - Boolean newValue = getBooleanValueOf(stringValue); - - Boolean old = this.throwExceptions; - this.throwExceptions = newValue; - this.firePropertyChanged(THROW_EXCEPTIONS_PROPERTY, old, newValue); - } - - public Boolean getDefaultThrowExceptions() { - return DEFAULT_THROW_EXCEPTIONS; - } - - // ********** WeavingLazy ********** - public Boolean getWeavingLazy() { - return this.weavingLazy; - } - - public void setWeavingLazy(Boolean newWeavingLazy) { - Boolean old = this.weavingLazy; - this.weavingLazy = newWeavingLazy; - this.putProperty(WEAVING_LAZY_PROPERTY, newWeavingLazy); - this.firePropertyChanged(WEAVING_LAZY_PROPERTY, old, newWeavingLazy); - } - - private void weavingLazyChanged(String stringValue) { - Boolean newValue = getBooleanValueOf(stringValue); - - Boolean old = this.weavingLazy; - this.weavingLazy = newValue; - this.firePropertyChanged(WEAVING_LAZY_PROPERTY, old, newValue); - } - - public Boolean getDefaultWeavingLazy() { - return DEFAULT_WEAVING_LAZY; - } - - // ********** WeavingChangeTracking ********** - public Boolean getWeavingChangeTracking() { - return this.weavingChangeTracking; - } - - public void setWeavingChangeTracking(Boolean newWeavingChangeTracking) { - Boolean old = this.weavingChangeTracking; - this.weavingChangeTracking = newWeavingChangeTracking; - this.putProperty(WEAVING_CHANGE_TRACKING_PROPERTY, newWeavingChangeTracking); - this.firePropertyChanged(WEAVING_CHANGE_TRACKING_PROPERTY, old, newWeavingChangeTracking); - } - - private void weavingChangeTrackingChanged(String stringValue) { - Boolean newValue = getBooleanValueOf(stringValue); - - Boolean old = this.weavingChangeTracking; - this.weavingChangeTracking = newValue; - this.firePropertyChanged(WEAVING_CHANGE_TRACKING_PROPERTY, old, newValue); - } - - public Boolean getDefaultWeavingChangeTracking() { - return DEFAULT_WEAVING_CHANGE_TRACKING; - } - - // ********** WeavingFetchGroups ********** - public Boolean getWeavingFetchGroups() { - return this.weavingFetchGroups; - } - - public void setWeavingFetchGroups(Boolean newWeavingFetchGroups) { - Boolean old = this.weavingFetchGroups; - this.weavingFetchGroups = newWeavingFetchGroups; - this.putProperty(WEAVING_FETCH_GROUPS_PROPERTY, newWeavingFetchGroups); - this.firePropertyChanged(WEAVING_FETCH_GROUPS_PROPERTY, old, newWeavingFetchGroups); - } - - private void weavingFetchGroupsChanged(String stringValue) { - Boolean newValue = getBooleanValueOf(stringValue); - - Boolean old = this.weavingFetchGroups; - this.weavingFetchGroups = newValue; - this.firePropertyChanged(WEAVING_FETCH_GROUPS_PROPERTY, old, newValue); - } - - public Boolean getDefaultWeavingFetchGroups() { - return DEFAULT_WEAVING_FETCH_GROUPS; - } - - // ********** WeavingInternal ********** - public Boolean getWeavingInternal() { - return this.weavingInternal; - } - - public void setWeavingInternal(Boolean newWeavingInternal) { - Boolean old = this.weavingInternal; - this.weavingInternal = newWeavingInternal; - this.putProperty(WEAVING_INTERNAL_PROPERTY, newWeavingInternal); - this.firePropertyChanged(WEAVING_INTERNAL_PROPERTY, old, newWeavingInternal); - } - - private void weavingInternalChanged(String stringValue) { - Boolean newValue = getBooleanValueOf(stringValue); - - Boolean old = this.weavingInternal; - this.weavingInternal = newValue; - this.firePropertyChanged(WEAVING_INTERNAL_PROPERTY, old, newValue); - } - - public Boolean getDefaultWeavingInternal() { - return DEFAULT_WEAVING_INTERNAL; - } - - // ********** WeavingEager ********** - public Boolean getWeavingEager() { - return this.weavingEager; - } - - public void setWeavingEager(Boolean newWeavingEager) { - Boolean old = this.weavingEager; - this.weavingEager = newWeavingEager; - this.putProperty(WEAVING_EAGER_PROPERTY, newWeavingEager); - this.firePropertyChanged(WEAVING_EAGER_PROPERTY, old, newWeavingEager); - } - - private void weavingEagerChanged(String stringValue) { - Boolean newValue = getBooleanValueOf(stringValue); - - Boolean old = this.weavingEager; - this.weavingEager = newValue; - this.firePropertyChanged(WEAVING_EAGER_PROPERTY, old, newValue); - } - - public Boolean getDefaultWeavingEager() { - return DEFAULT_WEAVING_EAGER; - } - - // ********** ValidationOnly ********** - public Boolean getValidationOnly() { - return this.validationOnly; - } - - public void setValidationOnly(Boolean newValidationOnly) { - Boolean old = this.validationOnly; - this.validationOnly = newValidationOnly; - this.putProperty(VALIDATION_ONLY_PROPERTY, newValidationOnly); - this.firePropertyChanged(VALIDATION_ONLY_PROPERTY, old, newValidationOnly); - } - - private void validationOnlyChanged(String stringValue) { - Boolean newValue = getBooleanValueOf(stringValue); - - Boolean old = this.validationOnly; - this.validationOnly = newValue; - this.firePropertyChanged(VALIDATION_ONLY_PROPERTY, old, newValue); - } - - public Boolean getDefaultValidationOnly() { - return DEFAULT_VALIDATION_ONLY; - } - - // ********** SessionCustomizers ********** - public ListIterator<String> sessionCustomizers(){ - return new CloneListIterator<String>(this.sessionCustomizers); - } - - public int sessionCustomizersSize(){ - return this.sessionCustomizers.size(); - } - - public boolean sessionCustomizerExists(String sessionCustomizerClassName) { - - for (String sessionCustomizer : this.sessionCustomizers) { - if(sessionCustomizer.equals(sessionCustomizerClassName)) { - return true; - } - } - return false; - } - - public String addSessionCustomizer(String newSessionCustomizerClassName){ - - if( ! this.sessionCustomizerExists(newSessionCustomizerClassName)) { - this.sessionCustomizers.add(newSessionCustomizerClassName); - this.putProperty(SESSION_CUSTOMIZER_PROPERTY, newSessionCustomizerClassName, true); - this.fireListChanged(SESSION_CUSTOMIZER_LIST, this.sessionCustomizers); - return newSessionCustomizerClassName; - } - return null; - } - - public void removeSessionCustomizer(String className){ - - if(this.removeSessionCustomizer_(className) != null) { - this.removeProperty(SESSION_CUSTOMIZER_PROPERTY, className); - this.fireListChanged(SESSION_CUSTOMIZER_LIST, this.sessionCustomizers); - } - } - - private String removeSessionCustomizer_(String className){ - - for ( ListIterator<String> i = this.sessionCustomizers(); i.hasNext();) { - String sessionCustomizer = i.next(); - if(sessionCustomizer.equals(className)) { - this.sessionCustomizers.remove(sessionCustomizer); - return sessionCustomizer; - } - } - return null; - } - - private void sessionCustomizersChanged() { - - this.initializeSessionCustomizersFromPersistenceUnit(); - this.fireListChanged(SESSION_CUSTOMIZER_LIST, this.sessionCustomizers); - } - - // ********** Weaving ********** - - public Weaving getWeaving() { - return this.weaving; - } - - public void setWeaving(Weaving newWeaving) { - Weaving old = this.weaving; - this.weaving = newWeaving; - this.putProperty(WEAVING_PROPERTY, newWeaving); - this.firePropertyChanged(WEAVING_PROPERTY, old, newWeaving); - } - - private void weavingChanged(String stringValue) { - Weaving newValue = getEnumValueOf(stringValue, Weaving.values()); - Weaving old = this.weaving; - this.weaving = newValue; - this.firePropertyChanged(WEAVING_PROPERTY, old, newValue); - } - - public Weaving getDefaultWeaving() { - return DEFAULT_WEAVING; - } - - // ********** ExceptionHandler ********** - public String getExceptionHandler() { - return this.exceptionHandler; - } - - public void setExceptionHandler(String newExceptionHandler) { - String old = this.exceptionHandler; - this.exceptionHandler = newExceptionHandler; - this.putProperty(EXCEPTION_HANDLER_PROPERTY, newExceptionHandler); - this.firePropertyChanged(EXCEPTION_HANDLER_PROPERTY, old, newExceptionHandler); - } - - private void exceptionHandlerChanged(String newValue) { - String old = this.exceptionHandler; - this.exceptionHandler = newValue; - this.firePropertyChanged(EXCEPTION_HANDLER_PROPERTY, old, newValue); - } - - public String getDefaultExceptionHandler() { - return DEFAULT_EXCEPTION_HANDLER; - } - - // ********** DescriptorCustomizer ********** - - public String getDescriptorCustomizerOf(String entityName) { - Entity entity = this.getEntityNamed(entityName); - return (entity == null) ? null : entity.getDescriptorCustomizer(); - } - - public void setDescriptorCustomizerOf(String entityName, String newDescriptorCustomizer) { - Entity old = this.setEntityDescriptorCustomizerOf(entityName, newDescriptorCustomizer); - this.putStringValue(ECLIPSELINK_DESCRIPTOR_CUSTOMIZER, entityName, newDescriptorCustomizer, false); - this.firePropertyChanged(DESCRIPTOR_CUSTOMIZER_PROPERTY, old, this.getEntityNamed(entityName)); - } - - private void descriptorCustomizerChanged(String propertyName, String stringValue) { - String entityName = this.extractEntityNameOf(propertyName); - Entity old = this.setEntityDescriptorCustomizerOf(entityName, stringValue); - this.firePropertyChanged(DESCRIPTOR_CUSTOMIZER_PROPERTY, old, this.getEntityNamed(entityName)); - } - - public String getDefaultDescriptorCustomizer() { - return DEFAULT_DESCRIPTOR_CUSTOMIZER; - } - - /** - * Returns the old Entity - */ - private Entity setEntityDescriptorCustomizerOf(String entityName, String descriptorCustomizerClassName) { - Entity entity = (this.entityExists(entityName)) ? - this.getEntityNamed(entityName) : - this.addEntity(entityName); - return this.setEntityDescriptorCustomizerOf(entity, descriptorCustomizerClassName); - } - - /** - * Returns the old Entity - */ - private Entity setEntityDescriptorCustomizerOf(Entity entity, String descriptorCustomizerClassName) { - if(entity == null) { - throw new IllegalArgumentException(); - } - Entity old = entity.clone(); - entity.setDescriptorCustomizer(descriptorCustomizerClassName); - return old; - } - - /** - * Convenience method to update the descriptorCustomizerClassName in entities. - * Returns the old Entity - */ - private Entity setEntityDescriptorCustomizerOf(PersistenceUnit.Property descriptorCustomizerProperty) { - String entityName = this.extractEntityNameOf(descriptorCustomizerProperty); - return this.setEntityDescriptorCustomizerOf(entityName, descriptorCustomizerProperty.getValue()); - } - - // ********** Profiler ********** - /** - * Returns Profiler or custom profiler class. - * - * @return EclipseLink string value for Profiler enum or custom profiler class - */ - public String getProfiler() { - return this.profiler; - } - - /** - * Sets EclipseLink profiler. - * - * @param newProfiler - Profiler - */ - public void setProfiler(Profiler newProfiler) { - if( newProfiler == null) { - this.setProfiler_((String) null); - return; - } - this.setProfiler_(getPropertyStringValueOf(newProfiler)); - } - - /** - * Sets EclipseLink profiler or custom profiler. - * - * @param newProfiler - - * Can be a EclipseLink profiler literal or - * a fully qualified class name of a custom profiler. - */ - public void setProfiler(String newProfiler) { - if( newProfiler == null) { - this.setProfiler_((String) null); - return; - } - Profiler p = Profiler.getProfilerFor(newProfiler); - if(p == null) { // custom profiler class - this.setProfiler_(newProfiler); - } - else { - this.setProfiler(p); - } - } - - private void setProfiler_(String newProfiler) { - String old = this.profiler; - this.profiler = newProfiler; - this.putProperty(PROFILER_PROPERTY, newProfiler); - this.firePropertyChanged(PROFILER_PROPERTY, old, newProfiler); - } - - private void profilerChanged(String newValue) { - String old = this.profiler; - this.profiler = newValue; - this.firePropertyChanged(PROFILER_PROPERTY, old, newValue); - } - - public String getDefaultProfiler() { - return DEFAULT_PROFILER; - } - - - // ****** convenience methods ******* - - /** - * Set all Entity properties to default. - */ - private void clearEntity(Entity entity) { - if(entity.isEmpty()) { - return; - } - String entityName = entity.getName(); - this.setDescriptorCustomizerOf(entityName, null); - } - - /** - * Returns the Entity with the given name. - */ - private Entity getEntityNamed(String name) { - for(Entity entity: this.entities) { - if(entity.getName().equals(name)) { - return entity; - } - } - return null; - } - - private Entity buildEntity(String name) { - return new Entity(this, name); - } - - private void removeEntity(Entity entity) { - if(entity == null) { - throw new IllegalArgumentException(); - } - this.entities.remove(entity); - this.fireListChanged(ENTITIES_LIST, this.entities); - } - - /** - * Return whether the Entity exist. - */ - public boolean entityExists(String name) { - for(Entity entity: this.entities) { - if(entity.getName().equals(name)) { - return true; - } - } - return false; - } - - // ****** entities list ******* - - public ListIterator<Entity> entities() { - return new CloneListIterator<Entity>(this.entities); - } - - public Iterator<String> entityNames() { - return new TransformationIterator<Entity, String>(this.entities()) { - @Override - protected String transform(Entity entity) { - return entity.getName(); - } - }; - } - - public int entitiesSize() { - return this.entities.size(); - } -} diff --git a/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/persistence/customization/Entity.java b/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/persistence/customization/Entity.java deleted file mode 100644 index 71f899435e..0000000000 --- a/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/persistence/customization/Entity.java +++ /dev/null @@ -1,106 +0,0 @@ -/******************************************************************************* -* Copyright (c) 2009 Oracle. All rights reserved. -* This program and the accompanying materials are made available under the -* terms of the Eclipse Public License v1.0, which accompanies this distribution -* and is available at http://www.eclipse.org/legal/epl-v10.html. -* -* Contributors: -* Oracle - initial API and implementation -*******************************************************************************/ -package org.eclipse.jpt.eclipselink.core.internal.context.persistence.customization; - -import java.io.Serializable; - -import org.eclipse.jpt.eclipselink.core.context.persistence.customization.Customization; -import org.eclipse.jpt.utility.internal.StringTools; -import org.eclipse.jpt.utility.internal.model.AbstractModel; - -/** - * Entity - */ -public class Entity extends AbstractModel implements Cloneable, Serializable -{ - private String name; - private Customization parent; - - public static final String DESCRIPTOR_CUSTOMIZER_PROPERTY = Customization.DESCRIPTOR_CUSTOMIZER_PROPERTY; //$NON-NLS-1$ - - // ********** EclipseLink properties ********** - private String descriptorCustomizer; - - private static final long serialVersionUID = 1L; - - // ********** constructors ********** - public Entity(Customization parent, String name) { - this(parent); - this.initialize(name); - } - - private Entity(Customization parent) { - this.parent = parent; - } - - private void initialize(String name) { - if(StringTools.stringIsEmpty(name)) { - throw new IllegalArgumentException(); - } - this.name = name; - } - - // ********** behaviors ********** - @Override - public boolean equals(Object o) { - if(o == null) { - return false; - } - Entity customizer = (Entity) o; - return ( - (this.descriptorCustomizer == null ? - customizer.descriptorCustomizer == null : - this.descriptorCustomizer.equals(customizer.descriptorCustomizer))); - } - - @Override - public Entity clone() { - try { - return (Entity)super.clone(); - } - catch (CloneNotSupportedException ex) { - throw new InternalError(); - } - } - - public boolean isEmpty() { - return this.descriptorCustomizer == null; - } - - public boolean entityNameIsValid() { - return ! StringTools.stringIsEmpty(this.name); - } - - public Customization getParent() { - return this.parent; - } - - // ********** getter/setter ********** - public String getName() { - return this.name; - } - - protected String getDescriptorCustomizer() { - return this.descriptorCustomizer; - } - - protected void setDescriptorCustomizer(String descriptorCustomizer) { - String old = this.descriptorCustomizer; - this.descriptorCustomizer = descriptorCustomizer; - this.firePropertyChanged(DESCRIPTOR_CUSTOMIZER_PROPERTY, old, descriptorCustomizer); - } - - public void toString(StringBuilder sb) { - sb.append("name: "); - sb.append(this.name); - sb.append(", descriptorCustomizer: "); - sb.append(this.descriptorCustomizer); - } -} diff --git a/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/persistence/general/EclipseLinkGeneralProperties.java b/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/persistence/general/EclipseLinkGeneralProperties.java deleted file mode 100644 index d647b03bd3..0000000000 --- a/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/persistence/general/EclipseLinkGeneralProperties.java +++ /dev/null @@ -1,96 +0,0 @@ -/******************************************************************************* -* Copyright (c) 2008, 2009 Oracle. All rights reserved. -* This program and the accompanying materials are made available under the -* terms of the Eclipse Public License v1.0, which accompanies this distribution -* and is available at http://www.eclipse.org/legal/epl-v10.html. -* -* Contributors: -* Oracle - initial API and implementation -*******************************************************************************/ -package org.eclipse.jpt.eclipselink.core.internal.context.persistence.general; - -import java.util.Map; - -import org.eclipse.jpt.core.context.persistence.PersistenceUnit; -import org.eclipse.jpt.eclipselink.core.context.persistence.general.GeneralProperties; -import org.eclipse.jpt.eclipselink.core.internal.context.persistence.EclipseLinkPersistenceUnitProperties; - -/** - * EclipseLinkGeneralProperties - */ -public class EclipseLinkGeneralProperties extends EclipseLinkPersistenceUnitProperties - implements GeneralProperties -{ - // ********** EclipseLink properties ********** - private Boolean excludeEclipselinkOrm; - - // ********** constructors ********** - public EclipseLinkGeneralProperties(PersistenceUnit parent) { - super(parent); - } - - // ********** initialization ********** - /** - * Initializes properties with values from the persistence unit. - */ - @Override - protected void initializeProperties() { - - this.excludeEclipselinkOrm = - this.getBooleanValue(ECLIPSELINK_EXCLUDE_ECLIPSELINK_ORM); - } - - - // ********** behavior ********** - - public void propertyValueChanged(String propertyName, String newValue) { - if (propertyName.equals(ECLIPSELINK_EXCLUDE_ECLIPSELINK_ORM)) { - excludeEclipselinkOrmChanged(newValue); - } - } - - public void propertyRemoved(String propertyName) { - if (propertyName.equals(ECLIPSELINK_EXCLUDE_ECLIPSELINK_ORM)) { - excludeEclipselinkOrmChanged(null); - } - } - - - /** - * Adds property names key/value pairs, where: - * key = EclipseLink property key - * value = property id - */ - @Override - protected void addPropertyNames(Map<String, String> propertyNames) { - propertyNames.put( - ECLIPSELINK_EXCLUDE_ECLIPSELINK_ORM, - EXCLUDE_ECLIPSELINK_ORM_PROPERTY); - } - - - // ********** ExcludeEclipselinkOrm ********** - public Boolean getExcludeEclipselinkOrm() { - return this.excludeEclipselinkOrm; - } - - public void setExcludeEclipselinkOrm(Boolean newExcludeEclipselinkOrm) { - Boolean old = this.excludeEclipselinkOrm; - this.excludeEclipselinkOrm = newExcludeEclipselinkOrm; - this.putProperty(EXCLUDE_ECLIPSELINK_ORM_PROPERTY, newExcludeEclipselinkOrm); - this.firePropertyChanged(EXCLUDE_ECLIPSELINK_ORM_PROPERTY, old, newExcludeEclipselinkOrm); - } - - private void excludeEclipselinkOrmChanged(String stringValue) { - Boolean newValue = getBooleanValueOf(stringValue); - - Boolean old = this.excludeEclipselinkOrm; - this.excludeEclipselinkOrm = newValue; - this.firePropertyChanged(EXCLUDE_ECLIPSELINK_ORM_PROPERTY, old, newValue); - } - - public Boolean getDefaultExcludeEclipselinkOrm() { - return DEFAULT_EXCLUDE_ECLIPSELINK_ORM; - } - -} diff --git a/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/persistence/logging/EclipseLinkLogging.java b/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/persistence/logging/EclipseLinkLogging.java deleted file mode 100644 index 568d2d33d0..0000000000 --- a/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/persistence/logging/EclipseLinkLogging.java +++ /dev/null @@ -1,358 +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.eclipselink.core.internal.context.persistence.logging; - -import java.util.Map; -import org.eclipse.jpt.core.context.persistence.PersistenceUnit; -import org.eclipse.jpt.eclipselink.core.context.persistence.logging.Logger; -import org.eclipse.jpt.eclipselink.core.context.persistence.logging.Logging; -import org.eclipse.jpt.eclipselink.core.context.persistence.logging.LoggingLevel; -import org.eclipse.jpt.eclipselink.core.internal.context.persistence.EclipseLinkPersistenceUnitProperties; - -/** - * EclipseLinkLogging - */ -public class EclipseLinkLogging extends EclipseLinkPersistenceUnitProperties - implements Logging -{ - // ********** EclipseLink properties ********** - private LoggingLevel level; - private Boolean timestamp; - private Boolean thread; - private Boolean session; - private Boolean exceptions; - private String logFileLocation; - private String logger; // storing EclipseLinkStringValue since value can be Logger or custom class - - // ********** constructors ********** - public EclipseLinkLogging(PersistenceUnit parent) { - super(parent); - } - - // ********** initialization ********** - /** - * Initializes properties with values from the persistence unit. - */ - @Override - protected void initializeProperties() { - // TOREVIEW - handle incorrect String in persistence.xml - this.level = - this.getEnumValue(ECLIPSELINK_LEVEL, LoggingLevel.values()); - this.timestamp = - this.getBooleanValue(ECLIPSELINK_TIMESTAMP); - this.thread = - this.getBooleanValue(ECLIPSELINK_THREAD); - this.session = - this.getBooleanValue(ECLIPSELINK_SESSION); - this.exceptions = - this.getBooleanValue(ECLIPSELINK_EXCEPTIONS); - this.logFileLocation = - this.getStringValue(ECLIPSELINK_LOG_FILE_LOCATION); - - this.logger = this.getLoggerProtertyValue(); - } - - /** - * Gets the Logger property from the persistence unit. - */ - private String getLoggerProtertyValue() { - - String value = this.getStringValue(ECLIPSELINK_LOGGER); - if (value == null) { - return null; // no property found - } - Logger standardLogger = this.getEnumValue(ECLIPSELINK_LOGGER, Logger.values()); - return (standardLogger == null) ? value : getPropertyStringValueOf(standardLogger); - } - - // ********** behavior ********** - - public void propertyValueChanged(String propertyName, String newValue) { - if (propertyName.equals(ECLIPSELINK_LEVEL)) { - this.levelChanged(newValue); - } - else if (propertyName.equals(ECLIPSELINK_TIMESTAMP)) { - this.timestampChanged(newValue); - } - else if (propertyName.equals(ECLIPSELINK_THREAD)) { - this.threadChanged(newValue); - } - else if (propertyName.equals(ECLIPSELINK_SESSION)) { - this.sessionChanged(newValue); - } - else if (propertyName.equals(ECLIPSELINK_EXCEPTIONS)) { - this.exceptionsChanged(newValue); - } - else if (propertyName.equals(ECLIPSELINK_LOG_FILE_LOCATION)) { - this.logFileLocationChanged(newValue); - } - else if (propertyName.equals(ECLIPSELINK_LOGGER)) { - this.loggerChanged(newValue); - } - } - - public void propertyRemoved(String propertyName) { - if (propertyName.equals(ECLIPSELINK_LEVEL)) { - this.levelChanged(null); - } - else if (propertyName.equals(ECLIPSELINK_TIMESTAMP)) { - this.timestampChanged(null); - } - else if (propertyName.equals(ECLIPSELINK_THREAD)) { - this.threadChanged(null); - } - else if (propertyName.equals(ECLIPSELINK_SESSION)) { - this.sessionChanged(null); - } - else if (propertyName.equals(ECLIPSELINK_EXCEPTIONS)) { - this.exceptionsChanged(null); - } - else if (propertyName.equals(ECLIPSELINK_LOG_FILE_LOCATION)) { - this.logFileLocationChanged(null); - } - else if (propertyName.equals(ECLIPSELINK_LOGGER)) { - this.loggerChanged(null); - } - } - - /** - * Adds property names key/value pairs, where: - * key = EclipseLink property key - * value = property id - */ - @Override - protected void addPropertyNames(Map<String, String> propertyNames) { - propertyNames.put( - ECLIPSELINK_LEVEL, - LEVEL_PROPERTY); - propertyNames.put( - ECLIPSELINK_TIMESTAMP, - TIMESTAMP_PROPERTY); - propertyNames.put( - ECLIPSELINK_THREAD, - THREAD_PROPERTY); - propertyNames.put( - ECLIPSELINK_SESSION, - SESSION_PROPERTY); - propertyNames.put( - ECLIPSELINK_EXCEPTIONS, - EXCEPTIONS_PROPERTY); - propertyNames.put( - ECLIPSELINK_LOG_FILE_LOCATION, - LOG_FILE_LOCATION_PROPERTY); - propertyNames.put( - ECLIPSELINK_LOGGER, - LOGGER_PROPERTY); - } - - // ********** LoggingLevel ********** - - public LoggingLevel getLevel() { - return this.level; - } - - public void setLevel(LoggingLevel newLevel) { - LoggingLevel old = this.level; - this.level = newLevel; - this.putProperty(LEVEL_PROPERTY, newLevel); - this.firePropertyChanged(LEVEL_PROPERTY, old, newLevel); - } - - private void levelChanged(String stringValue) { - LoggingLevel newValue = getEnumValueOf(stringValue, LoggingLevel.values()); - LoggingLevel old = this.level; - this.level = newValue; - this.firePropertyChanged(LEVEL_PROPERTY, old, newValue); - } - - public LoggingLevel getDefaultLevel() { - return DEFAULT_LEVEL; - } - - // ********** Timestamp ********** - public Boolean getTimestamp() { - return this.timestamp; - } - - public void setTimestamp(Boolean newTimestamp) { - Boolean old = this.timestamp; - this.timestamp = newTimestamp; - this.putProperty(TIMESTAMP_PROPERTY, newTimestamp); - this.firePropertyChanged(TIMESTAMP_PROPERTY, old, newTimestamp); - } - - private void timestampChanged(String stringValue) { - Boolean newValue = getBooleanValueOf(stringValue); - - Boolean old = this.timestamp; - this.timestamp = newValue; - this.firePropertyChanged(TIMESTAMP_PROPERTY, old, newValue); - } - - public Boolean getDefaultTimestamp() { - return DEFAULT_TIMESTAMP; - } - - // ********** Thread ********** - public Boolean getThread() { - return this.thread; - } - - public void setThread(Boolean newThread) { - Boolean old = this.thread; - this.thread = newThread; - this.putProperty(THREAD_PROPERTY, newThread); - this.firePropertyChanged(THREAD_PROPERTY, old, newThread); - } - - private void threadChanged(String stringValue) { - Boolean newValue = getBooleanValueOf(stringValue); - - Boolean old = this.thread; - this.thread = newValue; - this.firePropertyChanged(THREAD_PROPERTY, old, newValue); - } - - public Boolean getDefaultThread() { - return DEFAULT_THREAD; - } - - // ********** Session ********** - public Boolean getSession() { - return this.session; - } - - public void setSession(Boolean newSession) { - Boolean old = this.session; - this.session = newSession; - this.putProperty(SESSION_PROPERTY, newSession); - this.firePropertyChanged(SESSION_PROPERTY, old, newSession); - } - - private void sessionChanged(String stringValue) { - Boolean newValue = getBooleanValueOf(stringValue); - - Boolean old = this.session; - this.session = newValue; - this.firePropertyChanged(SESSION_PROPERTY, old, newValue); - } - - public Boolean getDefaultSession() { - return DEFAULT_SESSION; - } - - // ********** Exceptions ********** - public Boolean getExceptions() { - return this.exceptions; - } - - public void setExceptions(Boolean newExceptions) { - Boolean old = this.exceptions; - this.exceptions = newExceptions; - this.putProperty(EXCEPTIONS_PROPERTY, newExceptions); - this.firePropertyChanged(EXCEPTIONS_PROPERTY, old, newExceptions); - } - - private void exceptionsChanged(String stringValue) { - Boolean newValue = getBooleanValueOf(stringValue); - - Boolean old = this.exceptions; - this.exceptions = newValue; - this.firePropertyChanged(EXCEPTIONS_PROPERTY, old, newValue); - } - - public Boolean getDefaultExceptions() { - return DEFAULT_EXCEPTIONS; - } - - // ********** logFileLocation ********** - public String getLogFileLocation() { - return this.logFileLocation; - } - - public void setLogFileLocation(String newLogFileLocation) { - String old = this.logFileLocation; - this.logFileLocation = newLogFileLocation; - this.putProperty(LOG_FILE_LOCATION_PROPERTY, newLogFileLocation); - this.firePropertyChanged(LOG_FILE_LOCATION_PROPERTY, old, newLogFileLocation); - } - - private void logFileLocationChanged(String newValue) { - String old = this.logFileLocation; - this.logFileLocation = newValue; - this.firePropertyChanged(LOG_FILE_LOCATION_PROPERTY, old, newValue); - } - - public String getDefaultLogFileLocation() { - return DEFAULT_LOG_FILE_LOCATION; - } - - // ********** Logger ********** - /** - * Returns Logger or custom logger class. - * - * @return EclipseLink string value for Logger enum or custom logger class - */ - public String getLogger() { - return this.logger; - } - - /** - * Sets EclipseLink logger. - * - * @param newLogger - Logger - */ - public void setLogger(Logger newLogger) { - if( newLogger == null) { - this.setLogger_((String) null); - return; - } - this.setLogger_(getPropertyStringValueOf(newLogger)); - } - - /** - * Sets EclipseLink logger or custom logger. - * - * @param newLogger - - * Can be a EclipseLink logger literal or - * a fully qualified class name of a custom logger. - */ - public void setLogger(String newLogger) { - if( newLogger == null) { - this.setLogger_(null); - return; - } - Logger l = Logger.getLoggerFor(newLogger); - if(l == null) { // custom Logger class - this.setLogger_(newLogger); - } - else { - this.setLogger(l); - } - } - - private void setLogger_(String newLogger) { - String old = this.logger; - this.logger = newLogger; - this.putProperty(LOGGER_PROPERTY, newLogger); - this.firePropertyChanged(LOGGER_PROPERTY, old, newLogger); - } - - private void loggerChanged(String newValue) { - String old = this.logger; - this.logger = newValue; - this.firePropertyChanged(LOGGER_PROPERTY, old, newValue); - } - - public String getDefaultLogger() { - return DEFAULT_LOGGER; - } - -}
\ No newline at end of file diff --git a/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/persistence/options/EclipseLinkOptions.java b/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/persistence/options/EclipseLinkOptions.java deleted file mode 100644 index 95783f0f39..0000000000 --- a/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/persistence/options/EclipseLinkOptions.java +++ /dev/null @@ -1,399 +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.eclipselink.core.internal.context.persistence.options; - -import java.util.Map; -import org.eclipse.jpt.core.context.persistence.PersistenceUnit; -import org.eclipse.jpt.eclipselink.core.context.persistence.options.Options; -import org.eclipse.jpt.eclipselink.core.context.persistence.options.TargetDatabase; -import org.eclipse.jpt.eclipselink.core.context.persistence.options.TargetServer; -import org.eclipse.jpt.eclipselink.core.internal.context.persistence.EclipseLinkPersistenceUnitProperties; - -/** - * EclipseLinkOptions - */ -public class EclipseLinkOptions extends EclipseLinkPersistenceUnitProperties - implements Options -{ - // ********** EclipseLink properties ********** - private String sessionName; - private String sessionsXml; - private Boolean includeDescriptorQueries; - private String targetDatabase; // storing EclipseLinkStringValue since value can be TargetDatabase or custom class - private String targetServer; // storing EclipseLinkStringValue since value can be TargetServer or custom class - private String eventListener; - private Boolean temporalMutable; - - - // ********** constructors ********** - public EclipseLinkOptions(PersistenceUnit parent) { - super(parent); - } - - // ********** initialization ********** - /** - * Initializes properties with values from the persistence unit. - */ - @Override - protected void initializeProperties() { - // TOREVIEW - handle incorrect String in persistence.xml - this.sessionName = - this.getStringValue(ECLIPSELINK_SESSION_NAME); - this.sessionsXml = - this.getStringValue(ECLIPSELINK_SESSIONS_XML); - this.includeDescriptorQueries = - this.getBooleanValue(ECLIPSELINK_SESSION_INCLUDE_DESCRIPTOR_QUERIES); - this.targetDatabase = this.getTargetDatabaseFromPersistenceXml(); - this.targetServer = this.getTargetServerFromPersistenceXml(); - this.eventListener = - this.getStringValue(ECLIPSELINK_SESSION_EVENT_LISTENER); - this.temporalMutable = - this.getBooleanValue(ECLIPSELINK_TEMPORAL_MUTABLE); - } - - protected String getTargetDatabaseFromPersistenceXml() { - - String value = this.getStringValue(ECLIPSELINK_TARGET_DATABASE); - if (value == null) { - return null; - } - TargetDatabase standardTargetDatabase = this.getEnumValue(ECLIPSELINK_TARGET_DATABASE, TargetDatabase.values()); - return (standardTargetDatabase == null) ? value : getPropertyStringValueOf(standardTargetDatabase); - } - - protected String getTargetServerFromPersistenceXml() { - - String value = this.getStringValue(ECLIPSELINK_TARGET_SERVER); - if (value == null) { - return null; - } - TargetServer standardTargetServer = this.getEnumValue(ECLIPSELINK_TARGET_SERVER, TargetServer.values()); - return (standardTargetServer == null) ? value : getPropertyStringValueOf(standardTargetServer); - } - - // ********** behavior ********** - - public void propertyValueChanged(String propertyName, String newValue) { - if (propertyName.equals(ECLIPSELINK_SESSION_NAME)) { - this.sessionNameChanged(newValue); - } - else if (propertyName.equals(ECLIPSELINK_SESSIONS_XML)) { - this.sessionsXmlChanged(newValue); - } - else if (propertyName.equals(ECLIPSELINK_TARGET_DATABASE)) { - this.targetDatabaseChanged(newValue); - } - else if (propertyName.equals(ECLIPSELINK_TARGET_SERVER)) { - this.targetServerChanged(newValue); - } - else if (propertyName.equals(ECLIPSELINK_SESSION_INCLUDE_DESCRIPTOR_QUERIES)) { - this.includeDescriptorQueriesChanged(newValue); - } - else if (propertyName.equals(ECLIPSELINK_SESSION_EVENT_LISTENER)) { - this.eventListenerChanged(newValue); - } - else if (propertyName.equals(ECLIPSELINK_TEMPORAL_MUTABLE)) { - this.temporalMutableChanged(newValue); - } - } - - public void propertyRemoved(String propertyName) { - if (propertyName.equals(ECLIPSELINK_SESSION_NAME)) { - this.sessionNameChanged(null); - } - else if (propertyName.equals(ECLIPSELINK_SESSIONS_XML)) { - this.sessionsXmlChanged(null); - } - else if (propertyName.equals(ECLIPSELINK_TARGET_DATABASE)) { - this.targetDatabaseChanged(null); - } - else if (propertyName.equals(ECLIPSELINK_TARGET_SERVER)) { - this.targetServerChanged(null); - } - else if (propertyName.equals(ECLIPSELINK_SESSION_INCLUDE_DESCRIPTOR_QUERIES)) { - this.includeDescriptorQueriesChanged(null); - } - else if (propertyName.equals(ECLIPSELINK_SESSION_EVENT_LISTENER)) { - this.eventListenerChanged(null); - } - else if (propertyName.equals(ECLIPSELINK_TEMPORAL_MUTABLE)) { - this.temporalMutableChanged(null); - } - } - - /** - * Adds property names key/value pairs, where: - * key = EclipseLink property key - * value = property id - */ - @Override - protected void addPropertyNames(Map<String, String> propertyNames) { - propertyNames.put( - ECLIPSELINK_SESSION_NAME, - SESSION_NAME_PROPERTY); - propertyNames.put( - ECLIPSELINK_SESSIONS_XML, - SESSIONS_XML_PROPERTY); - propertyNames.put( - ECLIPSELINK_SESSION_INCLUDE_DESCRIPTOR_QUERIES, - SESSION_INCLUDE_DESCRIPTOR_QUERIES_PROPERTY); - propertyNames.put( - ECLIPSELINK_TARGET_DATABASE, - TARGET_DATABASE_PROPERTY); - propertyNames.put( - ECLIPSELINK_TARGET_SERVER, - TARGET_SERVER_PROPERTY); - propertyNames.put( - ECLIPSELINK_SESSION_EVENT_LISTENER, - SESSION_EVENT_LISTENER_PROPERTY); - propertyNames.put( - ECLIPSELINK_TEMPORAL_MUTABLE, - TEMPORAL_MUTABLE_PROPERTY); - } - - - // ********** SessionName ********** - public String getSessionName() { - return this.sessionName; - } - - public void setSessionName(String newSessionName) { - String old = this.sessionName; - this.sessionName = newSessionName; - this.putProperty(SESSION_NAME_PROPERTY, newSessionName); - this.firePropertyChanged(SESSION_NAME_PROPERTY, old, newSessionName); - } - - private void sessionNameChanged(String newValue) { - String old = this.sessionName; - this.sessionName = newValue; - this.firePropertyChanged(SESSION_NAME_PROPERTY, old, newValue); - } - - public String getDefaultSessionName() { - return DEFAULT_SESSION_NAME; - } - - // ********** SessionsXml ********** - public String getSessionsXml() { - return this.sessionsXml; - } - - public void setSessionsXml(String newSessionsXml) { - String old = this.sessionsXml; - this.sessionsXml = newSessionsXml; - this.putProperty(SESSIONS_XML_PROPERTY, newSessionsXml); - this.firePropertyChanged(SESSIONS_XML_PROPERTY, old, newSessionsXml); - } - - private void sessionsXmlChanged(String newValue) { - String old = this.sessionsXml; - this.sessionsXml = newValue; - this.firePropertyChanged(SESSIONS_XML_PROPERTY, old, newValue); - } - - public String getDefaultSessionsXml() { - return DEFAULT_SESSIONS_XML; - } - - // ********** IncludeDescriptorQueries ********** - public Boolean getIncludeDescriptorQueries() { - return this.includeDescriptorQueries; - } - - public void setIncludeDescriptorQueries(Boolean newIncludeDescriptorQueries) { - Boolean old = this.includeDescriptorQueries; - this.includeDescriptorQueries = newIncludeDescriptorQueries; - this.putProperty(SESSION_INCLUDE_DESCRIPTOR_QUERIES_PROPERTY, newIncludeDescriptorQueries); - this.firePropertyChanged(SESSION_INCLUDE_DESCRIPTOR_QUERIES_PROPERTY, old, newIncludeDescriptorQueries); - } - - private void includeDescriptorQueriesChanged(String stringValue) { - Boolean newValue = getBooleanValueOf(stringValue); - - Boolean old = this.includeDescriptorQueries; - this.includeDescriptorQueries = newValue; - this.firePropertyChanged(SESSION_INCLUDE_DESCRIPTOR_QUERIES_PROPERTY, old, newValue); - } - - public Boolean getDefaultIncludeDescriptorQueries() { - return DEFAULT_SESSION_INCLUDE_DESCRIPTOR_QUERIES; - } - - // ********** TargetDatabase ********** - /** - * Returns TargetDatabase or custom targetDatabase class. - * - * @return EclipseLink string value for TargetDatabase enum or custom targetDatabase class - */ - public String getTargetDatabase() { - return this.targetDatabase; - } - - /** - * Sets EclipseLink targetDatabase. - * - * @param newTargetDatabase - TargetDatabase - */ - public void setTargetDatabase(TargetDatabase newTargetDatabase) { - if( newTargetDatabase == null) { - this.setTargetDatabase_((String) null); - return; - } - this.setTargetDatabase_(getPropertyStringValueOf(newTargetDatabase)); - } - - /** - * Sets EclipseLink targetDatabase or custom targetDatabase. - * - * @param newTargetDatabase - - * Can be a EclipseLink TargetDatabase literal or - * a fully qualified class name of a custom targetDatabase. - */ - public void setTargetDatabase(String newTargetDatabase) { - if( newTargetDatabase == null) { - this.setTargetDatabase_((String) null); - return; - } - TargetDatabase customTargetDatabase = TargetDatabase.getTargetDatabaseFor(newTargetDatabase); - if(customTargetDatabase == null) { // custom TargetDatabase class - this.setTargetDatabase_(newTargetDatabase); - } - else { - this.setTargetDatabase(customTargetDatabase); - } - } - - private void setTargetDatabase_(String newTargetDatabase) { - String old = this.targetDatabase; - this.targetDatabase = newTargetDatabase; - this.putProperty(TARGET_DATABASE_PROPERTY, newTargetDatabase); - this.firePropertyChanged(TARGET_DATABASE_PROPERTY, old, newTargetDatabase); - } - - private void targetDatabaseChanged(String newValue) { - String old = this.targetDatabase; - this.targetDatabase = newValue; - this.firePropertyChanged(TARGET_DATABASE_PROPERTY, old, newValue); - } - - public String getDefaultTargetDatabase() { - return DEFAULT_TARGET_DATABASE; - } - - // ********** TargetServer ********** - /** - * Returns TargetServer or custom targetServer class. - * - * @return EclipseLink string value for TargetServer enum or custom targetServer class - */ - public String getTargetServer() { - return this.targetServer; - } - - /** - * Sets EclipseLink targetServer. - * - * @param newTargetServer - TargetServer - */ - public void setTargetServer(TargetServer newTargetServer) { - if( newTargetServer == null) { - this.setTargetServer_((String) null); - return; - } - this.setTargetServer_(getPropertyStringValueOf(newTargetServer)); - } - - /** - * Sets EclipseLink targetServer or custom targetServer. - * - * @param newTargetServer - - * Can be a EclipseLink TargetServer literal or - * a fully qualified class name of a custom targetServer. - */ - public void setTargetServer(String newTargetServer) { - if( newTargetServer == null) { - this.setTargetServer_((String) null); - return; - } - TargetServer customTargetServer = TargetServer.getTargetServerFor(newTargetServer); - if(customTargetServer == null) { // custom TargetServer class - this.setTargetServer_(newTargetServer); - } - else { - this.setTargetServer(customTargetServer); - } - } - - private void setTargetServer_(String newTargetServer) { - String old = this.targetServer; - this.targetServer = newTargetServer; - this.putProperty(TARGET_SERVER_PROPERTY, newTargetServer); - this.firePropertyChanged(TARGET_SERVER_PROPERTY, old, newTargetServer); - } - - private void targetServerChanged(String newValue) { - String old = this.targetServer; - this.targetServer = newValue; - this.firePropertyChanged(TARGET_SERVER_PROPERTY, old, newValue); - } - - public String getDefaultTargetServer() { - return DEFAULT_TARGET_SERVER; - } - - // ********** EventListener ********** - public String getEventListener() { - return this.eventListener; - } - - public void setEventListener(String newEventListener) { - String old = this.eventListener; - this.eventListener = newEventListener; - this.putProperty(SESSION_EVENT_LISTENER_PROPERTY, newEventListener); - this.firePropertyChanged(SESSION_EVENT_LISTENER_PROPERTY, old, newEventListener); - } - - private void eventListenerChanged(String newValue) { - String old = this.eventListener; - this.eventListener = newValue; - this.firePropertyChanged(SESSION_EVENT_LISTENER_PROPERTY, old, newValue); - } - - public String getDefaultEventListener() { - return DEFAULT_SESSION_EVENT_LISTENER; - } - - // ********** TemporalMutable ********** - - public Boolean getTemporalMutable() { - return this.temporalMutable; - } - - public void setTemporalMutable(Boolean newTemporalMutable) { - Boolean old = this.temporalMutable; - this.temporalMutable = newTemporalMutable; - this.putProperty(TEMPORAL_MUTABLE_PROPERTY, newTemporalMutable); - this.firePropertyChanged(TEMPORAL_MUTABLE_PROPERTY, old, newTemporalMutable); - } - - private void temporalMutableChanged(String stringValue) { - Boolean newValue = getBooleanValueOf(stringValue); - - Boolean old = this.temporalMutable; - this.temporalMutable = newValue; - this.firePropertyChanged(TEMPORAL_MUTABLE_PROPERTY, old, newValue); - } - - public Boolean getDefaultTemporalMutable() { - return DEFAULT_TEMPORAL_MUTABLE; - } - -}
\ No newline at end of file diff --git a/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/persistence/schema/generation/EclipseLinkSchemaGeneration.java b/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/persistence/schema/generation/EclipseLinkSchemaGeneration.java deleted file mode 100644 index e9378d5dc0..0000000000 --- a/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/persistence/schema/generation/EclipseLinkSchemaGeneration.java +++ /dev/null @@ -1,229 +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.eclipselink.core.internal.context.persistence.schema.generation; - -import java.util.Map; -import org.eclipse.jpt.core.context.persistence.PersistenceUnit; -import org.eclipse.jpt.eclipselink.core.context.persistence.schema.generation.DdlGenerationType; -import org.eclipse.jpt.eclipselink.core.context.persistence.schema.generation.OutputMode; -import org.eclipse.jpt.eclipselink.core.context.persistence.schema.generation.SchemaGeneration; -import org.eclipse.jpt.eclipselink.core.internal.context.persistence.EclipseLinkPersistenceUnitProperties; - -/** - * EclipseLinkSchemaGeneration encapsulates EclipseLink SchemaGeneration - * properties. - */ -public class EclipseLinkSchemaGeneration - extends EclipseLinkPersistenceUnitProperties implements SchemaGeneration -{ - // ********** EclipseLink properties ********** - - private OutputMode outputMode; - private DdlGenerationType ddlGenerationType; - private String createFileName; - private String dropFileName; - private String applicationLocation; - - // ********** constructors/initialization ********** - - public EclipseLinkSchemaGeneration(PersistenceUnit parent) { - super(parent); - } - - /** - * Initializes properties with values from the persistence unit. - */ - @Override - protected void initializeProperties() { - this.outputMode = - this.getEnumValue(ECLIPSELINK_DDL_GENERATION_OUTPUT_MODE, OutputMode.values()); - this.ddlGenerationType = - this.getEnumValue(ECLIPSELINK_DDL_GENERATION_TYPE, DdlGenerationType.values()); - this.createFileName = - this.getStringValue(ECLIPSELINK_CREATE_FILE_NAME); - this.dropFileName = - this.getStringValue(ECLIPSELINK_DROP_FILE_NAME); - this.applicationLocation = - this.getStringValue(ECLIPSELINK_APPLICATION_LOCATION); - } - - /** - * Adds property names key/value pairs, where: key = EclipseLink property - * key; value = property id - */ - @Override - protected void addPropertyNames(Map<String, String> propertyNames) { - propertyNames.put( - ECLIPSELINK_DDL_GENERATION_OUTPUT_MODE, - OUTPUT_MODE_PROPERTY); - propertyNames.put( - ECLIPSELINK_DDL_GENERATION_TYPE, - DDL_GENERATION_TYPE_PROPERTY); - propertyNames.put( - ECLIPSELINK_CREATE_FILE_NAME, - CREATE_FILE_NAME_PROPERTY); - propertyNames.put( - ECLIPSELINK_DROP_FILE_NAME, - DROP_FILE_NAME_PROPERTY); - propertyNames.put( - ECLIPSELINK_APPLICATION_LOCATION, - APPLICATION_LOCATION_PROPERTY); - } - - // ********** behavior ********** - - public void propertyValueChanged(String propertyName, String newValue) { - if (propertyName.equals(ECLIPSELINK_DDL_GENERATION_OUTPUT_MODE)) { - this.outputModeChanged(newValue); - } - else if (propertyName.equals(ECLIPSELINK_DDL_GENERATION_TYPE)) { - this.ddlGenerationTypeChanged(newValue); - } - else if (propertyName.equals(ECLIPSELINK_CREATE_FILE_NAME)) { - this.createFileNameChanged(newValue); - } - else if (propertyName.equals(ECLIPSELINK_DROP_FILE_NAME)) { - this.dropFileNameChanged(newValue); - } - else if (propertyName.equals(ECLIPSELINK_APPLICATION_LOCATION)) { - this.applicationLocationChanged(newValue); - } - } - - public void propertyRemoved(String propertyName) { - if (propertyName.equals(ECLIPSELINK_DDL_GENERATION_OUTPUT_MODE)) { - this.outputModeChanged(null); - } - else if (propertyName.equals(ECLIPSELINK_DDL_GENERATION_TYPE)) { - this.ddlGenerationTypeChanged(null); - } - else if (propertyName.equals(ECLIPSELINK_CREATE_FILE_NAME)) { - this.createFileNameChanged(null); - } - else if (propertyName.equals(ECLIPSELINK_DROP_FILE_NAME)) { - this.dropFileNameChanged(null); - } - else if (propertyName.equals(ECLIPSELINK_APPLICATION_LOCATION)) { - this.applicationLocationChanged(null); - } - } - - // ********** DdlGenerationType ********** - public DdlGenerationType getDdlGenerationType() { - return this.ddlGenerationType; - } - - public void setDdlGenerationType(DdlGenerationType newDdlGenType) { - DdlGenerationType old = this.ddlGenerationType; - this.ddlGenerationType = newDdlGenType; - this.putProperty(DDL_GENERATION_TYPE_PROPERTY, newDdlGenType); - this.firePropertyChanged(DDL_GENERATION_TYPE_PROPERTY, old, newDdlGenType); - } - - private void ddlGenerationTypeChanged(String stringValue) { - DdlGenerationType newValue = getEnumValueOf(stringValue, DdlGenerationType.values()); - DdlGenerationType old = this.ddlGenerationType; - this.ddlGenerationType = newValue; - this.firePropertyChanged(DDL_GENERATION_TYPE_PROPERTY, old, newValue); - } - - public DdlGenerationType getDefaultDdlGenerationType() { - return DEFAULT_SCHEMA_GENERATION_DDL_GENERATION_TYPE; - } - - // ********** OutputMode ********** - public OutputMode getOutputMode() { - return this.outputMode; - } - - public void setOutputMode(OutputMode newOutputMode) { - OutputMode old = this.outputMode; - this.outputMode = newOutputMode; - this.putProperty(OUTPUT_MODE_PROPERTY, newOutputMode); - this.firePropertyChanged(OUTPUT_MODE_PROPERTY, old, newOutputMode); - } - - private void outputModeChanged(String stringValue) { - OutputMode newValue = getEnumValueOf(stringValue, OutputMode.values()); - OutputMode old = this.outputMode; - this.outputMode = newValue; - this.firePropertyChanged(OUTPUT_MODE_PROPERTY, old, newValue); - } - - public OutputMode getDefaultOutputMode() { - return DEFAULT_SCHEMA_GENERATION_OUTPUT_MODE; - } - - // ********** CreateFileName ********** - public String getCreateFileName() { - return this.createFileName; - } - - public void setCreateFileName(String newCreateFileName) { - String old = this.createFileName; - this.createFileName = newCreateFileName; - this.putProperty(CREATE_FILE_NAME_PROPERTY, newCreateFileName); - this.firePropertyChanged(CREATE_FILE_NAME_PROPERTY, old, newCreateFileName); - } - - private void createFileNameChanged(String newValue) { - String old = this.createFileName; - this.createFileName = newValue; - this.firePropertyChanged(CREATE_FILE_NAME_PROPERTY, old, newValue); - } - - public String getDefaultCreateFileName() { - return DEFAULT_SCHEMA_GENERATION_CREATE_FILE_NAME; - } - - // ********** dropFileName ********** - public String getDropFileName() { - return this.dropFileName; - } - - public void setDropFileName(String newDropFileName) { - String old = this.dropFileName; - this.dropFileName = newDropFileName; - this.putProperty(DROP_FILE_NAME_PROPERTY, newDropFileName); - this.firePropertyChanged(DROP_FILE_NAME_PROPERTY, old, newDropFileName); - } - - private void dropFileNameChanged(String newValue) { - String old = this.dropFileName; - this.dropFileName = newValue; - this.firePropertyChanged(DROP_FILE_NAME_PROPERTY, old, newValue); - } - - public String getDefaultDropFileName() { - return DEFAULT_SCHEMA_GENERATION_DROP_FILE_NAME; - } - - // ********** applicationLocation ********** - public String getApplicationLocation() { - return this.applicationLocation; - } - - public void setApplicationLocation(String newApplicationLocation) { - String old = this.applicationLocation; - this.applicationLocation = newApplicationLocation; - this.putProperty(APPLICATION_LOCATION_PROPERTY, newApplicationLocation); - this.firePropertyChanged(APPLICATION_LOCATION_PROPERTY, old, newApplicationLocation); - } - - private void applicationLocationChanged(String newValue) { - String old = this.applicationLocation; - this.applicationLocation = newValue; - this.firePropertyChanged(APPLICATION_LOCATION_PROPERTY, old, newValue); - } - - public String getDefaultApplicationLocation() { - return DEFAULT_SCHEMA_GENERATION_APPLICATION_LOCATION; - } -} |